From 29ace1f8d338b49bafd582ca402931547f626afc Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Sun, 13 Apr 2003 21:47:33 -0700 Subject: [PATCH] Remove all of arch/s390x and include/asm-s390x, since the 390x architecture is now just a 64-bit configuration option of the basic s390 architecture. --- arch/s390x/Kconfig | 352 ---- arch/s390x/Makefile | 53 - arch/s390x/boot/Makefile | 21 - arch/s390x/boot/install.sh | 38 - arch/s390x/boot/ipldump.S | 178 -- arch/s390x/boot/ipleckd.S | 303 --- arch/s390x/boot/iplfba.S | 131 -- arch/s390x/defconfig | 370 ---- arch/s390x/kernel/Makefile | 27 - arch/s390x/kernel/asm-offsets.c | 31 - arch/s390x/kernel/binfmt_elf32.c | 214 --- arch/s390x/kernel/bitmap.S | 56 - arch/s390x/kernel/cpcmd.c | 55 - arch/s390x/kernel/debug.c | 1206 ------------ arch/s390x/kernel/ebcdic.c | 400 ---- arch/s390x/kernel/entry.S | 943 ---------- arch/s390x/kernel/exec32.c | 93 - arch/s390x/kernel/exec_domain32.c | 30 - arch/s390x/kernel/gdb-stub.c | 575 ------ arch/s390x/kernel/head.S | 664 ------- arch/s390x/kernel/ieee.h | 90 - arch/s390x/kernel/init_task.c | 39 - arch/s390x/kernel/ioctl32.c | 1083 ----------- arch/s390x/kernel/linux32.c | 2863 ----------------------------- arch/s390x/kernel/linux32.h | 193 -- arch/s390x/kernel/module.c | 376 ---- arch/s390x/kernel/process.c | 352 ---- arch/s390x/kernel/ptrace.c | 612 ------ arch/s390x/kernel/ptrace32.h | 86 - arch/s390x/kernel/reipl.S | 96 - arch/s390x/kernel/s390_ext.c | 103 -- arch/s390x/kernel/s390_ksyms.c | 86 - arch/s390x/kernel/semaphore.c | 106 -- arch/s390x/kernel/setup.c | 563 ------ arch/s390x/kernel/signal.c | 487 ----- arch/s390x/kernel/signal32.c | 643 ------- arch/s390x/kernel/smp.c | 582 ------ arch/s390x/kernel/sys_s390.c | 258 --- arch/s390x/kernel/time.c | 241 --- arch/s390x/kernel/traps.c | 503 ----- arch/s390x/kernel/wrapper32.S | 1211 ------------ arch/s390x/lib/Makefile | 9 - arch/s390x/lib/delay.c | 50 - arch/s390x/lib/memset.S | 30 - arch/s390x/lib/strcmp.S | 27 - arch/s390x/lib/strncpy.S | 30 - arch/s390x/lib/uaccess.S | 107 -- arch/s390x/mm/Makefile | 5 - arch/s390x/mm/extable.c | 34 - arch/s390x/mm/fault.c | 480 ----- arch/s390x/mm/init.c | 238 --- arch/s390x/mm/ioremap.c | 138 -- arch/s390x/vmlinux.lds.S | 122 -- include/asm-s390x/a.out.h | 38 - include/asm-s390x/atomic.h | 168 -- include/asm-s390x/bitops.h | 950 ---------- include/asm-s390x/bug.h | 13 - include/asm-s390x/bugs.h | 22 - include/asm-s390x/byteorder.h | 102 - include/asm-s390x/cache.h | 18 - include/asm-s390x/cacheflush.h | 17 - include/asm-s390x/ccwdev.h | 185 -- include/asm-s390x/ccwgroup.h | 44 - include/asm-s390x/checksum.h | 195 -- include/asm-s390x/cio.h | 269 --- include/asm-s390x/compat.h | 122 -- include/asm-s390x/cpcmd.h | 14 - include/asm-s390x/current.h | 29 - include/asm-s390x/dasd.h | 268 --- include/asm-s390x/debug.h | 271 --- include/asm-s390x/delay.h | 22 - include/asm-s390x/div64.h | 10 - include/asm-s390x/dma-mapping.h | 1 - include/asm-s390x/dma.h | 18 - include/asm-s390x/ebcdic.h | 49 - include/asm-s390x/elf.h | 90 - include/asm-s390x/errno.h | 12 - include/asm-s390x/fcntl.h | 83 - include/asm-s390x/gdb-stub.h | 18 - include/asm-s390x/hardirq.h | 109 -- include/asm-s390x/idals.h | 259 --- include/asm-s390x/init.h | 7 - include/asm-s390x/io.h | 99 - include/asm-s390x/ioctl.h | 78 - include/asm-s390x/ioctls.h | 88 - include/asm-s390x/ipc.h | 39 - include/asm-s390x/ipcbuf.h | 28 - include/asm-s390x/irq.h | 29 - include/asm-s390x/kmap_types.h | 23 - include/asm-s390x/linkage.h | 6 - include/asm-s390x/lowcore.h | 184 -- include/asm-s390x/mman.h | 49 - include/asm-s390x/mmu.h | 7 - include/asm-s390x/mmu_context.h | 47 - include/asm-s390x/module.h | 43 - include/asm-s390x/msgbuf.h | 27 - include/asm-s390x/namei.h | 21 - include/asm-s390x/page.h | 120 -- include/asm-s390x/param.h | 34 - include/asm-s390x/pci.h | 10 - include/asm-s390x/percpu.h | 6 - include/asm-s390x/pgalloc.h | 154 -- include/asm-s390x/pgtable.h | 550 ------ include/asm-s390x/poll.h | 34 - include/asm-s390x/posix_types.h | 74 - include/asm-s390x/processor.h | 243 --- include/asm-s390x/ptrace.h | 339 ---- include/asm-s390x/qdio.h | 399 ---- include/asm-s390x/queue.h | 170 -- include/asm-s390x/resource.h | 56 - include/asm-s390x/rmap.h | 7 - include/asm-s390x/rwsem.h | 273 --- include/asm-s390x/s390_ext.h | 34 - include/asm-s390x/scatterlist.h | 12 - include/asm-s390x/segment.h | 4 - include/asm-s390x/semaphore.h | 103 -- include/asm-s390x/sembuf.h | 22 - include/asm-s390x/setup.h | 59 - include/asm-s390x/shmbuf.h | 38 - include/asm-s390x/shmparam.h | 13 - include/asm-s390x/sigcontext.h | 56 - include/asm-s390x/siginfo.h | 86 - include/asm-s390x/signal.h | 190 -- include/asm-s390x/sigp.h | 132 -- include/asm-s390x/smp.h | 77 - include/asm-s390x/socket.h | 71 - include/asm-s390x/sockios.h | 20 - include/asm-s390x/spinlock.h | 155 -- include/asm-s390x/stat.h | 35 - include/asm-s390x/statfs.h | 33 - include/asm-s390x/string.h | 112 -- include/asm-s390x/suspend.h | 5 - include/asm-s390x/system.h | 360 ---- include/asm-s390x/tape390.h | 39 - include/asm-s390x/termbits.h | 180 -- include/asm-s390x/termios.h | 115 -- include/asm-s390x/thread_info.h | 95 - include/asm-s390x/timex.h | 40 - include/asm-s390x/tlb.h | 20 - include/asm-s390x/tlbflush.h | 138 -- include/asm-s390x/todclk.h | 23 - include/asm-s390x/topology.h | 6 - include/asm-s390x/types.h | 69 - include/asm-s390x/uaccess.h | 481 ----- include/asm-s390x/ucontext.h | 20 - include/asm-s390x/unaligned.h | 24 - include/asm-s390x/unistd.h | 390 ---- include/asm-s390x/user.h | 77 - include/asm-s390x/vtoc.h | 373 ---- include/asm-s390x/xor.h | 1 - 150 files changed, 27931 deletions(-) delete mode 100644 arch/s390x/Kconfig delete mode 100644 arch/s390x/Makefile delete mode 100644 arch/s390x/boot/Makefile delete mode 100644 arch/s390x/boot/install.sh delete mode 100644 arch/s390x/boot/ipldump.S delete mode 100644 arch/s390x/boot/ipleckd.S delete mode 100644 arch/s390x/boot/iplfba.S delete mode 100644 arch/s390x/defconfig delete mode 100644 arch/s390x/kernel/Makefile delete mode 100644 arch/s390x/kernel/asm-offsets.c delete mode 100644 arch/s390x/kernel/binfmt_elf32.c delete mode 100644 arch/s390x/kernel/bitmap.S delete mode 100644 arch/s390x/kernel/cpcmd.c delete mode 100644 arch/s390x/kernel/debug.c delete mode 100644 arch/s390x/kernel/ebcdic.c delete mode 100644 arch/s390x/kernel/entry.S delete mode 100644 arch/s390x/kernel/exec32.c delete mode 100644 arch/s390x/kernel/exec_domain32.c delete mode 100644 arch/s390x/kernel/gdb-stub.c delete mode 100644 arch/s390x/kernel/head.S delete mode 100644 arch/s390x/kernel/ieee.h delete mode 100644 arch/s390x/kernel/init_task.c delete mode 100644 arch/s390x/kernel/ioctl32.c delete mode 100644 arch/s390x/kernel/linux32.c delete mode 100644 arch/s390x/kernel/linux32.h delete mode 100644 arch/s390x/kernel/module.c delete mode 100644 arch/s390x/kernel/process.c delete mode 100644 arch/s390x/kernel/ptrace.c delete mode 100644 arch/s390x/kernel/ptrace32.h delete mode 100644 arch/s390x/kernel/reipl.S delete mode 100644 arch/s390x/kernel/s390_ext.c delete mode 100644 arch/s390x/kernel/s390_ksyms.c delete mode 100644 arch/s390x/kernel/semaphore.c delete mode 100644 arch/s390x/kernel/setup.c delete mode 100644 arch/s390x/kernel/signal.c delete mode 100644 arch/s390x/kernel/signal32.c delete mode 100644 arch/s390x/kernel/smp.c delete mode 100644 arch/s390x/kernel/sys_s390.c delete mode 100644 arch/s390x/kernel/time.c delete mode 100644 arch/s390x/kernel/traps.c delete mode 100644 arch/s390x/kernel/wrapper32.S delete mode 100644 arch/s390x/lib/Makefile delete mode 100644 arch/s390x/lib/delay.c delete mode 100644 arch/s390x/lib/memset.S delete mode 100644 arch/s390x/lib/strcmp.S delete mode 100644 arch/s390x/lib/strncpy.S delete mode 100644 arch/s390x/lib/uaccess.S delete mode 100644 arch/s390x/mm/Makefile delete mode 100644 arch/s390x/mm/extable.c delete mode 100644 arch/s390x/mm/fault.c delete mode 100644 arch/s390x/mm/init.c delete mode 100644 arch/s390x/mm/ioremap.c delete mode 100644 arch/s390x/vmlinux.lds.S delete mode 100644 include/asm-s390x/a.out.h delete mode 100644 include/asm-s390x/atomic.h delete mode 100644 include/asm-s390x/bitops.h delete mode 100644 include/asm-s390x/bug.h delete mode 100644 include/asm-s390x/bugs.h delete mode 100644 include/asm-s390x/byteorder.h delete mode 100644 include/asm-s390x/cache.h delete mode 100644 include/asm-s390x/cacheflush.h delete mode 100644 include/asm-s390x/ccwdev.h delete mode 100644 include/asm-s390x/ccwgroup.h delete mode 100644 include/asm-s390x/checksum.h delete mode 100644 include/asm-s390x/cio.h delete mode 100644 include/asm-s390x/compat.h delete mode 100644 include/asm-s390x/cpcmd.h delete mode 100644 include/asm-s390x/current.h delete mode 100644 include/asm-s390x/dasd.h delete mode 100644 include/asm-s390x/debug.h delete mode 100644 include/asm-s390x/delay.h delete mode 100644 include/asm-s390x/div64.h delete mode 100644 include/asm-s390x/dma-mapping.h delete mode 100644 include/asm-s390x/dma.h delete mode 100644 include/asm-s390x/ebcdic.h delete mode 100644 include/asm-s390x/elf.h delete mode 100644 include/asm-s390x/errno.h delete mode 100644 include/asm-s390x/fcntl.h delete mode 100644 include/asm-s390x/gdb-stub.h delete mode 100644 include/asm-s390x/hardirq.h delete mode 100644 include/asm-s390x/idals.h delete mode 100644 include/asm-s390x/init.h delete mode 100644 include/asm-s390x/io.h delete mode 100644 include/asm-s390x/ioctl.h delete mode 100644 include/asm-s390x/ioctls.h delete mode 100644 include/asm-s390x/ipc.h delete mode 100644 include/asm-s390x/ipcbuf.h delete mode 100644 include/asm-s390x/irq.h delete mode 100644 include/asm-s390x/kmap_types.h delete mode 100644 include/asm-s390x/linkage.h delete mode 100644 include/asm-s390x/lowcore.h delete mode 100644 include/asm-s390x/mman.h delete mode 100644 include/asm-s390x/mmu.h delete mode 100644 include/asm-s390x/mmu_context.h delete mode 100644 include/asm-s390x/module.h delete mode 100644 include/asm-s390x/msgbuf.h delete mode 100644 include/asm-s390x/namei.h delete mode 100644 include/asm-s390x/page.h delete mode 100644 include/asm-s390x/param.h delete mode 100644 include/asm-s390x/pci.h delete mode 100644 include/asm-s390x/percpu.h delete mode 100644 include/asm-s390x/pgalloc.h delete mode 100644 include/asm-s390x/pgtable.h delete mode 100644 include/asm-s390x/poll.h delete mode 100644 include/asm-s390x/posix_types.h delete mode 100644 include/asm-s390x/processor.h delete mode 100644 include/asm-s390x/ptrace.h delete mode 100644 include/asm-s390x/qdio.h delete mode 100644 include/asm-s390x/queue.h delete mode 100644 include/asm-s390x/resource.h delete mode 100644 include/asm-s390x/rmap.h delete mode 100644 include/asm-s390x/rwsem.h delete mode 100644 include/asm-s390x/s390_ext.h delete mode 100644 include/asm-s390x/scatterlist.h delete mode 100644 include/asm-s390x/segment.h delete mode 100644 include/asm-s390x/semaphore.h delete mode 100644 include/asm-s390x/sembuf.h delete mode 100644 include/asm-s390x/setup.h delete mode 100644 include/asm-s390x/shmbuf.h delete mode 100644 include/asm-s390x/shmparam.h delete mode 100644 include/asm-s390x/sigcontext.h delete mode 100644 include/asm-s390x/siginfo.h delete mode 100644 include/asm-s390x/signal.h delete mode 100644 include/asm-s390x/sigp.h delete mode 100644 include/asm-s390x/smp.h delete mode 100644 include/asm-s390x/socket.h delete mode 100644 include/asm-s390x/sockios.h delete mode 100644 include/asm-s390x/spinlock.h delete mode 100644 include/asm-s390x/stat.h delete mode 100644 include/asm-s390x/statfs.h delete mode 100644 include/asm-s390x/string.h delete mode 100644 include/asm-s390x/suspend.h delete mode 100644 include/asm-s390x/system.h delete mode 100644 include/asm-s390x/tape390.h delete mode 100644 include/asm-s390x/termbits.h delete mode 100644 include/asm-s390x/termios.h delete mode 100644 include/asm-s390x/thread_info.h delete mode 100644 include/asm-s390x/timex.h delete mode 100644 include/asm-s390x/tlb.h delete mode 100644 include/asm-s390x/tlbflush.h delete mode 100644 include/asm-s390x/todclk.h delete mode 100644 include/asm-s390x/topology.h delete mode 100644 include/asm-s390x/types.h delete mode 100644 include/asm-s390x/uaccess.h delete mode 100644 include/asm-s390x/ucontext.h delete mode 100644 include/asm-s390x/unaligned.h delete mode 100644 include/asm-s390x/unistd.h delete mode 100644 include/asm-s390x/user.h delete mode 100644 include/asm-s390x/vtoc.h delete mode 100644 include/asm-s390x/xor.h diff --git a/arch/s390x/Kconfig b/arch/s390x/Kconfig deleted file mode 100644 index f307b24dd933d..0000000000000 --- a/arch/s390x/Kconfig +++ /dev/null @@ -1,352 +0,0 @@ -# -# For a description of the syntax of this configuration file, -# see Documentation/kbuild/kconfig-language.txt. -# - -config MMU - bool - default y - -config RWSEM_GENERIC_SPINLOCK - bool - -config RWSEM_XCHGADD_ALGORITHM - bool - default y - -config GENERIC_BUST_SPINLOCK - bool - - -mainmenu "Linux Kernel Configuration" - -config ARCH_S390 - bool - default y - help - Select this option, if you want to run the Kernel on one of IBM's - mainframes of the S/390 generation. You should have installed the - s390-compiler released by IBM (based on gcc-2.95.1) before. - -config ARCH_S390X - bool - default y - -source "init/Kconfig" - - -menu "Base setup" - -comment "Processor type and features" - -config SMP - bool "Symmetric multi-processing support" - ---help--- - This enables support for systems with more than one CPU. If you have - a system with only one CPU, like most personal computers, say N. If - you have a system with more than one CPU, say Y. - - If you say N here, the kernel will run on single and multiprocessor - machines, but will use only one CPU of a multiprocessor machine. If - you say Y here, the kernel will run on many, but not all, - singleprocessor machines. On a singleprocessor machine, the kernel - will run faster if you say N here. - - Note that if you say Y here and choose architecture "586" or - "Pentium" under "Processor family", the kernel will not work on 486 - architectures. Similarly, multiprocessor kernels for the "PPro" - architecture may not work on all Pentium based boards. - - People using multiprocessor machines who say Y here should also say - Y to "Enhanced Real Time Clock Support", below. The "Advanced Power - Management" code will be disabled if you say Y here. - - See also the , - , , - and the SMP-HOWTO available at - . - - If you don't know what to do here, say N. - -config NR_CPUS - int "Maximum number of CPUs (2-64)" - depends on SMP - default "64" - help - This allows you to specify the maximum number of CPUs which this - kernel will support. The maximum supported value is 64 and the - minimum value which makes sense is 2. - - This is purely to save memory - each supported CPU adds - approximately sixteen kilobytes to the kernel image. - -config S390_SUPPORT - bool "Kernel support for 31 bit emulation" - help - Select this option if you want to enable your system kernel to - handle system-calls from ELF binaries for 31 bit ESA. This option - (and some other stuff like libraries and such) is needed for - executing 31 bit applications. It is safe to say "Y". - -config COMPAT - bool - depends on S390_SUPPORT - default y - -config BINFMT_ELF32 - tristate "Kernel support for 31 bit ELF binaries" - depends on S390_SUPPORT - help - This allows you to run 32-bit Linux/ELF binaries on your Ultra. - Everybody wants this; say Y. - -comment "I/O subsystem configuration" - -config MACHCHK_WARNING - bool "Process warning machine checks" - help - Select this option if you want the machine check handler on IBM S/390 or - zSeries to process warning machine checks (e.g. on power failures). - If unsure, say "Y". - -config QDIO - tristate "QDIO support" - ---help--- - This driver provides the Queued Direct I/O base support for the - IBM S/390 (G5 and G6) and eServer zSeries (z800 and z900). - - For details please refer to the documentation provided by IBM at - - - This driver is also available as a module ( = code which can be - inserted in and removed from the running kernel whenever you want). - The module will be called qdio. If you want to compile it as a - module, say M here and read . - - If unsure, say Y. - -config QDIO_PERF_STATS - bool "Performance statistics in /proc" - depends on QDIO - help - Say Y here to get performance statistics in /proc/qdio_perf - - If unsure, say N. - -comment "Misc" - -config PREEMPT - bool "Preemptible Kernel" - help - This option reduces the latency of the kernel when reacting to - real-time or interactive events by allowing a low priority process to - be preempted even if it is in kernel mode executing a system call. - This allows applications to run more reliably even when the system is - under load. - - Say N if you are unsure. - -config IPL - bool "Builtin IPL record support" - help - If you want to use the produced kernel to IPL directly from a - device, you have to merge a bootsector specific to the device - into the first bytes of the kernel. You will have to select the - IPL device. - -choice - prompt "IPL method generated into head.S" - depends on IPL - default IPL_TAPE - -config IPL_TAPE - bool "tape" - help - Select "tape" if you want to IPL the image from a Tape. - - Select "vm_reader" if you are running under VM/ESA and want - to IPL the image from the emulated card reader. - -config IPL_VM - bool "vm_reader" - -endchoice - -config KCORE_ELF - bool - default y - ---help--- - If you enabled support for /proc file system then the file - /proc/kcore will contain the kernel core image. This can be used - in gdb: - - $ cd /usr/src/linux ; gdb vmlinux /proc/kcore - - You have two choices here: ELF and A.OUT. Selecting ELF will make - /proc/kcore appear in ELF core format as defined by the Executable - and Linking Format specification. Selecting A.OUT will choose the - old "a.out" format which may be necessary for some old versions - of binutils or on some architectures. - - This is especially useful if you have compiled the kernel with the - "-g" option to preserve debugging information. It is mainly used - for examining kernel data structures on the live kernel so if you - don't understand what this means or are not a kernel hacker, just - leave it at its default value ELF. - -config BINFMT_ELF - tristate "Kernel support for ELF binaries" - ---help--- - ELF (Executable and Linkable Format) is a format for libraries and - executables used across different architectures and operating - systems. Saying Y here will enable your kernel to run ELF binaries - and enlarge it by about 13 KB. ELF support under Linux has now all - but replaced the traditional Linux a.out formats (QMAGIC and ZMAGIC) - because it is portable (this does *not* mean that you will be able - to run executables from different architectures or operating systems - however) and makes building run-time libraries very easy. Many new - executables are distributed solely in ELF format. You definitely - want to say Y here. - - Information about ELF is contained in the ELF HOWTO available from - . - - If you find that after upgrading from Linux kernel 1.2 and saying Y - here, you still can't run any ELF binaries (they just crash), then - you'll have to install the newest ELF runtime libraries, including - ld.so (check the file for location and - latest version). - - If you want to compile this as a module ( = code which can be - inserted in and removed from the running kernel whenever you want), - say M here and read . The module - will be called binfmt_elf. Saying M or N here is dangerous because - some crucial programs on your system might be in ELF format. - -config BINFMT_MISC - tristate "Kernel support for MISC binaries" - ---help--- - If you say Y here, it will be possible to plug wrapper-driven binary - formats into the kernel. You will like this especially when you use - programs that need an interpreter to run like Java, Python or - Emacs-Lisp. It's also useful if you often run DOS executables under - the Linux DOS emulator DOSEMU (read the DOSEMU-HOWTO, available from - ). Once you have - registered such a binary class with the kernel, you can start one of - those programs simply by typing in its name at a shell prompt; Linux - will automatically feed it to the correct interpreter. - - You can do other nice things, too. Read the file - to learn how to use this - feature, and for information about how - to include Java support. - - You must say Y to "/proc file system support" (CONFIG_PROC_FS) to - use this part of the kernel. - - You may say M here for module support and later load the module when - you have use for it; the module is called binfmt_misc. If you - don't know what to answer at this point, say Y. - -config PROCESS_DEBUG - bool "Show crashed user process info" - help - Say Y to print all process fault locations to the console. This is - a debugging option; you probably do not want to set it unless you - are an S390 port maintainer. - -config PFAULT - bool "Pseudo page fault support" - help - Select this option, if you want to use PFAULT pseudo page fault - handling under VM. If running native or in LPAR, this option - has no effect. If your VM does not support PFAULT, PAGEEX - pseudo page fault handling will be used. - Note that VM 4.2 supports PFAULT but has a bug in its - implementation that causes some problems. - Everybody who wants to run Linux under VM != VM4.2 should select - this option. - -config SHARED_KERNEL - bool "VM shared kernel support" - help - Select this option, if you want to share the text segment of the - Linux kernel between different VM guests. This reduces memory - usage with lots of guests but greatly increases kernel size. - You should only select this option if you know what you are - doing and want to exploit this feature. - -endmenu - -config PCMCIA - bool - default n - -menu "SCSI support" - -config SCSI - tristate "SCSI support" - -source "drivers/scsi/Kconfig" - -endmenu - -source "drivers/s390/Kconfig" - -source "net/Kconfig" - -source "fs/Kconfig" - - -menu "Kernel hacking" - -config DEBUG_KERNEL - bool "Kernel debugging" - help - Say Y here if you are developing drivers or trying to debug and - identify kernel problems. - -config MAGIC_SYSRQ - bool "Magic SysRq key" - depends on DEBUG_KERNEL - help - If you say Y here, you will have some control over the system even - if the system crashes for example during kernel debugging (e.g., you - will be able to flush the buffer cache to disk, reboot the system - immediately or dump some status information). This is accomplished - by pressing various keys while holding SysRq (Alt+PrintScreen). It - also works on a serial console (on PC hardware at least), if you - send a BREAK and then within 5 seconds a command keypress. The - keys are documented in . Don't say Y - unless you really know what this hack does. - -config DEBUG_SLAB - bool "Debug memory allocations" - depends on DEBUG_KERNEL - help - Say Y here to have the kernel do limited verification on memory - allocation as well as poisoning memory on free to catch use of freed - memory. - -config KALLSYMS - bool "Load all symbols for debugging/kksymoops" - depends on DEBUG_KERNEL - help - Say Y here to let the kernel print out symbolic crash information and - symbolic stack backtraces. This increases the size of the kernel - somewhat, as all symbols have to be loaded into the kernel image. - -config DEBUG_SPINLOCK_SLEEP - bool "Sleep-inside-spinlock checking" - help - If you say Y here, various routines which may sleep will become very - noisy if they are called with a spinlock held. - -endmenu - -source "security/Kconfig" - -source "crypto/Kconfig" - -source "lib/Kconfig" - diff --git a/arch/s390x/Makefile b/arch/s390x/Makefile deleted file mode 100644 index 322bba56bba19..0000000000000 --- a/arch/s390x/Makefile +++ /dev/null @@ -1,53 +0,0 @@ - -# s390x/Makefile -# -# This file is included by the global makefile so that you can add your own -# architecture-specific flags and dependencies. Remember to do have actions -# for "archclean" and "archdep" for cleaning up and making dependencies for -# this architecture -# -# This file is subject to the terms and conditions of the GNU General Public -# License. See the file "COPYING" in the main directory of this archive -# for more details. -# -# Copyright (C) 1994 by Linus Torvalds -# - -LDFLAGS := -m elf64_s390 -OBJCOPYFLAGS := -O binary -LDFLAGS_vmlinux := -e start -MODFLAGS += -fpic -D__PIC__ -LDFLAGS_BLOB := --format binary --oformat elf64-s390 - -CFLAGS += -pipe -fno-strength-reduce -finline-limit=10000 -Wno-sign-compare - -head-y := arch/$(ARCH)/kernel/head.o arch/$(ARCH)/kernel/init_task.o - -core-y += arch/$(ARCH)/mm/ arch/$(ARCH)/kernel/ -libs-y += arch/$(ARCH)/lib/ -drivers-y += drivers/s390/ - - -makeboot =$(Q)$(MAKE) -f scripts/Makefile.build obj=arch/$(ARCH)/boot $(1) - -all: image listing - -listing image: vmlinux - $(call makeboot,arch/$(ARCH)/boot/$@) - -install: vmlinux - $(call makeboot, $@) - -archclean: - $(Q)$(MAKE) -f scripts/Makefile.clean obj=arch/$(ARCH)/boot - - -prepare: include/asm-$(ARCH)/offsets.h - -arch/$(ARCH)/kernel/asm-offsets.s: include/asm include/linux/version.h \ - include/config/MARKER - -include/asm-$(ARCH)/offsets.h: arch/$(ARCH)/kernel/asm-offsets.s - $(call filechk,gen-asm-offsets) - -CLEAN_FILES += include/asm-$(ARCH)/offsets.h diff --git a/arch/s390x/boot/Makefile b/arch/s390x/boot/Makefile deleted file mode 100644 index bd9ca0c988928..0000000000000 --- a/arch/s390x/boot/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -# -# Makefile for the linux s390-specific parts of the memory manager. -# - -targets := image listing -EXTRA_AFLAGS := -traditional - -quiet_cmd_listing = OBJDUMP $@ - cmd_listing = $(OBJDUMP) --disassemble --disassemble-all \ - --disassemble-zeroes --reloc vmlinux > $@ - -$(obj)/image: vmlinux FORCE - $(call if_changed,objcopy) - -$(obj)/listing: vmlinux FORCE - $(call if_changed,listing) - - -install: $(CONFIGURE) $(obj)/image - sh -x $(obj)/install.sh $(KERNELRELEASE) $(obj)/image \ - System.map Kerntypes "$(INSTALL_PATH)" diff --git a/arch/s390x/boot/install.sh b/arch/s390x/boot/install.sh deleted file mode 100644 index 278a8139cb18c..0000000000000 --- a/arch/s390x/boot/install.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/sh -# -# arch/s390x/boot/install.sh -# -# This file is subject to the terms and conditions of the GNU General Public -# License. See the file "COPYING" in the main directory of this archive -# for more details. -# -# Copyright (C) 1995 by Linus Torvalds -# -# Adapted from code in arch/i386/boot/Makefile by H. Peter Anvin -# -# "make install" script for s390 architecture -# -# Arguments: -# $1 - kernel version -# $2 - kernel image file -# $3 - kernel map file -# $4 - default install path (blank if root directory) -# - -# User may have a custom install script - -if [ -x ~/bin/installkernel ]; then exec ~/bin/installkernel "$@"; fi -if [ -x /sbin/installkernel ]; then exec /sbin/installkernel "$@"; fi - -# Default install - same as make zlilo - -if [ -f $4/vmlinuz ]; then - mv $4/vmlinuz $4/vmlinuz.old -fi - -if [ -f $4/System.map ]; then - mv $4/System.map $4/System.old -fi - -cat $2 > $4/vmlinuz -cp $3 $4/System.map diff --git a/arch/s390x/boot/ipldump.S b/arch/s390x/boot/ipldump.S deleted file mode 100644 index 84150b5af02c0..0000000000000 --- a/arch/s390x/boot/ipldump.S +++ /dev/null @@ -1,178 +0,0 @@ -/* - * arch/s390/boot/ipldump.S - * - * S390 version - * Copyright (C) 2000 IBM Deutschland Entwicklung GmbH, IBM Corporation - * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com), - * - * Tape dump ipl record. Put it on a tape and ipl from it and it will - * write a dump of the real storage after the ipl record on that tape. - */ - -#include -#include - -#define IPL_BS 1024 - .org 0 - .long 0x00080000,0x80000000+_start # The first 24 bytes are loaded - .long 0x07000000,0x60000001 # by ipl to addresses 0-23. - .long 0x02000000,0x20000000+IPL_BS # (a PSW and two CCWs). - .long 0x00000000,0x00000000 - .long 0x00000000,0x00000000 # svc old psw - .long 0x00000000,0x00000000 # program check old psw - .long 0x00000000,0x00000000 # machine check old psw - .long 0x00000000,0x00000000 # io old psw - .long 0x00000000,0x00000000 - .long 0x00000000,0x00000000 - .long 0x00000000,0x00000000 - .long 0x000a0000,0x00000058 # external new psw - .long 0x000a0000,0x00000060 # svc new psw - .long 0x000a0000,0x00000068 # program check new psw - .long 0x000a0000,0x00000070 # machine check new psw - .long 0x00080000,0x80000000+.Lioint # io new psw - - .org 0x100 - .globl _start -_start: - l %r1,0xb8 # load ipl subchannel number -# -# find out memory size -# - mvc 104(8),.Lpcmem0 # setup program check handler - slr %r3,%r3 - lhi %r2,1 - sll %r2,20 -.Lloop0: - l %r0,0(%r3) # test page - ar %r3,%r2 # add 1M - jnm .Lloop0 # r1 < 0x80000000 -> loop -.Lchkmem0: - n %r3,.L4malign0 # align to multiples of 4M - st %r3,.Lmemsize # store memory size -.Lmemok: - -# -# first write a tape mark -# - bras %r14,.Ltapemark -# -# write real storage to tape -# - slr %r2,%r2 # start at address 0 - bras %r14,.Lwriter # load ramdisk -# -# write another tape mark -# - bras %r14,.Ltapemark -# -# everything written, stop processor -# - lpsw .Lstopped -# -# subroutine for writing to tape -# Paramters: -# R1 = device number -# R2 = start address -# R3 = length -.Lwriter: - st %r14,.Lldret - la %r12,.Lorbread # r12 = address of orb - la %r5,.Lirb # r5 = address of irb - st %r2,.Lccwwrite+4 # initialize CCW data addresses - lctl %c6,%c6,.Lcr6 - slr %r2,%r2 -.Lldlp: - lhi %r6,3 # 3 retries -.Lssch: - ssch 0(%r12) # write chunk of IPL_BS bytes - jnz .Llderr -.Lw4end: - bras %r14,.Lwait4io - tm 8(%r5),0x82 # do we have a problem ? - jnz .Lrecov - l %r0,.Lccwwrite+4 # update CCW data addresses - ahi %r0,IPL_BS - st %r0,.Lccwwrite+4 - clr %r0,%r3 # enough ? - jl .Lldlp -.Ldone: - l %r14,.Lldret - br %r14 # r2 contains the total size -.Lrecov: - bras %r14,.Lsense # do the sensing - brct %r6,.Lssch # dec. retry count & branch - j .Llderr -.Ltapemark: - st %r14,.Lldret - la %r12,.Lorbmark # r12 = address of orb - la %r5,.Lirb # r5 = address of irb - lctl %c6,%c6,.Lcr6 - ssch 0(%r12) # write a tape mark - jnz .Llderr - bras %r14,.Lwait4io - l %r14,.Lldret - br %r14 -# -# Sense subroutine -# -.Lsense: - st %r14,.Lsnsret - la %r7,.Lorbsense - ssch 0(%r7) # start sense command - jnz .Llderr - bras %r14,.Lwait4io - l %r14,.Lsnsret - tm 8(%r5),0x82 # do we have a problem ? - jnz .Llderr - br %r14 -# -# Wait for interrupt subroutine -# -.Lwait4io: - lpsw .Lwaitpsw -.Lioint: - c %r1,0xb8 # compare subchannel number - jne .Lwait4io - tsch 0(%r5) - slr %r0,%r0 - tm 8(%r5),0x82 # do we have a problem ? - jnz .Lwtexit - tm 8(%r5),0x04 # got device end ? - jz .Lwait4io -.Lwtexit: - br %r14 -.Llderr: - lpsw .Lcrash - - .align 8 -.Lorbread: - .long 0x00000000,0x0080ff00,.Lccwwrite - .align 8 -.Lorbsense: - .long 0x00000000,0x0080ff00,.Lccwsense - .align 8 -.Lorbmark: - .long 0x00000000,0x0080ff00,.Lccwmark - .align 8 -.Lccwwrite: - .long 0x01200000+IPL_BS,0x00000000 -.Lccwsense: - .long 0x04200001,0x00000000 -.Lccwmark: - .long 0x1f200001,0x00000000 -.Lwaitpsw: - .long 0x020a0000,0x80000000+.Lioint - -.Lirb: .long 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -.Lcr6: .long 0xff000000 - .align 8 -.Lcrash:.long 0x000a0000,0x00000000 -.Lstopped: .long 0x000a0000,0x00001234 -.Lpcmem0:.long 0x00080000,0x80000000 + .Lchkmem0 -.L4malign0:.long 0xffc00000 -.Lmemsize:.long 0 -.Lldret:.long 0 -.Lsnsret: .long 0 - - .org IPL_BS - diff --git a/arch/s390x/boot/ipleckd.S b/arch/s390x/boot/ipleckd.S deleted file mode 100644 index d66a8d6848501..0000000000000 --- a/arch/s390x/boot/ipleckd.S +++ /dev/null @@ -1,303 +0,0 @@ -# -# arch/s390/boot/ipleckd.S -# IPL record for 3380/3390 DASD -# -# S390 version -# Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation -# Author(s): Holger Smolinski -# -# -# FIXME: should use the countarea to determine the blocksize -# FIXME: should insert zeroes into memory when filling holes -# FIXME: calculate blkpertrack from rdc data and blksize - -# change 09/20/00 removed obsolete store of ipldevice to textesegment - -# Usage of registers -# r1: ipl subchannel ( general use, dont overload without save/restore !) -# r10: -# r13: base register index to 0x0000 -# r14: callers address -# r15: temporary save register (we have no stack!) - -# storage layout: - -#include - - .org 0 -.psw: .long 0x00080000,0x80000000+_start -.ccw1: .long 0x06000000,0x00001000 # Re-Read enough of bootsector to start -.ccw2: .long 0x00000000,0x00000000 # read countarea of record 1 to s/w. - - .org 0x58 -.Lextn: .long 0x000a0000,0x00000000+.Lextn -.Lsvcn: .long 0x000a0000,0x00000000+.Lsvcn -.Lprgn: .long 0x00080000,0x00000000+.Lecs -.Lmcn: .long 0x000a0000,0x00000000+.Lmcn -.Lion: .long 0x00080000,0x80000000+.Lionewaddr - - .org 0xe0 -.Llstad:.long 0x00000000,0x00000000 # sectorno + ct of bootlist - - .org 0xf0 # Lets start now... -_start: .globl _start - l %r1,__LC_SUBCHANNEL_ID # get IPL-subchannel from lowcore - st %r1,__LC_IPLDEV # keep it for reipl - stsch .Lrdcdata - oi .Lrdcdata+5,0x84 # enable ssch and multipath mode -.Lecs: xi .Lrdcdata+27,0x01 # enable concurrent sense - msch .Lrdcdata - xi .Lprgn,6 # restore Wait and d/a bit in PCnew PSW - l %r2,.Lparm - mvc 0x0(8,%r2),.Lnull # set parmarea to null - lctl %c6,%c6,.Lc6 # enable all interrupts -.Lrdc: # read device characteristics - la %r6,.Lrdcccw - st %r6,.Lorb+8 # store cp-address to orb - bras %r15,.Lssch # start I/O - oi .Llodata+1,0x80 - lh %r5,.Lcountarea+6 # init r5 from countarea - stcm %r5,3,.Lrdccw+2 # and store into rd template *FIXME* - stcm %r5,3,.Llodata+14 # and store into lodata *FIXME* -.Lbootlist: - l %r2,.Llstad - l %r3,.Lblklst - lhi %r4,1 - bras %r14,.Lreadblks -.Lloader: - l %r10,.Lblklst # r10 is index to bootlist - lhi %r5,4 # r5: skip 4 blocks = firstpage.... -.Lkloop: - clc .Lnull(8),0(%r10) # test blocklist - jz .Lchkparm # end of list? - l %r2,0(%r10) # get startblock to r2 - slr %r4,%r4 # erase r4 - icm %r4,1,7(%r10) # get blockcount - slr %r3,%r3 # get address to r3 - icm %r3,0xe,4(%r10) - chi %r5,0 # still blocks to skip? - jz .Ldoread # no: start reading - cr %r5,%r4 # #skipblocks >= blockct? - jm .L007 # no: skip the blocks one by one -.L006: - sr %r5,%r4 # decrease number of blocks to skip - j .Lkcont # advance to next entry -.L007: - ahi %r2,1 # skip 1 block... - bctr %r4,0 # update blockct - ah %r3,.Lcountarea+6 # increment address - bct %r5,.L007 # 4 blocks skipped? -.Ldoread: - ltr %r2,%r2 # test startblock - jz .Lzeroes # startblocks is zero (hole) -.Ldiskread: - bras %r14,.Lreadblks - j .Lkcont -.Lzeroes: - lr %r2,%r3 -.L001: slr %r3,%r3 - icm %r3,3,.Lcountarea+6 # get blocksize - slr %r5,%r5 # no bytes to move -.L008: mvcle %r2,%r4,0 # fill zeroes to storage - jo .L008 # until block is filled - brct %r4,.L001 # skip to next block -.Lkcont: - ahi %r10,8 - j .Lkloop -.Lchkparm: - lm %r3,%r4,.Lstart # load .Lstart and .Lparm - clc 0x0(4,%r4),.Lnull - je .Lrunkern - mvc 0x480(128,%r3),0(%r4) # move 1k-0x80 to parmarea - mvc 0x500(256,%r3),0x80(%r4) - mvc 0x600(256,%r3),0x180(%r4) - mvc 0x700(256,%r3),0x280(%r4) -.Lrunkern: -# lhi %r2,17 -# sll %r2,12 -# st %r1,0xc6c(%r2) # store iplsubchannel to lowcore -# st %r1,0xc6c # store iplsubchannel to lowcore - br %r3 -# This function does the start IO -# r2: number of first block to read ( input by caller ) -# r3: address to read data to ( input by caller ) -# r4: number of blocks to read ( input by caller ) -# r5: destroyed -# r6: blocks per track ( input by caller ) -# r7: number of heads -# r8: -# r9: -# r10: -# r11: temporary register -# r12: local use for base address -# r13: base address for module -# r14: address of caller for subroutine -# r15: temporary save register (since we have no stack) -.Lreadblks: - la %r12,.Ldeccw - st %r12,8+.Lorb # store cpaddr to orb - ahi %r12,0x10 # increment r12 to point to rdccw - oi 1(%r12),0x40 # set CC in rd template - # first setup the read CCWs - lr %r15,%r4 # save number or blocks - slr %r7,%r7 - icm %r7,3,.Lrdcdata+14 # load heads to r7 - lhi %r6,9 - clc .Lrdcdata+3(2),.L9345 - je .L011 - lhi %r6,10 - clc .Lrdcdata+3(2),.L3380 - je .L011 - lhi %r6,12 - clc .Lrdcdata+3(2),.L3390 - je .L011 - bras %r14,.Ldisab -.L011: - # loop for nbl times -.Lrdloop: - mvc 0(8,%r12),.Lrdccw # copy template to this ccw - st %r3,4(%r12) # store target address to this ccw - bct %r4,.L005 # decrement no of blks still to do - ni 1(%r12),0x3f # delete CC from last ccw - lr %r4,%r15 # restore number of blocks - # read CCWs are setup now - stcm %r4,3,.Llodata+2 # store blockno to lodata clears r4 - ar %r4,%r2 # r4 (clear): ebl = blk + nbl - bctr %r4,0 # decrement r4 ( last blk touched - srda %r2,32 # trk = blk / bpt, bot = blk % bpt - dr %r2,%r6 # r3: trk, r2: bot - ahi %r2,1 # bot++ ( we start counting at 1 ) - stcm %r2,1,.Llodata+12 # store bot to lodata - xr %r2,%r2 # cy = trk / heads, hd = trk % heads - dr %r2,%r7 # r3: cy, r2: hd - sll %r3,16 # combine to CCHH in r3 - or %r3,%r2 - st %r3,.Ldedata+8 # store cchh to dedata - st %r3,.Llodata+4 # store cchh to lodata - st %r3,.Llodata+8 # store cchh to lodata - lr %r15,%r5 # save r5 - srda %r4,32 # tr2 = ebl / bpt - dr %r4,%r6 # r5: tr2, r4: bot2 - xr %r4,%r4 # cy2 = tr2 / heads, hd2 = hd2 % heads - dr %r4,%r7 # r5: cy2, r4: hd2 - stcm %r5,3,.Ldedata+12 # store cy2,hd2 to dedata - stcm %r4,3,.Ldedata+14 # store cy2,hd2 to dedata - lr %r5,%r15 # restore r5 - # CCWs are setup now, arent they? - bras %r15,.Lssch # start I/O - br %r14 # return to caller -.L005: - ah %r3,.Lcountarea+6 # add blocksize to target address - ahi %r12,8 # add sizeof(ccw) to base address - j .Lrdloop -# end of function -# This function does the start IO -# r1: Subchannel number -# r8: ORB address -# r9: IRB address -.Lssch: - lhi %r13,10 # initialize retries -.L012: - ssch .Lorb # start I/O - jz .Ltpi # ok? - bras %r14,.Ldisab # error -.Ltpi: - lpsw .Lwaitpsw # load wait-PSW -.Lionewaddr: - c %r1,0xb8 # compare to ipl subhchannel - jnz .Ltpi # not equal: loop - clc 0xbc(4),.Lorb # cross check the intparm - jnz .Ltpi # not equal: loop - tsch .Lirb # get status - tm .Lirb+9,0xff # channel status ? - jz .L003 # CS == 0x00 - bras %r14,.Ldisab # error -.L003: - tm .Lirb+8,0xf3 # DS different from CE/DE - jz .L004 # ok ? - bct %r13,.L012 # retries <= 5 ? - bras %r14,.Ldisab # error -.L004: - tm .Lirb+8,0x04 # DE set? - jz .Ltpi # DE not set, loop -.Lsschend: - br %r15 # return to caller -# end of function -# In case of error goto disabled wait with %r14 containing the caller -.Ldisab: - st %r14,.Ldisabpsw+4 - lpsw .Ldisabpsw - -# FIXME pre-initialized data should be listed first -# NULLed storage can be taken from anywhere ;) -.Lblklst: - .long 0x00002000 - .align 8 -.Ldisabpsw: - .long 0x000a0000,0x00000000 -.Lwaitpsw: - .long 0x020a0000,0x00000000+.Ltpi -.Lorb: - .long 0x0049504c,0x0080ff00 # intparm is " IPL" -.Lc6: .long 0xff000000 -.Lstart: - .long 0x00010000 # do not separate .Lstart and .Lparm -.Lparm: - .long 0x00008000 # they are loaded with a LM -.L3390: - .word 0x3390 -.L9345: - .word 0x9345 -.L3380: - .word 0x3380 -.Lnull: - .long 0x00000000,0x00000000 - .align 4 -.Lrdcdata: - .long 0x00000000,0x00000000 - .long 0x00000000,0x00000000 - .long 0x00000000,0x00000000 - .long 0x00000000,0x00000000 - .long 0x00000000,0x00000000 - .long 0x00000000,0x00000000 - .long 0x00000000,0x00000000 - .long 0x00000000,0x00000000 -.Lirb: - .long 0x00000000,0x00000000 - .long 0x00000000,0x00000000 - .long 0x00000000,0x00000000 - .long 0x00000000,0x00000000 - .long 0x00000000,0x00000000 - .long 0x00000000,0x00000000 - .long 0x00000000,0x00000000 - .long 0x00000000,0x00000000 -.Lcountarea: - .word 0x0000 # cyl; - .word 0x0000 # head; - .byte 0x00 # record; - .byte 0x00 # key length; - .word 0x0000 # data length == blocksize; -.Ldedata: - .long 0x40c00000,0x00000000 - .long 0x00000000,0x00000000 -.Llodata: - .long 0x06000001,0x00000000 - .long 0x00000000,0x01000000 - .long 0x12345678 - .org 0x7c8 -.Lrdcccw: # CCW read device characteristics - .long 0x64400040,0x00000000+.Lrdcdata - .long 0x63400010,0x00000000+.Ldedata - .long 0x47400010,0x00000000+.Llodata - .long 0x12000008,0x00000000+.Lcountarea -.Ldeccw: - .long 0x63400010,0x00000000+.Ldedata -.Lloccw: - .long 0x47400010,0x00000000+.Llodata -.Lrdccw: - .long 0x86400000,0x00000000 - .org 0x800 -# end of pre initialized data is here CCWarea follows -# from here we load 1k blocklist -# end of function - diff --git a/arch/s390x/boot/iplfba.S b/arch/s390x/boot/iplfba.S deleted file mode 100644 index 732a9848c2e40..0000000000000 --- a/arch/s390x/boot/iplfba.S +++ /dev/null @@ -1,131 +0,0 @@ -# -# Ipl block for fba devices -# Copyright (C) 1998 IBM Corporation -# Author(s): Martin Schwidefsky -# -# startup for ipl at address 0 -# start with restart - -# The first 24 byes are loaded by ipl to addresses 0-23 (a PSW and two CCWs). -# The CCWs on 8-23 are used as a continuation of the implicit ipl channel -# program. The fba ipl loader only uses the CCW on 8-15 to load the first 512 -# byte block to location 0-511 (the reading starts again at block 0, byte 0). -# The second CCW is used to store the location of the load list. - .org 0 - .long 0x00080000,0x80000000+_start # The first 24 byte are loaded - .long 0x02000000,0x20000200 # by ipl to addresses 0-23. - .long 0x00000001,0x00000001 # (PSW, one CCW & loadlist info). - - .globl _start -_start: - basr %r13,0 -.LPG0: - l %r1,0xb8 # load ipl subchannel number - lhi %r2,0x200 # location for the loadlist - lm %r3,%r4,0x10 # blocknr and length of loadlist - bras %r14,.Lloader # load loadlist - - lhi %r11,0x400 - lhi %r12,0x200 # load address of loadlist - l %r3,0(%r12) # get first block number - l %r4,4(%r12) # get first block count - la %r12,8(%r12) - j .Llistloop - .org 0x50 -.Llistloop: - lr %r2,%r11 # load address - lr %r5,%r4 # block count - mhi %r5,512 - la %r11,0(%r5,%r11) # update load address - bras %r14,.Lloader # load chunk of the image - l %r3,0(%r12) # get next block number - icm %r4,15,4(%r12) # get next block count - la %r12,8(%r12) - jnz .Llistloop - -# -# everything loaded, go for it -# - l %r1,.Lstart-.LPG0(%r13) - br %r1 - -# -# subroutine for loading a sequence of block from fba -# %r2: load address (24 bit address) -# %r3: number of first block (unsigned long) -# %r4: number of blocks to load (unsigned short) -# - .org 0xC0 -.Lloader: - la %r5,.Llo-.LPG0(%r13) - sth %r4,2(%r5) # initialize block count - st %r3,4(%r5) # initialize block number - la %r5,.Lccws-.LPG0(%r13) - mhi %r4,512 - sth %r4,22(%r5) # initialize byte count - icm %r2,8,16(%r5) - st %r2,16(%r5) # initialize CCW data address - - slr %r2,%r2 - la %r3,.Lorb-.LPG0(%r13) # r2 = address of orb into r2 - la %r4,.Ltinfo-.LPG0(%r13) # r3 = address of tpi info block - la %r5,.Lirb-.LPG0(%r13) # r4 = address of irb - - lctl %c6,%c6,.Lc6-.LPG0(%r13) -.Lldlp: - ssch 0(%r3) # read blocks -.Ltpi: - tpi 0(%r4) # test pending interrupt - jz .Ltpi - c %r1,0(%r4) # compare subchannel number - jne .Ltpi - tsch 0(%r5) - slr %r0,%r0 - tm 8(%r5),0x82 # do we have a problem ? - jnz .Ldwpsw - tm 8(%r5),0x04 # got device end ? - jz .Ltpi -.Lexit: - br %r14 - - .align 8 -.Ldwpsw:.long 0x000a0000,0x00000000 -.Lorb: .long 0x00000000,0x0000ff00,.Lccws -.Ltinfo:.long 0 -.Lirb: .long 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -.Lc6: .long 0xff000000 -.Lloadp:.long 0,0 -.Lparm: .long 0x10400 -.Lstart:.long 0x10000 - .align 8 -.Lccws: .long 0x63000000+.Lde,0x60000010 # define extent - .long 0x43000000+.Llo,0x60000008 # locate -# offset 1 in read CCW: data address (24 bit) -# offset 6 in read CCW: number of bytes (16 bit) - .long 0x42000000,0x20000000 # read -.Lde: .long 0x40000200,0x00000000 - .long 0x00000000,0x00001000 -# offset 2 in .Llo: block count (unsigned short) -# offset 4 in .Llo: block number (unsigned long) -.Llo: .long 0x06000000,0x00000000 - - .org 0x200 - .long 0x00000002,0x0000007f - .long 0x00000081,0x0000007f - .long 0x00000100,0x0000007f - .long 0x0000017f,0x0000007f - .long 0x000001fe,0x0000007f - .long 0x0000027d,0x0000007f - .long 0x000002fc,0x0000007f - .long 0x0000037b,0x0000007f - .long 0x000003fa,0x0000007f - .long 0x00000479,0x0000007f - .long 0x000004f8,0x0000007f - .long 0x00000577,0x0000007f - .long 0x000005f6,0x0000007f - .long 0x00000675,0x0000007f - .long 0x000006f4,0x0000007f - .long 0x00000773,0x0000003f - .long 0x00000000,0x00000000 - .org 0x400 - diff --git a/arch/s390x/defconfig b/arch/s390x/defconfig deleted file mode 100644 index 608044e12210d..0000000000000 --- a/arch/s390x/defconfig +++ /dev/null @@ -1,370 +0,0 @@ -# -# Automatically generated make config: don't edit -# -CONFIG_MMU=y -CONFIG_SWAP=y -CONFIG_RWSEM_XCHGADD_ALGORITHM=y -CONFIG_ARCH_S390=y -CONFIG_ARCH_S390X=y - -# -# Code maturity level options -# -CONFIG_EXPERIMENTAL=y - -# -# General setup -# -CONFIG_SYSVIPC=y -# CONFIG_BSD_PROCESS_ACCT is not set -CONFIG_SYSCTL=y -CONFIG_LOG_BUF_SHIFT=17 - -# -# Loadable module support -# -CONFIG_MODULES=y -# CONFIG_MODULE_UNLOAD is not set -CONFIG_OBSOLETE_MODPARM=y -# CONFIG_MODVERSIONS is not set -CONFIG_KMOD=y - -# -# Base setup -# - -# -# Processor type and features -# -CONFIG_SMP=y -CONFIG_NR_CPUS=64 -# CONFIG_S390_SUPPORT is not set - -# -# I/O subsystem configuration -# -CONFIG_MACHCHK_WARNING=y -CONFIG_QDIO=y -# CONFIG_QDIO_PERF_STATS is not set - -# -# Misc -# -# CONFIG_PREEMPT is not set -CONFIG_IPL=y -# CONFIG_IPL_TAPE is not set -CONFIG_IPL_VM=y -CONFIG_KCORE_ELF=y -CONFIG_BINFMT_ELF=y -CONFIG_BINFMT_MISC=m -# CONFIG_PROCESS_DEBUG is not set -CONFIG_PFAULT=y -# CONFIG_SHARED_KERNEL is not set -# CONFIG_PCMCIA is not set - -# -# SCSI support -# -# CONFIG_SCSI is not set -CONFIG_CCW=y - -# -# Block device drivers -# -CONFIG_BLK_DEV_LOOP=m -CONFIG_BLK_DEV_NBD=m -CONFIG_BLK_DEV_RAM=y -CONFIG_BLK_DEV_RAM_SIZE=4096 -CONFIG_BLK_DEV_INITRD=y -CONFIG_BLK_DEV_XPRAM=m - -# -# S/390 block device drivers -# -CONFIG_DASD=y -# CONFIG_DASD_PROFILE is not set -CONFIG_DASD_ECKD=y -CONFIG_DASD_FBA=y -# CONFIG_DASD_DIAG is not set - -# -# Multi-device support (RAID and LVM) -# -CONFIG_MD=y -CONFIG_BLK_DEV_MD=y -CONFIG_MD_LINEAR=m -CONFIG_MD_RAID0=m -CONFIG_MD_RAID1=m -CONFIG_MD_RAID5=m -CONFIG_MD_MULTIPATH=m -# CONFIG_BLK_DEV_DM is not set - -# -# Character device drivers -# -CONFIG_UNIX98_PTYS=y -CONFIG_UNIX98_PTY_COUNT=2048 - -# -# S/390 character device drivers -# -# CONFIG_TN3270 is not set -CONFIG_TN3215=y -CONFIG_TN3215_CONSOLE=y -CONFIG_CCW_CONSOLE=y -CONFIG_SCLP=y -CONFIG_SCLP_TTY=y -CONFIG_SCLP_CONSOLE=y -CONFIG_SCLP_CPI=m -CONFIG_S390_TAPE=m - -# -# S/390 tape interface support -# -CONFIG_S390_TAPE_BLOCK=y - -# -# S/390 tape hardware support -# -CONFIG_S390_TAPE_34XX=m -CONFIG_HOTPLUG=y - -# -# Networking support -# -CONFIG_NET=y - -# -# Networking options -# -CONFIG_PACKET=y -# CONFIG_PACKET_MMAP is not set -# CONFIG_NETLINK_DEV is not set -# CONFIG_NETFILTER is not set -# CONFIG_FILTER is not set -CONFIG_UNIX=y -# CONFIG_NET_KEY is not set -CONFIG_INET=y -CONFIG_IP_MULTICAST=y -# CONFIG_IP_ADVANCED_ROUTER is not set -# CONFIG_IP_PNP is not set -# CONFIG_NET_IPIP is not set -# CONFIG_NET_IPGRE is not set -# CONFIG_IP_MROUTE is not set -# CONFIG_ARPD is not set -# CONFIG_INET_ECN is not set -# CONFIG_SYN_COOKIES is not set -# CONFIG_INET_AH is not set -# CONFIG_INET_ESP is not set -# CONFIG_XFRM_USER is not set -CONFIG_IPV6=m - -# -# SCTP Configuration (EXPERIMENTAL) -# -CONFIG_IPV6_SCTP__=m -# CONFIG_IP_SCTP is not set -# CONFIG_ATM is not set -# CONFIG_VLAN_8021Q is not set -# CONFIG_LLC is not set -# CONFIG_DECNET is not set -# CONFIG_BRIDGE is not set -# CONFIG_X25 is not set -# CONFIG_LAPB is not set -# CONFIG_NET_DIVERT is not set -# CONFIG_ECONET is not set -# CONFIG_WAN_ROUTER is not set -# CONFIG_NET_FASTROUTE is not set -# CONFIG_NET_HW_FLOWCONTROL is not set - -# -# QoS and/or fair queueing -# -CONFIG_NET_SCHED=y -CONFIG_NET_SCH_CBQ=m -# CONFIG_NET_SCH_HTB is not set -CONFIG_NET_SCH_CSZ=m -CONFIG_NET_SCH_PRIO=m -CONFIG_NET_SCH_RED=m -CONFIG_NET_SCH_SFQ=m -CONFIG_NET_SCH_TEQL=m -CONFIG_NET_SCH_TBF=m -CONFIG_NET_SCH_GRED=m -CONFIG_NET_SCH_DSMARK=m -CONFIG_NET_QOS=y -CONFIG_NET_ESTIMATOR=y -CONFIG_NET_CLS=y -CONFIG_NET_CLS_TCINDEX=m -CONFIG_NET_CLS_ROUTE4=m -CONFIG_NET_CLS_ROUTE=y -CONFIG_NET_CLS_FW=m -CONFIG_NET_CLS_U32=m -CONFIG_NET_CLS_RSVP=m -CONFIG_NET_CLS_RSVP6=m -CONFIG_NET_CLS_POLICE=y - -# -# Network testing -# -# CONFIG_NET_PKTGEN is not set -CONFIG_NETDEVICES=y -CONFIG_DUMMY=m -CONFIG_BONDING=m -CONFIG_EQUALIZER=m -CONFIG_TUN=m -# CONFIG_ETHERTAP is not set - -# -# Ethernet (10 or 100Mbit) -# -CONFIG_NET_ETHERNET=y -# CONFIG_MII is not set - -# -# Ethernet (1000 Mbit) -# -# CONFIG_PPP is not set -# CONFIG_SLIP is not set - -# -# Wireless LAN (non-hamradio) -# -# CONFIG_NET_RADIO is not set - -# -# Token Ring devices (depends on LLC=y) -# -# CONFIG_SHAPER is not set - -# -# Wan interfaces -# -# CONFIG_WAN is not set - -# -# S/390 network device drivers -# -CONFIG_LCS=m -CONFIG_CTC=m -CONFIG_IUCV=m -CONFIG_CCWGROUP=m - -# -# File systems -# -CONFIG_QUOTA=y -# CONFIG_QFMT_V1 is not set -# CONFIG_QFMT_V2 is not set -CONFIG_QUOTACTL=y -# CONFIG_AUTOFS_FS is not set -# CONFIG_AUTOFS4_FS is not set -# CONFIG_REISERFS_FS is not set -# CONFIG_ADFS_FS is not set -# CONFIG_AFFS_FS is not set -# CONFIG_HFS_FS is not set -# CONFIG_BEFS_FS is not set -# CONFIG_BFS_FS is not set -CONFIG_EXT3_FS=y -CONFIG_EXT3_FS_XATTR=y -# CONFIG_EXT3_FS_POSIX_ACL is not set -CONFIG_JBD=y -# CONFIG_JBD_DEBUG is not set -# CONFIG_FAT_FS is not set -# CONFIG_EFS_FS is not set -# CONFIG_CRAMFS is not set -# CONFIG_TMPFS is not set -CONFIG_RAMFS=y -# CONFIG_ISO9660_FS is not set -# CONFIG_JFS_FS is not set -# CONFIG_MINIX_FS is not set -# CONFIG_VXFS_FS is not set -# CONFIG_NTFS_FS is not set -# CONFIG_HPFS_FS is not set -CONFIG_PROC_FS=y -# CONFIG_DEVFS_FS is not set -CONFIG_DEVPTS_FS=y -# CONFIG_QNX4FS_FS is not set -# CONFIG_ROMFS_FS is not set -CONFIG_EXT2_FS=y -# CONFIG_EXT2_FS_XATTR is not set -# CONFIG_SYSV_FS is not set -# CONFIG_UDF_FS is not set -# CONFIG_UFS_FS is not set -# CONFIG_XFS_FS is not set - -# -# Network File Systems -# -# CONFIG_CODA_FS is not set -# CONFIG_INTERMEZZO_FS is not set -CONFIG_NFS_FS=y -CONFIG_NFS_V3=y -# CONFIG_NFS_V4 is not set -CONFIG_NFSD=y -CONFIG_NFSD_V3=y -# CONFIG_NFSD_V4 is not set -# CONFIG_NFSD_TCP is not set -CONFIG_SUNRPC=y -# CONFIG_SUNRPC_GSS is not set -CONFIG_LOCKD=y -CONFIG_LOCKD_V4=y -CONFIG_EXPORTFS=y -# CONFIG_CIFS is not set -# CONFIG_SMB_FS is not set -# CONFIG_NCP_FS is not set -# CONFIG_AFS_FS is not set -CONFIG_FS_MBCACHE=y - -# -# Partition Types -# -CONFIG_PARTITION_ADVANCED=y -# CONFIG_ACORN_PARTITION is not set -# CONFIG_OSF_PARTITION is not set -# CONFIG_AMIGA_PARTITION is not set -# CONFIG_ATARI_PARTITION is not set -CONFIG_IBM_PARTITION=y -# CONFIG_MAC_PARTITION is not set -# CONFIG_MSDOS_PARTITION is not set -# CONFIG_LDM_PARTITION is not set -# CONFIG_SGI_PARTITION is not set -# CONFIG_ULTRIX_PARTITION is not set -# CONFIG_SUN_PARTITION is not set -# CONFIG_EFI_PARTITION is not set - -# -# Kernel hacking -# -CONFIG_DEBUG_KERNEL=y -CONFIG_MAGIC_SYSRQ=y -# CONFIG_DEBUG_SLAB is not set -# CONFIG_KALLSYMS is not set -# CONFIG_DEBUG_SPINLOCK_SLEEP is not set - -# -# Security options -# -# CONFIG_SECURITY is not set - -# -# Cryptographic options -# -CONFIG_CRYPTO=y -# CONFIG_CRYPTO_HMAC is not set -# CONFIG_CRYPTO_NULL is not set -# CONFIG_CRYPTO_MD4 is not set -# CONFIG_CRYPTO_MD5 is not set -# CONFIG_CRYPTO_SHA1 is not set -# CONFIG_CRYPTO_SHA256 is not set -# CONFIG_CRYPTO_SHA512 is not set -# CONFIG_CRYPTO_DES is not set -# CONFIG_CRYPTO_BLOWFISH is not set -# CONFIG_CRYPTO_TWOFISH is not set -# CONFIG_CRYPTO_SERPENT is not set -# CONFIG_CRYPTO_AES is not set -# CONFIG_CRYPTO_TEST is not set - -# -# Library routines -# -# CONFIG_CRC32 is not set diff --git a/arch/s390x/kernel/Makefile b/arch/s390x/kernel/Makefile deleted file mode 100644 index c59f5d6a1cc4a..0000000000000 --- a/arch/s390x/kernel/Makefile +++ /dev/null @@ -1,27 +0,0 @@ -# -# Makefile for the linux kernel. -# - -extra-y := head.o init_task.o -EXTRA_AFLAGS := -traditional - -obj-y := entry.o bitmap.o traps.o time.o process.o \ - setup.o sys_s390.o ptrace.o signal.o cpcmd.o ebcdic.o \ - semaphore.o reipl.o s390_ext.o debug.o - -obj-$(CONFIG_MODULES) += s390_ksyms.o module.o -obj-$(CONFIG_SMP) += smp.o - -# -# Kernel debugging -# -obj-$(CONFIG_REMOTE_DEBUG) += gdb-stub.o #gdb-low.o - -obj-$(CONFIG_S390_SUPPORT) += linux32.o signal32.o ioctl32.o wrapper32.o \ - exec32.o exec_domain32.o -obj-$(CONFIG_BINFMT_ELF32) += binfmt_elf32.o - -# -# This is just to get the dependencies... -# -binfmt_elf32.o: $(TOPDIR)/fs/binfmt_elf.c diff --git a/arch/s390x/kernel/asm-offsets.c b/arch/s390x/kernel/asm-offsets.c deleted file mode 100644 index 157e50591028c..0000000000000 --- a/arch/s390x/kernel/asm-offsets.c +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Generate definitions needed by assembly language modules. - * This code generates raw asm output which is post-processed to extract - * and format the required data. - */ - -#include -#include - -/* Use marker if you need to separate the values later */ - -#define DEFINE(sym, val, marker) \ - asm volatile("\n->" #sym " %0 " #val " " #marker : : "i" (val)) - -#define BLANK() asm volatile("\n->" : : ) - -int main(void) -{ - DEFINE(__THREAD_info, offsetof(struct task_struct, thread_info),); - DEFINE(__THREAD_ar2, offsetof(struct task_struct, thread.ar2),); - DEFINE(__THREAD_ar4, offsetof(struct task_struct, thread.ar4),); - DEFINE(__THREAD_ksp, offsetof(struct task_struct, thread.ksp),); - DEFINE(__THREAD_per, offsetof(struct task_struct, thread.per_info),); - BLANK(); - DEFINE(__TI_task, offsetof(struct thread_info, task),); - DEFINE(__TI_domain, offsetof(struct thread_info, exec_domain),); - DEFINE(__TI_flags, offsetof(struct thread_info, flags),); - DEFINE(__TI_cpu, offsetof(struct thread_info, cpu),); - DEFINE(__TI_precount, offsetof(struct thread_info, preempt_count),); - return 0; -} diff --git a/arch/s390x/kernel/binfmt_elf32.c b/arch/s390x/kernel/binfmt_elf32.c deleted file mode 100644 index afa0d62df6112..0000000000000 --- a/arch/s390x/kernel/binfmt_elf32.c +++ /dev/null @@ -1,214 +0,0 @@ -/* - * Support for 32-bit Linux for S390 ELF binaries. - * - * Copyright (C) 2000 IBM Deutschland Entwicklung GmbH, IBM Corporation - * Author(s): Gerhard Tonn (ton@de.ibm.com) - * - * Heavily inspired by the 32-bit Sparc compat code which is - * Copyright (C) 1995, 1996, 1997, 1998 David S. Miller (davem@redhat.com) - * Copyright (C) 1995, 1996, 1997, 1998 Jakub Jelinek (jj@ultra.linux.cz) - */ - -#define __ASMS390_ELF_H - -#include - -/* - * These are used to set parameters in the core dumps. - */ -#define ELF_CLASS ELFCLASS32 -#define ELF_DATA ELFDATA2MSB -#define ELF_ARCH EM_S390 - -/* - * This is used to ensure we don't load something for the wrong architecture. - */ -#define elf_check_arch(x) \ - (((x)->e_machine == EM_S390 || (x)->e_machine == EM_S390_OLD) \ - && (x)->e_ident[EI_CLASS] == ELF_CLASS) - -/* ELF register definitions */ -#define NUM_GPRS 16 -#define NUM_FPRS 16 -#define NUM_ACRS 16 - -#define TASK31_SIZE (0x80000000UL) - -/* For SVR4/S390 the function pointer to be registered with `atexit` is - passed in R14. */ -#define ELF_PLAT_INIT(_r, load_addr) \ - do { \ - _r->gprs[14] = 0; \ - set_thread_flag(TIF_31BIT); \ - } while(0) - -#define USE_ELF_CORE_DUMP -#define ELF_EXEC_PAGESIZE 4096 - -/* This is the location that an ET_DYN program is loaded if exec'ed. Typical - use of this is to invoke "./ld.so someprog" to test out a new version of - the loader. We need to make sure that it is out of the way of the program - that it will "exec", and that there is sufficient room for the brk. */ - -#define ELF_ET_DYN_BASE (TASK31_SIZE / 3 * 2) - -/* Wow, the "main" arch needs arch dependent functions too.. :) */ - -/* regs is struct pt_regs, pr_reg is elf_gregset_t (which is - now struct_user_regs, they are different) */ - -#define ELF_CORE_COPY_REGS(pr_reg, regs) \ - { \ - int i; \ - memcpy(&pr_reg.psw.mask, ®s->psw.mask, 4); \ - memcpy(&pr_reg.psw.addr, ((char*)®s->psw.addr)+4, 4); \ - for(i=0; igprs[i]; \ - for(i=0; iacrs[i]; \ - pr_reg.orig_gpr2 = regs->orig_gpr2; \ - } - - - -/* This yields a mask that user programs can use to figure out what - instruction set this CPU supports. */ - -#define ELF_HWCAP (0) - -/* This yields a string that ld.so will use to load implementation - specific libraries for optimization. This is more specific in - intent than poking at uname or /proc/cpuinfo. - - For the moment, we have only optimizations for the Intel generations, - but that could change... */ - -#define ELF_PLATFORM (NULL) - -#define SET_PERSONALITY(ex, ibcs2) \ -do { \ - if (ibcs2) \ - set_personality(PER_SVR4); \ - else if (current->personality != PER_LINUX32) \ - set_personality(PER_LINUX); \ -} while (0) - -#include "linux32.h" - -typedef _s390_fp_regs32 elf_fpregset_t; - -typedef struct -{ - - _psw_t32 psw; - __u32 gprs[__NUM_GPRS]; - __u32 acrs[__NUM_ACRS]; - __u32 orig_gpr2; -} s390_regs32; -typedef s390_regs32 elf_gregset_t; - -#include -#include -#include -#include -#include -#include - -int setup_arg_pages32(struct linux_binprm *bprm); - -#define elf_prstatus elf_prstatus32 -struct elf_prstatus32 -{ - struct elf_siginfo pr_info; /* Info associated with signal */ - short pr_cursig; /* Current signal */ - u32 pr_sigpend; /* Set of pending signals */ - u32 pr_sighold; /* Set of held signals */ - pid_t pr_pid; - pid_t pr_ppid; - pid_t pr_pgrp; - pid_t pr_sid; - struct compat_timeval pr_utime; /* User time */ - struct compat_timeval pr_stime; /* System time */ - struct compat_timeval pr_cutime; /* Cumulative user time */ - struct compat_timeval pr_cstime; /* Cumulative system time */ - elf_gregset_t pr_reg; /* GP registers */ - int pr_fpvalid; /* True if math co-processor being used. */ -}; - -#define elf_prpsinfo elf_prpsinfo32 -struct elf_prpsinfo32 -{ - char pr_state; /* numeric process state */ - char pr_sname; /* char for pr_state */ - char pr_zomb; /* zombie */ - char pr_nice; /* nice val */ - u32 pr_flag; /* flags */ - u16 pr_uid; - u16 pr_gid; - pid_t pr_pid, pr_ppid, pr_pgrp, pr_sid; - /* Lots missing */ - char pr_fname[16]; /* filename of executable */ - char pr_psargs[ELF_PRARGSZ]; /* initial part of arg list */ -}; - -#include - -#undef NEW_TO_OLD_UID -#undef NEW_TO_OLD_GID -#define NEW_TO_OLD_UID(uid) ((uid) > 65535) ? (u16)overflowuid : (u16)(uid) -#define NEW_TO_OLD_GID(gid) ((gid) > 65535) ? (u16)overflowgid : (u16)(gid) - -#define elf_addr_t u32 -/* -#define init_elf_binfmt init_elf32_binfmt -*/ -#undef CONFIG_BINFMT_ELF -#ifdef CONFIG_BINFMT_ELF32 -#define CONFIG_BINFMT_ELF CONFIG_BINFMT_ELF32 -#endif -#undef CONFIG_BINFMT_ELF_MODULE -#ifdef CONFIG_BINFMT_ELF32_MODULE -#define CONFIG_BINFMT_ELF_MODULE CONFIG_BINFMT_ELF32_MODULE -#endif - -#undef start_thread -#define start_thread start_thread31 -#define setup_arg_pages(bprm) setup_arg_pages32(bprm) -#define elf_map elf_map32 - -MODULE_DESCRIPTION("Binary format loader for compatibility with 32bit Linux for S390 binaries," - " Copyright 2000 IBM Corporation"); -MODULE_AUTHOR("Gerhard Tonn "); - -#undef MODULE_DESCRIPTION -#undef MODULE_AUTHOR - -#define jiffies_to_timeval jiffies_to_compat_timeval -static __inline__ void -jiffies_to_compat_timeval(unsigned long jiffies, struct compat_timeval *value) -{ - value->tv_usec = (jiffies % HZ) * (1000000L / HZ); - value->tv_sec = jiffies / HZ; -} - -#include "../../../fs/binfmt_elf.c" - -static unsigned long -elf_map32 (struct file *filep, unsigned long addr, struct elf_phdr *eppnt, int prot, int type) -{ - unsigned long map_addr; - - if (!addr) - addr = 0x40000000; - - if (prot & PROT_READ) - prot |= PROT_EXEC; - - down_write(¤t->mm->mmap_sem); - map_addr = do_mmap(filep, ELF_PAGESTART(addr), - eppnt->p_filesz + ELF_PAGEOFFSET(eppnt->p_vaddr), - prot, type, - eppnt->p_offset - ELF_PAGEOFFSET(eppnt->p_vaddr)); - up_write(¤t->mm->mmap_sem); - return(map_addr); -} diff --git a/arch/s390x/kernel/bitmap.S b/arch/s390x/kernel/bitmap.S deleted file mode 100644 index dfb41f946e234..0000000000000 --- a/arch/s390x/kernel/bitmap.S +++ /dev/null @@ -1,56 +0,0 @@ -/* - * arch/s390/kernel/bitmap.S - * Bitmaps for set_bit, clear_bit, test_and_set_bit, ... - * See include/asm-s390/{bitops.h|posix_types.h} for details - * - * S390 version - * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation - * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com), - */ - - .globl _oi_bitmap -_oi_bitmap: - .byte 0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80 - - .globl _ni_bitmap -_ni_bitmap: - .byte 0xFE,0xFD,0xFB,0xF7,0xEF,0xDF,0xBF,0x7F - - .globl _zb_findmap -_zb_findmap: - .byte 0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4 - .byte 0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5 - .byte 0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4 - .byte 0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,6 - .byte 0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4 - .byte 0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5 - .byte 0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4 - .byte 0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,7 - .byte 0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4 - .byte 0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5 - .byte 0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4 - .byte 0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,6 - .byte 0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4 - .byte 0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5 - .byte 0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4 - .byte 0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,8 - - .globl _sb_findmap -_sb_findmap: - .byte 8,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0 - .byte 4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0 - .byte 5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0 - .byte 4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0 - .byte 6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0 - .byte 4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0 - .byte 5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0 - .byte 4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0 - .byte 7,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0 - .byte 4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0 - .byte 5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0 - .byte 4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0 - .byte 6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0 - .byte 4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0 - .byte 5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0 - .byte 4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0 - diff --git a/arch/s390x/kernel/cpcmd.c b/arch/s390x/kernel/cpcmd.c deleted file mode 100644 index f2ec75b981e06..0000000000000 --- a/arch/s390x/kernel/cpcmd.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - * arch/s390/kernel/cpcmd.c - * - * S390 version - * Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation - * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com), - */ - -#include -#include -#include -#include -#include - -static spinlock_t cpcmd_lock = SPIN_LOCK_UNLOCKED; -static char cpcmd_buf[128]; - -void cpcmd(char *cmd, char *response, int rlen) -{ - const int mask = 0x40000000L; - unsigned long flags; - int cmdlen; - - spin_lock_irqsave(&cpcmd_lock, flags); - cmdlen = strlen(cmd); - strcpy(cpcmd_buf, cmd); - ASCEBC(cpcmd_buf, cmdlen); - - if (response != NULL && rlen > 0) { - asm volatile (" lrag 2,0(%0)\n" - " lgr 4,%1\n" - " o 4,%4\n" - " lrag 3,0(%2)\n" - " lgr 5,%3\n" - " sam31\n" - " .long 0x83240008 # Diagnose 83\n" - " sam64" - : /* no output */ - : "a" (cpcmd_buf), "d" (cmdlen), - "a" (response), "d" (rlen), "m" (mask) - : "2", "3", "4", "5" ); - EBCASC(response, rlen); - } else { - asm volatile (" lrag 2,0(%0)\n" - " lgr 3,%1\n" - " sam31\n" - " .long 0x83230008 # Diagnose 83\n" - " sam64" - : /* no output */ - : "a" (cpcmd_buf), "d" (cmdlen) - : "2", "3" ); - } - spin_unlock_irqrestore(&cpcmd_lock, flags); -} - diff --git a/arch/s390x/kernel/debug.c b/arch/s390x/kernel/debug.c deleted file mode 100644 index 55a2efc22bda3..0000000000000 --- a/arch/s390x/kernel/debug.c +++ /dev/null @@ -1,1206 +0,0 @@ -/* - * arch/s390/kernel/debug.c - * S/390 debug facility - * - * Copyright (C) 1999, 2000 IBM Deutschland Entwicklung GmbH, - * IBM Corporation - * Author(s): Michael Holzheu (holzheu@de.ibm.com), - * Holger Smolinski (Holger.Smolinski@de.ibm.com) - * - * Bugreports to: - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include - -#define MIN(a,b) (((a)<(b))?(a):(b)) -#define DEBUG_PROLOG_ENTRY -1 - -/* typedefs */ - -typedef struct file_private_info { - loff_t offset; /* offset of last read in file */ - int act_area; /* number of last formated area */ - int act_entry; /* last formated entry (offset */ - /* relative to beginning of last */ - /* formated area) */ - size_t act_entry_offset; /* up to this offset we copied */ - /* in last read the last formated */ - /* entry to userland */ - char temp_buf[2048]; /* buffer for output */ - debug_info_t *debug_info_org; /* original debug information */ - debug_info_t *debug_info_snap; /* snapshot of debug information */ - struct debug_view *view; /* used view of debug info */ -} file_private_info_t; - -typedef struct -{ - char *string; - /* - * This assumes that all args are converted into longs - * on L/390 this is the case for all types of parameter - * except of floats, and long long (32 bit) - * - */ - long args[0]; -} debug_sprintf_entry; - - -extern void tod_to_timeval(uint64_t todval, struct timeval *xtime); - -/* internal function prototyes */ - -static int debug_init(void); -static ssize_t debug_output(struct file *file, char *user_buf, - size_t user_len, loff_t * offset); -static ssize_t debug_input(struct file *file, const char *user_buf, - size_t user_len, loff_t * offset); -static int debug_open(struct inode *inode, struct file *file); -static int debug_close(struct inode *inode, struct file *file); -static debug_info_t* debug_info_create(char *name, int page_order, int nr_areas, int buf_size); -static void debug_info_get(debug_info_t *); -static void debug_info_put(debug_info_t *); -static int debug_prolog_level_fn(debug_info_t * id, - struct debug_view *view, char *out_buf); -static int debug_input_level_fn(debug_info_t * id, struct debug_view *view, - struct file *file, const char *user_buf, - size_t user_buf_size, loff_t * offset); -static int debug_input_flush_fn(debug_info_t * id, struct debug_view *view, - struct file *file, const char *user_buf, - size_t user_buf_size, loff_t * offset); -static int debug_hex_ascii_format_fn(debug_info_t * id, struct debug_view *view, - char *out_buf, const char *in_buf); -static int debug_raw_format_fn(debug_info_t * id, - struct debug_view *view, char *out_buf, - const char *in_buf); -static int debug_raw_header_fn(debug_info_t * id, struct debug_view *view, - int area, debug_entry_t * entry, char *out_buf); - -static int debug_sprintf_format_fn(debug_info_t * id, struct debug_view *view, - char *out_buf, debug_sprintf_entry *curr_event); - -/* globals */ - -struct debug_view debug_raw_view = { - "raw", - NULL, - &debug_raw_header_fn, - &debug_raw_format_fn, - NULL, - NULL -}; - -struct debug_view debug_hex_ascii_view = { - "hex_ascii", - NULL, - &debug_dflt_header_fn, - &debug_hex_ascii_format_fn, - NULL, - NULL -}; - -struct debug_view debug_level_view = { - "level", - &debug_prolog_level_fn, - NULL, - NULL, - &debug_input_level_fn, - NULL -}; - -struct debug_view debug_flush_view = { - "flush", - NULL, - NULL, - NULL, - &debug_input_flush_fn, - NULL -}; - -struct debug_view debug_sprintf_view = { - "sprintf", - NULL, - &debug_dflt_header_fn, - (debug_format_proc_t*)&debug_sprintf_format_fn, - NULL, - NULL -}; - - -unsigned int debug_feature_version = __DEBUG_FEATURE_VERSION; - -/* static globals */ - -static debug_info_t *debug_area_first = NULL; -static debug_info_t *debug_area_last = NULL; -DECLARE_MUTEX(debug_lock); - -static int initialized; - -static struct file_operations debug_file_ops = { - .owner = THIS_MODULE, - .read = debug_output, - .write = debug_input, - .open = debug_open, - .release = debug_close, -}; - -static struct proc_dir_entry *debug_proc_root_entry; - -/* functions */ - -/* - * debug_info_alloc - * - alloc new debug-info - */ - -static debug_info_t* debug_info_alloc(char *name, int page_order, - int nr_areas, int buf_size) -{ - debug_info_t* rc; - int i; - - /* alloc everything */ - - rc = (debug_info_t*) kmalloc(sizeof(debug_info_t), GFP_ATOMIC); - if(!rc) - goto fail_malloc_rc; - rc->active_entry = (int*)kmalloc(nr_areas * sizeof(int), GFP_ATOMIC); - if(!rc->active_entry) - goto fail_malloc_active_entry; - memset(rc->active_entry, 0, nr_areas * sizeof(int)); - rc->areas = (debug_entry_t **) kmalloc(nr_areas * - sizeof(debug_entry_t *), - GFP_ATOMIC); - if (!rc->areas) - goto fail_malloc_areas; - for (i = 0; i < nr_areas; i++) { - rc->areas[i] = (debug_entry_t *) __get_free_pages(GFP_ATOMIC, - page_order); - if (!rc->areas[i]) { - for (i--; i >= 0; i--) { - free_pages((unsigned long) rc->areas[i], - page_order); - } - goto fail_malloc_areas2; - } else { - memset(rc->areas[i], 0, PAGE_SIZE << page_order); - } - } - - /* initialize members */ - - spin_lock_init(&rc->lock); - rc->page_order = page_order; - rc->nr_areas = nr_areas; - rc->active_area = 0; - rc->level = DEBUG_DEFAULT_LEVEL; - rc->buf_size = buf_size; - rc->entry_size = sizeof(debug_entry_t) + buf_size; - strncpy(rc->name, name, MIN(strlen(name), (DEBUG_MAX_PROCF_LEN - 1))); - rc->name[MIN(strlen(name), (DEBUG_MAX_PROCF_LEN - 1))] = 0; - memset(rc->views, 0, DEBUG_MAX_VIEWS * sizeof(struct debug_view *)); -#ifdef CONFIG_PROC_FS - memset(rc->proc_entries, 0 ,DEBUG_MAX_VIEWS * - sizeof(struct proc_dir_entry*)); -#endif /* CONFIG_PROC_FS */ - atomic_set(&(rc->ref_count), 0); - - return rc; - -fail_malloc_areas2: - kfree(rc->areas); -fail_malloc_areas: - kfree(rc->active_entry); -fail_malloc_active_entry: - kfree(rc); -fail_malloc_rc: - return NULL; -} - -/* - * debug_info_free - * - free memory debug-info - */ - -static void debug_info_free(debug_info_t* db_info){ - int i; - for (i = 0; i < db_info->nr_areas; i++) { - free_pages((unsigned long) db_info->areas[i], - db_info->page_order); - } - kfree(db_info->areas); - kfree(db_info->active_entry); - kfree(db_info); -} - -/* - * debug_info_create - * - create new debug-info - */ - -static debug_info_t* debug_info_create(char *name, int page_order, - int nr_areas, int buf_size) -{ - debug_info_t* rc; - - rc = debug_info_alloc(name, page_order, nr_areas, buf_size); - if(!rc) - goto out; - - - /* create proc rood directory */ - rc->proc_root_entry = proc_mkdir(rc->name, debug_proc_root_entry); - - /* append new element to linked list */ - if (debug_area_first == NULL) { - /* first element in list */ - debug_area_first = rc; - rc->prev = NULL; - } else { - /* append element to end of list */ - debug_area_last->next = rc; - rc->prev = debug_area_last; - } - debug_area_last = rc; - rc->next = NULL; - - debug_info_get(rc); -out: - return rc; -} - -/* - * debug_info_copy - * - copy debug-info - */ - -static debug_info_t* debug_info_copy(debug_info_t* in) -{ - int i; - debug_info_t* rc; - rc = debug_info_alloc(in->name, in->page_order, - in->nr_areas, in->buf_size); - if(!rc) - goto out; - - for(i = 0; i < in->nr_areas; i++){ - memcpy(rc->areas[i],in->areas[i], PAGE_SIZE << in->page_order); - } -out: - return rc; -} - -/* - * debug_info_get - * - increments reference count for debug-info - */ - -static void debug_info_get(debug_info_t * db_info) -{ - if (db_info) - atomic_inc(&db_info->ref_count); -} - -/* - * debug_info_put: - * - decreases reference count for debug-info and frees it if necessary - */ - -static void debug_info_put(debug_info_t *db_info) -{ - int i; - - if (!db_info) - return; - if (atomic_dec_and_test(&db_info->ref_count)) { -#ifdef DEBUG - printk(KERN_INFO "debug: freeing debug area %p (%s)\n", - db_info, db_info->name); -#endif - for (i = 0; i < DEBUG_MAX_VIEWS; i++) { - if (db_info->views[i] == NULL) - continue; -#ifdef CONFIG_PROC_FS - remove_proc_entry(db_info->proc_entries[i]->name, - db_info->proc_root_entry); -#endif - } -#ifdef CONFIG_PROC_FS - remove_proc_entry(db_info->proc_root_entry->name, - debug_proc_root_entry); -#endif - if(db_info == debug_area_first) - debug_area_first = db_info->next; - if(db_info == debug_area_last) - debug_area_last = db_info->prev; - if(db_info->prev) db_info->prev->next = db_info->next; - if(db_info->next) db_info->next->prev = db_info->prev; - debug_info_free(db_info); - } -} - -/* - * debug_format_entry: - * - format one debug entry and return size of formated data - */ - -static int debug_format_entry(file_private_info_t *p_info) -{ - debug_info_t *id_org = p_info->debug_info_org; - debug_info_t *id_snap = p_info->debug_info_snap; - struct debug_view *view = p_info->view; - debug_entry_t *act_entry; - size_t len = 0; - if(p_info->act_entry == DEBUG_PROLOG_ENTRY){ - /* print prolog */ - if (view->prolog_proc) - len += view->prolog_proc(id_org, view,p_info->temp_buf); - goto out; - } - - act_entry = (debug_entry_t *) ((char*)id_snap->areas[p_info->act_area] + - p_info->act_entry); - - if (act_entry->id.stck == 0LL) - goto out; /* empty entry */ - if (view->header_proc) - len += view->header_proc(id_org, view, p_info->act_area, - act_entry, p_info->temp_buf + len); - if (view->format_proc) - len += view->format_proc(id_org, view, p_info->temp_buf + len, - DEBUG_DATA(act_entry)); - out: - return len; -} - -/* - * debug_next_entry: - * - goto next entry in p_info - */ - -extern inline int debug_next_entry(file_private_info_t *p_info) -{ - debug_info_t *id = p_info->debug_info_snap; - if(p_info->act_entry == DEBUG_PROLOG_ENTRY){ - p_info->act_entry = 0; - goto out; - } - if ((p_info->act_entry += id->entry_size) - > ((PAGE_SIZE << (id->page_order)) - - id->entry_size)){ - - /* next area */ - p_info->act_entry = 0; - p_info->act_area++; - if(p_info->act_area >= id->nr_areas) - return 1; - } -out: - return 0; -} - -/* - * debug_output: - * - called for user read() - * - copies formated debug entries to the user buffer - */ - -static ssize_t debug_output(struct file *file, /* file descriptor */ - char *user_buf, /* user buffer */ - size_t len, /* length of buffer */ - loff_t *offset /* offset in the file */ ) -{ - size_t count = 0; - size_t entry_offset, size = 0; - file_private_info_t *p_info; - - p_info = ((file_private_info_t *) file->private_data); - if (*offset != p_info->offset) - return -EPIPE; - if(p_info->act_area >= p_info->debug_info_snap->nr_areas) - return 0; - - entry_offset = p_info->act_entry_offset; - - while(count < len){ - size = debug_format_entry(p_info); - size = MIN((len - count), (size - entry_offset)); - - if(size){ - if (copy_to_user(user_buf + count, - p_info->temp_buf + entry_offset, size)) - return -EFAULT; - } - count += size; - entry_offset = 0; - if(count != len) - if(debug_next_entry(p_info)) - goto out; - } -out: - p_info->offset = *offset + count; - p_info->act_entry_offset = size; - *offset = p_info->offset; - return count; -} - -/* - * debug_input: - * - called for user write() - * - calls input function of view - */ - -static ssize_t debug_input(struct file *file, - const char *user_buf, size_t length, - loff_t *offset) -{ - int rc = 0; - file_private_info_t *p_info; - - down(&debug_lock); - p_info = ((file_private_info_t *) file->private_data); - if (p_info->view->input_proc) - rc = p_info->view->input_proc(p_info->debug_info_org, - p_info->view, file, user_buf, - length, offset); - else - rc = -EPERM; - up(&debug_lock); - return rc; /* number of input characters */ -} - -/* - * debug_open: - * - called for user open() - * - copies formated output to private_data area of the file - * handle - */ - -static int debug_open(struct inode *inode, struct file *file) -{ - int i = 0, rc = 0; - file_private_info_t *p_info; - debug_info_t *debug_info, *debug_info_snapshot; - -#ifdef DEBUG - printk("debug_open\n"); -#endif - down(&debug_lock); - - /* find debug log and view */ - - debug_info = debug_area_first; - while(debug_info != NULL){ - for (i = 0; i < DEBUG_MAX_VIEWS; i++) { - if (debug_info->views[i] == NULL) - continue; - else if (debug_info->proc_entries[i] == - PDE(file->f_dentry->d_inode)) { - goto found; /* found view ! */ - } - } - debug_info = debug_info->next; - } - /* no entry found */ - rc = -EINVAL; - goto out; - - found: - - /* make snapshot of current debug areas to get it consistent */ - - debug_info_snapshot = debug_info_copy(debug_info); - - if(!debug_info_snapshot){ -#ifdef DEBUG - printk(KERN_ERR "debug_open: debug_info_copy failed (out of mem)\n"); -#endif - rc = -ENOMEM; - goto out; - } - - if ((file->private_data = - kmalloc(sizeof(file_private_info_t), GFP_ATOMIC)) == 0) { -#ifdef DEBUG - printk(KERN_ERR "debug_open: kmalloc failed\n"); -#endif - debug_info_free(debug_info_snapshot); - rc = -ENOMEM; - goto out; - } - p_info = (file_private_info_t *) file->private_data; - p_info->offset = 0; - p_info->debug_info_snap = debug_info_snapshot; - p_info->debug_info_org = debug_info; - p_info->view = debug_info->views[i]; - p_info->act_area = 0; - p_info->act_entry = DEBUG_PROLOG_ENTRY; - p_info->act_entry_offset = 0; - - debug_info_get(debug_info); - - out: - up(&debug_lock); - return rc; -} - -/* - * debug_close: - * - called for user close() - * - deletes private_data area of the file handle - */ - -static int debug_close(struct inode *inode, struct file *file) -{ - file_private_info_t *p_info; -#ifdef DEBUG - printk("debug_close\n"); -#endif - p_info = (file_private_info_t *) file->private_data; - debug_info_free(p_info->debug_info_snap); - debug_info_put(p_info->debug_info_org); - kfree(file->private_data); - return 0; /* success */ -} - -/* - * debug_register: - * - creates and initializes debug area for the caller - * - returns handle for debug area - */ - -debug_info_t *debug_register - (char *name, int page_order, int nr_areas, int buf_size) -{ - debug_info_t *rc = NULL; - - MOD_INC_USE_COUNT; - if (!initialized) - BUG(); - down(&debug_lock); - - /* create new debug_info */ - - rc = debug_info_create(name, page_order, nr_areas, buf_size); - if(!rc) - goto out; - debug_register_view(rc, &debug_level_view); - debug_register_view(rc, &debug_flush_view); -#ifdef DEBUG - printk(KERN_INFO - "debug: reserved %d areas of %d pages for debugging %s\n", - nr_areas, 1 << page_order, rc->name); -#endif - out: - if (rc == NULL){ - printk(KERN_ERR "debug: debug_register failed for %s\n",name); - MOD_DEC_USE_COUNT; - } - up(&debug_lock); - return rc; -} - -/* - * debug_unregister: - * - give back debug area - */ - -void debug_unregister(debug_info_t * id) -{ - if (!id) - goto out; - down(&debug_lock); -#ifdef DEBUG - printk(KERN_INFO "debug: unregistering %s\n", id->name); -#endif - debug_info_put(id); - up(&debug_lock); - - MOD_DEC_USE_COUNT; - out: - return; -} - -/* - * debug_set_level: - * - set actual debug level - */ - -void debug_set_level(debug_info_t* id, int new_level) -{ - unsigned long flags; - if(!id) - return; - spin_lock_irqsave(&id->lock,flags); - if(new_level == DEBUG_OFF_LEVEL){ - id->level = DEBUG_OFF_LEVEL; - printk(KERN_INFO "debug: %s: switched off\n",id->name); - } else if ((new_level > DEBUG_MAX_LEVEL) || (new_level < 0)) { - printk(KERN_INFO - "debug: %s: level %i is out of range (%i - %i)\n", - id->name, new_level, 0, DEBUG_MAX_LEVEL); - } else { - id->level = new_level; -#ifdef DEBUG - printk(KERN_INFO - "debug: %s: new level %i\n",id->name,id->level); -#endif - } - spin_unlock_irqrestore(&id->lock,flags); -} - - -/* - * proceed_active_entry: - * - set active entry to next in the ring buffer - */ - -extern inline void proceed_active_entry(debug_info_t * id) -{ - if ((id->active_entry[id->active_area] += id->entry_size) - > ((PAGE_SIZE << (id->page_order)) - id->entry_size)) - id->active_entry[id->active_area] = 0; -} - -/* - * proceed_active_area: - * - set active area to next in the ring buffer - */ - -extern inline void proceed_active_area(debug_info_t * id) -{ - id->active_area++; - id->active_area = id->active_area % id->nr_areas; -} - -/* - * get_active_entry: - */ - -extern inline debug_entry_t *get_active_entry(debug_info_t * id) -{ - return (debug_entry_t *) ((char *) id->areas[id->active_area] + - id->active_entry[id->active_area]); -} - -/* - * debug_common: - * - set timestamp, caller address, cpu number etc. - */ - -extern inline debug_entry_t *debug_common(debug_info_t * id, int level, - const void *buf, int len, int exception) -{ - unsigned long flags; - debug_entry_t *active; - - spin_lock_irqsave(&id->lock, flags); - active = get_active_entry(id); - STCK(active->id.stck); - active->id.fields.cpuid = smp_processor_id(); - active->caller = __builtin_return_address(0); - active->id.fields.exception = exception; - active->id.fields.level = level; - memset(DEBUG_DATA(active), 0, id->buf_size); - memcpy(DEBUG_DATA(active), buf, MIN(len, id->buf_size)); - proceed_active_entry(id); - if(exception) - proceed_active_area(id); - spin_unlock_irqrestore(&id->lock, flags); - - return active; -} - -/* - * debug_event_common: - * - write debug entry with given size - */ - -debug_entry_t *debug_event_common(debug_info_t * id, int level, const void *buf, - int len) -{ - return debug_common(id, level, buf, len, 0); -} - -/* - * debug_exception_common: - * - write debug entry with given size and switch to next debug area - */ - -debug_entry_t *debug_exception_common(debug_info_t * id, int level, - const void *buf, int len) -{ - return debug_common(id, level, buf, len, 1); -} - -/* - * counts arguments in format string for sprintf view - */ - -extern inline int debug_count_numargs(char *string) -{ - int numargs=0; - - while(*string) { - if(*string++=='%') - numargs++; - } - return(numargs); -} - -/* - * debug_sprintf_event: - */ - -debug_entry_t *debug_sprintf_event(debug_info_t* id, - int level,char *string,...) -{ - va_list ap; - int numargs,alloc_size,idx; - debug_sprintf_entry *curr_event; - debug_entry_t *retval = NULL; - - if((!id) || (level > id->level)) - return NULL; - else { - numargs=debug_count_numargs(string); - alloc_size=offsetof(debug_sprintf_entry,args[numargs]); - curr_event=alloca(alloc_size); - - if(curr_event){ - va_start(ap,string); - curr_event->string=string; - for(idx=0;idxargs[idx]=va_arg(ap,long); - retval=debug_common(id,level, curr_event,alloc_size,0); - va_end(ap); - } - return retval; - } -} - -/* - * debug_sprintf_exception: - */ - -debug_entry_t *debug_sprintf_exception(debug_info_t* id, - int level,char *string,...) -{ - va_list ap; - int numargs,alloc_size,idx; - debug_sprintf_entry *curr_event; - debug_entry_t *retval = NULL; - - if((!id) || (level > id->level)) - return NULL; - else { - numargs=debug_count_numargs(string); - alloc_size=offsetof(debug_sprintf_entry,args[numargs]); - curr_event=alloca(alloc_size); - - if(curr_event){ - va_start(ap,string); - curr_event->string=string; - for(idx=0;idxargs[idx]=va_arg(ap,long); - retval=debug_common(id,level, curr_event,alloc_size,1); - va_end(ap); - } - return retval; - } -} - -/* - * debug_init: - * - is called exactly once to initialize the debug feature - */ - -static int __init debug_init(void) -{ - int rc = 0; - - down(&debug_lock); -#ifdef CONFIG_PROC_FS - debug_proc_root_entry = proc_mkdir(DEBUG_DIR_ROOT, NULL); -#endif /* CONFIG_PROC_FS */ - printk(KERN_INFO "debug: Initialization complete\n"); - initialized = 1; - up(&debug_lock); - - return rc; -} - -/* - * debug_register_view: - */ - -int debug_register_view(debug_info_t * id, struct debug_view *view) -{ - int rc = 0; - int i; - unsigned long flags; - mode_t mode = S_IFREG; - - if (!id) - goto out; - spin_lock_irqsave(&id->lock, flags); - for (i = 0; i < DEBUG_MAX_VIEWS; i++) { - if (id->views[i] == NULL) - break; - } - if (i == DEBUG_MAX_VIEWS) { - printk(KERN_WARNING "debug: cannot register view %s/%s\n", - id->name,view->name); - printk(KERN_WARNING - "debug: maximum number of views reached (%i)!\n", i); - rc = -1; - } - else { - id->views[i] = view; - if (view->prolog_proc || view->format_proc || view->header_proc) - mode |= S_IRUSR; - if (view->input_proc) - mode |= S_IWUSR; - id->proc_entries[i] = create_proc_entry(view->name, mode, - id->proc_root_entry); - if (id->proc_entries[i] != NULL) - id->proc_entries[i]->proc_fops = &debug_file_ops; - rc = 0; - } - spin_unlock_irqrestore(&id->lock, flags); - out: - return rc; -} - -/* - * debug_unregister_view: - */ - -int debug_unregister_view(debug_info_t * id, struct debug_view *view) -{ - int rc = 0; - int i; - unsigned long flags; - - if (!id) - goto out; - spin_lock_irqsave(&id->lock, flags); - for (i = 0; i < DEBUG_MAX_VIEWS; i++) { - if (id->views[i] == view) - break; - } - if (i == DEBUG_MAX_VIEWS) - rc = -1; - else { -#ifdef CONFIG_PROC_FS - remove_proc_entry(id->proc_entries[i]->name, - id->proc_root_entry); -#endif - id->views[i] = NULL; - rc = 0; - } - spin_unlock_irqrestore(&id->lock, flags); - out: - return rc; -} - -/* - * functions for debug-views - *********************************** -*/ - -/* - * prints out actual debug level - */ - -static int debug_prolog_level_fn(debug_info_t * id, - struct debug_view *view, char *out_buf) -{ - int rc = 0; - - if(id->level == -1) rc = sprintf(out_buf,"-\n"); - else rc = sprintf(out_buf, "%i\n", id->level); - return rc; -} - -/* - * reads new debug level - */ - -static int debug_input_level_fn(debug_info_t * id, struct debug_view *view, - struct file *file, const char *user_buf, - size_t in_buf_size, loff_t * offset) -{ - char input_buf[1]; - int rc = in_buf_size; - - if (*offset != 0) - goto out; - if (copy_from_user(input_buf, user_buf, 1)){ - rc = -EFAULT; - goto out; - } - if (isdigit(input_buf[0])) { - int new_level = ((int) input_buf[0] - (int) '0'); - debug_set_level(id, new_level); - } else if(input_buf[0] == '-') { - debug_set_level(id, DEBUG_OFF_LEVEL); - } else { - printk(KERN_INFO "debug: level `%c` is not valid\n", - input_buf[0]); - } - out: - *offset += in_buf_size; - return rc; /* number of input characters */ -} - - -/* - * flushes debug areas - */ - -void debug_flush(debug_info_t* id, int area) -{ - unsigned long flags; - int i; - - if(!id) - return; - spin_lock_irqsave(&id->lock,flags); - if(area == DEBUG_FLUSH_ALL){ - id->active_area = 0; - memset(id->active_entry, 0, id->nr_areas * sizeof(int)); - for (i = 0; i < id->nr_areas; i++) - memset(id->areas[i], 0, PAGE_SIZE << id->page_order); - printk(KERN_INFO "debug: %s: all areas flushed\n",id->name); - } else if(area >= 0 && area < id->nr_areas) { - id->active_entry[area] = 0; - memset(id->areas[area], 0, PAGE_SIZE << id->page_order); - printk(KERN_INFO - "debug: %s: area %i has been flushed\n", - id->name, area); - } else { - printk(KERN_INFO - "debug: %s: area %i cannot be flushed (range: %i - %i)\n", - id->name, area, 0, id->nr_areas-1); - } - spin_unlock_irqrestore(&id->lock,flags); -} - -/* - * view function: flushes debug areas - */ - -static int debug_input_flush_fn(debug_info_t * id, struct debug_view *view, - struct file *file, const char *user_buf, - size_t in_buf_size, loff_t * offset) -{ - char input_buf[1]; - int rc = in_buf_size; - - if (*offset != 0) - goto out; - if (copy_from_user(input_buf, user_buf, 1)){ - rc = -EFAULT; - goto out; - } - if(input_buf[0] == '-') { - debug_flush(id, DEBUG_FLUSH_ALL); - goto out; - } - if (isdigit(input_buf[0])) { - int area = ((int) input_buf[0] - (int) '0'); - debug_flush(id, area); - goto out; - } - - printk(KERN_INFO "debug: area `%c` is not valid\n", input_buf[0]); - - out: - *offset += in_buf_size; - return rc; /* number of input characters */ -} - -/* - * prints debug header in raw format - */ - -int debug_raw_header_fn(debug_info_t * id, struct debug_view *view, - int area, debug_entry_t * entry, char *out_buf) -{ - int rc; - - rc = sizeof(debug_entry_t); - memcpy(out_buf,entry,sizeof(debug_entry_t)); - return rc; -} - -/* - * prints debug data in raw format - */ - -static int debug_raw_format_fn(debug_info_t * id, struct debug_view *view, - char *out_buf, const char *in_buf) -{ - int rc; - - rc = id->buf_size; - memcpy(out_buf, in_buf, id->buf_size); - return rc; -} - -/* - * prints debug data in hex/ascii format - */ - -static int debug_hex_ascii_format_fn(debug_info_t * id, struct debug_view *view, - char *out_buf, const char *in_buf) -{ - int i, rc = 0; - - for (i = 0; i < id->buf_size; i++) { - rc += sprintf(out_buf + rc, "%02x ", - ((unsigned char *) in_buf)[i]); - } - rc += sprintf(out_buf + rc, "| "); - for (i = 0; i < id->buf_size; i++) { - unsigned char c = in_buf[i]; - if (!isprint(c)) - rc += sprintf(out_buf + rc, "."); - else - rc += sprintf(out_buf + rc, "%c", c); - } - rc += sprintf(out_buf + rc, "\n"); - return rc; -} - -/* - * prints header for debug entry - */ - -int debug_dflt_header_fn(debug_info_t * id, struct debug_view *view, - int area, debug_entry_t * entry, char *out_buf) -{ - struct timeval time_val; - unsigned long long time; - char *except_str; - unsigned long caller; - int rc = 0; - unsigned int level; - - level = entry->id.fields.level; - time = entry->id.stck; - /* adjust todclock to 1970 */ - time -= 0x8126d60e46000000LL - (0x3c26700LL * 1000000 * 4096); - tod_to_timeval(time, &time_val); - - if (entry->id.fields.exception) - except_str = "*"; - else - except_str = "-"; - caller = (unsigned long) entry->caller; -#if defined(CONFIG_ARCH_S390X) - rc += sprintf(out_buf, "%02i %011lu:%06lu %1u %1s %02i %016lx ", - area, time_val.tv_sec, time_val.tv_usec, level, - except_str, entry->id.fields.cpuid, caller); -#else - caller &= 0x7fffffff; - rc += sprintf(out_buf, "%02i %011lu:%06lu %1u %1s %02i %08lx ", - area, time_val.tv_sec, time_val.tv_usec, level, - except_str, entry->id.fields.cpuid, caller); -#endif - return rc; -} - -/* - * prints debug data sprintf-formated: - * debug_sprinf_event/exception calls must be used together with this view - */ - -#define DEBUG_SPRINTF_MAX_ARGS 10 - -int debug_sprintf_format_fn(debug_info_t * id, struct debug_view *view, - char *out_buf, debug_sprintf_entry *curr_event) -{ - int num_longs, num_used_args = 0,i, rc = 0; - int index[DEBUG_SPRINTF_MAX_ARGS]; - - /* count of longs fit into one entry */ - num_longs = id->buf_size / sizeof(long); - - if(num_longs < 1) - goto out; /* bufsize of entry too small */ - if(num_longs == 1) { - /* no args, we use only the string */ - strcpy(out_buf, curr_event->string); - rc = strlen(curr_event->string); - goto out; - } - - /* number of arguments used for sprintf (without the format string) */ - num_used_args = MIN(DEBUG_SPRINTF_MAX_ARGS, (num_longs - 1)); - - memset(index,0, DEBUG_SPRINTF_MAX_ARGS * sizeof(int)); - - for(i = 0; i < num_used_args; i++) - index[i] = i; - - rc = sprintf(out_buf, curr_event->string, curr_event->args[index[0]], - curr_event->args[index[1]], curr_event->args[index[2]], - curr_event->args[index[3]], curr_event->args[index[4]], - curr_event->args[index[5]], curr_event->args[index[6]], - curr_event->args[index[7]], curr_event->args[index[8]], - curr_event->args[index[9]]); - -out: - - return rc; -} - -/* - * clean up module - */ -void __exit debug_exit(void) -{ -#ifdef DEBUG - printk("debug_cleanup_module: \n"); -#endif -#ifdef CONFIG_PROC_FS - remove_proc_entry(debug_proc_root_entry->name, NULL); -#endif /* CONFIG_PROC_FS */ - return; -} - -/* - * module definitions - */ -core_initcall(debug_init); -module_exit(debug_exit); -MODULE_LICENSE("GPL"); - -EXPORT_SYMBOL(debug_register); -EXPORT_SYMBOL(debug_unregister); -EXPORT_SYMBOL(debug_set_level); -EXPORT_SYMBOL(debug_register_view); -EXPORT_SYMBOL(debug_unregister_view); -EXPORT_SYMBOL(debug_event_common); -EXPORT_SYMBOL(debug_exception_common); -EXPORT_SYMBOL(debug_hex_ascii_view); -EXPORT_SYMBOL(debug_raw_view); -EXPORT_SYMBOL(debug_dflt_header_fn); -EXPORT_SYMBOL(debug_sprintf_view); -EXPORT_SYMBOL(debug_sprintf_exception); -EXPORT_SYMBOL(debug_sprintf_event); diff --git a/arch/s390x/kernel/ebcdic.c b/arch/s390x/kernel/ebcdic.c deleted file mode 100644 index 52d5a78b5708f..0000000000000 --- a/arch/s390x/kernel/ebcdic.c +++ /dev/null @@ -1,400 +0,0 @@ -/* - * arch/s390/kernel/ebcdic.c - * ECBDIC -> ASCII, ASCII -> ECBDIC, - * upper to lower case (EBCDIC) conversion tables. - * - * S390 version - * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation - * Author(s): Martin Schwidefsky - * Martin Peschke - */ - -#include -#include - -/* - * ASCII (IBM PC 437) -> EBCDIC 037 - */ -__u8 _ascebc[256] = -{ - /*00 NUL SOH STX ETX EOT ENQ ACK BEL */ - 0x00, 0x01, 0x02, 0x03, 0x37, 0x2D, 0x2E, 0x2F, - /*08 BS HT LF VT FF CR SO SI */ - /* ->NL */ - 0x16, 0x05, 0x15, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, - /*10 DLE DC1 DC2 DC3 DC4 NAK SYN ETB */ - 0x10, 0x11, 0x12, 0x13, 0x3C, 0x3D, 0x32, 0x26, - /*18 CAN EM SUB ESC FS GS RS US */ - /* ->IGS ->IRS ->IUS */ - 0x18, 0x19, 0x3F, 0x27, 0x22, 0x1D, 0x1E, 0x1F, - /*20 SP ! " # $ % & ' */ - 0x40, 0x5A, 0x7F, 0x7B, 0x5B, 0x6C, 0x50, 0x7D, - /*28 ( ) * + , - . / */ - 0x4D, 0x5D, 0x5C, 0x4E, 0x6B, 0x60, 0x4B, 0x61, - /*30 0 1 2 3 4 5 6 7 */ - 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, - /*38 8 9 : ; < = > ? */ - 0xF8, 0xF9, 0x7A, 0x5E, 0x4C, 0x7E, 0x6E, 0x6F, - /*40 @ A B C D E F G */ - 0x7C, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, - /*48 H I J K L M N O */ - 0xC8, 0xC9, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, - /*50 P Q R S T U V W */ - 0xD7, 0xD8, 0xD9, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, - /*58 X Y Z [ \ ] ^ _ */ - 0xE7, 0xE8, 0xE9, 0xBA, 0xE0, 0xBB, 0xB0, 0x6D, - /*60 ` a b c d e f g */ - 0x79, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, - /*68 h i j k l m n o */ - 0x88, 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, - /*70 p q r s t u v w */ - 0x97, 0x98, 0x99, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, - /*78 x y z { | } ~ DL */ - 0xA7, 0xA8, 0xA9, 0xC0, 0x4F, 0xD0, 0xA1, 0x07, - /*80*/ - 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, - /*88*/ - 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, - /*90*/ - 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, - /*98*/ - 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, - /*A0*/ - 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, - /*A8*/ - 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, - /*B0*/ - 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, - /*B8*/ - 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, - /*C0*/ - 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, - /*C8*/ - 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, - /*D0*/ - 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, - /*D8*/ - 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, - /*E0 sz */ - 0x3F, 0x59, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, - /*E8*/ - 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, - /*F0*/ - 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, - /*F8*/ - 0x90, 0x3F, 0x3F, 0x3F, 0x3F, 0xEA, 0x3F, 0xFF -}; - -/* - * EBCDIC 037 -> ASCII (IBM PC 437) - */ -__u8 _ebcasc[256] = -{ - /* 0x00 NUL SOH STX ETX *SEL HT *RNL DEL */ - 0x00, 0x01, 0x02, 0x03, 0x07, 0x09, 0x07, 0x7F, - /* 0x08 -GE -SPS -RPT VT FF CR SO SI */ - 0x07, 0x07, 0x07, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, - /* 0x10 DLE DC1 DC2 DC3 -RES -NL BS -POC - -ENP ->LF */ - 0x10, 0x11, 0x12, 0x13, 0x07, 0x0A, 0x08, 0x07, - /* 0x18 CAN EM -UBS -CU1 -IFS -IGS -IRS -ITB - -IUS */ - 0x18, 0x19, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, - /* 0x20 -DS -SOS FS -WUS -BYP LF ETB ESC - -INP */ - 0x07, 0x07, 0x1C, 0x07, 0x07, 0x0A, 0x17, 0x1B, - /* 0x28 -SA -SFE -SM -CSP -MFA ENQ ACK BEL - -SW */ - 0x07, 0x07, 0x07, 0x07, 0x07, 0x05, 0x06, 0x07, - /* 0x30 ---- ---- SYN -IR -PP -TRN -NBS EOT */ - 0x07, 0x07, 0x16, 0x07, 0x07, 0x07, 0x07, 0x04, - /* 0x38 -SBS -IT -RFF -CU3 DC4 NAK ---- SUB */ - 0x07, 0x07, 0x07, 0x07, 0x14, 0x15, 0x07, 0x1A, - /* 0x40 SP RSP ä ---- */ - 0x20, 0xFF, 0x83, 0x84, 0x85, 0xA0, 0x07, 0x86, - /* 0x48 . < ( + | */ - 0x87, 0xA4, 0x9B, 0x2E, 0x3C, 0x28, 0x2B, 0x7C, - /* 0x50 & ---- */ - 0x26, 0x82, 0x88, 0x89, 0x8A, 0xA1, 0x8C, 0x07, - /* 0x58 ß ! $ * ) ; */ - 0x8D, 0xE1, 0x21, 0x24, 0x2A, 0x29, 0x3B, 0xAA, - /* 0x60 - / ---- Ä ---- ---- ---- */ - 0x2D, 0x2F, 0x07, 0x8E, 0x07, 0x07, 0x07, 0x8F, - /* 0x68 ---- , % _ > ? */ - 0x80, 0xA5, 0x07, 0x2C, 0x25, 0x5F, 0x3E, 0x3F, - /* 0x70 ---- ---- ---- ---- ---- ---- ---- */ - 0x07, 0x90, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, - /* 0x78 * ` : # @ ' = " */ - 0x70, 0x60, 0x3A, 0x23, 0x40, 0x27, 0x3D, 0x22, - /* 0x80 * a b c d e f g */ - 0x07, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, - /* 0x88 h i ---- ---- ---- */ - 0x68, 0x69, 0xAE, 0xAF, 0x07, 0x07, 0x07, 0xF1, - /* 0x90 ° j k l m n o p */ - 0xF8, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70, - /* 0x98 q r ---- ---- */ - 0x71, 0x72, 0xA6, 0xA7, 0x91, 0x07, 0x92, 0x07, - /* 0xA0 ~ s t u v w x */ - 0xE6, 0x7E, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, - /* 0xA8 y z ---- ---- ---- ---- */ - 0x79, 0x7A, 0xAD, 0xAB, 0x07, 0x07, 0x07, 0x07, - /* 0xB0 ^ ---- § ---- */ - 0x5E, 0x9C, 0x9D, 0xFA, 0x07, 0x07, 0x07, 0xAC, - /* 0xB8 ---- [ ] ---- ---- ---- ---- */ - 0xAB, 0x07, 0x5B, 0x5D, 0x07, 0x07, 0x07, 0x07, - /* 0xC0 { A B C D E F G */ - 0x7B, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, - /* 0xC8 H I ---- ö ---- */ - 0x48, 0x49, 0x07, 0x93, 0x94, 0x95, 0xA2, 0x07, - /* 0xD0 } J K L M N O P */ - 0x7D, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, - /* 0xD8 Q R ---- ü */ - 0x51, 0x52, 0x07, 0x96, 0x81, 0x97, 0xA3, 0x98, - /* 0xE0 \ S T U V W X */ - 0x5C, 0xF6, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, - /* 0xE8 Y Z ---- Ö ---- ---- ---- */ - 0x59, 0x5A, 0xFD, 0x07, 0x99, 0x07, 0x07, 0x07, - /* 0xF0 0 1 2 3 4 5 6 7 */ - 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, - /* 0xF8 8 9 ---- ---- Ü ---- ---- ---- */ - 0x38, 0x39, 0x07, 0x07, 0x9A, 0x07, 0x07, 0x07 -}; - - -/* - * ASCII (IBM PC 437) -> EBCDIC 500 - */ -__u8 _ascebc_500[256] = -{ - /*00 NUL SOH STX ETX EOT ENQ ACK BEL */ - 0x00, 0x01, 0x02, 0x03, 0x37, 0x2D, 0x2E, 0x2F, - /*08 BS HT LF VT FF CR SO SI */ - /* ->NL */ - 0x16, 0x05, 0x15, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, - /*10 DLE DC1 DC2 DC3 DC4 NAK SYN ETB */ - 0x10, 0x11, 0x12, 0x13, 0x3C, 0x3D, 0x32, 0x26, - /*18 CAN EM SUB ESC FS GS RS US */ - /* ->IGS ->IRS ->IUS */ - 0x18, 0x19, 0x3F, 0x27, 0x22, 0x1D, 0x1E, 0x1F, - /*20 SP ! " # $ % & ' */ - 0x40, 0x4F, 0x7F, 0x7B, 0x5B, 0x6C, 0x50, 0x7D, - /*28 ( ) * + , - . / */ - 0x4D, 0x5D, 0x5C, 0x4E, 0x6B, 0x60, 0x4B, 0x61, - /*30 0 1 2 3 4 5 6 7 */ - 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, - /*38 8 9 : ; < = > ? */ - 0xF8, 0xF9, 0x7A, 0x5E, 0x4C, 0x7E, 0x6E, 0x6F, - /*40 @ A B C D E F G */ - 0x7C, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, - /*48 H I J K L M N O */ - 0xC8, 0xC9, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, - /*50 P Q R S T U V W */ - 0xD7, 0xD8, 0xD9, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, - /*58 X Y Z [ \ ] ^ _ */ - 0xE7, 0xE8, 0xE9, 0x4A, 0xE0, 0x5A, 0x5F, 0x6D, - /*60 ` a b c d e f g */ - 0x79, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, - /*68 h i j k l m n o */ - 0x88, 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, - /*70 p q r s t u v w */ - 0x97, 0x98, 0x99, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, - /*78 x y z { | } ~ DL */ - 0xA7, 0xA8, 0xA9, 0xC0, 0xBB, 0xD0, 0xA1, 0x07, - /*80*/ - 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, - /*88*/ - 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, - /*90*/ - 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, - /*98*/ - 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, - /*A0*/ - 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, - /*A8*/ - 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, - /*B0*/ - 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, - /*B8*/ - 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, - /*C0*/ - 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, - /*C8*/ - 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, - /*D0*/ - 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, - /*D8*/ - 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, - /*E0 sz */ - 0x3F, 0x59, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, - /*E8*/ - 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, - /*F0*/ - 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, - /*F8*/ - 0x90, 0x3F, 0x3F, 0x3F, 0x3F, 0xEA, 0x3F, 0xFF -}; - -/* - * EBCDIC 500 -> ASCII (IBM PC 437) - */ -__u8 _ebcasc_500[256] = -{ - /* 0x00 NUL SOH STX ETX *SEL HT *RNL DEL */ - 0x00, 0x01, 0x02, 0x03, 0x07, 0x09, 0x07, 0x7F, - /* 0x08 -GE -SPS -RPT VT FF CR SO SI */ - 0x07, 0x07, 0x07, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, - /* 0x10 DLE DC1 DC2 DC3 -RES -NL BS -POC - -ENP ->LF */ - 0x10, 0x11, 0x12, 0x13, 0x07, 0x0A, 0x08, 0x07, - /* 0x18 CAN EM -UBS -CU1 -IFS -IGS -IRS -ITB - -IUS */ - 0x18, 0x19, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, - /* 0x20 -DS -SOS FS -WUS -BYP LF ETB ESC - -INP */ - 0x07, 0x07, 0x1C, 0x07, 0x07, 0x0A, 0x17, 0x1B, - /* 0x28 -SA -SFE -SM -CSP -MFA ENQ ACK BEL - -SW */ - 0x07, 0x07, 0x07, 0x07, 0x07, 0x05, 0x06, 0x07, - /* 0x30 ---- ---- SYN -IR -PP -TRN -NBS EOT */ - 0x07, 0x07, 0x16, 0x07, 0x07, 0x07, 0x07, 0x04, - /* 0x38 -SBS -IT -RFF -CU3 DC4 NAK ---- SUB */ - 0x07, 0x07, 0x07, 0x07, 0x14, 0x15, 0x07, 0x1A, - /* 0x40 SP RSP ä ---- */ - 0x20, 0xFF, 0x83, 0x84, 0x85, 0xA0, 0x07, 0x86, - /* 0x48 [ . < ( + ! */ - 0x87, 0xA4, 0x5B, 0x2E, 0x3C, 0x28, 0x2B, 0x21, - /* 0x50 & ---- */ - 0x26, 0x82, 0x88, 0x89, 0x8A, 0xA1, 0x8C, 0x07, - /* 0x58 ß ] $ * ) ; ^ */ - 0x8D, 0xE1, 0x5D, 0x24, 0x2A, 0x29, 0x3B, 0x5E, - /* 0x60 - / ---- Ä ---- ---- ---- */ - 0x2D, 0x2F, 0x07, 0x8E, 0x07, 0x07, 0x07, 0x8F, - /* 0x68 ---- , % _ > ? */ - 0x80, 0xA5, 0x07, 0x2C, 0x25, 0x5F, 0x3E, 0x3F, - /* 0x70 ---- ---- ---- ---- ---- ---- ---- */ - 0x07, 0x90, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, - /* 0x78 * ` : # @ ' = " */ - 0x70, 0x60, 0x3A, 0x23, 0x40, 0x27, 0x3D, 0x22, - /* 0x80 * a b c d e f g */ - 0x07, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, - /* 0x88 h i ---- ---- ---- */ - 0x68, 0x69, 0xAE, 0xAF, 0x07, 0x07, 0x07, 0xF1, - /* 0x90 ° j k l m n o p */ - 0xF8, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70, - /* 0x98 q r ---- ---- */ - 0x71, 0x72, 0xA6, 0xA7, 0x91, 0x07, 0x92, 0x07, - /* 0xA0 ~ s t u v w x */ - 0xE6, 0x7E, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, - /* 0xA8 y z ---- ---- ---- ---- */ - 0x79, 0x7A, 0xAD, 0xAB, 0x07, 0x07, 0x07, 0x07, - /* 0xB0 ---- § ---- */ - 0x9B, 0x9C, 0x9D, 0xFA, 0x07, 0x07, 0x07, 0xAC, - /* 0xB8 ---- | ---- ---- ---- ---- */ - 0xAB, 0x07, 0xAA, 0x7C, 0x07, 0x07, 0x07, 0x07, - /* 0xC0 { A B C D E F G */ - 0x7B, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, - /* 0xC8 H I ---- ö ---- */ - 0x48, 0x49, 0x07, 0x93, 0x94, 0x95, 0xA2, 0x07, - /* 0xD0 } J K L M N O P */ - 0x7D, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, - /* 0xD8 Q R ---- ü */ - 0x51, 0x52, 0x07, 0x96, 0x81, 0x97, 0xA3, 0x98, - /* 0xE0 \ S T U V W X */ - 0x5C, 0xF6, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, - /* 0xE8 Y Z ---- Ö ---- ---- ---- */ - 0x59, 0x5A, 0xFD, 0x07, 0x99, 0x07, 0x07, 0x07, - /* 0xF0 0 1 2 3 4 5 6 7 */ - 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, - /* 0xF8 8 9 ---- ---- Ü ---- ---- ---- */ - 0x38, 0x39, 0x07, 0x07, 0x9A, 0x07, 0x07, 0x07 -}; - - -/* - * EBCDIC 037/500 conversion table: - * from upper to lower case - */ -__u8 _ebc_tolower[256] = -{ - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, - 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, - 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, - 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, - 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, - 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, - 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, - 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, - 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, - 0x58, 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F, - 0x60, 0x61, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, - 0x48, 0x49, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, - 0x70, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, - 0x58, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F, - 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, - 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, - 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, - 0x98, 0x99, 0x9A, 0x9B, 0x9C, 0x9D, 0x9C, 0x9F, - 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, - 0xA8, 0xA9, 0xAA, 0xAB, 0x8C, 0x8D, 0x8E, 0xAF, - 0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7, - 0xB8, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF, - 0xC0, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, - 0x88, 0x89, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, - 0xD0, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, - 0x98, 0x99, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF, - 0xE0, 0xE1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, - 0xA8, 0xA9, 0xEA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, - 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, - 0xF8, 0xF9, 0xFA, 0xDB, 0xDC, 0xDD, 0xDE, 0xFF -}; - - -/* - * EBCDIC 037/500 conversion table: - * from lower to upper case - */ -__u8 _ebc_toupper[256] = -{ - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, - 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, - 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, - 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, - 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, - 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, - 0x40, 0x41, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, - 0x68, 0x69, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, - 0x50, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, - 0x78, 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F, - 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, - 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, - 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, - 0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F, - 0x80, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, - 0xC8, 0xC9, 0x8A, 0x8B, 0xAC, 0xAD, 0xAE, 0x8F, - 0x90, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, - 0xD8, 0xD9, 0x9A, 0x9B, 0x9E, 0x9D, 0x9E, 0x9F, - 0xA0, 0xA1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, - 0xE8, 0xE9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF, - 0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7, - 0xB8, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF, - 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, - 0xC8, 0xC9, 0xCA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF, - 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, - 0xD8, 0xD9, 0xDA, 0xFB, 0xFC, 0xFD, 0xFE, 0xDF, - 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, - 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF, - 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, - 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF -}; - -EXPORT_SYMBOL_NOVERS(_ascebc_500); -EXPORT_SYMBOL_NOVERS(_ebcasc_500); -EXPORT_SYMBOL_NOVERS(_ascebc); -EXPORT_SYMBOL_NOVERS(_ebcasc); -EXPORT_SYMBOL_NOVERS(_ebc_tolower); -EXPORT_SYMBOL_NOVERS(_ebc_toupper); - diff --git a/arch/s390x/kernel/entry.S b/arch/s390x/kernel/entry.S deleted file mode 100644 index 10bac2f12c89f..0000000000000 --- a/arch/s390x/kernel/entry.S +++ /dev/null @@ -1,943 +0,0 @@ -/* - * arch/s390/kernel/entry.S - * S390 low-level entry points. - * - * S390 version - * Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation - * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com), - * Hartmut Penner (hp@de.ibm.com), - * Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com), - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* - * Stack layout for the system_call stack entry. - * The first few entries are identical to the user_regs_struct. - */ -SP_PTREGS = STACK_FRAME_OVERHEAD -SP_PSW = STACK_FRAME_OVERHEAD + PT_PSWMASK -SP_R0 = STACK_FRAME_OVERHEAD + PT_GPR0 -SP_R1 = STACK_FRAME_OVERHEAD + PT_GPR1 -SP_R2 = STACK_FRAME_OVERHEAD + PT_GPR2 -SP_R3 = STACK_FRAME_OVERHEAD + PT_GPR3 -SP_R4 = STACK_FRAME_OVERHEAD + PT_GPR4 -SP_R5 = STACK_FRAME_OVERHEAD + PT_GPR5 -SP_R6 = STACK_FRAME_OVERHEAD + PT_GPR6 -SP_R7 = STACK_FRAME_OVERHEAD + PT_GPR7 -SP_R8 = STACK_FRAME_OVERHEAD + PT_GPR8 -SP_R9 = STACK_FRAME_OVERHEAD + PT_GPR9 -SP_R10 = STACK_FRAME_OVERHEAD + PT_GPR10 -SP_R11 = STACK_FRAME_OVERHEAD + PT_GPR11 -SP_R12 = STACK_FRAME_OVERHEAD + PT_GPR12 -SP_R13 = STACK_FRAME_OVERHEAD + PT_GPR13 -SP_R14 = STACK_FRAME_OVERHEAD + PT_GPR14 -SP_R15 = STACK_FRAME_OVERHEAD + PT_GPR15 -SP_AREGS = STACK_FRAME_OVERHEAD + PT_ACR0 -SP_ORIG_R2 = STACK_FRAME_OVERHEAD + PT_ORIGGPR2 -/* Now the additional entries */ -SP_TRAP = (SP_ORIG_R2+GPR_SIZE) -SP_SIZE = (SP_TRAP+4) - -_TIF_WORK_SVC = (_TIF_SIGPENDING | _TIF_NEED_RESCHED | _TIF_RESTART_SVC) -_TIF_WORK_INT = (_TIF_SIGPENDING | _TIF_NEED_RESCHED) - -/* - * Register usage in interrupt handlers: - * R9 - pointer to current task structure - * R13 - pointer to literal pool - * R14 - return register for function calls - * R15 - kernel stack pointer - */ - - .macro SAVE_ALL psworg,sync # system entry macro - stmg %r14,%r15,__LC_SAVE_AREA - tm \psworg+1,0x01 # test problem state bit - stam %a2,%a4,__LC_SAVE_AREA+16 - .if \sync - jz 1f # skip stack setup save - .else - jnz 0f # from user -> load kernel stack - lg %r14,__LC_ASYNC_STACK # are we already on the async. stack ? - slgr %r14,%r15 - srag %r14,%r14,14 - jz 1f - lg %r15,__LC_ASYNC_STACK # load async. stack - j 1f - .endif -0: lg %r15,__LC_KERNEL_STACK # problem state -> load ksp - larl %r14,.Lc_ac - lam %a2,%a4,0(%r14) -1: aghi %r15,-SP_SIZE # make room for registers & psw - nill %r15,0xfff8 # align stack pointer to 8 - stmg %r0,%r14,SP_R0(%r15) # store gprs 0-14 to kernel stack - stg %r2,SP_ORIG_R2(%r15) # store original content of gpr 2 - mvc SP_R14(16,%r15),__LC_SAVE_AREA # move R15 to stack - stam %a0,%a15,SP_AREGS(%r15) # store access registers to kst. - mvc SP_AREGS+8(12,%r15),__LC_SAVE_AREA+16 # store ac. regs - mvc SP_PSW(16,%r15),\psworg # move user PSW to stack - lhi %r0,\psworg # store trap indication - st %r0,SP_TRAP(%r15) - xc 0(8,%r15),0(%r15) # clear back chain - .endm - - .macro RESTORE_ALL sync # system exit macro - mvc __LC_RETURN_PSW(16),SP_PSW(%r15) # move user PSW to lowcore - lam %a0,%a15,SP_AREGS(%r15) # load the access registers - lmg %r0,%r15,SP_R0(%r15) # load gprs 0-15 of user - ni __LC_RETURN_PSW+1,0xfd # clear wait state bit - lpswe __LC_RETURN_PSW # back to caller - .endm - - .macro GET_THREAD_INFO - lg %r9,__LC_KERNEL_STACK # load pointer to task_struct to %r9 - aghi %r9,-16384 - .endm - - -/* - * Scheduler resume function, called by switch_to - * gpr2 = (task_struct *) prev - * gpr3 = (task_struct *) next - * Returns: - * gpr2 = prev - */ - .globl resume -resume: - tm __THREAD_per+4(%r3),0xe8 # is the new process using per ? - jz resume_noper # if not we're fine - stctg %c9,%c11,48(%r15) # We are using per stuff - clc __THREAD_per(24,%r3),48(%r15) - je resume_noper # we got away without bashing TLB's - lctlg %c9,%c11,__THREAD_per(%r3) # Nope we didn't -resume_noper: - stmg %r6,%r15,48(%r15) # store resume registers of prev task - stg %r15,__THREAD_ksp(%r2) # store kernel stack to prev->tss.ksp - lg %r15,__THREAD_ksp(%r3) # load kernel stack from next->tss.ksp - stam %a2,%a2,__THREAD_ar2(%r2) # store kernel access reg. 2 - stam %a4,%a4,__THREAD_ar4(%r2) # store kernel access reg. 4 - lam %a2,%a2,__THREAD_ar2(%r3) # load kernel access reg. 2 - lam %a4,%a4,__THREAD_ar4(%r3) # load kernel access reg. 4 - lmg %r6,%r15,48(%r15) # load resume registers of next task - lg %r3,__THREAD_info(%r3) # load thread_info from task struct - aghi %r3,16384 - stg %r3,__LC_KERNEL_STACK # __LC_KERNEL_STACK = new kernel stack - br %r14 - -/* - * do_softirq calling function. We want to run the softirq functions on the - * asynchronous interrupt stack. - */ - .global do_call_softirq -do_call_softirq: - stmg %r12,%r15,48(%r15) - lgr %r12,%r15 - lg %r0,__LC_ASYNC_STACK - slgr %r0,%r15 - srag %r0,%r0,14 - je 0f - lg %r15,__LC_ASYNC_STACK -0: aghi %r15,-STACK_FRAME_OVERHEAD - stg %r12,0(%r15) # store back chain - brasl %r14,do_softirq - lmg %r12,%r15,48(%r12) - br %r14 - -/* - * SVC interrupt handler routine. System calls are synchronous events and - * are executed with interrupts enabled. - */ - - .globl system_call -system_call: - SAVE_ALL __LC_SVC_OLD_PSW,1 - llgh %r7,__LC_SVC_INT_CODE # get svc number from lowcore - GET_THREAD_INFO # load pointer to task_struct to R9 - stosm 48(%r15),0x03 # reenable interrupts -sysc_do_restart: - larl %r10,sys_call_table - sll %r7,3 - tm SP_PSW+3(%r15),0x01 # are we running in 31 bit mode ? - jo sysc_noemu - la %r10,4(%r10) # use 31 bit emulation system calls -sysc_noemu: - lgf %r8,0(%r7,%r10) # load address of system call routine - tm __TI_flags+7(%r9),_TIF_SYSCALL_TRACE - jo sysc_tracesys - basr %r14,%r8 # call sys_xxxx - stg %r2,SP_R2(%r15) # store return value (change R2 on stack) - # ATTENTION: check sys_execve_glue before - # changing anything here !! - -sysc_return: - stnsm 48(%r15),0xfc # disable I/O and ext. interrupts - tm __TI_flags+7(%r9),_TIF_WORK_SVC - jnz sysc_work # there is work to do (signals etc.) -sysc_leave: - RESTORE_ALL 1 - -# -# recheck if there is more work to do -# -sysc_work_loop: - stnsm 48(%r15),0xfc # disable I/O and ext. interrupts - GET_THREAD_INFO # load pointer to task_struct to R9 - tm __TI_flags+7(%r9),_TIF_WORK_SVC - jz sysc_leave # there is no work to do -# -# One of the work bits is on. Find out which one. -# Checked are: _TIF_SIGPENDING and _TIF_NEED_RESCHED -# -sysc_work: - tm __TI_flags+7(%r9),_TIF_NEED_RESCHED - jo sysc_reschedule - tm __TI_flags+7(%r9),_TIF_SIGPENDING - jo sysc_sigpending - tm __TI_flags+7(%r9),_TIF_RESTART_SVC - jo sysc_restart - j sysc_leave - -# -# _TIF_NEED_RESCHED is set, call schedule -# -sysc_reschedule: - stosm 48(%r15),0x03 # reenable interrupts - larl %r14,sysc_work_loop - jg schedule # return point is sysc_return - -# -# _TIF_SIGPENDING is set, call do_signal -# -sysc_sigpending: - stosm 48(%r15),0x03 # reenable interrupts - la %r2,SP_PTREGS(%r15) # load pt_regs - sgr %r3,%r3 # clear *oldset - brasl %r14,do_signal # call do_signal - stnsm 48(%r15),0xfc # disable I/O and ext. interrupts - j sysc_leave # out of here, do NOT recheck - -# -# _TIF_RESTART_SVC is set, set up registers and restart svc -# -sysc_restart: - ni __TI_flags+3(%r9),255-_TIF_RESTART_SVC # clear TIF_RESTART_SVC - stosm 48(%r15),0x03 # reenable interrupts - lg %r7,SP_R2(%r15) # load new svc number - mvc SP_R2(8,%r15),SP_ORIG_R2(%r15) # restore first argument - lmg %r2,%r6,SP_R2(%r15) # load svc arguments - j sysc_do_restart # restart svc - -# -# call syscall_trace before and after system call -# special linkage: %r12 contains the return address for trace_svc -# -sysc_tracesys: - srl %r7,3 - stg %r7,SP_R2(%r15) - brasl %r14,syscall_trace - lghi %r7,255 # strace might have changed the - ng %r7,SP_R2(%r15) # the system call - sll %r7,3 - lgf %r8,0(%r7,%r10) -sysc_tracego: - lmg %r3,%r6,SP_R3(%r15) - lg %r2,SP_ORIG_R2(%r15) - basr %r14,%r8 # call sys_xxx - stg %r2,SP_R2(%r15) # store return value - tm __TI_flags+7(%r9),_TIF_SYSCALL_TRACE - jno sysc_return - larl %r14,sysc_return # return point is sysc_return - jg syscall_trace - -# -# a new process exits the kernel with ret_from_fork -# - .globl ret_from_fork -ret_from_fork: - GET_THREAD_INFO # load pointer to task_struct to R9 -#if CONFIG_SMP || CONFIG_PREEMPT - larl %r14,sysc_return - jg schedule_tail # return to sysc_return -#else - j sysc_return -#endif - -# -# clone, fork, vfork, exec and sigreturn need glue, -# because they all expect pt_regs as parameter, -# but are called with different parameter. -# return-address is set up above -# -sys_clone_glue: - la %r2,SP_PTREGS(%r15) # load pt_regs - jg sys_clone # branch to sys_clone - -#ifdef CONFIG_S390_SUPPORT -sys32_clone_glue: - la %r2,SP_PTREGS(%r15) # load pt_regs - jg sys32_clone # branch to sys32_clone -#endif - -sys_fork_glue: - la %r2,SP_PTREGS(%r15) # load pt_regs - jg sys_fork # branch to sys_fork - -sys_vfork_glue: - la %r2,SP_PTREGS(%r15) # load pt_regs - jg sys_vfork # branch to sys_vfork - -sys_execve_glue: - la %r2,SP_PTREGS(%r15) # load pt_regs - lgr %r12,%r14 # save return address - brasl %r14,sys_execve # call sys_execve - ltgr %r2,%r2 # check if execve failed - bnz 0(%r12) # it did fail -> store result in gpr2 - b 6(%r12) # SKIP STG 2,SP_R2(15) in - # system_call/sysc_tracesys -#ifdef CONFIG_S390_SUPPORT -sys32_execve_glue: - la %r2,SP_PTREGS(%r15) # load pt_regs - lgr %r12,%r14 # save return address - brasl %r14,sys32_execve # call sys32_execve - ltgr %r2,%r2 # check if execve failed - bnz 0(%r12) # it did fail -> store result in gpr2 - b 6(%r12) # SKIP STG 2,SP_R2(15) in - # system_call/sysc_tracesys -#endif - -sys_sigreturn_glue: - la %r2,SP_PTREGS(%r15) # load pt_regs as parameter - jg sys_sigreturn # branch to sys_sigreturn - -#ifdef CONFIG_S390_SUPPORT -sys32_sigreturn_glue: - la %r2,SP_PTREGS(%r15) # load pt_regs as parameter - jg sys32_sigreturn # branch to sys32_sigreturn -#endif - -sys_rt_sigreturn_glue: - la %r2,SP_PTREGS(%r15) # load pt_regs as parameter - jg sys_rt_sigreturn # branch to sys_sigreturn - -#ifdef CONFIG_S390_SUPPORT -sys32_rt_sigreturn_glue: - la %r2,SP_PTREGS(%r15) # load pt_regs as parameter - jg sys32_rt_sigreturn # branch to sys32_sigreturn -#endif - -# -# sigsuspend and rt_sigsuspend need pt_regs as an additional -# parameter and they have to skip the store of %r2 into the -# user register %r2 because the return value was set in -# sigsuspend and rt_sigsuspend already and must not be overwritten! -# - -sys_sigsuspend_glue: - lgr %r5,%r4 # move mask back - lgr %r4,%r3 # move history1 parameter - lgr %r3,%r2 # move history0 parameter - la %r2,SP_PTREGS(%r15) # load pt_regs as first parameter - la %r14,6(%r14) # skip store of return value - jg sys_sigsuspend # branch to sys_sigsuspend - -#ifdef CONFIG_S390_SUPPORT -sys32_sigsuspend_glue: - llgfr %r4,%r4 # unsigned long - lgr %r5,%r4 # move mask back - lgfr %r3,%r3 # int - lgr %r4,%r3 # move history1 parameter - lgfr %r2,%r2 # int - lgr %r3,%r2 # move history0 parameter - la %r2,SP_PTREGS(%r15) # load pt_regs as first parameter - la %r14,6(%r14) # skip store of return value - jg sys32_sigsuspend # branch to sys32_sigsuspend -#endif - -sys_rt_sigsuspend_glue: - lgr %r4,%r3 # move sigsetsize parameter - lgr %r3,%r2 # move unewset parameter - la %r2,SP_PTREGS(%r15) # load pt_regs as first parameter - la %r14,6(%r14) # skip store of return value - jg sys_rt_sigsuspend # branch to sys_rt_sigsuspend - -#ifdef CONFIG_S390_SUPPORT -sys32_rt_sigsuspend_glue: - llgfr %r3,%r3 # size_t - lgr %r4,%r3 # move sigsetsize parameter - llgtr %r2,%r2 # sigset_emu31_t * - lgr %r3,%r2 # move unewset parameter - la %r2,SP_PTREGS(%r15) # load pt_regs as first parameter - la %r14,6(%r14) # skip store of return value - jg sys32_rt_sigsuspend # branch to sys32_rt_sigsuspend -#endif - -sys_sigaltstack_glue: - la %r4,SP_PTREGS(%r15) # load pt_regs as parameter - jg sys_sigaltstack # branch to sys_sigreturn - -#ifdef CONFIG_S390_SUPPORT -sys32_sigaltstack_glue: - la %r4,SP_PTREGS(%r15) # load pt_regs as parameter - jg sys32_sigaltstack_wrapper # branch to sys_sigreturn -#endif - -#ifdef CONFIG_S390_SUPPORT -#define SYSCALL(esame,esa) esame,esa -#else -#define SYSCALL(esame,esa) esame,sys_ni_syscall -#endif - - .globl sys_call_table -sys_call_table: - .long SYSCALL(sys_ni_syscall,sys_ni_syscall) /* 0 */ - .long SYSCALL(sys_exit,sys32_exit_wrapper) - .long SYSCALL(sys_fork_glue,sys_fork_glue) - .long SYSCALL(sys_read,sys32_read_wrapper) - .long SYSCALL(sys_write,sys32_write_wrapper) - .long SYSCALL(sys_open,sys32_open_wrapper) /* 5 */ - .long SYSCALL(sys_close,sys32_close_wrapper) - .long SYSCALL(sys_restart_syscall,sys_ni_syscall) - .long SYSCALL(sys_creat,sys32_creat_wrapper) - .long SYSCALL(sys_link,sys32_link_wrapper) - .long SYSCALL(sys_unlink,sys32_unlink_wrapper) /* 10 */ - .long SYSCALL(sys_execve_glue,sys32_execve_glue) - .long SYSCALL(sys_chdir,sys32_chdir_wrapper) - .long SYSCALL(sys_ni_syscall,sys32_time_wrapper) /* old time syscall */ - .long SYSCALL(sys_mknod,sys32_mknod_wrapper) - .long SYSCALL(sys_chmod,sys32_chmod_wrapper) /* 15 */ - .long SYSCALL(sys_ni_syscall,sys32_lchown16_wrapper) /* old lchown16 syscall*/ - .long SYSCALL(sys_ni_syscall,sys_ni_syscall) /* old break syscall */ - .long SYSCALL(sys_ni_syscall,sys_ni_syscall) /* old stat syscall */ - .long SYSCALL(sys_lseek,sys32_lseek_wrapper) - .long SYSCALL(sys_getpid,sys_getpid) /* 20 */ - .long SYSCALL(sys_mount,sys32_mount_wrapper) - .long SYSCALL(sys_oldumount,sys32_oldumount_wrapper) - .long SYSCALL(sys_ni_syscall,sys32_setuid16_wrapper) /* old setuid16 syscall*/ - .long SYSCALL(sys_ni_syscall,sys32_getuid16) /* old getuid16 syscall*/ - .long SYSCALL(sys_ni_syscall,sys32_stime_wrapper) /* 25 old stime syscall */ - .long SYSCALL(sys_ptrace,sys32_ptrace_wrapper) - .long SYSCALL(sys_alarm,sys32_alarm_wrapper) - .long SYSCALL(sys_ni_syscall,sys_ni_syscall) /* old fstat syscall */ - .long SYSCALL(sys_pause,sys32_pause) - .long SYSCALL(sys_utime,compat_sys_utime_wrapper) /* 30 */ - .long SYSCALL(sys_ni_syscall,sys_ni_syscall) /* old stty syscall */ - .long SYSCALL(sys_ni_syscall,sys_ni_syscall) /* old gtty syscall */ - .long SYSCALL(sys_access,sys32_access_wrapper) - .long SYSCALL(sys_nice,sys32_nice_wrapper) - .long SYSCALL(sys_ni_syscall,sys_ni_syscall) /* old ftime syscall */ - .long SYSCALL(sys_sync,sys_sync) - .long SYSCALL(sys_kill,sys32_kill_wrapper) - .long SYSCALL(sys_rename,sys32_rename_wrapper) - .long SYSCALL(sys_mkdir,sys32_mkdir_wrapper) - .long SYSCALL(sys_rmdir,sys32_rmdir_wrapper) /* 40 */ - .long SYSCALL(sys_dup,sys32_dup_wrapper) - .long SYSCALL(sys_pipe,sys32_pipe_wrapper) - .long SYSCALL(sys_times,compat_sys_times_wrapper) - .long SYSCALL(sys_ni_syscall,sys_ni_syscall) /* old prof syscall */ - .long SYSCALL(sys_brk,sys32_brk_wrapper) /* 45 */ - .long SYSCALL(sys_ni_syscall,sys32_setgid16) /* old setgid16 syscall*/ - .long SYSCALL(sys_ni_syscall,sys32_getgid16) /* old getgid16 syscall*/ - .long SYSCALL(sys_signal,sys32_signal_wrapper) - .long SYSCALL(sys_ni_syscall,sys32_geteuid16) /* old geteuid16 syscall */ - .long SYSCALL(sys_ni_syscall,sys32_getegid16) /* old getegid16 syscall */ - .long SYSCALL(sys_acct,sys32_acct_wrapper) - .long SYSCALL(sys_umount,sys32_umount_wrapper) - .long SYSCALL(sys_ni_syscall,sys_ni_syscall) /* old lock syscall */ - .long SYSCALL(sys_ioctl,sys32_ioctl_wrapper) - .long SYSCALL(sys_fcntl,compat_sys_fcntl_wrapper) /* 55 */ - .long SYSCALL(sys_ni_syscall,sys_ni_syscall) /* intel mpx syscall */ - .long SYSCALL(sys_setpgid,sys32_setpgid_wrapper) - .long SYSCALL(sys_ni_syscall,sys_ni_syscall) /* old ulimit syscall */ - .long SYSCALL(sys_ni_syscall,sys_ni_syscall) /* old uname syscall */ - .long SYSCALL(sys_umask,sys32_umask_wrapper) /* 60 */ - .long SYSCALL(sys_chroot,sys32_chroot_wrapper) - .long SYSCALL(sys_ustat,sys32_ustat_wrapper) - .long SYSCALL(sys_dup2,sys32_dup2_wrapper) - .long SYSCALL(sys_getppid,sys_getppid) - .long SYSCALL(sys_getpgrp,sys_getpgrp) /* 65 */ - .long SYSCALL(sys_setsid,sys_setsid) - .long SYSCALL(sys_sigaction,sys32_sigaction_wrapper) - .long SYSCALL(sys_ni_syscall,sys_ni_syscall) /* old sgetmask syscall*/ - .long SYSCALL(sys_ni_syscall,sys_ni_syscall) /* old ssetmask syscall*/ - .long SYSCALL(sys_ni_syscall,sys32_setreuid16_wrapper) /* old setreuid16 syscall */ - .long SYSCALL(sys_ni_syscall,sys32_setregid16_wrapper) /* old setregid16 syscall */ - .long SYSCALL(sys_sigsuspend_glue,sys32_sigsuspend_glue) - .long SYSCALL(sys_sigpending,compat_sys_sigpending_wrapper) - .long SYSCALL(sys_sethostname,sys32_sethostname_wrapper) - .long SYSCALL(sys_setrlimit,sys32_setrlimit_wrapper) /* 75 */ - .long SYSCALL(sys_getrlimit,sys32_old_getrlimit_wrapper) - .long SYSCALL(sys_getrusage,sys32_getrusage_wrapper) - .long SYSCALL(sys_gettimeofday,sys32_gettimeofday_wrapper) - .long SYSCALL(sys_settimeofday,sys32_settimeofday_wrapper) - .long SYSCALL(sys_ni_syscall,sys32_getgroups16_wrapper) /* old getgroups16 syscall */ - .long SYSCALL(sys_ni_syscall,sys32_setgroups16_wrapper) /* old setgroups16 syscall */ - .long SYSCALL(sys_ni_syscall,sys_ni_syscall) /* old select syscall */ - .long SYSCALL(sys_symlink,sys32_symlink_wrapper) - .long SYSCALL(sys_ni_syscall,sys_ni_syscall) /* old lstat syscall */ - .long SYSCALL(sys_readlink,sys32_readlink_wrapper) /* 85 */ - .long SYSCALL(sys_uselib,sys32_uselib_wrapper) - .long SYSCALL(sys_swapon,sys32_swapon_wrapper) - .long SYSCALL(sys_reboot,sys32_reboot_wrapper) - .long SYSCALL(sys_ni_syscall,old32_readdir_wrapper) /* old readdir syscall */ - .long SYSCALL(old_mmap,old32_mmap_wrapper) /* 90 */ - .long SYSCALL(sys_munmap,sys32_munmap_wrapper) - .long SYSCALL(sys_truncate,sys32_truncate_wrapper) - .long SYSCALL(sys_ftruncate,sys32_ftruncate_wrapper) - .long SYSCALL(sys_fchmod,sys32_fchmod_wrapper) - .long SYSCALL(sys_ni_syscall,sys32_fchown16_wrapper) /* old fchown16 syscall*/ - .long SYSCALL(sys_getpriority,sys32_getpriority_wrapper) - .long SYSCALL(sys_setpriority,sys32_setpriority_wrapper) - .long SYSCALL(sys_ni_syscall,sys_ni_syscall) /* old profil syscall */ - .long SYSCALL(sys_statfs,compat_sys_statfs_wrapper) - .long SYSCALL(sys_fstatfs,compat_sys_fstatfs_wrapper) /* 100 */ - .long SYSCALL(sys_ni_syscall,sys_ni_syscall) - .long SYSCALL(sys_socketcall,compat_sys_socketcall_wrapper) - .long SYSCALL(sys_syslog,sys32_syslog_wrapper) - .long SYSCALL(sys_setitimer,compat_sys_setitimer_wrapper) - .long SYSCALL(sys_getitimer,compat_sys_getitimer_wrapper) /* 105 */ - .long SYSCALL(sys_newstat,compat_sys_newstat_wrapper) - .long SYSCALL(sys_newlstat,compat_sys_newlstat_wrapper) - .long SYSCALL(sys_newfstat,compat_sys_newfstat_wrapper) - .long SYSCALL(sys_ni_syscall,sys_ni_syscall) /* old uname syscall */ - .long SYSCALL(sys_ni_syscall,sys_ni_syscall) /* iopl for i386 */ - .long SYSCALL(sys_vhangup,sys_vhangup) - .long SYSCALL(sys_ni_syscall,sys_ni_syscall) /* old "idle" system call */ - .long SYSCALL(sys_ni_syscall,sys_ni_syscall) /* vm86old for i386 */ - .long SYSCALL(sys_wait4,sys32_wait4_wrapper) - .long SYSCALL(sys_swapoff,sys32_swapoff_wrapper) /* 115 */ - .long SYSCALL(sys_sysinfo,sys32_sysinfo_wrapper) - .long SYSCALL(sys_ipc,sys32_ipc_wrapper) - .long SYSCALL(sys_fsync,sys32_fsync_wrapper) - .long SYSCALL(sys_sigreturn_glue,sys32_sigreturn_glue) - .long SYSCALL(sys_clone_glue,sys32_clone_glue) /* 120 */ - .long SYSCALL(sys_setdomainname,sys32_setdomainname_wrapper) - .long SYSCALL(s390x_newuname,sys32_newuname_wrapper) - .long SYSCALL(sys_ni_syscall,sys_ni_syscall) /* modify_ldt for i386 */ - .long SYSCALL(sys_adjtimex,sys32_adjtimex_wrapper) - .long SYSCALL(sys_mprotect,sys32_mprotect_wrapper) /* 125 */ - .long SYSCALL(sys_sigprocmask,compat_sys_sigprocmask_wrapper) - .long SYSCALL(sys_ni_syscall,sys_ni_syscall) /* old "create module" */ - .long SYSCALL(sys_init_module,sys32_init_module_wrapper) - .long SYSCALL(sys_delete_module,sys32_delete_module_wrapper) - .long SYSCALL(sys_ni_syscall,sys_ni_syscall) /* 130: old get_kernel_syms */ - .long SYSCALL(sys_quotactl,sys32_quotactl_wrapper) - .long SYSCALL(sys_getpgid,sys32_getpgid_wrapper) - .long SYSCALL(sys_fchdir,sys32_fchdir_wrapper) - .long SYSCALL(sys_bdflush,sys32_bdflush_wrapper) - .long SYSCALL(sys_sysfs,sys32_sysfs_wrapper) /* 135 */ - .long SYSCALL(s390x_personality,sys32_personality_wrapper) - .long SYSCALL(sys_ni_syscall,sys_ni_syscall) /* for afs_syscall */ - .long SYSCALL(sys_ni_syscall,sys32_setfsuid16_wrapper) /* old setfsuid16 syscall */ - .long SYSCALL(sys_ni_syscall,sys32_setfsgid16_wrapper) /* old setfsgid16 syscall */ - .long SYSCALL(sys_llseek,sys32_llseek_wrapper) /* 140 */ - .long SYSCALL(sys_getdents,sys32_getdents_wrapper) - .long SYSCALL(sys_select,sys32_select_wrapper) - .long SYSCALL(sys_flock,sys32_flock_wrapper) - .long SYSCALL(sys_msync,sys32_msync_wrapper) - .long SYSCALL(sys_readv,sys32_readv_wrapper) /* 145 */ - .long SYSCALL(sys_writev,sys32_writev_wrapper) - .long SYSCALL(sys_getsid,sys32_getsid_wrapper) - .long SYSCALL(sys_fdatasync,sys32_fdatasync_wrapper) - .long SYSCALL(sys_sysctl,sys32_sysctl_wrapper) - .long SYSCALL(sys_mlock,sys32_mlock_wrapper) /* 150 */ - .long SYSCALL(sys_munlock,sys32_munlock_wrapper) - .long SYSCALL(sys_mlockall,sys32_mlockall_wrapper) - .long SYSCALL(sys_munlockall,sys_munlockall) - .long SYSCALL(sys_sched_setparam,sys32_sched_setparam_wrapper) - .long SYSCALL(sys_sched_getparam,sys32_sched_getparam_wrapper) /* 155 */ - .long SYSCALL(sys_sched_setscheduler,sys32_sched_setscheduler_wrapper) - .long SYSCALL(sys_sched_getscheduler,sys32_sched_getscheduler_wrapper) - .long SYSCALL(sys_sched_yield,sys_sched_yield) - .long SYSCALL(sys_sched_get_priority_max,sys32_sched_get_priority_max_wrapper) - .long SYSCALL(sys_sched_get_priority_min,sys32_sched_get_priority_min_wrapper) - .long SYSCALL(sys_sched_rr_get_interval,sys32_sched_rr_get_interval_wrapper) - .long SYSCALL(sys_nanosleep,compat_sys_nanosleep_wrapper) - .long SYSCALL(sys_mremap,sys32_mremap_wrapper) - .long SYSCALL(sys_ni_syscall,sys32_setresuid16_wrapper) /* old setresuid16 syscall */ - .long SYSCALL(sys_ni_syscall,sys32_getresuid16_wrapper) /* old getresuid16 syscall */ - .long SYSCALL(sys_ni_syscall,sys_ni_syscall) /* for vm86 */ - .long SYSCALL(sys_ni_syscall,sys_ni_syscall) /* old sys_query_module */ - .long SYSCALL(sys_poll,sys32_poll_wrapper) - .long SYSCALL(sys_nfsservctl,sys32_nfsservctl_wrapper) - .long SYSCALL(sys_ni_syscall,sys32_setresgid16_wrapper) /* old setresgid16 syscall */ - .long SYSCALL(sys_ni_syscall,sys32_getresgid16_wrapper) /* old getresgid16 syscall */ - .long SYSCALL(sys_prctl,sys32_prctl_wrapper) - .long SYSCALL(sys_rt_sigreturn_glue,sys32_rt_sigreturn_glue) - .long SYSCALL(sys_rt_sigaction,sys32_rt_sigaction_wrapper) - .long SYSCALL(sys_rt_sigprocmask,sys32_rt_sigprocmask_wrapper) /* 175 */ - .long SYSCALL(sys_rt_sigpending,sys32_rt_sigpending_wrapper) - .long SYSCALL(sys_rt_sigtimedwait,sys32_rt_sigtimedwait_wrapper) - .long SYSCALL(sys_rt_sigqueueinfo,sys32_rt_sigqueueinfo_wrapper) - .long SYSCALL(sys_rt_sigsuspend_glue,sys32_rt_sigsuspend_glue) - .long SYSCALL(sys_pread64,sys32_pread64_wrapper) /* 180 */ - .long SYSCALL(sys_pwrite64,sys32_pwrite64_wrapper) - .long SYSCALL(sys_ni_syscall,sys32_chown16_wrapper) /* old chown16 syscall */ - .long SYSCALL(sys_getcwd,sys32_getcwd_wrapper) - .long SYSCALL(sys_capget,sys32_capget_wrapper) - .long SYSCALL(sys_capset,sys32_capset_wrapper) /* 185 */ - .long SYSCALL(sys_sigaltstack_glue,sys32_sigaltstack_glue) - .long SYSCALL(sys_sendfile,sys32_sendfile_wrapper) - .long SYSCALL(sys_ni_syscall,sys_ni_syscall) /* streams1 */ - .long SYSCALL(sys_ni_syscall,sys_ni_syscall) /* streams2 */ - .long SYSCALL(sys_vfork_glue,sys_vfork_glue) /* 190 */ - .long SYSCALL(sys_getrlimit,sys32_getrlimit_wrapper) - .long SYSCALL(sys_mmap2,sys32_mmap2_wrapper) - .long SYSCALL(sys_ni_syscall,sys32_truncate64_wrapper) - .long SYSCALL(sys_ni_syscall,sys32_ftruncate64_wrapper) - .long SYSCALL(sys_ni_syscall,sys32_stat64_wrapper) /* 195 */ - .long SYSCALL(sys_ni_syscall,sys32_lstat64_wrapper) - .long SYSCALL(sys_ni_syscall,sys32_fstat64_wrapper) - .long SYSCALL(sys_lchown,sys32_lchown_wrapper) - .long SYSCALL(sys_getuid,sys_getuid) - .long SYSCALL(sys_getgid,sys_getgid) /* 200 */ - .long SYSCALL(sys_geteuid,sys_geteuid) - .long SYSCALL(sys_getegid,sys_getegid) - .long SYSCALL(sys_setreuid,sys32_setreuid_wrapper) - .long SYSCALL(sys_setregid,sys32_setregid_wrapper) - .long SYSCALL(sys_getgroups,sys32_getgroups_wrapper) /* 205 */ - .long SYSCALL(sys_setgroups,sys32_setgroups_wrapper) - .long SYSCALL(sys_fchown,sys32_fchown_wrapper) - .long SYSCALL(sys_setresuid,sys32_setresuid_wrapper) - .long SYSCALL(sys_getresuid,sys32_getresuid_wrapper) - .long SYSCALL(sys_setresgid,sys32_setresgid_wrapper) /* 210 */ - .long SYSCALL(sys_getresgid,sys32_getresgid_wrapper) - .long SYSCALL(sys_chown,sys32_chown_wrapper) - .long SYSCALL(sys_setuid,sys32_setuid_wrapper) - .long SYSCALL(sys_setgid,sys32_setgid_wrapper) - .long SYSCALL(sys_setfsuid,sys32_setfsuid_wrapper) /* 215 */ - .long SYSCALL(sys_setfsgid,sys32_setfsgid_wrapper) - .long SYSCALL(sys_pivot_root,sys32_pivot_root_wrapper) - .long SYSCALL(sys_mincore,sys32_mincore_wrapper) - .long SYSCALL(sys_madvise,sys32_madvise_wrapper) - .long SYSCALL(sys_getdents64,sys32_getdents64_wrapper)/* 220 */ - .long SYSCALL(sys_ni_syscall,compat_sys_fcntl64_wrapper) - .long SYSCALL(sys_readahead,sys32_readahead) - .long SYSCALL(sys_ni_syscall,sys32_sendfile64) - .long SYSCALL(sys_setxattr,sys32_setxattr_wrapper) - .long SYSCALL(sys_lsetxattr,sys32_lsetxattr_wrapper) /* 225 */ - .long SYSCALL(sys_fsetxattr,sys32_fsetxattr_wrapper) - .long SYSCALL(sys_getxattr,sys32_getxattr_wrapper) - .long SYSCALL(sys_lgetxattr,sys32_lgetxattr_wrapper) - .long SYSCALL(sys_fgetxattr,sys32_fgetxattr_wrapper) - .long SYSCALL(sys_listxattr,sys32_listxattr_wrapper) /* 230 */ - .long SYSCALL(sys_llistxattr,sys32_llistxattr_wrapper) - .long SYSCALL(sys_flistxattr,sys32_flistxattr_wrapper) - .long SYSCALL(sys_removexattr,sys32_removexattr_wrapper) - .long SYSCALL(sys_lremovexattr,sys32_lremovexattr_wrapper) - .long SYSCALL(sys_fremovexattr,sys32_fremovexattr_wrapper) /* 235 */ - .long SYSCALL(sys_gettid,sys_gettid) - .long SYSCALL(sys_tkill,sys_tkill) - .long SYSCALL(sys_futex,compat_sys_futex_wrapper) - .long SYSCALL(sys_sched_setaffinity,sys32_sched_setaffinity_wrapper) - .long SYSCALL(sys_sched_getaffinity,sys32_sched_getaffinity_wrapper) /* 240 */ - .long SYSCALL(sys_ni_syscall,sys_ni_syscall) - .long SYSCALL(sys_ni_syscall,sys_ni_syscall) /* reserved for TUX */ - .long SYSCALL(sys_io_setup,sys_ni_syscall) - .long SYSCALL(sys_io_destroy,sys_ni_syscall) - .long SYSCALL(sys_io_getevents,sys_ni_syscall) /* 245 */ - .long SYSCALL(sys_io_submit,sys_ni_syscall) - .long SYSCALL(sys_io_cancel,sys_ni_syscall) - .long SYSCALL(sys_exit_group,sys32_exit_group_wrapper) - .long SYSCALL(sys_epoll_create,sys_ni_syscall) - .long SYSCALL(sys_epoll_ctl,sys_ni_syscall) - .long SYSCALL(sys_epoll_wait,sys_ni_syscall) - .long SYSCALL(sys_set_tid_address,sys32_set_tid_address_wrapper) - .long SYSCALL(sys_fadvise64,sys_ni_syscall) - .rept 255-253 - .long SYSCALL(sys_ni_syscall,sys_ni_syscall) - .endr - -/* - * Program check handler routine - */ - - .globl pgm_check_handler -pgm_check_handler: -/* - * First we need to check for a special case: - * Single stepping an instruction that disables the PER event mask will - * cause a PER event AFTER the mask has been set. Example: SVC or LPSW. - * For a single stepped SVC the program check handler gets control after - * the SVC new PSW has been loaded. But we want to execute the SVC first and - * then handle the PER event. Therefore we update the SVC old PSW to point - * to the pgm_check_handler and branch to the SVC handler after we checked - * if we have to load the kernel stack register. - * For every other possible cause for PER event without the PER mask set - * we just ignore the PER event (FIXME: is there anything we have to do - * for LPSW?). - */ - tm __LC_PGM_INT_CODE+1,0x80 # check whether we got a per exception - jnz pgm_per # got per exception -> special case - SAVE_ALL __LC_PGM_OLD_PSW,1 - lghi %r8,0x7f - lgf %r3,__LC_PGM_ILC # load program interruption code - ngr %r8,%r3 - sll %r8,3 - GET_THREAD_INFO - stosm 48(%r15),0x03 # reenable interrupts - larl %r1,pgm_check_table - lg %r1,0(%r8,%r1) # load address of handler routine - la %r2,SP_PTREGS(%r15) # address of register-save area - larl %r14,sysc_return - br %r1 # branch to interrupt-handler - -# -# handle per exception -# -pgm_per: - tm __LC_PGM_OLD_PSW,0x40 # test if per event recording is on - jnz pgm_per_std # ok, normal per event from user space -# ok its one of the special cases, now we need to find out which one - clc __LC_PGM_OLD_PSW(16),__LC_SVC_NEW_PSW - je pgm_svcper -# no interesting special case, ignore PER event - lpswe __LC_PGM_OLD_PSW - -# -# Normal per exception -# -pgm_per_std: - SAVE_ALL __LC_PGM_OLD_PSW,1 - GET_THREAD_INFO - lghi %r4,0x7f - lgf %r3,__LC_PGM_ILC # load program interruption code - stosm 48(%r15),0x03 # reenable interrupts - nr %r4,%r3 # clear per-event-bit and ilc - je pgm_per_only # only per of per+check ? - sll %r4,3 - larl %r1,pgm_check_table - lg %r1,0(%r4,%r1) # load address of handler routine - la %r2,SP_PTREGS(%r15) # address of register-save area - basr %r14,%r1 # branch to interrupt-handler -pgm_per_only: - la %r2,SP_PTREGS(15) # address of register-save area - larl %r14,sysc_return # load adr. of system return - jg handle_per_exception - -# -# it was a single stepped SVC that is causing all the trouble -# -pgm_svcper: - SAVE_ALL __LC_SVC_OLD_PSW,1 - llgh %r8,__LC_SVC_INT_CODE # get svc number from lowcore - GET_THREAD_INFO # load pointer to task_struct to R9 - stosm 48(%r15),0x03 # reenable interrupts - larl %r7,sys_call_table - sll %r8,3 - tm SP_PSW+3(%r15),0x01 # are we running in 31 bit mode ? - jo pgm_svcper_noemu - la %r7,4(%r8) # use 31 bit emulation system calls -pgm_svcper_noemu: - lgf %r8,0(%r8,%r7) # load address of system call routine - tm __TI_flags+3(%r9),_TIF_SYSCALL_TRACE - jo pgm_tracesys - basr %r14,%r8 # call sys_xxxx - stg %r2,SP_R2(%r15) # store return value (change R2 on stack) - # ATTENTION: check sys_execve_glue before - # changing anything here !! - -pgm_svcret: - tm __TI_flags+3(%r9),_TIF_SIGPENDING - jo pgm_svcper_nosig - la %r2,SP_PTREGS(%r15) # load pt_regs - sgr %r3,%r3 # clear *oldset - brasl %r14,do_signal - -pgm_svcper_nosig: - lhi %r0,__LC_PGM_OLD_PSW # set trap indication back to pgm_chk - st %r0,SP_TRAP(%r15) - la %r2,SP_PTREGS(15) # address of register-save area - larl %r14,sysc_return # load adr. of system return - jg handle_per_exception -# -# call trace before and after sys_call -# -pgm_tracesys: - lghi %r0,-ENOSYS - stg %r0,SP_R2(%r15) # give sysc_trace an -ENOSYS retval - brasl %r14,syscall_trace - lg %r2,SP_R2(%r15) - cghi %r2,256 - jnl pgm_svc_go - sllg %r2,%r2,3 # strace wants to change the syscall - lgf %r8,0(%r2,%r7) -pgm_svc_go: - lmg %r3,%r6,SP_R3(%r15) - lg %r2,SP_ORIG_R2(%r15) - basr %r14,%r8 # call sys_xxx - stg %r2,SP_R2(%r15) # store return value - tm __TI_flags+7(%r9),_TIF_SYSCALL_TRACE - jno pgm_svcret - larl %r14,pgm_svcret # return point is sysc_return - jg syscall_trace - -/* - * IO interrupt handler routine - */ - .globl io_int_handler -io_int_handler: - SAVE_ALL __LC_IO_OLD_PSW,0 - GET_THREAD_INFO # load pointer to task_struct to R9 - la %r2,SP_PTREGS(%r15) # address of register-save area - llgh %r3,__LC_SUBCHANNEL_NR # load subchannel number - llgf %r4,__LC_IO_INT_PARM # load interruption parm - llgf %r5,__LC_IO_INT_WORD # load interruption word - brasl %r14,do_IRQ # call standard irq handler - -io_return: - tm SP_PSW+1(%r15),0x01 # returning to user ? -#ifdef CONFIG_PREEMPT - jno io_preempt # no -> check for preemptive scheduling -#else - jno io_leave # no-> skip resched & signal -#endif - tm __TI_flags+7(%r9),_TIF_WORK_INT - jnz io_work # there is work to do (signals etc.) -io_leave: - RESTORE_ALL 0 - -#ifdef CONFIG_PREEMPT -io_preempt: - icm %r0,15,__TI_precount(%r9) - jnz io_leave -io_resume_loop: - tm __TI_flags+7(%r9),_TIF_NEED_RESCHED - jno io_leave - larl %r1,.Lc_pactive - mvc __TI_precount(4,%r9),0(%r1) - # hmpf, we are on the async. stack but to call schedule - # we have to move the interrupt frame to the process stack - lg %r1,SP_R15(%r15) - aghi %r1,-SP_SIZE - nill %r1,0xfff8 - mvc SP_PTREGS(SP_SIZE-SP_PTREGS,%r1),SP_PTREGS(%r15) - xc 0(8,%r1),0(%r1) # clear back chain - lgr %r15,%r1 - stosm 48(%r15),0x03 # reenable interrupts - brasl %r14,schedule # call schedule - stnsm 48(%r15),0xfc # disable I/O and ext. interrupts - GET_THREAD_INFO # load pointer to task_struct to R9 - xc __TI_precount(4,%r9),__TI_precount(%r9) - j io_resume_loop -#endif - -# -# recheck if there is more work to do -# -io_work_loop: - stnsm 48(%r15),0xfc # disable I/O and ext. interrupts - GET_THREAD_INFO # load pointer to task_struct to R9 - tm __TI_flags+7(%r9),_TIF_WORK_INT - jz io_leave # there is no work to do -# -# One of the work bits is on. Find out which one. -# Checked are: _TIF_SIGPENDING and _TIF_NEED_RESCHED -# -io_work: - tm __TI_flags+7(%r9),_TIF_NEED_RESCHED - jo io_reschedule - tm __TI_flags+7(%r9),_TIF_SIGPENDING - jo io_sigpending - j io_leave - -# -# _TIF_NEED_RESCHED is set, call schedule -# -io_reschedule: - stosm 48(%r15),0x03 # reenable interrupts - larl %r14,io_work_loop - jg schedule # call scheduler - -# -# _TIF_SIGPENDING is set, call do_signal -# -io_sigpending: - stosm 48(%r15),0x03 # reenable interrupts - la %r2,SP_PTREGS(%r15) # load pt_regs - slgr %r3,%r3 # clear *oldset - brasl %r14,do_signal # call do_signal - stnsm 48(%r15),0xfc # disable I/O and ext. interrupts - j sysc_leave # out of here, do NOT recheck - -/* - * External interrupt handler routine - */ - .globl ext_int_handler -ext_int_handler: - SAVE_ALL __LC_EXT_OLD_PSW,0 - GET_THREAD_INFO # load pointer to task_struct to R9 - llgh %r6,__LC_EXT_INT_CODE # get interruption code - lgr %r1,%r6 # calculate index = code & 0xff - nill %r1,0xff - sll %r1,3 - larl %r7,ext_int_hash - lg %r7,0(%r1,%r7) # get first list entry for hash value - ltgr %r7,%r7 # == NULL ? - jz io_return # yes, nothing to do, exit -ext_int_loop: - ch %r6,16(%r7) # compare external interrupt code - jne ext_int_next - lg %r1,8(%r7) # get handler address - la %r2,SP_PTREGS(%r15) # address of register-save area - lgr %r3,%r6 # interruption code - basr %r14,%r1 # call handler -ext_int_next: - lg %r7,0(%r7) # next list entry - ltgr %r7,%r7 - jnz ext_int_loop - j io_return - -/* - * Machine check handler routines - */ - .globl mcck_int_handler -mcck_int_handler: - SAVE_ALL __LC_MCK_OLD_PSW,0 - brasl %r14,s390_do_machine_check -mcck_return: - RESTORE_ALL 0 - -#ifdef CONFIG_SMP -/* - * Restart interruption handler, kick starter for additional CPUs - */ - .globl restart_int_handler -restart_int_handler: - lg %r15,__LC_SAVE_AREA+120 # load ksp - lghi %r10,__LC_CREGS_SAVE_AREA - lctlg %c0,%c15,0(%r10) # get new ctl regs - lghi %r10,__LC_AREGS_SAVE_AREA - lam %a0,%a15,0(%r10) - stosm 0(%r15),0x04 # now we can turn dat on - lmg %r6,%r15,48(%r15) # load registers from clone - jg start_secondary -#else -/* - * If we do not run with SMP enabled, let the new CPU crash ... - */ - .globl restart_int_handler -restart_int_handler: - basr %r1,0 -restart_base: - lpswe restart_crash-restart_base(%r1) - .align 8 -restart_crash: - .long 0x000a0000,0x00000000,0x00000000,0x00000000 -restart_go: -#endif - -/* - * Integer constants - */ - .align 4 -.Lc_ac: .long 0,0,1 -.Lc_pactive: .long PREEMPT_ACTIVE -.Lc256: .quad 256 diff --git a/arch/s390x/kernel/exec32.c b/arch/s390x/kernel/exec32.c deleted file mode 100644 index 4009f8aff611a..0000000000000 --- a/arch/s390x/kernel/exec32.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Support for 32-bit Linux for S390 ELF binaries. - * - * Copyright (C) 2000 IBM Deutschland Entwicklung GmbH, IBM Corporation - * Author(s): Gerhard Tonn (ton@de.ibm.com) - * - * Separated from binfmt_elf32.c to reduce exports for module enablement. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#ifdef CONFIG_KMOD -#include -#endif - - -extern void put_dirty_page(struct task_struct * tsk, struct page *page, unsigned long address); - -#undef STACK_TOP -#define STACK_TOP TASK31_SIZE - -int setup_arg_pages32(struct linux_binprm *bprm) -{ - unsigned long stack_base; - struct vm_area_struct *mpnt; - struct mm_struct *mm = current->mm; - int i; - - stack_base = STACK_TOP - MAX_ARG_PAGES*PAGE_SIZE; - mm->arg_start = bprm->p + stack_base; - - bprm->p += stack_base; - if (bprm->loader) - bprm->loader += stack_base; - bprm->exec += stack_base; - - mpnt = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL); - if (!mpnt) - return -ENOMEM; - - if (!vm_enough_memory((STACK_TOP - (PAGE_MASK & (unsigned long) bprm->p))>>PAGE_SHIFT)) { - kmem_cache_free(vm_area_cachep, mpnt); - return -ENOMEM; - } - - down_write(&mm->mmap_sem); - { - mpnt->vm_mm = mm; - mpnt->vm_start = PAGE_MASK & (unsigned long) bprm->p; - mpnt->vm_end = STACK_TOP; - mpnt->vm_page_prot = PAGE_COPY; - mpnt->vm_flags = VM_STACK_FLAGS; - mpnt->vm_ops = NULL; - mpnt->vm_pgoff = 0; - mpnt->vm_file = NULL; - INIT_LIST_HEAD(&mpnt->shared); - mpnt->vm_private_data = (void *) 0; - insert_vm_struct(mm, mpnt); - mm->total_vm = (mpnt->vm_end - mpnt->vm_start) >> PAGE_SHIFT; - } - - for (i = 0 ; i < MAX_ARG_PAGES ; i++) { - struct page *page = bprm->page[i]; - if (page) { - bprm->page[i] = NULL; - put_dirty_page(current,page,stack_base); - } - stack_base += PAGE_SIZE; - } - up_write(&mm->mmap_sem); - - return 0; -} - -EXPORT_SYMBOL(setup_arg_pages32); diff --git a/arch/s390x/kernel/exec_domain32.c b/arch/s390x/kernel/exec_domain32.c deleted file mode 100644 index 71d27c493568b..0000000000000 --- a/arch/s390x/kernel/exec_domain32.c +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Support for 32-bit Linux for S390 personality. - * - * Copyright (C) 2000 IBM Deutschland Entwicklung GmbH, IBM Corporation - * Author(s): Gerhard Tonn (ton@de.ibm.com) - * - * - */ - -#include -#include -#include -#include - -struct exec_domain s390_exec_domain; - -static int __init -s390_init (void) -{ - s390_exec_domain.name = "Linux/s390"; - s390_exec_domain.handler = NULL; - s390_exec_domain.pers_low = PER_LINUX32; - s390_exec_domain.pers_high = PER_LINUX32; - s390_exec_domain.signal_map = default_exec_domain.signal_map; - s390_exec_domain.signal_invmap = default_exec_domain.signal_invmap; - register_exec_domain(&s390_exec_domain); - return 0; -} - -__initcall(s390_init); diff --git a/arch/s390x/kernel/gdb-stub.c b/arch/s390x/kernel/gdb-stub.c deleted file mode 100644 index 06e3adbb069ba..0000000000000 --- a/arch/s390x/kernel/gdb-stub.c +++ /dev/null @@ -1,575 +0,0 @@ -/* - * arch/s390/kernel/gdb-stub.c - * - * S390 version - * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation - * Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com), - * - * Originally written by Glenn Engel, Lake Stevens Instrument Division - * - * Contributed by HP Systems - * - * Modified for SPARC by Stu Grossman, Cygnus Support. - * - * Modified for Linux/MIPS (and MIPS in general) by Andreas Busse - * Send complaints, suggestions etc. to - * - * Copyright (C) 1995 Andreas Busse - */ - -/* - * To enable debugger support, two things need to happen. One, a - * call to set_debug_traps() is necessary in order to allow any breakpoints - * or error conditions to be properly intercepted and reported to gdb. - * Two, a breakpoint needs to be generated to begin communication. This - * is most easily accomplished by a call to breakpoint(). Breakpoint() - * simulates a breakpoint by executing a BREAK instruction. - * - * - * The following gdb commands are supported: - * - * command function Return value - * - * g return the value of the CPU registers hex data or ENN - * G set the value of the CPU registers OK or ENN - * - * mAA..AA,LLLL Read LLLL bytes at address AA..AA hex data or ENN - * MAA..AA,LLLL: Write LLLL bytes at address AA.AA OK or ENN - * - * c Resume at current address SNN ( signal NN) - * cAA..AA Continue at address AA..AA SNN - * - * s Step one instruction SNN - * sAA..AA Step one instruction from AA..AA SNN - * - * k kill - * - * ? What was the last sigval ? SNN (signal NN) - * - * - * All commands and responses are sent with a packet which includes a - * checksum. A packet consists of - * - * $#. - * - * where - * :: - * :: < two hex digits computed as modulo 256 sum of > - * - * When a packet is received, it is first acknowledged with either '+' or '-'. - * '+' indicates a successful transfer. '-' indicates a failed transfer. - * - * Example: - * - * Host: Reply: - * $m0,10#2a +$00010203040506070809101112131415#42 - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include - - -/* - * external low-level support routines - */ - -extern int putDebugChar(char c); /* write a single character */ -extern char getDebugChar(void); /* read and return a single char */ -extern void fltr_set_mem_err(void); -extern void trap_low(void); - -/* - * breakpoint and test functions - */ -extern void breakpoint(void); -extern void breakinst(void); - -/* - * local prototypes - */ - -static void getpacket(char *buffer); -static void putpacket(char *buffer); -static int hex(unsigned char ch); -static int hexToInt(char **ptr, int *intValue); -static unsigned char *mem2hex(char *mem, char *buf, int count, int may_fault); - - -/* - * BUFMAX defines the maximum number of characters in inbound/outbound buffers - * at least NUMREGBYTES*2 are needed for register packets - */ -#define BUFMAX 2048 - -static char input_buffer[BUFMAX]; -static char output_buffer[BUFMAX]; -int gdb_stub_initialised = FALSE; -static const char hexchars[]="0123456789abcdef"; - - -/* - * Convert ch from a hex digit to an int - */ -static int hex(unsigned char ch) -{ - if (ch >= 'a' && ch <= 'f') - return ch-'a'+10; - if (ch >= '0' && ch <= '9') - return ch-'0'; - if (ch >= 'A' && ch <= 'F') - return ch-'A'+10; - return -1; -} - -/* - * scan for the sequence $# - */ -static void getpacket(char *buffer) -{ - unsigned char checksum; - unsigned char xmitcsum; - int i; - int count; - unsigned char ch; - - do { - /* - * wait around for the start character, - * ignore all other characters - */ - while ((ch = (getDebugChar() & 0x7f)) != '$') ; - - checksum = 0; - xmitcsum = -1; - count = 0; - - /* - * now, read until a # or end of buffer is found - */ - while (count < BUFMAX) { - ch = getDebugChar() & 0x7f; - if (ch == '#') - break; - checksum = checksum + ch; - buffer[count] = ch; - count = count + 1; - } - - if (count >= BUFMAX) - continue; - - buffer[count] = 0; - - if (ch == '#') { - xmitcsum = hex(getDebugChar() & 0x7f) << 4; - xmitcsum |= hex(getDebugChar() & 0x7f); - - if (checksum != xmitcsum) - putDebugChar('-'); /* failed checksum */ - else { - putDebugChar('+'); /* successful transfer */ - - /* - * if a sequence char is present, - * reply the sequence ID - */ - if (buffer[2] == ':') { - putDebugChar(buffer[0]); - putDebugChar(buffer[1]); - - /* - * remove sequence chars from buffer - */ - count = strlen(buffer); - for (i=3; i <= count; i++) - buffer[i-3] = buffer[i]; - } - } - } - } - while (checksum != xmitcsum); -} - -/* - * send the packet in buffer. - */ -static void putpacket(char *buffer) -{ - unsigned char checksum; - int count; - unsigned char ch; - - /* - * $#. - */ - - do { - putDebugChar('$'); - checksum = 0; - count = 0; - - while ((ch = buffer[count]) != 0) { - if (!(putDebugChar(ch))) - return; - checksum += ch; - count += 1; - } - - putDebugChar('#'); - putDebugChar(hexchars[checksum >> 4]); - putDebugChar(hexchars[checksum & 0xf]); - - } - while ((getDebugChar() & 0x7f) != '+'); -} - - - -/* - * Convert the memory pointed to by mem into hex, placing result in buf. - * Return a pointer to the last char put in buf (null), in case of mem fault, - * return 0. - * If MAY_FAULT is non-zero, then we will handle memory faults by returning - * a 0, else treat a fault like any other fault in the stub. - */ -static unsigned char *mem2hex(char *mem, char *buf, int count, int may_fault) -{ - unsigned char ch; - -/* set_mem_fault_trap(may_fault); */ - - while (count-- > 0) { - ch = *(mem++); - if (mem_err) - return 0; - *buf++ = hexchars[ch >> 4]; - *buf++ = hexchars[ch & 0xf]; - } - - *buf = 0; - -/* set_mem_fault_trap(0); */ - - return buf; -} - -/* - * convert the hex array pointed to by buf into binary to be placed in mem - * return a pointer to the character AFTER the last byte written - */ -static char *hex2mem(char *buf, char *mem, int count, int may_fault) -{ - int i; - unsigned char ch; - -/* set_mem_fault_trap(may_fault); */ - - for (i=0; ifp_regs; - int has_ieee=save_fp_regs1(fpregs); - - if(!has_ieee) - { - fpregs->fpc=0; - fpregs->fprs[1].d= - fpregs->fprs[3].d= - fpregs->fprs[5].d= - fpregs->fprs[7].d=0; - memset(&fpregs->fprs[8].d,0,sizeof(freg_t)*8); - } -} - -void gdb_stub_set_non_pt_regs(gdb_pt_regs *regs) -{ - restore_fp_regs1(®s->fp_regs); -} - -void gdb_stub_send_signal(int sigval) -{ - char *ptr; - ptr = output_buffer; - - /* - * Send trap type (converted to signal) - */ - *ptr++ = 'S'; - *ptr++ = hexchars[sigval >> 4]; - *ptr++ = hexchars[sigval & 0xf]; - *ptr++ = 0; - putpacket(output_buffer); /* send it off... */ -} - -/* - * This function does all command processing for interfacing to gdb. It - * returns 1 if you should skip the instruction at the trap address, 0 - * otherwise. - */ -void gdb_stub_handle_exception(gdb_pt_regs *regs,int sigval) -{ - int trap; /* Trap type */ - int addr; - int length; - char *ptr; - unsigned long *stack; - - - /* - * reply to host that an exception has occurred - */ - send_signal(sigval); - - /* - * Wait for input from remote GDB - */ - while (1) { - output_buffer[0] = 0; - getpacket(input_buffer); - - switch (input_buffer[0]) - { - case '?': - send_signal(sigval); - continue; - - case 'd': - /* toggle debug flag */ - break; - - /* - * Return the value of the CPU registers - */ - case 'g': - gdb_stub_get_non_pt_regs(regs); - ptr = output_buffer; - ptr= mem2hex((char *)regs,ptr,sizeof(s390_regs_common),FALSE); - ptr= mem2hex((char *)®s->crs[0],ptr,NUM_CRS*CR_SIZE,FALSE); - ptr = mem2hex((char *)®s->fp_regs, ptr,sizeof(s390_fp_regs)); - break; - - /* - * set the value of the CPU registers - return OK - * FIXME: Needs to be written - */ - case 'G': - ptr=input_buffer; - hex2mem (ptr, (char *)regs,sizeof(s390_regs_common), FALSE); - ptr+=sizeof(s390_regs_common)*2; - hex2mem (ptr, (char *)regs->crs[0],NUM_CRS*CR_SIZE, FALSE); - ptr+=NUM_CRS*CR_SIZE*2; - hex2mem (ptr, (char *)regs->fp_regs,sizeof(s390_fp_regs), FALSE); - gdb_stub_set_non_pt_regs(regs); - strcpy(output_buffer,"OK"); - break; - - /* - * mAA..AA,LLLL Read LLLL bytes at address AA..AA - */ - case 'm': - ptr = &input_buffer[1]; - - if (hexToInt(&ptr, &addr) - && *ptr++ == ',' - && hexToInt(&ptr, &length)) { - if (mem2hex((char *)addr, output_buffer, length, 1)) - break; - strcpy (output_buffer, "E03"); - } else - strcpy(output_buffer,"E01"); - break; - - /* - * MAA..AA,LLLL: Write LLLL bytes at address AA.AA return OK - */ - case 'M': - ptr = &input_buffer[1]; - - if (hexToInt(&ptr, &addr) - && *ptr++ == ',' - && hexToInt(&ptr, &length) - && *ptr++ == ':') { - if (hex2mem(ptr, (char *)addr, length, 1)) - strcpy(output_buffer, "OK"); - else - strcpy(output_buffer, "E03"); - } - else - strcpy(output_buffer, "E02"); - break; - - /* - * cAA..AA Continue at address AA..AA(optional) - */ - case 'c': - /* try to read optional parameter, pc unchanged if no parm */ - - ptr = &input_buffer[1]; - if (hexToInt(&ptr, &addr)) - regs->cp0_epc = addr; - - /* - * Need to flush the instruction cache here, as we may - * have deposited a breakpoint, and the icache probably - * has no way of knowing that a data ref to some location - * may have changed something that is in the instruction - * cache. - * NB: We flush both caches, just to be sure... - */ - - flush_cache_all(); - return; - /* NOTREACHED */ - break; - - - /* - * kill the program - */ - case 'k' : - break; /* do nothing */ - - - /* - * Reset the whole machine (FIXME: system dependent) - */ - case 'r': - break; - - - /* - * Step to next instruction - */ - case 's': - /* - * There is no single step insn in the MIPS ISA, so we - * use breakpoints and continue, instead. - */ - single_step(regs); - flush_cache_all(); - return; - /* NOTREACHED */ - - } - break; - - } /* switch */ - - /* - * reply to the request - */ - - putpacket(output_buffer); - - } /* while */ -} - -/* - * This function will generate a breakpoint exception. It is used at the - * beginning of a program to sync up with a debugger and can be used - * otherwise as a quick means to stop program execution and "break" into - * the debugger. - */ -void breakpoint(void) -{ - if (!gdb_stub_initialised) - return; - __asm__ __volatile__( - ".globl breakinst\n" - "breakinst:\t.word %0\n\t" - : - : "i" (S390_BREAKPOINT_U16) - : - ); -} - - - - - - - diff --git a/arch/s390x/kernel/head.S b/arch/s390x/kernel/head.S deleted file mode 100644 index 886c80c9f35ca..0000000000000 --- a/arch/s390x/kernel/head.S +++ /dev/null @@ -1,664 +0,0 @@ -/* - * arch/s390/kernel/head.S - * - * S390 version - * Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation - * Author(s): Hartmut Penner (hp@de.ibm.com), - * Martin Schwidefsky (schwidefsky@de.ibm.com), - * Rob van der Heij (rvdhei@iae.nl) - * - * There are 5 different IPL methods - * 1) load the image directly into ram at address 0 and do an PSW restart - * 2) linload will load the image from address 0x10000 to memory 0x10000 - * and start the code thru LPSW 0x0008000080010000 (VM only, deprecated) - * 3) generate the tape ipl header, store the generated image on a tape - * and ipl from it - * In case of SL tape you need to IPL 5 times to get past VOL1 etc - * 4) generate the vm reader ipl header, move the generated image to the - * VM reader (use option NOH!) and do a ipl from reader (VM only) - * 5) direct call of start by the SALIPL loader - * We use the cpuid to distinguish between VM and native ipl - * params for kernel are pushed to 0x10400 (see setup.h) - - Changes: - Okt 25 2000 - added code to skip HDR and EOF to allow SL tape IPL (5 retries) - changed first CCW from rewind to backspace block - - */ - -#include -#include -#include - -#ifndef CONFIG_IPL - .org 0 - .long 0x00080000,0x80000000+startup # Just a restart PSW -#else -#ifdef CONFIG_IPL_TAPE -#define IPL_BS 1024 - .org 0 - .long 0x00080000,0x80000000+iplstart # The first 24 bytes are loaded - .long 0x27000000,0x60000001 # by ipl to addresses 0-23. - .long 0x02000000,0x20000000+IPL_BS # (a PSW and two CCWs). - .long 0x00000000,0x00000000 # external old psw - .long 0x00000000,0x00000000 # svc old psw - .long 0x00000000,0x00000000 # program check old psw - .long 0x00000000,0x00000000 # machine check old psw - .long 0x00000000,0x00000000 # io old psw - .long 0x00000000,0x00000000 - .long 0x00000000,0x00000000 - .long 0x00000000,0x00000000 - .long 0x000a0000,0x00000058 # external new psw - .long 0x000a0000,0x00000060 # svc new psw - .long 0x000a0000,0x00000068 # program check new psw - .long 0x000a0000,0x00000070 # machine check new psw - .long 0x00080000,0x80000000+.Lioint # io new psw - - .org 0x100 -# -# subroutine for loading from tape -# Paramters: -# R1 = device number -# R2 = load address -.Lloader: - st %r14,.Lldret - la %r3,.Lorbread # r3 = address of orb - la %r5,.Lirb # r5 = address of irb - st %r2,.Lccwread+4 # initialize CCW data addresses - lctl %c6,%c6,.Lcr6 - slr %r2,%r2 -.Lldlp: - la %r6,3 # 3 retries -.Lssch: - ssch 0(%r3) # load chunk of IPL_BS bytes - bnz .Llderr -.Lw4end: - bas %r14,.Lwait4io - tm 8(%r5),0x82 # do we have a problem ? - bnz .Lrecov - slr %r7,%r7 - icm %r7,3,10(%r5) # get residual count - lcr %r7,%r7 - la %r7,IPL_BS(%r7) # IPL_BS-residual=#bytes read - ar %r2,%r7 # add to total size - tm 8(%r5),0x01 # found a tape mark ? - bnz .Ldone - l %r0,.Lccwread+4 # update CCW data addresses - ar %r0,%r7 - st %r0,.Lccwread+4 - b .Lldlp -.Ldone: - l %r14,.Lldret - br %r14 # r2 contains the total size -.Lrecov: - bas %r14,.Lsense # do the sensing - bct %r6,.Lssch # dec. retry count & branch - b .Llderr -# -# Sense subroutine -# -.Lsense: - st %r14,.Lsnsret - la %r7,.Lorbsense - ssch 0(%r7) # start sense command - bnz .Llderr - bas %r14,.Lwait4io - l %r14,.Lsnsret - tm 8(%r5),0x82 # do we have a problem ? - bnz .Llderr - br %r14 -# -# Wait for interrupt subroutine -# -.Lwait4io: - lpsw .Lwaitpsw -.Lioint: - c %r1,0xb8 # compare subchannel number - bne .Lwait4io - tsch 0(%r5) - slr %r0,%r0 - tm 8(%r5),0x82 # do we have a problem ? - bnz .Lwtexit - tm 8(%r5),0x04 # got device end ? - bz .Lwait4io -.Lwtexit: - br %r14 -.Llderr: - lpsw .Lcrash - - .align 8 -.Lorbread: - .long 0x00000000,0x0080ff00,.Lccwread - .align 8 -.Lorbsense: - .long 0x00000000,0x0080ff00,.Lccwsense - .align 8 -.Lccwread: - .long 0x02200000+IPL_BS,0x00000000 -.Lccwsense: - .long 0x04200001,0x00000000 -.Lwaitpsw: - .long 0x020a0000,0x80000000+.Lioint - -.Lirb: .long 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -.Lcr6: .long 0xff000000 - .align 8 -.Lcrash:.long 0x000a0000,0x00000000 -.Lldret:.long 0 -.Lsnsret: .long 0 -#endif /* CONFIG_IPL_TAPE */ - -#ifdef CONFIG_IPL_VM -#define IPL_BS 0x730 - .org 0 - .long 0x00080000,0x80000000+iplstart # The first 24 bytes are loaded - .long 0x02000018,0x60000050 # by ipl to addresses 0-23. - .long 0x02000068,0x60000050 # (a PSW and two CCWs). - .fill 80-24,1,0x40 # bytes 24-79 are discarded !! - .long 0x020000f0,0x60000050 # The next 160 byte are loaded - .long 0x02000140,0x60000050 # to addresses 0x18-0xb7 - .long 0x02000190,0x60000050 # They form the continuation - .long 0x020001e0,0x60000050 # of the CCW program started - .long 0x02000230,0x60000050 # by ipl and load the range - .long 0x02000280,0x60000050 # 0x0f0-0x730 from the image - .long 0x020002d0,0x60000050 # to the range 0x0f0-0x730 - .long 0x02000320,0x60000050 # in memory. At the end of - .long 0x02000370,0x60000050 # the channel program the PSW - .long 0x020003c0,0x60000050 # at location 0 is loaded. - .long 0x02000410,0x60000050 # Initial processing starts - .long 0x02000460,0x60000050 # at 0xf0 = iplstart. - .long 0x020004b0,0x60000050 - .long 0x02000500,0x60000050 - .long 0x02000550,0x60000050 - .long 0x020005a0,0x60000050 - .long 0x020005f0,0x60000050 - .long 0x02000640,0x60000050 - .long 0x02000690,0x60000050 - .long 0x020006e0,0x20000050 - - .org 0xf0 -# -# subroutine for loading cards from the reader -# -.Lloader: - la %r3,.Lorb # r2 = address of orb into r2 - la %r5,.Lirb # r4 = address of irb - la %r6,.Lccws - la %r7,20 -.Linit: - st %r2,4(%r6) # initialize CCW data addresses - la %r2,0x50(%r2) - la %r6,8(%r6) - bct 7,.Linit - - lctl %c6,%c6,.Lcr6 # set IO subclass mask - slr %r2,%r2 -.Lldlp: - ssch 0(%r3) # load chunk of 1600 bytes - bnz .Llderr -.Lwait4irq: - mvc 0x78(8),.Lnewpsw # set up IO interrupt psw - lpsw .Lwaitpsw -.Lioint: - c %r1,0xb8 # compare subchannel number - bne .Lwait4irq - tsch 0(%r5) - - slr %r0,%r0 - ic %r0,8(%r5) # get device status - chi %r0,8 # channel end ? - be .Lcont - chi %r0,12 # channel end + device end ? - be .Lcont - - l %r0,4(%r5) - s %r0,8(%r3) # r0/8 = number of ccws executed - mhi %r0,10 # *10 = number of bytes in ccws - lh %r3,10(%r5) # get residual count - sr %r0,%r3 # #ccws*80-residual=#bytes read - ar %r2,%r0 - - br %r14 # r2 contains the total size - -.Lcont: - ahi %r2,0x640 # add 0x640 to total size - la %r6,.Lccws - la %r7,20 -.Lincr: - l %r0,4(%r6) # update CCW data addresses - ahi %r0,0x640 - st %r0,4(%r6) - ahi %r6,8 - bct 7,.Lincr - - b .Lldlp -.Llderr: - lpsw .Lcrash - - .align 8 -.Lorb: .long 0x00000000,0x0080ff00,.Lccws -.Lirb: .long 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -.Lcr6: .long 0xff000000 -.Lloadp:.long 0,0 - .align 8 -.Lcrash:.long 0x000a0000,0x00000000 -.Lnewpsw: - .long 0x00080000,0x80000000+.Lioint -.Lwaitpsw: - .long 0x020a0000,0x80000000+.Lioint - - .align 8 -.Lccws: .rept 19 - .long 0x02600050,0x00000000 - .endr - .long 0x02200050,0x00000000 -#endif /* CONFIG_IPL_VM */ - -iplstart: - lh %r1,0xb8 # test if subchannel number - bct %r1,.Lnoload # is valid - l %r1,0xb8 # load ipl subchannel number - la %r2,IPL_BS # load start address - bas %r14,.Lloader # load rest of ipl image - larl %r12,_pstart # pointer to parameter area - st %r1,IPL_DEVICE+4-PARMAREA(%r12) # store ipl device number - -# -# load parameter file from ipl device -# -.Lagain1: - l %r2,INITRD_START+4-PARMAREA(%r12)# use ramdisk location as temp - bas %r14,.Lloader # load parameter file - ltr %r2,%r2 # got anything ? - bz .Lnopf - chi %r2,895 - bnh .Lnotrunc - la %r2,895 -.Lnotrunc: - l %r4,INITRD_START+4-PARMAREA(%r12) - clc 0(3,%r4),.L_hdr # if it is HDRx - bz .Lagain1 # skip dataset header - clc 0(3,%r4),.L_eof # if it is EOFx - bz .Lagain1 # skip dateset trailer - la %r5,0(%r4,%r2) - lr %r3,%r2 -.Lidebc: - tm 0(%r5),0x80 # high order bit set ? - bo .Ldocv # yes -> convert from EBCDIC - ahi %r5,-1 - bct %r3,.Lidebc - b .Lnocv -.Ldocv: - l %r3,.Lcvtab - tr 0(256,%r4),0(%r3) # convert parameters to ascii - tr 256(256,%r4),0(%r3) - tr 512(256,%r4),0(%r3) - tr 768(122,%r4),0(%r3) -.Lnocv: la %r3,COMMAND_LINE-PARMAREA(%r12) # load adr. of command line - mvc 0(256,%r3),0(%r4) - mvc 256(256,%r3),256(%r4) - mvc 512(256,%r3),512(%r4) - mvc 768(122,%r3),768(%r4) - slr %r0,%r0 - b .Lcntlp -.Ldelspc: - ic %r0,0(%r2,%r3) - chi %r0,0x20 # is it a space ? - be .Lcntlp - ahi %r2,1 - b .Leolp -.Lcntlp: - brct %r2,.Ldelspc -.Leolp: - slr %r0,%r0 - stc %r0,0(%r2,%r3) # terminate buffer -.Lnopf: - -# -# load ramdisk from ipl device -# -.Lagain2: - l %r2,INITRD_START+4-PARMAREA(%r12)# load adr. of ramdisk - bas %r14,.Lloader # load ramdisk - st %r2,INITRD_SIZE+4-PARMAREA(%r12) # store size of ramdisk - ltr %r2,%r2 - bnz .Lrdcont - st %r2,INITRD_START+4-PARMAREA(%r12)# no ramdisk found, null it -.Lrdcont: - l %r2,INITRD_START+4-PARMAREA(%r12) - clc 0(3,%r2),.L_hdr # skip HDRx and EOFx - bz .Lagain2 - clc 0(3,%r2),.L_eof - bz .Lagain2 - -#ifdef CONFIG_IPL_VM -# -# reset files in VM reader -# - stidp __LC_CPUID # store cpuid - tm __LC_CPUID,0xff # running VM ? - bno .Lnoreset - la %r2,.Lreset - lhi %r3,26 - .long 0x83230008 -.Lnoreset: -#endif - -# -# everything loaded, go for it -# -.Lnoload: - l %r1,.Lstartup - br %r1 - -.Lstartup: .long startup -.Lcvtab:.long _ebcasc # ebcdic to ascii table -.Lreset:.byte 0xc3,0xc8,0xc1,0xd5,0xc7,0xc5,0x40,0xd9,0xc4,0xd9,0x40 - .byte 0xc1,0xd3,0xd3,0x40,0xd2,0xc5,0xc5,0xd7,0x40,0xd5,0xd6 - .byte 0xc8,0xd6,0xd3,0xc4 # "change rdr all keep nohold" -.L_eof: .long 0xc5d6c600 /* C'EOF' */ -.L_hdr: .long 0xc8c4d900 /* C'HDR' */ -#endif /* CONFIG_IPL */ - -# -# SALIPL loader support. Based on a patch by Rob van der Heij. -# This entry point is called directly from the SALIPL loader and -# doesn't need a builtin ipl record. -# - .org 0x800 - .globl start -start: - stm %r0,%r15,0x07b0 # store registers - basr %r12,%r0 -.base: - l %r11,.parm - l %r8,.cmd # pointer to command buffer - - ltr %r9,%r9 # do we have SALIPL parameters? - bp .sk8x8 - - mvc 0(64,%r8),0x00b0 # copy saved registers - xc 64(240-64,%r8),0(%r8) # remainder of buffer - tr 0(64,%r8),.lowcase - b .gotr -.sk8x8: - mvc 0(240,%r8),0(%r9) # copy iplparms into buffer -.gotr: - l %r10,.tbl # EBCDIC to ASCII table - tr 0(240,%r8),0(%r10) - stidp __LC_CPUID # Are we running on VM maybe - cli __LC_CPUID,0xff - bnz .test - .long 0x83300060 # diag 3,0,x'0060' - storage size - b .done -.test: - mvc 0x68(8),.pgmnw # set up pgm check handler - l %r2,.fourmeg - lr %r3,%r2 - bctr %r3,%r0 # 4M-1 -.loop: iske %r0,%r3 - ar %r3,%r2 -.pgmx: - sr %r3,%r2 - la %r3,1(%r3) -.done: - l %r1,.memsize - st %r3,4(%r1) - slr %r0,%r0 - st %r0,INITRD_SIZE+4-PARMAREA(%r11) - st %r0,INITRD_START+4-PARMAREA(%r11) - j startup # continue with startup -.tbl: .long _ebcasc # translate table -.cmd: .long COMMAND_LINE # address of command line buffer -.parm: .long PARMAREA -.fourmeg: .long 0x00400000 # 4M -.pgmnw: .long 0x00080000,.pgmx -.memsize: .long memory_size -.lowcase: - .byte 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07 - .byte 0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f - .byte 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17 - .byte 0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f - .byte 0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27 - .byte 0x28,0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f - .byte 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37 - .byte 0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f - .byte 0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47 - .byte 0x48,0x49,0x4a,0x4b,0x4c,0x4d,0x4e,0x4f - .byte 0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57 - .byte 0x58,0x59,0x5a,0x5b,0x5c,0x5d,0x5e,0x5f - .byte 0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67 - .byte 0x68,0x69,0x6a,0x6b,0x6c,0x6d,0x6e,0x6f - .byte 0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77 - .byte 0x78,0x79,0x7a,0x7b,0x7c,0x7d,0x7e,0x7f - - .byte 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87 - .byte 0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f - .byte 0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97 - .byte 0x98,0x99,0x9a,0x9b,0x9c,0x9d,0x9e,0x9f - .byte 0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7 - .byte 0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf - .byte 0xb0,0xb1,0xb2,0xb3,0xb4,0xb5,0xb6,0xb7 - .byte 0xb8,0xb9,0xba,0xbb,0xbc,0xbd,0xbe,0xbf - .byte 0xc0,0x81,0x82,0x83,0x84,0x85,0x86,0x87 # .abcdefg - .byte 0x88,0x89,0xca,0xcb,0xcc,0xcd,0xce,0xcf # hi - .byte 0xd0,0x91,0x92,0x93,0x94,0x95,0x96,0x97 # .jklmnop - .byte 0x98,0x99,0xda,0xdb,0xdc,0xdd,0xde,0xdf # qr - .byte 0xe0,0xe1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7 # ..stuvwx - .byte 0xa8,0xa9,0xea,0xeb,0xec,0xed,0xee,0xef # yz - .byte 0xf0,0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7 - .byte 0xf8,0xf9,0xfa,0xfb,0xfc,0xfd,0xfe,0xff - -# -# startup-code at 0x10000, running in real mode -# this is called either by the ipl loader or directly by PSW restart -# or linload or SALIPL -# - .org 0x10000 -startup:basr %r13,0 # get base -.LPG1: sll %r13,1 # remove high order bit - srl %r13,1 - lhi %r1,1 # mode 1 = esame - slr %r0,%r0 # set cpuid to zero - sigp %r1,%r0,0x12 # switch to esame mode - sam64 # switch to 64 bit mode - lctlg %c0,%c15,.Lctl-.LPG1(%r13) # load control registers - larl %r12,_pstart # pointer to parameter area - # move IPL device to lowcore - mvc __LC_IPLDEV(4),IPL_DEVICE+4-PARMAREA(%r12) - -# -# clear bss memory -# - larl %r2,__bss_start # start of bss segment - larl %r3,_end # end of bss segment - sgr %r3,%r2 # length of bss - sgr %r4,%r4 # - sgr %r5,%r5 # set src,length and pad to zero - mvcle %r2,%r4,0 # clear mem - jo .-4 # branch back, if not finish - - # set program check new psw mask - mvc __LC_PGM_NEW_PSW(8),.Lpcmsk-.LPG1(%r13) - -# -# find memory chunks. -# - larl %r1,.Lchkmem # set program check address - stg %r1,__LC_PGM_NEW_PSW+8 - la %r1,1 # test in increments of 128KB - sllg %r1,%r1,17 - larl %r3,memory_chunk - slgr %r4,%r4 # set start of chunk to zero - slgr %r5,%r5 # set end of chunk to zero - slr %r6,%r6 # set access code to zero -.Lloop: - tprot 0(%r5),0 # test protection of first byte - ipm %r7 - srl %r7,28 - clr %r6,%r7 # compare cc with last access code - je .Lsame - clgr %r4,%r5 # chunk size > 0? - je .Lsize0 - stg %r4,0(%r3) # store start address of chunk - lgr %r0,%r5 - slgr %r0,%r4 - stg %r0,8(%r3) # store size of chunk - st %r6,20(%r3) # store type of chunk - la %r3,24(%r3) - lgr %r4,%r5 # set start to end - larl %r8,memory_size - stg %r5,0(%r8) # store memory size -.Lsize0: - lr %r6,%r7 # set access code to last cc -.Lsame: - algr %r5,%r1 # add 128KB to end of chunk - brc 12,.Lloop -.Lchkmem: # > 16EB or tprot got a program check - clgr %r4,%r5 # chunk size > 0? - je .Ldonemem - stg %r4,0(%r3) # store start address of chunk - lgr %r0,%r5 - slgr %r0,%r4 - stg %r0,8(%r3) # store size of chunk - st %r6,20(%r3) # store type of chunk - la %r3,24(%r3) - lgr %r4,%r5 - larl %r8,memory_size - stg %r5,0(%r8) # store memory size -# -# Running native the HSA is located at 2GB and we will get an -# addressing exception trying to access it. We have to restart -# the scan at 2GB to find out if the machine has more than 2GB. -# - lghi %r4,1 - sllg %r4,%r4,31 - clgr %r5,%r4 - jhe .Ldonemem - lgr %r5,%r4 - j .Lloop -.Ldonemem: - - larl %r12,machine_flags -# -# find out if we are running under VM -# - stidp __LC_CPUID # store cpuid - tm __LC_CPUID,0xff # running under VM ? - bno 0f-.LPG1(%r13) - oi 7(%r12),1 # set VM flag -0: lh %r0,__LC_CPUID+4 # get cpu version - chi %r0,0x7490 # running on a P/390 ? - bne 1f-.LPG1(%r13) - oi 7(%r12),4 # set P/390 flag -1: - -# -# find out if we have the MVPG instruction -# - la %r1,0f-.LPG1(%r13) # set program check address - stg %r1,__LC_PGM_NEW_PSW+8 - sgr %r0,%r0 - lghi %r1,0 - lghi %r2,0 - mvpg %r1,%r2 # test MVPG instruction - oi 7(%r12),16 # set MVPG flag -0: - -# -# find out if the diag 0x44 works in 64 bit mode -# - la %r1,0f-.LPG1(%r13) # set program check address - stg %r1,__LC_PGM_NEW_PSW+8 - mvc __LC_DIAG44_OPCODE(8),.Lnop-.LPG1(%r13) - diag 0,0,0x44 # test diag 0x44 - oi 7(%r12),32 # set diag44 flag - mvc __LC_DIAG44_OPCODE(8),.Ldiag44-.LPG1(%r13) -0: - - lpswe .Lentry-.LPG1(13) # jump to _stext in primary-space, - # virtual and never return ... - .align 16 -.Lentry:.quad 0x0000000180000000,_stext -.Lctl: .quad 0x04b50002 # cr0: various things - .quad 0 # cr1: primary space segment table - .quad .Lduct # cr2: dispatchable unit control table - .quad 0 # cr3: instruction authorization - .quad 0 # cr4: instruction authorization - .quad 0 # cr5: various things - .quad 0 # cr6: I/O interrupts - .quad 0 # cr7: secondary space segment table - .quad 0 # cr8: access registers translation - .quad 0 # cr9: tracing off - .quad 0 # cr10: tracing off - .quad 0 # cr11: tracing off - .quad 0 # cr12: tracing off - .quad 0 # cr13: home space segment table - .quad 0xc0000000 # cr14: machine check handling off - .quad 0 # cr15: linkage stack operations -.Lpcmsk:.quad 0x0000000180000000 -.L4malign:.quad 0xffffffffffc00000 -.Lscan2g:.quad 0x80000000 + 0x20000 - 8 # 2GB + 128K - 8 -.Lnop: .long 0x07000700 -.Ldiag44:.long 0x83000044 - - .org PARMAREA-64 -.Lduct: .long 0,0,0,0,0,0,0,0 - .long 0,0,0,0,0,0,0,0 - -# -# params at 10400 (setup.h) -# - .org PARMAREA - .global _pstart -_pstart: - .quad 0 # IPL_DEVICE - .quad RAMDISK_ORIGIN # INITRD_START - .quad RAMDISK_SIZE # INITRD_SIZE - - .org COMMAND_LINE - .byte "root=/dev/ram0 ro" - .byte 0 - .org 0x11000 - .global _pend -_pend: - -#ifdef CONFIG_SHARED_KERNEL - .org 0x100000 -#endif - -# -# startup-code, running in virtual mode -# - .globl _stext -_stext: basr %r13,0 # get base -.LPG2: -# -# Setup stack -# - larl %r15,init_thread_union - aghi %r15,16384 # init_task_union + 16384 - stg %r15,__LC_KERNEL_STACK # set end of kernel stack - aghi %r15,-160 - xc 0(8,%r15),0(%r15) # set backchain to zero - -# check control registers - stctg %c0,%c15,0(%r15) - oi 6(%r15),0x20 # enable sigp external interrupts - oi 4(%r15),0x10 # switch on low address proctection - lctlg %c0,%c15,0(%r15) - -# - lam 0,15,.Laregs-.LPG2(%r13) # load access regs needed by uaccess - brasl %r14,start_kernel # go to C code -# -# We returned from start_kernel ?!? PANIK -# - basr %r13,0 - lpswe .Ldw-.(%r13) # load disabled wait psw -# - .align 8 -.Ldw: .quad 0x0002000180000000,0x0000000000000000 -.Laregs: .long 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - diff --git a/arch/s390x/kernel/ieee.h b/arch/s390x/kernel/ieee.h deleted file mode 100644 index ef7cc29de576c..0000000000000 --- a/arch/s390x/kernel/ieee.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * arch/s390/kernel/ieee.h - * - * S390 version - * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation - * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com), - */ - -#include - -static inline void _adddf(int R1,int R2) -{ - current->tss.fprs[R1].fd = current->tss.fprs[R1].fd + - current->tss.fprs[R2].fd; -} - -static inline void _subdf(int R1,int R2) -{ - current->tss.fprs[R1].fd = current->tss.fprs[R1].fd - - current->tss.fprs[R2].fd; -} - -static inline void _muldf(int R1,int R2) -{ - current->tss.fprs[R1].fd = current->tss.fprs[R1].fd * - current->tss.fprs[R2].fd; -} - -static inline void _divdf(int R1,int R2) -{ - current->tss.fprs[R1].fd = current->tss.fprs[R1].fd / - current->tss.fprs[R2].fd; -} - -static inline void _negdf(int R1,int R2) -{ - current->tss.fprs[R1].fd = -current->tss.fprs[R1].fd; -} - -static inline void _fixdfsi(int R1,int R2) -{ - current->tss.regs->gprs[R1] = (__u32) current->tss.fprs[R2].fd; -} - -static inline void _extendsidf(int R1,int R2) -{ - current->tss.fprs[R1].fd = (double) current->tss.regs->gprs[R2]; -} - - -static inline void _addsf(int R1,int R2) -{ - current->tss.fprs[R1].ff = current->tss.fprs[R1].ff + - current->tss.fprs[R2].ff; -} - -static inline void _subsf(int R1,int R2) -{ - current->tss.fprs[R1].ff = current->tss.fprs[R1].ff - - current->tss.fprs[R2].ff; -} - -static inline void _mulsf(int R1,int R2) -{ - current->tss.fprs[R1].ff = current->tss.fprs[R1].ff * - current->tss.fprs[R2].ff; -} - -static inline void _divsf(int R1,int R2) -{ - current->tss.fprs[R1].ff = current->tss.fprs[R1].ff / - current->tss.fprs[R2].ff; -} - -static inline void _negsf(int R1,int R2) -{ - current->tss.fprs[R1].ff = -current->tss.fprs[R1].ff; -} - -static inline void _fixsfsi(int R1,int R2) -{ - current->tss.regs->gprs[R1] = (__u32) current->tss.fprs[R2].ff; -} - -static inline void _extendsisf(int R1,int R2) -{ - current->tss.fprs[R1].ff = (double) current->tss.regs->gprs[R2]; -} - - diff --git a/arch/s390x/kernel/init_task.c b/arch/s390x/kernel/init_task.c deleted file mode 100644 index efab42c45fb8d..0000000000000 --- a/arch/s390x/kernel/init_task.c +++ /dev/null @@ -1,39 +0,0 @@ -/* - * arch/s390/kernel/init_task.c - * - * S390 version - * - * Derived from "arch/i386/kernel/init_task.c" - */ - -#include -#include -#include - -#include -#include - -static struct fs_struct init_fs = INIT_FS; -static struct files_struct init_files = INIT_FILES; -static struct signal_struct init_signals = INIT_SIGNALS(init_signals); -static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); -struct mm_struct init_mm = INIT_MM(init_mm); - -/* - * Initial thread structure. - * - * We need to make sure that this is 8192-byte aligned due to the - * way process stacks are handled. This is done by having a special - * "init_task" linker map entry.. - */ -union thread_union init_thread_union - __attribute__((__section__(".data.init_task"))) = - { INIT_THREAD_INFO(init_task) }; - -/* - * Initial task structure. - * - * All other task structs will be allocated on slabs in fork.c - */ -struct task_struct init_task = INIT_TASK(init_task); - diff --git a/arch/s390x/kernel/ioctl32.c b/arch/s390x/kernel/ioctl32.c deleted file mode 100644 index 0dfef815cd091..0000000000000 --- a/arch/s390x/kernel/ioctl32.c +++ /dev/null @@ -1,1083 +0,0 @@ -/* - * ioctl32.c: Conversion between 32bit and 64bit native ioctls. - * - * S390 version - * Copyright (C) 2000 IBM Deutschland Entwicklung GmbH, IBM Corporation - * Author(s): Gerhard Tonn (ton@de.ibm.com) - * - * Heavily inspired by the 32-bit Sparc compat code which is - * Copyright (C) 2000 Silicon Graphics, Inc. - * Written by Ulf Carlsson (ulfc@engr.sgi.com) - * - */ - -#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 "linux32.h" - -long sys_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg); - -struct hd_geometry32 { - unsigned char heads; - unsigned char sectors; - unsigned short cylinders; - __u32 start; -}; - -static inline int hd_geometry_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg) -{ - struct hd_geometry32 *hg32 = (struct hd_geometry32 *) A(arg); - struct hd_geometry hg; - int ret; - mm_segment_t old_fs = get_fs(); - - set_fs (KERNEL_DS); - ret = sys_ioctl (fd, cmd, (long)&hg); - set_fs (old_fs); - - if (ret) - return ret; - - ret = put_user (hg.heads, &(hg32->heads)); - ret |= __put_user (hg.sectors, &(hg32->sectors)); - ret |= __put_user (hg.cylinders, &(hg32->cylinders)); - ret |= __put_user (hg.start, &(hg32->start)); - - return ret; -} - -#define EXT2_IOC32_GETFLAGS _IOR('f', 1, int) -#define EXT2_IOC32_SETFLAGS _IOW('f', 2, int) -#define EXT2_IOC32_GETVERSION _IOR('v', 1, int) -#define EXT2_IOC32_SETVERSION _IOW('v', 2, int) - -struct ifmap32 { - unsigned int mem_start; - unsigned int mem_end; - unsigned short base_addr; - unsigned char irq; - unsigned char dma; - unsigned char port; -}; - -struct ifreq32 { -#define IFHWADDRLEN 6 -#define IFNAMSIZ 16 - union { - char ifrn_name[IFNAMSIZ]; /* if name, e.g. "en0" */ - } ifr_ifrn; - union { - struct sockaddr ifru_addr; - struct sockaddr ifru_dstaddr; - struct sockaddr ifru_broadaddr; - struct sockaddr ifru_netmask; - struct sockaddr ifru_hwaddr; - short ifru_flags; - int ifru_ivalue; - int ifru_mtu; - struct ifmap32 ifru_map; - char ifru_slave[IFNAMSIZ]; /* Just fits the size */ - char ifru_newname[IFNAMSIZ]; - __u32 ifru_data; - } ifr_ifru; -}; - -struct ifconf32 { - int ifc_len; /* size of buffer */ - __u32 ifcbuf; -}; - -static int dev_ifname32(unsigned int fd, unsigned int cmd, unsigned long arg) -{ - struct ireq32 *uir32 = (struct ireq32 *) A(arg); - struct net_device *dev; - struct ifreq32 ifr32; - - if (copy_from_user(&ifr32, uir32, sizeof(struct ifreq32))) - return -EFAULT; - - read_lock(&dev_base_lock); - dev = __dev_get_by_index(ifr32.ifr_ifindex); - if (!dev) { - read_unlock(&dev_base_lock); - return -ENODEV; - } - - strcpy(ifr32.ifr_name, dev->name); - read_unlock(&dev_base_lock); - - if (copy_to_user(uir32, &ifr32, sizeof(struct ifreq32))) - return -EFAULT; - - return 0; -} - -static inline int dev_ifconf(unsigned int fd, unsigned int cmd, - unsigned long arg) -{ - struct ioconf32 *uifc32 = (struct ioconf32 *) A(arg); - struct ifconf32 ifc32; - struct ifconf ifc; - struct ifreq32 *ifr32; - struct ifreq *ifr; - mm_segment_t old_fs; - int len; - int err; - - if (copy_from_user(&ifc32, uifc32, sizeof(struct ifconf32))) - return -EFAULT; - - if(ifc32.ifcbuf == 0) { - ifc32.ifc_len = 0; - ifc.ifc_len = 0; - ifc.ifc_buf = NULL; - } else { - ifc.ifc_len = ((ifc32.ifc_len / sizeof (struct ifreq32))) * - sizeof (struct ifreq); - ifc.ifc_buf = kmalloc (ifc.ifc_len, GFP_KERNEL); - if (!ifc.ifc_buf) - return -ENOMEM; - } - ifr = ifc.ifc_req; - ifr32 = (struct ifreq32 *) A(ifc32.ifcbuf); - len = ifc32.ifc_len / sizeof (struct ifreq32); - while (len--) { - if (copy_from_user(ifr++, ifr32++, sizeof (struct ifreq32))) { - err = -EFAULT; - goto out; - } - } - - old_fs = get_fs(); - set_fs (KERNEL_DS); - err = sys_ioctl (fd, SIOCGIFCONF, (unsigned long)&ifc); - set_fs (old_fs); - if (err) - goto out; - - ifr = ifc.ifc_req; - ifr32 = (struct ifreq32 *) A(ifc32.ifcbuf); - len = ifc.ifc_len / sizeof (struct ifreq); - ifc32.ifc_len = len * sizeof (struct ifreq32); - - while (len--) { - if (copy_to_user(ifr32++, ifr++, sizeof (struct ifreq32))) { - err = -EFAULT; - goto out; - } - } - - if (copy_to_user(uifc32, &ifc32, sizeof(struct ifconf32))) { - err = -EFAULT; - goto out; - } -out: - if(ifc.ifc_buf != NULL) - kfree (ifc.ifc_buf); - return err; -} - -static int bond_ioctl(unsigned long fd, unsigned int cmd, unsigned long arg) -{ - struct ifreq ifr; - mm_segment_t old_fs; - int err, len; - u32 data; - - if (copy_from_user(&ifr, (struct ifreq32 *)arg, sizeof(struct ifreq32))) - return -EFAULT; - ifr.ifr_data = (__kernel_caddr_t)get_zeroed_page(GFP_KERNEL); - if (!ifr.ifr_data) - return -EAGAIN; - - switch (cmd) { - case SIOCBONDENSLAVE: - case SIOCBONDRELEASE: - case SIOCBONDSETHWADDR: - case SIOCBONDCHANGEACTIVE: - len = IFNAMSIZ * sizeof(char); - break; - case SIOCBONDSLAVEINFOQUERY: - len = sizeof(struct ifslave); - break; - case SIOCBONDINFOQUERY: - len = sizeof(struct ifbond); - break; - default: - err = -EINVAL; - goto out; - }; - - __get_user(data, &(((struct ifreq32 *)arg)->ifr_ifru.ifru_data)); - if (copy_from_user(ifr.ifr_data, (char *)A(data), len)) { - err = -EFAULT; - goto out; - } - - old_fs = get_fs(); - set_fs (KERNEL_DS); - err = sys_ioctl (fd, cmd, (unsigned long)&ifr); - set_fs (old_fs); - if (!err) { - len = copy_to_user((char *)A(data), ifr.ifr_data, len); - if (len) - err = -EFAULT; - } - -out: - free_page((unsigned long)ifr.ifr_data); - return err; -} - -static inline int dev_ifsioc(unsigned int fd, unsigned int cmd, - unsigned long arg) -{ - struct ifreq32 *uifr = (struct ifreq32 *) A(arg); - struct ifreq ifr; - mm_segment_t old_fs; - int err; - - switch (cmd) { - case SIOCSIFMAP: - err = copy_from_user(&ifr, uifr, sizeof(ifr.ifr_name)); - err |= __get_user(ifr.ifr_map.mem_start, &(uifr->ifr_ifru.ifru_map.mem_start)); - err |= __get_user(ifr.ifr_map.mem_end, &(uifr->ifr_ifru.ifru_map.mem_end)); - err |= __get_user(ifr.ifr_map.base_addr, &(uifr->ifr_ifru.ifru_map.base_addr)); - err |= __get_user(ifr.ifr_map.irq, &(uifr->ifr_ifru.ifru_map.irq)); - err |= __get_user(ifr.ifr_map.dma, &(uifr->ifr_ifru.ifru_map.dma)); - err |= __get_user(ifr.ifr_map.port, &(uifr->ifr_ifru.ifru_map.port)); - if (err) - return -EFAULT; - break; - default: - if (copy_from_user(&ifr, uifr, sizeof(struct ifreq32))) - return -EFAULT; - break; - } - old_fs = get_fs(); - set_fs (KERNEL_DS); - err = sys_ioctl (fd, cmd, (unsigned long)&ifr); - set_fs (old_fs); - if (!err) { - switch (cmd) { - case SIOCGIFFLAGS: - case SIOCGIFMETRIC: - case SIOCGIFMTU: - case SIOCGIFMEM: - case SIOCGIFHWADDR: - case SIOCGIFINDEX: - case SIOCGIFADDR: - case SIOCGIFBRDADDR: - case SIOCGIFDSTADDR: - case SIOCGIFNETMASK: - case SIOCGIFTXQLEN: - if (copy_to_user(uifr, &ifr, sizeof(struct ifreq32))) - return -EFAULT; - break; - case SIOCGIFMAP: - err = copy_to_user(uifr, &ifr, sizeof(ifr.ifr_name)); - err |= __put_user(ifr.ifr_map.mem_start, &(uifr->ifr_ifru.ifru_map.mem_start)); - err |= __put_user(ifr.ifr_map.mem_end, &(uifr->ifr_ifru.ifru_map.mem_end)); - err |= __put_user(ifr.ifr_map.base_addr, &(uifr->ifr_ifru.ifru_map.base_addr)); - err |= __put_user(ifr.ifr_map.irq, &(uifr->ifr_ifru.ifru_map.irq)); - err |= __put_user(ifr.ifr_map.dma, &(uifr->ifr_ifru.ifru_map.dma)); - err |= __put_user(ifr.ifr_map.port, &(uifr->ifr_ifru.ifru_map.port)); - if (err) - err = -EFAULT; - break; - } - } - return err; -} - -struct rtentry32 -{ - unsigned int rt_pad1; - struct sockaddr rt_dst; /* target address */ - struct sockaddr rt_gateway; /* gateway addr (RTF_GATEWAY) */ - struct sockaddr rt_genmask; /* target network mask (IP) */ - unsigned short rt_flags; - short rt_pad2; - unsigned int rt_pad3; - unsigned int rt_pad4; - short rt_metric; /* +1 for binary compatibility! */ - unsigned int rt_dev; /* forcing the device at add */ - unsigned int rt_mtu; /* per route MTU/Window */ -#ifndef __KERNEL__ -#define rt_mss rt_mtu /* Compatibility :-( */ -#endif - unsigned int rt_window; /* Window clamping */ - unsigned short rt_irtt; /* Initial RTT */ -}; - -static inline int routing_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg) -{ - struct rtentry32 *ur = (struct rtentry32 *) A(arg); - struct rtentry r; - char devname[16]; - u32 rtdev; - int ret; - mm_segment_t old_fs = get_fs(); - - ret = copy_from_user (&r.rt_dst, &(ur->rt_dst), 3 * sizeof(struct sockaddr)); - ret |= __get_user (r.rt_flags, &(ur->rt_flags)); - ret |= __get_user (r.rt_metric, &(ur->rt_metric)); - ret |= __get_user (r.rt_mtu, &(ur->rt_mtu)); - ret |= __get_user (r.rt_window, &(ur->rt_window)); - ret |= __get_user (r.rt_irtt, &(ur->rt_irtt)); - ret |= __get_user (rtdev, &(ur->rt_dev)); - if (rtdev) { - ret |= copy_from_user (devname, (char *) A(rtdev), 15); - r.rt_dev = devname; devname[15] = 0; - } else - r.rt_dev = 0; - if (ret) - return -EFAULT; - set_fs (KERNEL_DS); - ret = sys_ioctl (fd, cmd, (long)&r); - set_fs (old_fs); - return ret; -} - -static int do_ext2_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg) -{ - /* These are just misnamed, they actually get/put from/to user an int */ - switch (cmd) { - case EXT2_IOC32_GETFLAGS: cmd = EXT2_IOC_GETFLAGS; break; - case EXT2_IOC32_SETFLAGS: cmd = EXT2_IOC_SETFLAGS; break; - case EXT2_IOC32_GETVERSION: cmd = EXT2_IOC_GETVERSION; break; - case EXT2_IOC32_SETVERSION: cmd = EXT2_IOC_SETVERSION; break; - } - return sys_ioctl(fd, cmd, arg); -} - - -struct loop_info32 { - int lo_number; /* ioctl r/o */ - compat_dev_t lo_device; /* ioctl r/o */ - unsigned int lo_inode; /* ioctl r/o */ - compat_dev_t lo_rdevice; /* ioctl r/o */ - int lo_offset; - int lo_encrypt_type; - int lo_encrypt_key_size; /* ioctl w/o */ - int lo_flags; /* ioctl r/o */ - char lo_name[LO_NAME_SIZE]; - unsigned char lo_encrypt_key[LO_KEY_SIZE]; /* ioctl w/o */ - unsigned int lo_init[2]; - char reserved[4]; -}; - -static int loop_status(unsigned int fd, unsigned int cmd, unsigned long arg) -{ - mm_segment_t old_fs = get_fs(); - struct loop_info l; - int err = -EINVAL; - - switch(cmd) { - case LOOP_SET_STATUS: - err = get_user(l.lo_number, &((struct loop_info32 *)arg)->lo_number); - err |= __get_user(l.lo_device, &((struct loop_info32 *)arg)->lo_device); - err |= __get_user(l.lo_inode, &((struct loop_info32 *)arg)->lo_inode); - err |= __get_user(l.lo_rdevice, &((struct loop_info32 *)arg)->lo_rdevice); - err |= __copy_from_user((char *)&l.lo_offset, (char *)&((struct loop_info32 *)arg)->lo_offset, - 8 + (unsigned long)l.lo_init - (unsigned long)&l.lo_offset); - if (err) { - err = -EFAULT; - } else { - set_fs (KERNEL_DS); - err = sys_ioctl (fd, cmd, (unsigned long)&l); - set_fs (old_fs); - } - break; - case LOOP_GET_STATUS: - set_fs (KERNEL_DS); - err = sys_ioctl (fd, cmd, (unsigned long)&l); - set_fs (old_fs); - if (!err) { - err = put_user(l.lo_number, &((struct loop_info32 *)arg)->lo_number); - err |= __put_user(l.lo_device, &((struct loop_info32 *)arg)->lo_device); - err |= __put_user(l.lo_inode, &((struct loop_info32 *)arg)->lo_inode); - err |= __put_user(l.lo_rdevice, &((struct loop_info32 *)arg)->lo_rdevice); - err |= __copy_to_user((char *)&((struct loop_info32 *)arg)->lo_offset, - (char *)&l.lo_offset, (unsigned long)l.lo_init - (unsigned long)&l.lo_offset); - if (err) - err = -EFAULT; - } - break; - default: { - static int count = 0; - if (++count <= 20) - printk("%s: Unknown loop ioctl cmd, fd(%d) " - "cmd(%08x) arg(%08lx)\n", - __FUNCTION__, fd, cmd, arg); - } - } - return err; -} - - -struct blkpg_ioctl_arg32 { - int op; - int flags; - int datalen; - u32 data; -}; - -static int blkpg_ioctl_trans(unsigned int fd, unsigned int cmd, struct blkpg_ioctl_arg32 *arg) -{ - struct blkpg_ioctl_arg a; - struct blkpg_partition p; - int err; - mm_segment_t old_fs = get_fs(); - - err = get_user(a.op, &arg->op); - err |= __get_user(a.flags, &arg->flags); - err |= __get_user(a.datalen, &arg->datalen); - err |= __get_user((long)a.data, &arg->data); - if (err) return err; - switch (a.op) { - case BLKPG_ADD_PARTITION: - case BLKPG_DEL_PARTITION: - if (a.datalen < sizeof(struct blkpg_partition)) - return -EINVAL; - if (copy_from_user(&p, a.data, sizeof(struct blkpg_partition))) - return -EFAULT; - a.data = &p; - set_fs (KERNEL_DS); - err = sys_ioctl(fd, cmd, (unsigned long)&a); - set_fs (old_fs); - default: - return -EINVAL; - } - return err; -} - - -typedef struct ica_z90_status_t { - int totalcount; - int leedslitecount; - int leeds2count; - int requestqWaitCount; - int pendingqWaitCount; - int totalOpenCount; - int cryptoDomain; - unsigned char status[64]; - unsigned char qdepth[64]; -} ica_z90_status; - -typedef struct _ica_rsa_modexpo { - char *inputdata; - unsigned int inputdatalength; - char *outputdata; - unsigned int outputdatalength; - char *b_key; - char *n_modulus; -} ica_rsa_modexpo_t; - -typedef struct _ica_rsa_modexpo_32 { - u32 inputdata; - u32 inputdatalength; - u32 outputdata; - u32 outputdatalength; - u32 b_key; - u32 n_modulus; -} ica_rsa_modexpo_32_t; - -typedef struct _ica_rsa_modexpo_crt { - char *inputdata; - unsigned int inputdatalength; - char *outputdata; - unsigned int outputdatalength; - char *bp_key; - char *bq_key; - char *np_prime; - char *nq_prime; - char *u_mult_inv; -} ica_rsa_modexpo_crt_t; - -typedef struct _ica_rsa_modexpo_crt_32 { - u32 inputdata; - u32 inputdatalength; - u32 outputdata; - u32 outputdatalength; - u32 bp_key; - u32 bq_key; - u32 np_prime; - u32 nq_prime; - u32 u_mult_inv; -} ica_rsa_modexpo_crt_32_t; - -#define ICA_IOCTL_MAGIC 'z' -#define ICARSAMODEXPO _IOC(_IOC_READ|_IOC_WRITE, ICA_IOCTL_MAGIC, 0x05, 0) -#define ICARSACRT _IOC(_IOC_READ|_IOC_WRITE, ICA_IOCTL_MAGIC, 0x06, 0) -#define ICARSAMODMULT _IOC(_IOC_READ|_IOC_WRITE, ICA_IOCTL_MAGIC, 0x07, 0) -#define ICAZ90STATUS _IOC(_IOC_READ, ICA_IOCTL_MAGIC, 0x10, sizeof(ica_z90_status)) -#define ICAZ90QUIESCE _IOC(_IOC_NONE, ICA_IOCTL_MAGIC, 0x11, 0) -#define ICAZ90HARDRESET _IOC(_IOC_NONE, ICA_IOCTL_MAGIC, 0x12, 0) -#define ICAZ90HARDERROR _IOC(_IOC_NONE, ICA_IOCTL_MAGIC, 0x13, 0) - -static int do_rsa_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg) -{ - mm_segment_t old_fs = get_fs(); - int err = 0; - ica_rsa_modexpo_t rsa; - ica_rsa_modexpo_32_t *rsa32 = (ica_rsa_modexpo_32_t *)arg; - u32 inputdata, outputdata, b_key, n_modulus; - - memset (&rsa, 0, sizeof(rsa)); - - err |= __get_user (inputdata, &rsa32->inputdata); - err |= __get_user (rsa.inputdatalength, &rsa32->inputdatalength); - err |= __get_user (outputdata, &rsa32->outputdata); - err |= __get_user (rsa.outputdatalength, &rsa32->outputdatalength); - err |= __get_user (b_key, &rsa32->b_key); - err |= __get_user (n_modulus, &rsa32->n_modulus); - if (err) - return -EFAULT; - - rsa.inputdata = (char *)kmalloc(rsa.inputdatalength, GFP_KERNEL); - if (!rsa.inputdata) { - err = -ENOMEM; - goto cleanup; - } - if (copy_from_user(rsa.inputdata, (char *)(u64)(inputdata & 0x7fffffff), - rsa.inputdatalength)) { - err = -EFAULT; - goto cleanup; - } - - rsa.outputdata = (char *)kmalloc(rsa.outputdatalength, GFP_KERNEL); - if (!rsa.outputdata) { - err = -ENOMEM; - goto cleanup; - } - - rsa.b_key = (char *)kmalloc(rsa.inputdatalength, GFP_KERNEL); - if (!rsa.b_key) { - err = -ENOMEM; - goto cleanup; - } - if (copy_from_user(rsa.b_key, (char *)(u64)(b_key & 0x7fffffff), - rsa.inputdatalength)) { - err = -EFAULT; - goto cleanup; - } - - rsa.n_modulus = (char *)kmalloc(rsa.inputdatalength, GFP_KERNEL); - if (!rsa.n_modulus) { - err = -ENOMEM; - goto cleanup; - } - if (copy_from_user(rsa.n_modulus, (char *)(u64)(n_modulus & 0x7fffffff), - rsa.inputdatalength)) { - err = -EFAULT; - goto cleanup; - } - - set_fs(KERNEL_DS); - err = sys_ioctl(fd, cmd, (unsigned long)&rsa); - set_fs(old_fs); - if (err < 0) - goto cleanup; - - if (copy_to_user((char *)(u64)(outputdata & 0x7fffffff), rsa.outputdata, - rsa.outputdatalength)) - err = -EFAULT; - -cleanup: - if (rsa.inputdata) - kfree(rsa.inputdata); - if (rsa.outputdata) - kfree(rsa.outputdata); - if (rsa.b_key) - kfree(rsa.b_key); - if (rsa.n_modulus) - kfree(rsa.n_modulus); - - return err; -} - -static int do_rsa_crt_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg) -{ - mm_segment_t old_fs = get_fs(); - int err = 0; - ica_rsa_modexpo_crt_t rsa; - ica_rsa_modexpo_crt_32_t *rsa32 = (ica_rsa_modexpo_crt_32_t *)arg; - u32 inputdata, outputdata, bp_key, bq_key, np_prime, nq_prime, u_mult_inv; - - memset (&rsa, 0, sizeof(rsa)); - - err |= __get_user (inputdata, &rsa32->inputdata); - err |= __get_user (rsa.inputdatalength, &rsa32->inputdatalength); - err |= __get_user (outputdata, &rsa32->outputdata); - err |= __get_user (rsa.outputdatalength, &rsa32->outputdatalength); - err |= __get_user (bp_key, &rsa32->bp_key); - err |= __get_user (bq_key, &rsa32->bq_key); - err |= __get_user (np_prime, &rsa32->np_prime); - err |= __get_user (nq_prime, &rsa32->nq_prime); - err |= __get_user (u_mult_inv, &rsa32->u_mult_inv); - if (err) - return -EFAULT; - - rsa.inputdata = (char *)kmalloc(rsa.inputdatalength, GFP_KERNEL); - if (!rsa.inputdata) { - err = -ENOMEM; - goto cleanup; - } - if (copy_from_user(rsa.inputdata, (char *)(u64)(inputdata & 0x7fffffff), - rsa.inputdatalength)) { - err = -EFAULT; - goto cleanup; - } - - rsa.outputdata = (char *)kmalloc(rsa.outputdatalength, GFP_KERNEL); - if (!rsa.outputdata) { - err = -ENOMEM; - goto cleanup; - } - - rsa.bp_key = (char *)kmalloc(rsa.inputdatalength/2 + 8, GFP_KERNEL); - if (!rsa.bp_key) { - err = -ENOMEM; - goto cleanup; - } - if (copy_from_user(rsa.bp_key, (char *)(u64)(bp_key & 0x7fffffff), - rsa.inputdatalength/2 + 8)) { - err = -EFAULT; - goto cleanup; - } - - rsa.bq_key = (char *)kmalloc(rsa.inputdatalength/2, GFP_KERNEL); - if (!rsa.bq_key) { - err = -ENOMEM; - goto cleanup; - } - if (copy_from_user(rsa.bq_key, (char *)(u64)(bq_key & 0x7fffffff), - rsa.inputdatalength/2)) { - err = -EFAULT; - goto cleanup; - } - - rsa.np_prime = (char *)kmalloc(rsa.inputdatalength/2 + 8, GFP_KERNEL); - if (!rsa.np_prime) { - err = -ENOMEM; - goto cleanup; - } - if (copy_from_user(rsa.np_prime, (char *)(u64)(np_prime & 0x7fffffff), - rsa.inputdatalength/2 + 8)) { - err = -EFAULT; - goto cleanup; - } - - rsa.nq_prime = (char *)kmalloc(rsa.inputdatalength/2, GFP_KERNEL); - if (!rsa.nq_prime) { - err = -ENOMEM; - goto cleanup; - } - if (copy_from_user(rsa.nq_prime, (char *)(u64)(nq_prime & 0x7fffffff), - rsa.inputdatalength/2)) { - err = -EFAULT; - goto cleanup; - } - - rsa.u_mult_inv = (char *)kmalloc(rsa.inputdatalength/2 + 8, GFP_KERNEL); - if (!rsa.u_mult_inv) { - err = -ENOMEM; - goto cleanup; - } - if (copy_from_user(rsa.u_mult_inv, (char *)(u64)(u_mult_inv & 0x7fffffff), - rsa.inputdatalength/2 + 8)) { - err = -EFAULT; - goto cleanup; - } - - set_fs(KERNEL_DS); - err = sys_ioctl(fd, cmd, (unsigned long)&rsa); - set_fs(old_fs); - if (err < 0) - goto cleanup; - - if (copy_to_user((char *)(u64)(outputdata & 0x7fffffff), rsa.outputdata, - rsa.outputdatalength)) - err = -EFAULT; - -cleanup: - if (rsa.inputdata) - kfree(rsa.inputdata); - if (rsa.outputdata) - kfree(rsa.outputdata); - if (rsa.bp_key) - kfree(rsa.bp_key); - if (rsa.bq_key) - kfree(rsa.bq_key); - if (rsa.np_prime) - kfree(rsa.np_prime); - if (rsa.nq_prime) - kfree(rsa.nq_prime); - if (rsa.u_mult_inv) - kfree(rsa.u_mult_inv); - - return err; -} - -static int w_long(unsigned int fd, unsigned int cmd, unsigned long arg) -{ - mm_segment_t old_fs = get_fs(); - int err; - unsigned long val; - - set_fs (KERNEL_DS); - err = sys_ioctl(fd, cmd, (unsigned long)&val); - set_fs (old_fs); - if (!err && put_user((unsigned int) val, (u32 *)arg)) - return -EFAULT; - return err; -} - -struct ioctl32_handler { - unsigned int cmd; - int (*function)(unsigned int, unsigned int, unsigned long); -}; - -struct ioctl32_list { - struct ioctl32_handler handler; - struct ioctl32_list *next; -}; - -#define IOCTL32_DEFAULT(cmd) { { cmd, (void *) sys_ioctl }, 0 } -#define IOCTL32_HANDLER(cmd, handler) { { cmd, (void *) handler }, 0 } - -static struct ioctl32_list ioctl32_handler_table[] = { - IOCTL32_DEFAULT(FIBMAP), - IOCTL32_DEFAULT(FIGETBSZ), - - IOCTL32_DEFAULT(DASDAPIVER), - IOCTL32_DEFAULT(BIODASDDISABLE), - IOCTL32_DEFAULT(BIODASDENABLE), - IOCTL32_DEFAULT(BIODASDRSRV), - IOCTL32_DEFAULT(BIODASDRLSE), - IOCTL32_DEFAULT(BIODASDSLCK), - IOCTL32_DEFAULT(BIODASDINFO), - IOCTL32_DEFAULT(BIODASDFMT), - - IOCTL32_DEFAULT(TAPE390_DISPLAY), - - IOCTL32_DEFAULT(BLKROSET), - IOCTL32_DEFAULT(BLKROGET), - IOCTL32_DEFAULT(BLKRRPART), - IOCTL32_DEFAULT(BLKFLSBUF), - IOCTL32_DEFAULT(BLKRASET), - IOCTL32_DEFAULT(BLKFRASET), - IOCTL32_DEFAULT(BLKSECTSET), - IOCTL32_DEFAULT(BLKSSZGET), - IOCTL32_DEFAULT(BLKBSZGET), - IOCTL32_DEFAULT(BLKGETSIZE64), - - IOCTL32_HANDLER(HDIO_GETGEO, hd_geometry_ioctl), - - IOCTL32_DEFAULT(TCGETA), - IOCTL32_DEFAULT(TCSETA), - IOCTL32_DEFAULT(TCSETAW), - IOCTL32_DEFAULT(TCSETAF), - IOCTL32_DEFAULT(TCSBRK), - IOCTL32_DEFAULT(TCXONC), - IOCTL32_DEFAULT(TCFLSH), - IOCTL32_DEFAULT(TCGETS), - IOCTL32_DEFAULT(TCSETS), - IOCTL32_DEFAULT(TCSETSW), - IOCTL32_DEFAULT(TCSETSF), - IOCTL32_DEFAULT(TIOCLINUX), - - IOCTL32_DEFAULT(TIOCGETD), - IOCTL32_DEFAULT(TIOCSETD), - IOCTL32_DEFAULT(TIOCEXCL), - IOCTL32_DEFAULT(TIOCNXCL), - IOCTL32_DEFAULT(TIOCCONS), - IOCTL32_DEFAULT(TIOCGSOFTCAR), - IOCTL32_DEFAULT(TIOCSSOFTCAR), - IOCTL32_DEFAULT(TIOCSWINSZ), - IOCTL32_DEFAULT(TIOCGWINSZ), - IOCTL32_DEFAULT(TIOCMGET), - IOCTL32_DEFAULT(TIOCMBIC), - IOCTL32_DEFAULT(TIOCMBIS), - IOCTL32_DEFAULT(TIOCMSET), - IOCTL32_DEFAULT(TIOCPKT), - IOCTL32_DEFAULT(TIOCNOTTY), - IOCTL32_DEFAULT(TIOCSTI), - IOCTL32_DEFAULT(TIOCOUTQ), - IOCTL32_DEFAULT(TIOCSPGRP), - IOCTL32_DEFAULT(TIOCGPGRP), - IOCTL32_DEFAULT(TIOCSCTTY), - IOCTL32_DEFAULT(TIOCGPTN), - IOCTL32_DEFAULT(TIOCSPTLCK), - IOCTL32_DEFAULT(TIOCGSERIAL), - IOCTL32_DEFAULT(TIOCSSERIAL), - IOCTL32_DEFAULT(TIOCSERGETLSR), - - IOCTL32_DEFAULT(FIOCLEX), - IOCTL32_DEFAULT(FIONCLEX), - IOCTL32_DEFAULT(FIOASYNC), - IOCTL32_DEFAULT(FIONBIO), - IOCTL32_DEFAULT(FIONREAD), - - IOCTL32_DEFAULT(PIO_FONT), - IOCTL32_DEFAULT(GIO_FONT), - IOCTL32_DEFAULT(KDSIGACCEPT), - IOCTL32_DEFAULT(KDGETKEYCODE), - IOCTL32_DEFAULT(KDSETKEYCODE), - IOCTL32_DEFAULT(KIOCSOUND), - IOCTL32_DEFAULT(KDMKTONE), - IOCTL32_DEFAULT(KDGKBTYPE), - IOCTL32_DEFAULT(KDSETMODE), - IOCTL32_DEFAULT(KDGETMODE), - IOCTL32_DEFAULT(KDSKBMODE), - IOCTL32_DEFAULT(KDGKBMODE), - IOCTL32_DEFAULT(KDSKBMETA), - IOCTL32_DEFAULT(KDGKBMETA), - IOCTL32_DEFAULT(KDGKBENT), - IOCTL32_DEFAULT(KDSKBENT), - IOCTL32_DEFAULT(KDGKBSENT), - IOCTL32_DEFAULT(KDSKBSENT), - IOCTL32_DEFAULT(KDGKBDIACR), - IOCTL32_DEFAULT(KDSKBDIACR), - IOCTL32_DEFAULT(KDGKBLED), - IOCTL32_DEFAULT(KDSKBLED), - IOCTL32_DEFAULT(KDGETLED), - IOCTL32_DEFAULT(KDSETLED), - IOCTL32_DEFAULT(GIO_SCRNMAP), - IOCTL32_DEFAULT(PIO_SCRNMAP), - IOCTL32_DEFAULT(GIO_UNISCRNMAP), - IOCTL32_DEFAULT(PIO_UNISCRNMAP), - IOCTL32_DEFAULT(PIO_FONTRESET), - IOCTL32_DEFAULT(PIO_UNIMAPCLR), - - IOCTL32_DEFAULT(VT_SETMODE), - IOCTL32_DEFAULT(VT_GETMODE), - IOCTL32_DEFAULT(VT_GETSTATE), - IOCTL32_DEFAULT(VT_OPENQRY), - IOCTL32_DEFAULT(VT_ACTIVATE), - IOCTL32_DEFAULT(VT_WAITACTIVE), - IOCTL32_DEFAULT(VT_RELDISP), - IOCTL32_DEFAULT(VT_DISALLOCATE), - IOCTL32_DEFAULT(VT_RESIZE), - IOCTL32_DEFAULT(VT_RESIZEX), - IOCTL32_DEFAULT(VT_LOCKSWITCH), - IOCTL32_DEFAULT(VT_UNLOCKSWITCH), - - IOCTL32_DEFAULT(SIOCGSTAMP), - - IOCTL32_DEFAULT(DM_VERSION), - IOCTL32_DEFAULT(DM_REMOVE_ALL), - IOCTL32_DEFAULT(DM_DEV_CREATE), - IOCTL32_DEFAULT(DM_DEV_REMOVE), - IOCTL32_DEFAULT(DM_DEV_RELOAD), - IOCTL32_DEFAULT(DM_DEV_SUSPEND), - IOCTL32_DEFAULT(DM_DEV_RENAME), - IOCTL32_DEFAULT(DM_DEV_DEPS), - IOCTL32_DEFAULT(DM_DEV_STATUS), - IOCTL32_DEFAULT(DM_TARGET_STATUS), - IOCTL32_DEFAULT(DM_TARGET_WAIT), - - IOCTL32_DEFAULT(LOOP_SET_FD), - IOCTL32_DEFAULT(LOOP_CLR_FD), - - IOCTL32_HANDLER(SIOCGIFNAME, dev_ifname32), - IOCTL32_HANDLER(SIOCGIFCONF, dev_ifconf), - IOCTL32_HANDLER(SIOCGIFFLAGS, dev_ifsioc), - IOCTL32_HANDLER(SIOCSIFFLAGS, dev_ifsioc), - IOCTL32_HANDLER(SIOCGIFMETRIC, dev_ifsioc), - IOCTL32_HANDLER(SIOCSIFMETRIC, dev_ifsioc), - IOCTL32_HANDLER(SIOCGIFMTU, dev_ifsioc), - IOCTL32_HANDLER(SIOCSIFMTU, dev_ifsioc), - IOCTL32_HANDLER(SIOCGIFMEM, dev_ifsioc), - IOCTL32_HANDLER(SIOCSIFMEM, dev_ifsioc), - IOCTL32_HANDLER(SIOCGIFHWADDR, dev_ifsioc), - IOCTL32_HANDLER(SIOCSIFHWADDR, dev_ifsioc), - IOCTL32_HANDLER(SIOCADDMULTI, dev_ifsioc), - IOCTL32_HANDLER(SIOCDELMULTI, dev_ifsioc), - IOCTL32_HANDLER(SIOCGIFINDEX, dev_ifsioc), - IOCTL32_HANDLER(SIOCGIFMAP, dev_ifsioc), - IOCTL32_HANDLER(SIOCSIFMAP, dev_ifsioc), - IOCTL32_HANDLER(SIOCGIFADDR, dev_ifsioc), - IOCTL32_HANDLER(SIOCSIFADDR, dev_ifsioc), - IOCTL32_HANDLER(SIOCGIFBRDADDR, dev_ifsioc), - IOCTL32_HANDLER(SIOCSIFBRDADDR, dev_ifsioc), - IOCTL32_HANDLER(SIOCGIFDSTADDR, dev_ifsioc), - IOCTL32_HANDLER(SIOCSIFDSTADDR, dev_ifsioc), - IOCTL32_HANDLER(SIOCGIFNETMASK, dev_ifsioc), - IOCTL32_HANDLER(SIOCSIFNETMASK, dev_ifsioc), - IOCTL32_HANDLER(SIOCSIFPFLAGS, dev_ifsioc), - IOCTL32_HANDLER(SIOCGIFPFLAGS, dev_ifsioc), - IOCTL32_HANDLER(SIOCGIFTXQLEN, dev_ifsioc), - IOCTL32_HANDLER(SIOCSIFTXQLEN, dev_ifsioc), - IOCTL32_HANDLER(SIOCADDRT, routing_ioctl), - IOCTL32_HANDLER(SIOCDELRT, routing_ioctl), - - IOCTL32_HANDLER(SIOCBONDENSLAVE, bond_ioctl), - IOCTL32_HANDLER(SIOCBONDRELEASE, bond_ioctl), - IOCTL32_HANDLER(SIOCBONDSETHWADDR, bond_ioctl), - IOCTL32_HANDLER(SIOCBONDSLAVEINFOQUERY, bond_ioctl), - IOCTL32_HANDLER(SIOCBONDINFOQUERY, bond_ioctl), - IOCTL32_HANDLER(SIOCBONDCHANGEACTIVE, bond_ioctl), - - IOCTL32_HANDLER(EXT2_IOC32_GETFLAGS, do_ext2_ioctl), - IOCTL32_HANDLER(EXT2_IOC32_SETFLAGS, do_ext2_ioctl), - IOCTL32_HANDLER(EXT2_IOC32_GETVERSION, do_ext2_ioctl), - IOCTL32_HANDLER(EXT2_IOC32_SETVERSION, do_ext2_ioctl), - - IOCTL32_HANDLER(LOOP_SET_STATUS, loop_status), - IOCTL32_HANDLER(LOOP_GET_STATUS, loop_status), - - IOCTL32_HANDLER(ICARSAMODEXPO, do_rsa_ioctl), - IOCTL32_HANDLER(ICARSACRT, do_rsa_crt_ioctl), - IOCTL32_HANDLER(ICARSAMODMULT, do_rsa_ioctl), - IOCTL32_DEFAULT(ICAZ90STATUS), - IOCTL32_DEFAULT(ICAZ90QUIESCE), - IOCTL32_DEFAULT(ICAZ90HARDRESET), - IOCTL32_DEFAULT(ICAZ90HARDERROR), - - IOCTL32_HANDLER(BLKRAGET, w_long), - IOCTL32_HANDLER(BLKGETSIZE, w_long), - IOCTL32_HANDLER(BLKFRAGET, w_long), - IOCTL32_HANDLER(BLKSECTGET, w_long), - IOCTL32_HANDLER(BLKPG, blkpg_ioctl_trans) - -}; - -#define NR_IOCTL32_HANDLERS (sizeof(ioctl32_handler_table) / \ - sizeof(ioctl32_handler_table[0])) - -static struct ioctl32_list *ioctl32_hash_table[1024]; - -static inline int ioctl32_hash(unsigned int cmd) -{ - return ((cmd >> 6) ^ (cmd >> 4) ^ cmd) & 0x3ff; -} - -int sys32_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg) -{ - int (*handler)(unsigned int, unsigned int, unsigned long, struct file * filp); - struct file *filp; - struct ioctl32_list *l; - int error; - - l = ioctl32_hash_table[ioctl32_hash(cmd)]; - - error = -EBADF; - - filp = fget(fd); - if (!filp) - return error; - - if (!filp->f_op || !filp->f_op->ioctl) { - error = sys_ioctl (fd, cmd, arg); - goto out; - } - - while (l && l->handler.cmd != cmd) - l = l->next; - - if (l) { - handler = (void *)l->handler.function; - error = handler(fd, cmd, arg, filp); - } else { - error = -EINVAL; - printk("unknown ioctl: %08x\n", cmd); - } -out: - fput(filp); - return error; -} - -static void ioctl32_insert(struct ioctl32_list *entry) -{ - int hash = ioctl32_hash(entry->handler.cmd); - - entry->next = 0; - if (!ioctl32_hash_table[hash]) - ioctl32_hash_table[hash] = entry; - else { - struct ioctl32_list *l; - l = ioctl32_hash_table[hash]; - while (l->next) - l = l->next; - l->next = entry; - } -} - -int register_ioctl32_conversion(unsigned int cmd, - int (*handler)(unsigned int, unsigned int, - unsigned long, struct file *)) -{ - struct ioctl32_list *l, *new; - int hash; - - hash = ioctl32_hash(cmd); - for (l = ioctl32_hash_table[hash]; l != NULL; l = l->next) - if (l->handler.cmd == cmd) - return -EBUSY; - new = kmalloc(sizeof(struct ioctl32_list), GFP_KERNEL); - if (new == NULL) - return -ENOMEM; - new->handler.cmd = cmd; - new->handler.function = (void *) handler; - ioctl32_insert(new); - return 0; -} - -int unregister_ioctl32_conversion(unsigned int cmd) -{ - struct ioctl32_list *p, *l; - int hash; - - hash = ioctl32_hash(cmd); - p = NULL; - for (l = ioctl32_hash_table[hash]; l != NULL; l = l->next) { - if (l->handler.cmd == cmd) - break; - p = l; - } - if (l == NULL) - return -ENOENT; - if (p == NULL) - ioctl32_hash_table[hash] = l->next; - else - p->next = l->next; - kfree(l); - return 0; -} - -static int __init init_ioctl32(void) -{ - int i; - for (i = 0; i < NR_IOCTL32_HANDLERS; i++) - ioctl32_insert(&ioctl32_handler_table[i]); - return 0; -} - -__initcall(init_ioctl32); diff --git a/arch/s390x/kernel/linux32.c b/arch/s390x/kernel/linux32.c deleted file mode 100644 index f1b62d186cfb4..0000000000000 --- a/arch/s390x/kernel/linux32.c +++ /dev/null @@ -1,2863 +0,0 @@ -/* - * arch/s390x/kernel/linux32.c - * - * S390 version - * Copyright (C) 2000 IBM Deutschland Entwicklung GmbH, IBM Corporation - * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com), - * Gerhard Tonn (ton@de.ibm.com) - * - * Conversion between 31bit and 64bit native syscalls. - * - * Heavily inspired by the 32-bit Sparc compat code which is - * Copyright (C) 1997,1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz) - * Copyright (C) 1997 David S. Miller (davem@caip.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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include -#include - -#include "linux32.h" - -extern asmlinkage long sys_chown(const char *, uid_t,gid_t); -extern asmlinkage long sys_lchown(const char *, uid_t,gid_t); -extern asmlinkage long sys_fchown(unsigned int, uid_t,gid_t); -extern asmlinkage long sys_setregid(gid_t, gid_t); -extern asmlinkage long sys_setgid(gid_t); -extern asmlinkage long sys_setreuid(uid_t, uid_t); -extern asmlinkage long sys_setuid(uid_t); -extern asmlinkage long sys_setresuid(uid_t, uid_t, uid_t); -extern asmlinkage long sys_setresgid(gid_t, gid_t, gid_t); -extern asmlinkage long sys_setfsuid(uid_t); -extern asmlinkage long sys_setfsgid(gid_t); - -/* For this source file, we want overflow handling. */ - -#undef high2lowuid -#undef high2lowgid -#undef low2highuid -#undef low2highgid -#undef SET_UID16 -#undef SET_GID16 -#undef NEW_TO_OLD_UID -#undef NEW_TO_OLD_GID -#undef SET_OLDSTAT_UID -#undef SET_OLDSTAT_GID -#undef SET_STAT_UID -#undef SET_STAT_GID - -#define high2lowuid(uid) ((uid) > 65535) ? (u16)overflowuid : (u16)(uid) -#define high2lowgid(gid) ((gid) > 65535) ? (u16)overflowgid : (u16)(gid) -#define low2highuid(uid) ((uid) == (u16)-1) ? (uid_t)-1 : (uid_t)(uid) -#define low2highgid(gid) ((gid) == (u16)-1) ? (gid_t)-1 : (gid_t)(gid) -#define SET_UID16(var, uid) var = high2lowuid(uid) -#define SET_GID16(var, gid) var = high2lowgid(gid) -#define NEW_TO_OLD_UID(uid) high2lowuid(uid) -#define NEW_TO_OLD_GID(gid) high2lowgid(gid) -#define SET_OLDSTAT_UID(stat, uid) (stat).st_uid = high2lowuid(uid) -#define SET_OLDSTAT_GID(stat, gid) (stat).st_gid = high2lowgid(gid) -#define SET_STAT_UID(stat, uid) (stat).st_uid = high2lowuid(uid) -#define SET_STAT_GID(stat, gid) (stat).st_gid = high2lowgid(gid) - -asmlinkage long sys32_chown16(const char * filename, u16 user, u16 group) -{ - return sys_chown(filename, low2highuid(user), low2highgid(group)); -} - -asmlinkage long sys32_lchown16(const char * filename, u16 user, u16 group) -{ - return sys_lchown(filename, low2highuid(user), low2highgid(group)); -} - -asmlinkage long sys32_fchown16(unsigned int fd, u16 user, u16 group) -{ - return sys_fchown(fd, low2highuid(user), low2highgid(group)); -} - -asmlinkage long sys32_setregid16(u16 rgid, u16 egid) -{ - return sys_setregid(low2highgid(rgid), low2highgid(egid)); -} - -asmlinkage long sys32_setgid16(u16 gid) -{ - return sys_setgid((gid_t)gid); -} - -asmlinkage long sys32_setreuid16(u16 ruid, u16 euid) -{ - return sys_setreuid(low2highuid(ruid), low2highuid(euid)); -} - -asmlinkage long sys32_setuid16(u16 uid) -{ - return sys_setuid((uid_t)uid); -} - -asmlinkage long sys32_setresuid16(u16 ruid, u16 euid, u16 suid) -{ - return sys_setresuid(low2highuid(ruid), low2highuid(euid), - low2highuid(suid)); -} - -asmlinkage long sys32_getresuid16(u16 *ruid, u16 *euid, u16 *suid) -{ - int retval; - - if (!(retval = put_user(high2lowuid(current->uid), ruid)) && - !(retval = put_user(high2lowuid(current->euid), euid))) - retval = put_user(high2lowuid(current->suid), suid); - - return retval; -} - -asmlinkage long sys32_setresgid16(u16 rgid, u16 egid, u16 sgid) -{ - return sys_setresgid(low2highgid(rgid), low2highgid(egid), - low2highgid(sgid)); -} - -asmlinkage long sys32_getresgid16(u16 *rgid, u16 *egid, u16 *sgid) -{ - int retval; - - if (!(retval = put_user(high2lowgid(current->gid), rgid)) && - !(retval = put_user(high2lowgid(current->egid), egid))) - retval = put_user(high2lowgid(current->sgid), sgid); - - return retval; -} - -asmlinkage long sys32_setfsuid16(u16 uid) -{ - return sys_setfsuid((uid_t)uid); -} - -asmlinkage long sys32_setfsgid16(u16 gid) -{ - return sys_setfsgid((gid_t)gid); -} - -asmlinkage long sys32_getgroups16(int gidsetsize, u16 *grouplist) -{ - u16 groups[NGROUPS]; - int i,j; - - if (gidsetsize < 0) - return -EINVAL; - i = current->ngroups; - if (gidsetsize) { - if (i > gidsetsize) - return -EINVAL; - for(j=0;jgroups[j]; - if (copy_to_user(grouplist, groups, sizeof(u16)*i)) - return -EFAULT; - } - return i; -} - -asmlinkage long sys32_setgroups16(int gidsetsize, u16 *grouplist) -{ - u16 groups[NGROUPS]; - int i; - - if (!capable(CAP_SETGID)) - return -EPERM; - if ((unsigned) gidsetsize > NGROUPS) - return -EINVAL; - if (copy_from_user(groups, grouplist, gidsetsize * sizeof(u16))) - return -EFAULT; - for (i = 0 ; i < gidsetsize ; i++) - current->groups[i] = (gid_t)groups[i]; - current->ngroups = gidsetsize; - return 0; -} - -asmlinkage long sys32_getuid16(void) -{ - return high2lowuid(current->uid); -} - -asmlinkage long sys32_geteuid16(void) -{ - return high2lowuid(current->euid); -} - -asmlinkage long sys32_getgid16(void) -{ - return high2lowgid(current->gid); -} - -asmlinkage long sys32_getegid16(void) -{ - return high2lowgid(current->egid); -} - -/* 32-bit timeval and related flotsam. */ - -static inline long get_tv32(struct timeval *o, struct compat_timeval *i) -{ - return (!access_ok(VERIFY_READ, tv32, sizeof(*tv32)) || - (__get_user(o->tv_sec, &i->tv_sec) | - __get_user(o->tv_usec, &i->tv_usec))); -} - -static inline long put_tv32(struct compat_timeval *o, struct timeval *i) -{ - return (!access_ok(VERIFY_WRITE, o, sizeof(*o)) || - (__put_user(i->tv_sec, &o->tv_sec) | - __put_user(i->tv_usec, &o->tv_usec))); -} - -struct msgbuf32 { s32 mtype; char mtext[1]; }; - -struct ipc64_perm_ds32 -{ - __kernel_key_t key; - __kernel_uid32_t uid; - __kernel_gid32_t gid; - __kernel_uid32_t cuid; - __kernel_gid32_t cgid; - compat_mode_t mode; - unsigned short __pad1; - unsigned short seq; - unsigned short __pad2; - unsigned int __unused1; - unsigned int __unused2; -}; - -struct ipc_perm32 -{ - key_t key; - compat_uid_t uid; - compat_gid_t gid; - compat_uid_t cuid; - compat_gid_t cgid; - compat_mode_t mode; - unsigned short seq; -}; - -struct semid_ds32 { - struct ipc_perm32 sem_perm; /* permissions .. see ipc.h */ - compat_time_t sem_otime; /* last semop time */ - compat_time_t sem_ctime; /* last change time */ - u32 sem_base; /* ptr to first semaphore in array */ - u32 sem_pending; /* pending operations to be processed */ - u32 sem_pending_last; /* last pending operation */ - u32 undo; /* undo requests on this array */ - unsigned short sem_nsems; /* no. of semaphores in array */ -}; - -struct semid64_ds32 { - struct ipc64_perm_ds32 sem_perm; - unsigned int __pad1; - compat_time_t sem_otime; - unsigned int __pad2; - compat_time_t sem_ctime; - u32 sem_nsems; - u32 __unused1; - u32 __unused2; -}; - -struct msqid_ds32 -{ - struct ipc_perm32 msg_perm; - u32 msg_first; - u32 msg_last; - compat_time_t msg_stime; - compat_time_t msg_rtime; - compat_time_t msg_ctime; - u32 wwait; - u32 rwait; - unsigned short msg_cbytes; - unsigned short msg_qnum; - unsigned short msg_qbytes; - compat_ipc_pid_t msg_lspid; - compat_ipc_pid_t msg_lrpid; -}; - -struct msqid64_ds32 { - struct ipc64_perm_ds32 msg_perm; - unsigned int __pad1; - compat_time_t msg_stime; - unsigned int __pad2; - compat_time_t msg_rtime; - unsigned int __pad3; - compat_time_t msg_ctime; - unsigned int msg_cbytes; - unsigned int msg_qnum; - unsigned int msg_qbytes; - compat_pid_t msg_lspid; - compat_pid_t msg_lrpid; - unsigned int __unused1; - unsigned int __unused2; -}; - - -struct shmid_ds32 { - struct ipc_perm32 shm_perm; - int shm_segsz; - compat_time_t shm_atime; - compat_time_t shm_dtime; - compat_time_t shm_ctime; - compat_ipc_pid_t shm_cpid; - compat_ipc_pid_t shm_lpid; - unsigned short shm_nattch; -}; - -struct shmid64_ds32 { - struct ipc64_perm_ds32 shm_perm; - compat_size_t shm_segsz; - compat_time_t shm_atime; - unsigned int __unused1; - compat_time_t shm_dtime; - unsigned int __unused2; - compat_time_t shm_ctime; - unsigned int __unused3; - compat_pid_t shm_cpid; - compat_pid_t shm_lpid; - unsigned int shm_nattch; - unsigned int __unused4; - unsigned int __unused5; -}; - - -/* - * sys32_ipc() is the de-multiplexer for the SysV IPC calls in 32bit emulation.. - * - * This is really horribly ugly. - */ -#define IPCOP_MASK(__x) (1UL << (__x)) -static int do_sys32_semctl(int first, int second, int third, void *uptr) -{ - union semun fourth; - u32 pad; - int err = -EINVAL; - - if (!uptr) - goto out; - err = -EFAULT; - if (get_user (pad, (u32 *)uptr)) - goto out; - if(third == SETVAL) - fourth.val = (int)pad; - else - fourth.__pad = (void *)A(pad); - if (IPCOP_MASK (third) & - (IPCOP_MASK (IPC_INFO) | IPCOP_MASK (SEM_INFO) | IPCOP_MASK (GETVAL) | - IPCOP_MASK (GETPID) | IPCOP_MASK (GETNCNT) | IPCOP_MASK (GETZCNT) | - IPCOP_MASK (GETALL) | IPCOP_MASK (SETALL) | IPCOP_MASK (IPC_RMID))) { - err = sys_semctl (first, second, third, fourth); - } else if (third & IPC_64) { - struct semid64_ds s; - struct semid64_ds32 *usp = (struct semid64_ds32 *)A(pad); - mm_segment_t old_fs; - int need_back_translation; - - if (third == (IPC_SET|IPC_64)) { - err = get_user (s.sem_perm.uid, &usp->sem_perm.uid); - err |= __get_user (s.sem_perm.gid, &usp->sem_perm.gid); - err |= __get_user (s.sem_perm.mode, &usp->sem_perm.mode); - if (err) - goto out; - fourth.__pad = &s; - } - need_back_translation = - (IPCOP_MASK (third) & - (IPCOP_MASK (SEM_STAT) | IPCOP_MASK (IPC_STAT))) != 0; - if (need_back_translation) - fourth.__pad = &s; - old_fs = get_fs (); - set_fs (KERNEL_DS); - err = sys_semctl (first, second, third, fourth); - set_fs (old_fs); - if (need_back_translation) { - int err2 = put_user (s.sem_perm.key, &usp->sem_perm.key); - err2 |= __put_user (high2lowuid(s.sem_perm.uid), &usp->sem_perm.uid); - err2 |= __put_user (high2lowgid(s.sem_perm.gid), &usp->sem_perm.gid); - err2 |= __put_user (high2lowuid(s.sem_perm.cuid), &usp->sem_perm.cuid); - err2 |= __put_user (high2lowgid(s.sem_perm.cgid), &usp->sem_perm.cgid); - err2 |= __put_user (s.sem_perm.mode, &usp->sem_perm.mode); - err2 |= __put_user (s.sem_perm.seq, &usp->sem_perm.seq); - err2 |= __put_user (s.sem_otime, &usp->sem_otime); - err2 |= __put_user (s.sem_ctime, &usp->sem_ctime); - err2 |= __put_user (s.sem_nsems, &usp->sem_nsems); - if (err2) err = -EFAULT; - } - } else { - struct semid_ds s; - struct semid_ds32 *usp = (struct semid_ds32 *)A(pad); - mm_segment_t old_fs; - int need_back_translation; - - if (third == IPC_SET) { - err = get_user (s.sem_perm.uid, &usp->sem_perm.uid); - err |= __get_user (s.sem_perm.gid, &usp->sem_perm.gid); - err |= __get_user (s.sem_perm.mode, &usp->sem_perm.mode); - if (err) - goto out; - fourth.__pad = &s; - } - need_back_translation = - (IPCOP_MASK (third) & - (IPCOP_MASK (SEM_STAT) | IPCOP_MASK (IPC_STAT))) != 0; - if (need_back_translation) - fourth.__pad = &s; - old_fs = get_fs (); - set_fs (KERNEL_DS); - err = sys_semctl (first, second, third, fourth); - set_fs (old_fs); - if (need_back_translation) { - int err2 = put_user (s.sem_perm.key, &usp->sem_perm.key); - err2 |= __put_user (high2lowuid(s.sem_perm.uid), &usp->sem_perm.uid); - err2 |= __put_user (high2lowgid(s.sem_perm.gid), &usp->sem_perm.gid); - err2 |= __put_user (high2lowuid(s.sem_perm.cuid), &usp->sem_perm.cuid); - err2 |= __put_user (high2lowgid(s.sem_perm.cgid), &usp->sem_perm.cgid); - err2 |= __put_user (s.sem_perm.mode, &usp->sem_perm.mode); - err2 |= __put_user (s.sem_perm.seq, &usp->sem_perm.seq); - err2 |= __put_user (s.sem_otime, &usp->sem_otime); - err2 |= __put_user (s.sem_ctime, &usp->sem_ctime); - err2 |= __put_user (s.sem_nsems, &usp->sem_nsems); - if (err2) err = -EFAULT; - } - } -out: - return err; -} - -static int do_sys32_msgsnd (int first, int second, int third, void *uptr) -{ - struct msgbuf *p = kmalloc (second + sizeof (struct msgbuf), GFP_USER); - struct msgbuf32 *up = (struct msgbuf32 *)uptr; - mm_segment_t old_fs; - int err; - - if (!p) - return -ENOMEM; - - err = -EINVAL; - if (second > MSGMAX || first < 0 || second < 0) - goto out; - - err = -EFAULT; - if (!uptr) - goto out; - if (get_user (p->mtype, &up->mtype) || - __copy_from_user (p->mtext, &up->mtext, second)) - goto out; - old_fs = get_fs (); - set_fs (KERNEL_DS); - err = sys_msgsnd (first, p, second, third); - set_fs (old_fs); -out: - kfree (p); - return err; -} - -static int do_sys32_msgrcv (int first, int second, int msgtyp, int third, - int version, void *uptr) -{ - struct msgbuf32 *up; - struct msgbuf *p; - mm_segment_t old_fs; - int err; - - if (first < 0 || second < 0) - return -EINVAL; - - if (!version) { - struct ipc_kludge_32 *uipck = (struct ipc_kludge_32 *)uptr; - struct ipc_kludge_32 ipck; - - err = -EINVAL; - if (!uptr) - goto out; - err = -EFAULT; - if (copy_from_user (&ipck, uipck, sizeof (struct ipc_kludge_32))) - goto out; - uptr = (void *)A(ipck.msgp); - msgtyp = ipck.msgtyp; - } - err = -ENOMEM; - p = kmalloc (second + sizeof (struct msgbuf), GFP_USER); - if (!p) - goto out; - old_fs = get_fs (); - set_fs (KERNEL_DS); - err = sys_msgrcv (first, p, second, msgtyp, third); - set_fs (old_fs); - if (err < 0) - goto free_then_out; - up = (struct msgbuf32 *)uptr; - if (put_user (p->mtype, &up->mtype) || - __copy_to_user (&up->mtext, p->mtext, err)) - err = -EFAULT; -free_then_out: - kfree (p); -out: - return err; -} - -static int do_sys32_msgctl (int first, int second, void *uptr) -{ - int err; - - if (IPCOP_MASK (second) & - (IPCOP_MASK (IPC_INFO) | IPCOP_MASK (MSG_INFO) | - IPCOP_MASK (IPC_RMID))) { - err = sys_msgctl (first, second, (struct msqid_ds *)uptr); - } else if (second & IPC_64) { - struct msqid64_ds m; - struct msqid64_ds32 *up = (struct msqid64_ds32 *)uptr; - mm_segment_t old_fs; - - if (second == (IPC_SET|IPC_64)) { - err = get_user (m.msg_perm.uid, &up->msg_perm.uid); - err |= __get_user (m.msg_perm.gid, &up->msg_perm.gid); - err |= __get_user (m.msg_perm.mode, &up->msg_perm.mode); - err |= __get_user (m.msg_qbytes, &up->msg_qbytes); - if (err) - goto out; - } - old_fs = get_fs (); - set_fs (KERNEL_DS); - err = sys_msgctl (first, second, (struct msqid_ds *)&m); - set_fs (old_fs); - if (IPCOP_MASK (second) & - (IPCOP_MASK (MSG_STAT) | IPCOP_MASK (IPC_STAT))) { - int err2 = put_user (m.msg_perm.key, &up->msg_perm.key); - err2 |= __put_user (high2lowuid(m.msg_perm.uid), &up->msg_perm.uid); - err2 |= __put_user (high2lowgid(m.msg_perm.gid), &up->msg_perm.gid); - err2 |= __put_user (high2lowuid(m.msg_perm.cuid), &up->msg_perm.cuid); - err2 |= __put_user (high2lowgid(m.msg_perm.cgid), &up->msg_perm.cgid); - err2 |= __put_user (m.msg_perm.mode, &up->msg_perm.mode); - err2 |= __put_user (m.msg_perm.seq, &up->msg_perm.seq); - err2 |= __put_user (m.msg_stime, &up->msg_stime); - err2 |= __put_user (m.msg_rtime, &up->msg_rtime); - err2 |= __put_user (m.msg_ctime, &up->msg_ctime); - err2 |= __put_user (m.msg_cbytes, &up->msg_cbytes); - err2 |= __put_user (m.msg_qnum, &up->msg_qnum); - err2 |= __put_user (m.msg_qbytes, &up->msg_qbytes); - err2 |= __put_user (m.msg_lspid, &up->msg_lspid); - err2 |= __put_user (m.msg_lrpid, &up->msg_lrpid); - if (err2) - err = -EFAULT; - } - } else { - struct msqid_ds m; - struct msqid_ds32 *up = (struct msqid_ds32 *)uptr; - mm_segment_t old_fs; - - if (second == IPC_SET) { - err = get_user (m.msg_perm.uid, &up->msg_perm.uid); - err |= __get_user (m.msg_perm.gid, &up->msg_perm.gid); - err |= __get_user (m.msg_perm.mode, &up->msg_perm.mode); - err |= __get_user (m.msg_qbytes, &up->msg_qbytes); - if (err) - goto out; - } - old_fs = get_fs (); - set_fs (KERNEL_DS); - err = sys_msgctl (first, second, &m); - set_fs (old_fs); - if (IPCOP_MASK (second) & - (IPCOP_MASK (MSG_STAT) | IPCOP_MASK (IPC_STAT))) { - int err2 = put_user (m.msg_perm.key, &up->msg_perm.key); - err2 |= __put_user (high2lowuid(m.msg_perm.uid), &up->msg_perm.uid); - err2 |= __put_user (high2lowgid(m.msg_perm.gid), &up->msg_perm.gid); - err2 |= __put_user (high2lowuid(m.msg_perm.cuid), &up->msg_perm.cuid); - err2 |= __put_user (high2lowgid(m.msg_perm.cgid), &up->msg_perm.cgid); - err2 |= __put_user (m.msg_perm.mode, &up->msg_perm.mode); - err2 |= __put_user (m.msg_perm.seq, &up->msg_perm.seq); - err2 |= __put_user (m.msg_stime, &up->msg_stime); - err2 |= __put_user (m.msg_rtime, &up->msg_rtime); - err2 |= __put_user (m.msg_ctime, &up->msg_ctime); - err2 |= __put_user (m.msg_cbytes, &up->msg_cbytes); - err2 |= __put_user (m.msg_qnum, &up->msg_qnum); - err2 |= __put_user (m.msg_qbytes, &up->msg_qbytes); - err2 |= __put_user (m.msg_lspid, &up->msg_lspid); - err2 |= __put_user (m.msg_lrpid, &up->msg_lrpid); - if (err2) - err = -EFAULT; - } - } - -out: - return err; -} - -static int do_sys32_shmat (int first, int second, int third, int version, void *uptr) -{ - unsigned long raddr; - u32 *uaddr = (u32 *)A((u32)third); - int err = -EINVAL; - - if (version == 1) - goto out; - err = sys_shmat (first, uptr, second, &raddr); - if (err) - goto out; - err = put_user (raddr, uaddr); -out: - return err; -} - -static int do_sys32_shmctl (int first, int second, void *uptr) -{ - int err; - - if (IPCOP_MASK (second) & - (IPCOP_MASK (IPC_INFO) | IPCOP_MASK (SHM_LOCK) | IPCOP_MASK (SHM_UNLOCK) | - IPCOP_MASK (IPC_RMID))) { - if (second == (IPC_INFO|IPC_64)) - second = IPC_INFO; /* So that we don't have to translate it */ - err = sys_shmctl (first, second, (struct shmid_ds *)uptr); - } else if ((second & IPC_64) && second != (SHM_INFO|IPC_64)) { - struct shmid64_ds s; - struct shmid64_ds32 *up = (struct shmid64_ds32 *)uptr; - mm_segment_t old_fs; - - if (second == (IPC_SET|IPC_64)) { - err = get_user (s.shm_perm.uid, &up->shm_perm.uid); - err |= __get_user (s.shm_perm.gid, &up->shm_perm.gid); - err |= __get_user (s.shm_perm.mode, &up->shm_perm.mode); - if (err) - goto out; - } - old_fs = get_fs (); - set_fs (KERNEL_DS); - err = sys_shmctl (first, second, (struct shmid_ds *)&s); - set_fs (old_fs); - if (err < 0) - goto out; - - /* Mask it even in this case so it becomes a CSE. */ - if (IPCOP_MASK (second) & - (IPCOP_MASK (SHM_STAT) | IPCOP_MASK (IPC_STAT))) { - int err2 = put_user (s.shm_perm.key, &up->shm_perm.key); - err2 |= __put_user (high2lowuid(s.shm_perm.uid), &up->shm_perm.uid); - err2 |= __put_user (high2lowgid(s.shm_perm.gid), &up->shm_perm.gid); - err2 |= __put_user (high2lowuid(s.shm_perm.cuid), &up->shm_perm.cuid); - err2 |= __put_user (high2lowgid(s.shm_perm.cgid), &up->shm_perm.cgid); - err2 |= __put_user (s.shm_perm.mode, &up->shm_perm.mode); - err2 |= __put_user (s.shm_perm.seq, &up->shm_perm.seq); - err2 |= __put_user (s.shm_atime, &up->shm_atime); - err2 |= __put_user (s.shm_dtime, &up->shm_dtime); - err2 |= __put_user (s.shm_ctime, &up->shm_ctime); - err2 |= __put_user (s.shm_segsz, &up->shm_segsz); - err2 |= __put_user (s.shm_nattch, &up->shm_nattch); - err2 |= __put_user (s.shm_cpid, &up->shm_cpid); - err2 |= __put_user (s.shm_lpid, &up->shm_lpid); - if (err2) - err = -EFAULT; - } - } else { - struct shmid_ds s; - struct shmid_ds32 *up = (struct shmid_ds32 *)uptr; - mm_segment_t old_fs; - - second &= ~IPC_64; - if (second == IPC_SET) { - err = get_user (s.shm_perm.uid, &up->shm_perm.uid); - err |= __get_user (s.shm_perm.gid, &up->shm_perm.gid); - err |= __get_user (s.shm_perm.mode, &up->shm_perm.mode); - if (err) - goto out; - } - old_fs = get_fs (); - set_fs (KERNEL_DS); - err = sys_shmctl (first, second, &s); - set_fs (old_fs); - if (err < 0) - goto out; - - /* Mask it even in this case so it becomes a CSE. */ - if (second == SHM_INFO) { - struct shm_info32 { - int used_ids; - u32 shm_tot, shm_rss, shm_swp; - u32 swap_attempts, swap_successes; - } *uip = (struct shm_info32 *)uptr; - struct shm_info *kp = (struct shm_info *)&s; - int err2 = put_user (kp->used_ids, &uip->used_ids); - err2 |= __put_user (kp->shm_tot, &uip->shm_tot); - err2 |= __put_user (kp->shm_rss, &uip->shm_rss); - err2 |= __put_user (kp->shm_swp, &uip->shm_swp); - err2 |= __put_user (kp->swap_attempts, &uip->swap_attempts); - err2 |= __put_user (kp->swap_successes, &uip->swap_successes); - if (err2) - err = -EFAULT; - } else if (IPCOP_MASK (second) & - (IPCOP_MASK (SHM_STAT) | IPCOP_MASK (IPC_STAT))) { - int err2 = put_user (s.shm_perm.key, &up->shm_perm.key); - err2 |= __put_user (high2lowuid(s.shm_perm.uid), &up->shm_perm.uid); - err2 |= __put_user (high2lowgid(s.shm_perm.gid), &up->shm_perm.gid); - err2 |= __put_user (high2lowuid(s.shm_perm.cuid), &up->shm_perm.cuid); - err2 |= __put_user (high2lowgid(s.shm_perm.cgid), &up->shm_perm.cgid); - err2 |= __put_user (s.shm_perm.mode, &up->shm_perm.mode); - err2 |= __put_user (s.shm_perm.seq, &up->shm_perm.seq); - err2 |= __put_user (s.shm_atime, &up->shm_atime); - err2 |= __put_user (s.shm_dtime, &up->shm_dtime); - err2 |= __put_user (s.shm_ctime, &up->shm_ctime); - err2 |= __put_user (s.shm_segsz, &up->shm_segsz); - err2 |= __put_user (s.shm_nattch, &up->shm_nattch); - err2 |= __put_user (s.shm_cpid, &up->shm_cpid); - err2 |= __put_user (s.shm_lpid, &up->shm_lpid); - if (err2) - err = -EFAULT; - } - } -out: - return err; -} - -asmlinkage int sys32_ipc (u32 call, int first, int second, int third, u32 ptr, u32 fifth) -{ - int version, err; - - version = call >> 16; /* hack for backward compatibility */ - call &= 0xffff; - - if(version) - return -EINVAL; - - if (call <= SEMCTL) - switch (call) { - case SEMOP: - /* struct sembuf is the same on 32 and 64bit :)) */ - err = sys_semop (first, (struct sembuf *)AA(ptr), second); - goto out; - case SEMGET: - err = sys_semget (first, second, third); - goto out; - case SEMCTL: - err = do_sys32_semctl (first, second, third, (void *)AA(ptr)); - goto out; - default: - err = -EINVAL; - goto out; - }; - if (call <= MSGCTL) - switch (call) { - case MSGSND: - err = do_sys32_msgsnd (first, second, third, (void *)AA(ptr)); - goto out; - case MSGRCV: - err = do_sys32_msgrcv (first, second, 0, third, - version, (void *)AA(ptr)); - goto out; - case MSGGET: - err = sys_msgget ((key_t) first, second); - goto out; - case MSGCTL: - err = do_sys32_msgctl (first, second, (void *)AA(ptr)); - goto out; - default: - err = -EINVAL; - goto out; - } - if (call <= SHMCTL) - switch (call) { - case SHMAT: - err = do_sys32_shmat (first, second, third, - version, (void *)AA(ptr)); - goto out; - case SHMDT: - err = sys_shmdt ((char *)AA(ptr)); - goto out; - case SHMGET: - err = sys_shmget (first, second, third); - goto out; - case SHMCTL: - err = do_sys32_shmctl (first, second, (void *)AA(ptr)); - goto out; - default: - err = -EINVAL; - goto out; - } - - err = -EINVAL; - -out: - return err; -} - -extern asmlinkage long sys_truncate(const char * path, unsigned long length); -extern asmlinkage long sys_ftruncate(unsigned int fd, unsigned long length); - -asmlinkage int sys32_truncate64(const char * path, unsigned long high, unsigned long low) -{ - if ((int)high < 0) - return -EINVAL; - else - return sys_truncate(path, (high << 32) | low); -} - -asmlinkage int sys32_ftruncate64(unsigned int fd, unsigned long high, unsigned long low) -{ - if ((int)high < 0) - return -EINVAL; - else - return sys_ftruncate(fd, (high << 32) | low); -} - -typedef ssize_t (*io_fn_t)(struct file *, char *, size_t, loff_t *); -typedef ssize_t (*iov_fn_t)(struct file *, const struct iovec *, unsigned long, loff_t *); - -static long do_readv_writev32(int type, struct file *file, - const struct compat_iovec *vector, u32 count) -{ - unsigned long tot_len; - struct iovec iovstack[UIO_FASTIOV]; - struct iovec *iov=iovstack, *ivp; - struct inode *inode; - long retval, i; - io_fn_t fn; - iov_fn_t fnv; - - /* First get the "struct iovec" from user memory and - * verify all the pointers - */ - if (!count) - return 0; - if (verify_area(VERIFY_READ, vector, sizeof(struct compat_iovec)*count)) - return -EFAULT; - if (count > UIO_MAXIOV) - return -EINVAL; - if (count > UIO_FASTIOV) { - iov = kmalloc(count*sizeof(struct iovec), GFP_KERNEL); - if (!iov) - return -ENOMEM; - } - - tot_len = 0; - i = count; - ivp = iov; - while(i > 0) { - u32 len; - u32 buf; - - __get_user(len, &vector->iov_len); - __get_user(buf, &vector->iov_base); - tot_len += len; - ivp->iov_base = (void *)A(buf); - ivp->iov_len = (__kernel_size_t) len; - vector++; - ivp++; - i--; - } - - inode = file->f_dentry->d_inode; - /* VERIFY_WRITE actually means a read, as we write to user space */ - retval = locks_verify_area((type == VERIFY_WRITE - ? FLOCK_VERIFY_READ : FLOCK_VERIFY_WRITE), - inode, file, file->f_pos, tot_len); - if (retval) - goto out; - - /* VERIFY_WRITE actually means a read, as we write to user space */ - fnv = (type == VERIFY_WRITE ? file->f_op->readv : file->f_op->writev); - if (fnv) { - retval = fnv(file, iov, count, &file->f_pos); - goto out; - } - - fn = (type == VERIFY_WRITE ? file->f_op->read : - (io_fn_t) file->f_op->write); - - ivp = iov; - while (count > 0) { - void * base; - int len, nr; - - base = ivp->iov_base; - len = ivp->iov_len; - ivp++; - count--; - nr = fn(file, base, len, &file->f_pos); - if (nr < 0) { - if (!retval) - retval = nr; - break; - } - retval += nr; - if (nr != len) - break; - } -out: - if (iov != iovstack) - kfree(iov); - - return retval; -} - -asmlinkage long sys32_readv(int fd, struct compat_iovec *vector, u32 count) -{ - struct file *file; - long ret = -EBADF; - - file = fget(fd); - if(!file) - goto bad_file; - - if (file->f_op && (file->f_mode & FMODE_READ) && - (file->f_op->readv || file->f_op->read)) - ret = do_readv_writev32(VERIFY_WRITE, file, vector, count); - fput(file); - -bad_file: - return ret; -} - -asmlinkage long sys32_writev(int fd, struct compat_iovec *vector, u32 count) -{ - struct file *file; - int ret = -EBADF; - - file = fget(fd); - if(!file) - goto bad_file; - if (file->f_op && (file->f_mode & FMODE_WRITE) && - (file->f_op->writev || file->f_op->write)) - ret = do_readv_writev32(VERIFY_READ, file, vector, count); - fput(file); - -bad_file: - return ret; -} - -/* readdir & getdents */ - -#define NAME_OFFSET(de) ((int) ((de)->d_name - (char *) (de))) -#define ROUND_UP(x) (((x)+sizeof(u32)-1) & ~(sizeof(u32)-1)) - -struct old_linux_dirent32 { - u32 d_ino; - u32 d_offset; - unsigned short d_namlen; - char d_name[1]; -}; - -struct readdir_callback32 { - struct old_linux_dirent32 * dirent; - int count; -}; - -static int fillonedir(void * __buf, const char * name, int namlen, - loff_t offset, ino_t ino, unsigned int d_type) -{ - struct readdir_callback32 * buf = (struct readdir_callback32 *) __buf; - struct old_linux_dirent32 * dirent; - - if (buf->count) - return -EINVAL; - buf->count++; - dirent = buf->dirent; - put_user(ino, &dirent->d_ino); - put_user(offset, &dirent->d_offset); - put_user(namlen, &dirent->d_namlen); - copy_to_user(dirent->d_name, name, namlen); - put_user(0, dirent->d_name + namlen); - return 0; -} - -asmlinkage int old32_readdir(unsigned int fd, struct old_linux_dirent32 *dirent, unsigned int count) -{ - int error = -EBADF; - struct file * file; - struct readdir_callback32 buf; - - file = fget(fd); - if (!file) - goto out; - - buf.count = 0; - buf.dirent = dirent; - - error = vfs_readdir(file, fillonedir, &buf); - if (error < 0) - goto out_putf; - error = buf.count; - -out_putf: - fput(file); -out: - return error; -} - -struct linux_dirent32 { - u32 d_ino; - u32 d_off; - unsigned short d_reclen; - char d_name[1]; -}; - -struct getdents_callback32 { - struct linux_dirent32 * current_dir; - struct linux_dirent32 * previous; - int count; - int error; -}; - -static int filldir(void * __buf, const char * name, int namlen, loff_t offset, ino_t ino, - unsigned int d_type) -{ - struct linux_dirent32 * dirent; - struct getdents_callback32 * buf = (struct getdents_callback32 *) __buf; - int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 1); - - buf->error = -EINVAL; /* only used if we fail.. */ - if (reclen > buf->count) - return -EINVAL; - dirent = buf->previous; - if (dirent) - put_user(offset, &dirent->d_off); - dirent = buf->current_dir; - buf->previous = dirent; - put_user(ino, &dirent->d_ino); - put_user(reclen, &dirent->d_reclen); - copy_to_user(dirent->d_name, name, namlen); - put_user(0, dirent->d_name + namlen); - ((char *) dirent) += reclen; - buf->current_dir = dirent; - buf->count -= reclen; - return 0; -} - -asmlinkage int sys32_getdents(unsigned int fd, struct linux_dirent32 *dirent, unsigned int count) -{ - struct file * file; - struct linux_dirent32 * lastdirent; - struct getdents_callback32 buf; - int error = -EBADF; - - file = fget(fd); - if (!file) - goto out; - - buf.current_dir = dirent; - buf.previous = NULL; - buf.count = count; - buf.error = 0; - - error = vfs_readdir(file, 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 = count - buf.count; - } -out_putf: - fput(file); -out: - return error; -} - -/* end of readdir & getdents */ - -/* - * Ooo, nasty. We need here to frob 32-bit unsigned longs to - * 64-bit unsigned longs. - */ - -static inline int -get_fd_set32(unsigned long n, unsigned long *fdset, u32 *ufdset) -{ - if (ufdset) { - unsigned long odd; - - if (verify_area(VERIFY_WRITE, ufdset, n*sizeof(u32))) - return -EFAULT; - - odd = n & 1UL; - n &= ~1UL; - while (n) { - unsigned long h, l; - __get_user(l, ufdset); - __get_user(h, ufdset+1); - ufdset += 2; - *fdset++ = h << 32 | l; - n -= 2; - } - if (odd) - __get_user(*fdset, ufdset); - } else { - /* Tricky, must clear full unsigned long in the - * kernel fdset at the end, this makes sure that - * actually happens. - */ - memset(fdset, 0, ((n + 1) & ~1)*sizeof(u32)); - } - return 0; -} - -static inline void -set_fd_set32(unsigned long n, u32 *ufdset, unsigned long *fdset) -{ - unsigned long odd; - - if (!ufdset) - return; - - odd = n & 1UL; - n &= ~1UL; - while (n) { - unsigned long h, l; - l = *fdset++; - h = l >> 32; - __put_user(l, ufdset); - __put_user(h, ufdset+1); - ufdset += 2; - n -= 2; - } - if (odd) - __put_user(*fdset, ufdset); -} - -#define MAX_SELECT_SECONDS \ - ((unsigned long) (MAX_SCHEDULE_TIMEOUT / HZ)-1) - -asmlinkage int sys32_select(int n, u32 *inp, u32 *outp, u32 *exp, u32 tvp_x) -{ - fd_set_bits fds; - struct compat_timeval *tvp = (struct compat_timeval *)AA(tvp_x); - char *bits; - unsigned long nn; - long timeout; - int ret, size; - - timeout = MAX_SCHEDULE_TIMEOUT; - if (tvp) { - int sec, usec; - - if ((ret = verify_area(VERIFY_READ, tvp, sizeof(*tvp))) - || (ret = __get_user(sec, &tvp->tv_sec)) - || (ret = __get_user(usec, &tvp->tv_usec))) - goto out_nofds; - - ret = -EINVAL; - if(sec < 0 || usec < 0) - goto out_nofds; - - if ((unsigned long) sec < MAX_SELECT_SECONDS) { - timeout = (usec + 1000000/HZ - 1) / (1000000/HZ); - timeout += sec * (unsigned long) HZ; - } - } - - ret = -EINVAL; - if (n < 0) - goto out_nofds; - if (n > current->files->max_fdset) - n = current->files->max_fdset; - - /* - * We need 6 bitmaps (in/out/ex for both incoming and outgoing), - * since we used fdset we need to allocate memory in units of - * long-words. - */ - ret = -ENOMEM; - size = FDS_BYTES(n); - bits = kmalloc(6 * size, GFP_KERNEL); - if (!bits) - goto out_nofds; - fds.in = (unsigned long *) bits; - fds.out = (unsigned long *) (bits + size); - fds.ex = (unsigned long *) (bits + 2*size); - fds.res_in = (unsigned long *) (bits + 3*size); - fds.res_out = (unsigned long *) (bits + 4*size); - fds.res_ex = (unsigned long *) (bits + 5*size); - - nn = (n + 8*sizeof(u32) - 1) / (8*sizeof(u32)); - if ((ret = get_fd_set32(nn, fds.in, inp)) || - (ret = get_fd_set32(nn, fds.out, outp)) || - (ret = get_fd_set32(nn, fds.ex, exp))) - goto out; - zero_fd_set(n, fds.res_in); - zero_fd_set(n, fds.res_out); - zero_fd_set(n, fds.res_ex); - - ret = do_select(n, &fds, &timeout); - - if (tvp && !(current->personality & STICKY_TIMEOUTS)) { - int sec = 0, usec = 0; - if (timeout) { - sec = timeout / HZ; - usec = timeout % HZ; - usec *= (1000000/HZ); - } - put_user(sec, &tvp->tv_sec); - put_user(usec, &tvp->tv_usec); - } - - if (ret < 0) - goto out; - if (!ret) { - ret = -ERESTARTNOHAND; - if (signal_pending(current)) - goto out; - ret = 0; - } - - set_fd_set32(nn, inp, fds.res_in); - set_fd_set32(nn, outp, fds.res_out); - set_fd_set32(nn, exp, fds.res_ex); - -out: - kfree(bits); -out_nofds: - return ret; -} - -int cp_compat_stat(struct kstat *stat, struct compat_stat *statbuf) -{ - int err; - - err = put_user(stat->dev, &statbuf->st_dev); - err |= put_user(stat->ino, &statbuf->st_ino); - err |= put_user(stat->mode, &statbuf->st_mode); - err |= put_user(stat->nlink, &statbuf->st_nlink); - err |= put_user(high2lowuid(stat->uid), &statbuf->st_uid); - err |= put_user(high2lowgid(stat->gid), &statbuf->st_gid); - err |= put_user(stat->rdev, &statbuf->st_rdev); - err |= put_user(stat->size, &statbuf->st_size); - err |= put_user(stat->atime.tv_sec, &statbuf->st_atime); - err |= put_user(stat->atime.tv_nsec, &statbuf->st_atime_nsec); - err |= put_user(stat->mtime.tv_sec, &statbuf->st_mtime); - err |= put_user(stat->mtime.tv_nsec, &statbuf->st_mtime_nsec); - err |= put_user(stat->ctime.tv_sec, &statbuf->st_ctime); - err |= put_user(stat->ctime.tv_nsec, &statbuf->st_ctime_nsec); - err |= put_user(stat->blksize, &statbuf->st_blksize); - err |= put_user(stat->blocks, &statbuf->st_blocks); -/* fixme - err |= put_user(0, &statbuf->__unused4[0]); - err |= put_user(0, &statbuf->__unused4[1]); -*/ - return err; -} - -extern asmlinkage int sys_sysfs(int option, unsigned long arg1, unsigned long arg2); - -asmlinkage int sys32_sysfs(int option, u32 arg1, u32 arg2) -{ - return sys_sysfs(option, arg1, arg2); -} - -struct ncp_mount_data32 { - int version; - unsigned int ncp_fd; - compat_uid_t mounted_uid; - compat_pid_t wdog_pid; - unsigned char mounted_vol[NCP_VOLNAME_LEN + 1]; - unsigned int time_out; - unsigned int retry_count; - unsigned int flags; - compat_uid_t uid; - compat_gid_t gid; - compat_mode_t file_mode; - compat_mode_t dir_mode; -}; - -static void *do_ncp_super_data_conv(void *raw_data) -{ - struct ncp_mount_data *n = (struct ncp_mount_data *)raw_data; - struct ncp_mount_data32 *n32 = (struct ncp_mount_data32 *)raw_data; - - n->dir_mode = n32->dir_mode; - n->file_mode = n32->file_mode; - n->gid = low2highgid(n32->gid); - n->uid = low2highuid(n32->uid); - memmove (n->mounted_vol, n32->mounted_vol, (sizeof (n32->mounted_vol) + 3 * sizeof (unsigned int))); - n->wdog_pid = n32->wdog_pid; - n->mounted_uid = low2highuid(n32->mounted_uid); - return raw_data; -} - -struct smb_mount_data32 { - int version; - compat_uid_t mounted_uid; - compat_uid_t uid; - compat_gid_t gid; - compat_mode_t file_mode; - compat_mode_t dir_mode; -}; - -static void *do_smb_super_data_conv(void *raw_data) -{ - struct smb_mount_data *s = (struct smb_mount_data *)raw_data; - struct smb_mount_data32 *s32 = (struct smb_mount_data32 *)raw_data; - - if (s32->version != SMB_MOUNT_OLDVERSION) - goto out; - s->version = s32->version; - s->mounted_uid = low2highuid(s32->mounted_uid); - s->uid = low2highuid(s32->uid); - s->gid = low2highgid(s32->gid); - s->file_mode = s32->file_mode; - s->dir_mode = s32->dir_mode; -out: - return raw_data; -} - -static int copy_mount_stuff_to_kernel(const void *user, unsigned long *kernel) -{ - int i; - unsigned long page; - struct vm_area_struct *vma; - - *kernel = 0; - if(!user) - return 0; - vma = find_vma(current->mm, (unsigned long)user); - if(!vma || (unsigned long)user < vma->vm_start) - return -EFAULT; - if(!(vma->vm_flags & VM_READ)) - return -EFAULT; - i = vma->vm_end - (unsigned long) user; - if(PAGE_SIZE <= (unsigned long) i) - i = PAGE_SIZE - 1; - if(!(page = __get_free_page(GFP_KERNEL))) - return -ENOMEM; - if(copy_from_user((void *) page, user, i)) { - free_page(page); - return -EFAULT; - } - *kernel = page; - return 0; -} - -#define SMBFS_NAME "smbfs" -#define NCPFS_NAME "ncpfs" - -asmlinkage int sys32_mount(char *dev_name, char *dir_name, char *type, unsigned long new_flags, u32 data) -{ - unsigned long type_page = 0; - unsigned long data_page = 0; - unsigned long dev_page = 0; - unsigned long dir_page = 0; - int err, is_smb, is_ncp; - - is_smb = is_ncp = 0; - - err = copy_mount_stuff_to_kernel((const void *)type, &type_page); - if (err) - goto out; - - if (!type_page) { - err = -EINVAL; - goto out; - } - - is_smb = !strcmp((char *)type_page, SMBFS_NAME); - is_ncp = !strcmp((char *)type_page, NCPFS_NAME); - - err = copy_mount_stuff_to_kernel((const void *)AA(data), &data_page); - if (err) - goto type_out; - - err = copy_mount_stuff_to_kernel(dev_name, &dev_page); - if (err) - goto data_out; - - err = copy_mount_stuff_to_kernel(dir_name, &dir_page); - if (err) - goto dev_out; - - if (!is_smb && !is_ncp) { - lock_kernel(); - err = do_mount((char*)dev_page, (char*)dir_page, - (char*)type_page, new_flags, (char*)data_page); - unlock_kernel(); - } else { - if (is_ncp) - do_ncp_super_data_conv((void *)data_page); - else - do_smb_super_data_conv((void *)data_page); - - lock_kernel(); - err = do_mount((char*)dev_page, (char*)dir_page, - (char*)type_page, new_flags, (char*)data_page); - unlock_kernel(); - } - free_page(dir_page); - -dev_out: - free_page(dev_page); - -data_out: - free_page(data_page); - -type_out: - free_page(type_page); - -out: - return err; -} - -struct rusage32 { - struct compat_timeval ru_utime; - struct compat_timeval ru_stime; - s32 ru_maxrss; - s32 ru_ixrss; - s32 ru_idrss; - s32 ru_isrss; - s32 ru_minflt; - s32 ru_majflt; - s32 ru_nswap; - s32 ru_inblock; - s32 ru_oublock; - s32 ru_msgsnd; - s32 ru_msgrcv; - s32 ru_nsignals; - s32 ru_nvcsw; - s32 ru_nivcsw; -}; - -static int put_rusage (struct rusage32 *ru, struct rusage *r) -{ - int err; - - err = put_user (r->ru_utime.tv_sec, &ru->ru_utime.tv_sec); - err |= __put_user (r->ru_utime.tv_usec, &ru->ru_utime.tv_usec); - err |= __put_user (r->ru_stime.tv_sec, &ru->ru_stime.tv_sec); - err |= __put_user (r->ru_stime.tv_usec, &ru->ru_stime.tv_usec); - err |= __put_user (r->ru_maxrss, &ru->ru_maxrss); - err |= __put_user (r->ru_ixrss, &ru->ru_ixrss); - err |= __put_user (r->ru_idrss, &ru->ru_idrss); - err |= __put_user (r->ru_isrss, &ru->ru_isrss); - err |= __put_user (r->ru_minflt, &ru->ru_minflt); - err |= __put_user (r->ru_majflt, &ru->ru_majflt); - err |= __put_user (r->ru_nswap, &ru->ru_nswap); - err |= __put_user (r->ru_inblock, &ru->ru_inblock); - err |= __put_user (r->ru_oublock, &ru->ru_oublock); - err |= __put_user (r->ru_msgsnd, &ru->ru_msgsnd); - err |= __put_user (r->ru_msgrcv, &ru->ru_msgrcv); - err |= __put_user (r->ru_nsignals, &ru->ru_nsignals); - err |= __put_user (r->ru_nvcsw, &ru->ru_nvcsw); - err |= __put_user (r->ru_nivcsw, &ru->ru_nivcsw); - return err; -} - -asmlinkage int sys32_wait4(compat_pid_t pid, unsigned int *stat_addr, int options, struct rusage32 *ru) -{ - if (!ru) - return sys_wait4(pid, stat_addr, options, NULL); - else { - struct rusage r; - int ret; - unsigned int status; - mm_segment_t old_fs = get_fs(); - - set_fs (KERNEL_DS); - ret = sys_wait4(pid, stat_addr ? &status : NULL, options, &r); - set_fs (old_fs); - if (put_rusage (ru, &r)) return -EFAULT; - if (stat_addr && put_user (status, stat_addr)) - return -EFAULT; - return ret; - } -} - -struct sysinfo32 { - s32 uptime; - u32 loads[3]; - u32 totalram; - u32 freeram; - u32 sharedram; - u32 bufferram; - u32 totalswap; - u32 freeswap; - unsigned short procs; - char _f[22]; -}; - -extern asmlinkage int sys_sysinfo(struct sysinfo *info); - -asmlinkage int sys32_sysinfo(struct sysinfo32 *info) -{ - struct sysinfo s; - int ret, err; - mm_segment_t old_fs = get_fs (); - - set_fs (KERNEL_DS); - ret = sys_sysinfo(&s); - set_fs (old_fs); - err = put_user (s.uptime, &info->uptime); - err |= __put_user (s.loads[0], &info->loads[0]); - err |= __put_user (s.loads[1], &info->loads[1]); - err |= __put_user (s.loads[2], &info->loads[2]); - err |= __put_user (s.totalram, &info->totalram); - err |= __put_user (s.freeram, &info->freeram); - err |= __put_user (s.sharedram, &info->sharedram); - err |= __put_user (s.bufferram, &info->bufferram); - err |= __put_user (s.totalswap, &info->totalswap); - err |= __put_user (s.freeswap, &info->freeswap); - err |= __put_user (s.procs, &info->procs); - if (err) - return -EFAULT; - return ret; -} - -extern asmlinkage int sys_sched_rr_get_interval(pid_t pid, struct timespec *interval); - -asmlinkage int sys32_sched_rr_get_interval(compat_pid_t pid, - struct compat_timespec *interval) -{ - struct timespec t; - int ret; - mm_segment_t old_fs = get_fs (); - - set_fs (KERNEL_DS); - ret = sys_sched_rr_get_interval(pid, &t); - set_fs (old_fs); - if (put_compat_timespec(&t, interval)) - return -EFAULT; - return ret; -} - -extern asmlinkage int sys_rt_sigprocmask(int how, sigset_t *set, sigset_t *oset, size_t sigsetsize); - -asmlinkage int sys32_rt_sigprocmask(int how, compat_sigset_t *set, compat_sigset_t *oset, compat_size_t sigsetsize) -{ - sigset_t s; - compat_sigset_t s32; - int ret; - mm_segment_t old_fs = get_fs(); - - if (set) { - if (copy_from_user (&s32, set, sizeof(compat_sigset_t))) - return -EFAULT; - switch (_NSIG_WORDS) { - case 4: s.sig[3] = s32.sig[6] | (((long)s32.sig[7]) << 32); - case 3: s.sig[2] = s32.sig[4] | (((long)s32.sig[5]) << 32); - case 2: s.sig[1] = s32.sig[2] | (((long)s32.sig[3]) << 32); - case 1: s.sig[0] = s32.sig[0] | (((long)s32.sig[1]) << 32); - } - } - set_fs (KERNEL_DS); - ret = sys_rt_sigprocmask(how, set ? &s : NULL, oset ? &s : NULL, sigsetsize); - set_fs (old_fs); - if (ret) return ret; - if (oset) { - switch (_NSIG_WORDS) { - case 4: s32.sig[7] = (s.sig[3] >> 32); s32.sig[6] = s.sig[3]; - case 3: s32.sig[5] = (s.sig[2] >> 32); s32.sig[4] = s.sig[2]; - case 2: s32.sig[3] = (s.sig[1] >> 32); s32.sig[2] = s.sig[1]; - case 1: s32.sig[1] = (s.sig[0] >> 32); s32.sig[0] = s.sig[0]; - } - if (copy_to_user (oset, &s32, sizeof(compat_sigset_t))) - return -EFAULT; - } - return 0; -} - -extern asmlinkage int sys_rt_sigpending(sigset_t *set, size_t sigsetsize); - -asmlinkage int sys32_rt_sigpending(compat_sigset_t *set, compat_size_t sigsetsize) -{ - sigset_t s; - compat_sigset_t s32; - int ret; - mm_segment_t old_fs = get_fs(); - - set_fs (KERNEL_DS); - ret = sys_rt_sigpending(&s, sigsetsize); - set_fs (old_fs); - if (!ret) { - switch (_NSIG_WORDS) { - case 4: s32.sig[7] = (s.sig[3] >> 32); s32.sig[6] = s.sig[3]; - case 3: s32.sig[5] = (s.sig[2] >> 32); s32.sig[4] = s.sig[2]; - case 2: s32.sig[3] = (s.sig[1] >> 32); s32.sig[2] = s.sig[1]; - case 1: s32.sig[1] = (s.sig[0] >> 32); s32.sig[0] = s.sig[0]; - } - if (copy_to_user (set, &s32, sizeof(compat_sigset_t))) - return -EFAULT; - } - return ret; -} - -extern int -copy_siginfo_to_user32(siginfo_t32 *to, siginfo_t *from); - -asmlinkage int -sys32_rt_sigtimedwait(compat_sigset_t *uthese, siginfo_t32 *uinfo, - struct compat_timespec *uts, compat_size_t sigsetsize) -{ - int ret, sig; - sigset_t these; - compat_sigset_t these32; - struct timespec ts; - siginfo_t info; - long timeout = 0; - - /* XXX: Don't preclude handling different sized sigset_t's. */ - if (sigsetsize != sizeof(sigset_t)) - return -EINVAL; - - if (copy_from_user (&these32, uthese, sizeof(compat_sigset_t))) - return -EFAULT; - - switch (_NSIG_WORDS) { - case 4: these.sig[3] = these32.sig[6] | (((long)these32.sig[7]) << 32); - case 3: these.sig[2] = these32.sig[4] | (((long)these32.sig[5]) << 32); - case 2: these.sig[1] = these32.sig[2] | (((long)these32.sig[3]) << 32); - case 1: these.sig[0] = these32.sig[0] | (((long)these32.sig[1]) << 32); - } - - /* - * Invert the set of allowed signals to get those we - * want to block. - */ - sigdelsetmask(&these, sigmask(SIGKILL)|sigmask(SIGSTOP)); - signotset(&these); - - if (uts) { - if (get_compat_timespec(&ts, uts)) - return -EINVAL; - if (ts.tv_nsec >= 1000000000L || ts.tv_nsec < 0 - || ts.tv_sec < 0) - return -EINVAL; - } - - spin_lock_irq(¤t->sighand->siglock); - sig = dequeue_signal(current, &these, &info); - if (!sig) { - /* None ready -- temporarily unblock those we're interested - in so that we'll be awakened when they arrive. */ - current->real_blocked = current->blocked; - sigandsets(¤t->blocked, ¤t->blocked, &these); - recalc_sigpending(); - spin_unlock_irq(¤t->sighand->siglock); - - timeout = MAX_SCHEDULE_TIMEOUT; - if (uts) - timeout = (timespec_to_jiffies(&ts) - + (ts.tv_sec || ts.tv_nsec)); - - current->state = TASK_INTERRUPTIBLE; - timeout = schedule_timeout(timeout); - - spin_lock_irq(¤t->sighand->siglock); - sig = dequeue_signal(current, &these, &info); - current->blocked = current->real_blocked; - siginitset(¤t->real_blocked, 0); - recalc_sigpending(); - } - spin_unlock_irq(¤t->sighand->siglock); - - if (sig) { - ret = sig; - if (uinfo) { - if (copy_siginfo_to_user32(uinfo, &info)) - ret = -EFAULT; - } - } else { - ret = -EAGAIN; - if (timeout) - ret = -EINTR; - } - - return ret; -} - -extern asmlinkage int -sys_rt_sigqueueinfo(int pid, int sig, siginfo_t *uinfo); - -asmlinkage int -sys32_rt_sigqueueinfo(int pid, int sig, siginfo_t32 *uinfo) -{ - siginfo_t info; - int ret; - mm_segment_t old_fs = get_fs(); - - if (copy_from_user (&info, uinfo, 3*sizeof(int)) || - copy_from_user (info._sifields._pad, uinfo->_sifields._pad, SI_PAD_SIZE)) - return -EFAULT; - set_fs (KERNEL_DS); - ret = sys_rt_sigqueueinfo(pid, sig, &info); - set_fs (old_fs); - return ret; -} - -#define RLIM_OLD_INFINITY32 0x7fffffff -#define RLIM_INFINITY32 0xffffffff -#define RESOURCE32_OLD(x) ((x > RLIM_OLD_INFINITY32) ? RLIM_OLD_INFINITY32 : x) -#define RESOURCE32(x) ((x > RLIM_INFINITY32) ? RLIM_INFINITY32 : x) - -struct rlimit32 { - u32 rlim_cur; - u32 rlim_max; -}; - -extern asmlinkage long sys_getrlimit(unsigned int resource, struct rlimit *rlim); - -asmlinkage int sys32_old_getrlimit(unsigned int resource, struct rlimit32 *rlim) -{ - struct rlimit r; - int ret; - mm_segment_t old_fs = get_fs (); - - set_fs (KERNEL_DS); - ret = sys_getrlimit(resource, &r); - set_fs (old_fs); - if (!ret) { - ret = put_user (RESOURCE32_OLD(r.rlim_cur), &rlim->rlim_cur); - ret |= __put_user (RESOURCE32_OLD(r.rlim_max), &rlim->rlim_max); - } - return ret; -} - -asmlinkage int sys32_getrlimit(unsigned int resource, struct rlimit32 *rlim) -{ - struct rlimit r; - int ret; - mm_segment_t old_fs = get_fs (); - - set_fs (KERNEL_DS); - ret = sys_getrlimit(resource, &r); - set_fs (old_fs); - if (!ret) { - ret = put_user (RESOURCE32(r.rlim_cur), &rlim->rlim_cur); - ret |= __put_user (RESOURCE32(r.rlim_max), &rlim->rlim_max); - } - return ret; -} - -extern asmlinkage int sys_setrlimit(unsigned int resource, struct rlimit *rlim); - -asmlinkage int sys32_setrlimit(unsigned int resource, struct rlimit32 *rlim) -{ - struct rlimit r; - int ret; - mm_segment_t old_fs = get_fs (); - - if (resource >= RLIM_NLIMITS) return -EINVAL; - if (get_user (r.rlim_cur, &rlim->rlim_cur) || - __get_user (r.rlim_max, &rlim->rlim_max)) - return -EFAULT; - if (r.rlim_cur == RLIM_INFINITY32) - r.rlim_cur = RLIM_INFINITY; - if (r.rlim_max == RLIM_INFINITY32) - r.rlim_max = RLIM_INFINITY; - set_fs (KERNEL_DS); - ret = sys_setrlimit(resource, &r); - set_fs (old_fs); - return ret; -} - -extern asmlinkage int sys_getrusage(int who, struct rusage *ru); - -asmlinkage int sys32_getrusage(int who, struct rusage32 *ru) -{ - struct rusage r; - int ret; - mm_segment_t old_fs = get_fs(); - - set_fs (KERNEL_DS); - ret = sys_getrusage(who, &r); - set_fs (old_fs); - if (put_rusage (ru, &r)) return -EFAULT; - return ret; -} - -extern void check_pending(int signum); - -/* - * count32() counts the number of arguments/envelopes - */ -static int count32(u32 * argv) -{ - int i = 0; - - if (argv != NULL) { - for (;;) { - u32 p; int error; - - error = get_user(p,argv); - if (error) return error; - if (!p) break; - argv++; i++; - } - } - return i; -} - -/* - * 'copy_string32()' copies argument/envelope strings from user - * memory to free pages in kernel mem. These are in a format ready - * to be put directly into the top of new user memory. - */ -static int copy_strings32(int argc, u32 * argv, struct linux_binprm *bprm) -{ - while (argc-- > 0) { - u32 str; - int len; - unsigned long pos; - - if (get_user(str, argv + argc) || - !str || - !(len = strnlen_user((char *)A(str), bprm->p))) - return -EFAULT; - - if (bprm->p < len) - return -E2BIG; - - bprm->p -= len; - - pos = bprm->p; - while (len) { - char *kaddr; - struct page *page; - int offset, bytes_to_copy, new, err; - - offset = pos % PAGE_SIZE; - page = bprm->page[pos / PAGE_SIZE]; - new = 0; - if (!page) { - page = alloc_page(GFP_USER); - bprm->page[pos / PAGE_SIZE] = page; - if (!page) - return -ENOMEM; - new = 1; - } - kaddr = (char *)kmap(page); - - if (new && offset) - memset(kaddr, 0, offset); - bytes_to_copy = PAGE_SIZE - offset; - if (bytes_to_copy > len) { - bytes_to_copy = len; - if (new) - memset(kaddr+offset+len, 0, - PAGE_SIZE-offset-len); - } - - err = copy_from_user(kaddr + offset, (char *)A(str), - bytes_to_copy); - kunmap(page); - - if (err) - return -EFAULT; - - pos += bytes_to_copy; - str += bytes_to_copy; - len -= bytes_to_copy; - } - } - return 0; -} - -/* - * sys32_execve() executes a new program. - */ -static inline int -do_execve32(char * filename, u32 * argv, u32 * envp, struct pt_regs * regs) -{ - struct linux_binprm bprm; - struct file * file; - int retval; - int i; - - sched_balance_exec(); - - file = open_exec(filename); - - retval = PTR_ERR(file); - if (IS_ERR(file)) - return retval; - - bprm.p = PAGE_SIZE*MAX_ARG_PAGES-sizeof(void *); - memset(bprm.page, 0, MAX_ARG_PAGES * sizeof(bprm.page[0])); - - bprm.file = file; - bprm.filename = filename; - bprm.sh_bang = 0; - bprm.loader = 0; - bprm.exec = 0; - bprm.mm = mm_alloc(); - retval = -ENOMEM; - if (!bprm.mm) - goto out_file; - - /* init_new_context is empty for s390x. */ - - bprm.argc = count32(argv); - if ((retval = bprm.argc) < 0) - goto out_mm; - - bprm.envc = count32(envp); - if ((retval = bprm.envc) < 0) - goto out_mm; - - retval = security_bprm_alloc(&bprm); - if (retval) - goto out; - - retval = prepare_binprm(&bprm); - if (retval < 0) - goto out; - - retval = copy_strings_kernel(1, &bprm.filename, &bprm); - if (retval < 0) - goto out; - - bprm.exec = bprm.p; - retval = copy_strings32(bprm.envc, envp, &bprm); - if (retval < 0) - goto out; - - retval = copy_strings32(bprm.argc, argv, &bprm); - if (retval < 0) - goto out; - - retval = search_binary_handler(&bprm, regs); - if (retval >= 0) { - /* execve success */ - security_bprm_free(&bprm); - return retval; - } - -out: - /* Something went wrong, return the inode and free the argument pages*/ - for (i=0 ; iptrace &= ~PT_DTRACE; - current->thread.fp_regs.fpc=0; - __asm__ __volatile__ - ("sr 0,0\n\t" - "sfpc 0,0\n\t" - : : :"0"); - } - putname(filename); -out: - return error; -} - - -#ifdef CONFIG_MODULES - -extern asmlinkage int sys_init_module(const char *name_user, struct module *mod_user); - -/* Hey, when you're trying to init module, take time and prepare us a nice 64bit - * module structure, even if from 32bit modutils... Why to pollute kernel... :)) - */ -asmlinkage int sys32_init_module(const char *name_user, struct module *mod_user) -{ - return sys_init_module(name_user, mod_user); -} - -extern asmlinkage int sys_delete_module(const char *name_user); - -asmlinkage int sys32_delete_module(const char *name_user) -{ - return sys_delete_module(name_user); -} - -struct module_info32 { - u32 addr; - u32 size; - u32 flags; - s32 usecount; -}; - -#else /* CONFIG_MODULES */ - -asmlinkage int -sys32_init_module(const char *name_user, struct module *mod_user) -{ - return -ENOSYS; -} - -asmlinkage int -sys32_delete_module(const char *name_user) -{ - return -ENOSYS; -} - -#endif /* CONFIG_MODULES */ - -/* Stuff for NFS server syscalls... */ -struct nfsctl_svc32 { - u16 svc32_port; - s32 svc32_nthreads; -}; - -struct nfsctl_client32 { - s8 cl32_ident[NFSCLNT_IDMAX+1]; - s32 cl32_naddr; - struct in_addr cl32_addrlist[NFSCLNT_ADDRMAX]; - s32 cl32_fhkeytype; - s32 cl32_fhkeylen; - u8 cl32_fhkey[NFSCLNT_KEYMAX]; -}; - -struct nfsctl_export32 { - s8 ex32_client[NFSCLNT_IDMAX+1]; - s8 ex32_path[NFS_MAXPATHLEN+1]; - compat_dev_t ex32_dev; - compat_ino_t ex32_ino; - s32 ex32_flags; - compat_uid_t ex32_anon_uid; - compat_gid_t ex32_anon_gid; -}; - -struct nfsctl_fdparm32 { - struct sockaddr gd32_addr; - s8 gd32_path[NFS_MAXPATHLEN+1]; - s32 gd32_version; -}; - -struct nfsctl_fsparm32 { - struct sockaddr gd32_addr; - s8 gd32_path[NFS_MAXPATHLEN+1]; - s32 gd32_maxlen; -}; - -struct nfsctl_arg32 { - s32 ca32_version; /* safeguard */ - union { - struct nfsctl_svc32 u32_svc; - struct nfsctl_client32 u32_client; - struct nfsctl_export32 u32_export; - struct nfsctl_fdparm32 u32_getfd; - struct nfsctl_fsparm32 u32_getfs; - } u; -#define ca32_svc u.u32_svc -#define ca32_client u.u32_client -#define ca32_export u.u32_export -#define ca32_getfd u.u32_getfd -#define ca32_getfs u.u32_getfs -#define ca32_authd u.u32_authd -}; - -union nfsctl_res32 { - __u8 cr32_getfh[NFS_FHSIZE]; - struct knfsd_fh cr32_getfs; -}; - -static int nfs_svc32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32) -{ - int err; - - err = __get_user(karg->ca_version, &arg32->ca32_version); - err |= __get_user(karg->ca_svc.svc_port, &arg32->ca32_svc.svc32_port); - err |= __get_user(karg->ca_svc.svc_nthreads, &arg32->ca32_svc.svc32_nthreads); - return err; -} - -static int nfs_clnt32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32) -{ - int err; - - err = __get_user(karg->ca_version, &arg32->ca32_version); - err |= copy_from_user(&karg->ca_client.cl_ident[0], - &arg32->ca32_client.cl32_ident[0], - NFSCLNT_IDMAX); - err |= __get_user(karg->ca_client.cl_naddr, &arg32->ca32_client.cl32_naddr); - err |= copy_from_user(&karg->ca_client.cl_addrlist[0], - &arg32->ca32_client.cl32_addrlist[0], - (sizeof(struct in_addr) * NFSCLNT_ADDRMAX)); - err |= __get_user(karg->ca_client.cl_fhkeytype, - &arg32->ca32_client.cl32_fhkeytype); - err |= __get_user(karg->ca_client.cl_fhkeylen, - &arg32->ca32_client.cl32_fhkeylen); - err |= copy_from_user(&karg->ca_client.cl_fhkey[0], - &arg32->ca32_client.cl32_fhkey[0], - NFSCLNT_KEYMAX); - return err; -} - -static int nfs_exp32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32) -{ - int err; - - err = __get_user(karg->ca_version, &arg32->ca32_version); - err |= copy_from_user(&karg->ca_export.ex_client[0], - &arg32->ca32_export.ex32_client[0], - NFSCLNT_IDMAX); - err |= copy_from_user(&karg->ca_export.ex_path[0], - &arg32->ca32_export.ex32_path[0], - NFS_MAXPATHLEN); - err |= __get_user(karg->ca_export.ex_dev, - &arg32->ca32_export.ex32_dev); - err |= __get_user(karg->ca_export.ex_ino, - &arg32->ca32_export.ex32_ino); - err |= __get_user(karg->ca_export.ex_flags, - &arg32->ca32_export.ex32_flags); - err |= __get_user(karg->ca_export.ex_anon_uid, - &arg32->ca32_export.ex32_anon_uid); - err |= __get_user(karg->ca_export.ex_anon_gid, - &arg32->ca32_export.ex32_anon_gid); - karg->ca_export.ex_anon_uid = high2lowuid(karg->ca_export.ex_anon_uid); - karg->ca_export.ex_anon_gid = high2lowgid(karg->ca_export.ex_anon_gid); - return err; -} - -static int nfs_getfd32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32) -{ - int err; - - err = __get_user(karg->ca_version, &arg32->ca32_version); - err |= copy_from_user(&karg->ca_getfd.gd_addr, - &arg32->ca32_getfd.gd32_addr, - (sizeof(struct sockaddr))); - err |= copy_from_user(&karg->ca_getfd.gd_path, - &arg32->ca32_getfd.gd32_path, - (NFS_MAXPATHLEN+1)); - err |= __get_user(karg->ca_getfd.gd_version, - &arg32->ca32_getfd.gd32_version); - return err; -} - -static int nfs_getfs32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32) -{ - int err; - - err = __get_user(karg->ca_version, &arg32->ca32_version); - err |= copy_from_user(&karg->ca_getfs.gd_addr, - &arg32->ca32_getfs.gd32_addr, - (sizeof(struct sockaddr))); - err |= copy_from_user(&karg->ca_getfs.gd_path, - &arg32->ca32_getfs.gd32_path, - (NFS_MAXPATHLEN+1)); - err |= __get_user(karg->ca_getfs.gd_maxlen, - &arg32->ca32_getfs.gd32_maxlen); - return err; -} - -/* This really doesn't need translations, we are only passing - * back a union which contains opaque nfs file handle data. - */ -static int nfs_getfh32_res_trans(union nfsctl_res *kres, union nfsctl_res32 *res32) -{ - return copy_to_user(res32, kres, sizeof(*res32)) ? -EFAULT : 0; -} - -/* -asmlinkage long sys_ni_syscall(void); -*/ - -int asmlinkage sys32_nfsservctl(int cmd, struct nfsctl_arg32 *arg32, union nfsctl_res32 *res32) -{ - struct nfsctl_arg *karg = NULL; - union nfsctl_res *kres = NULL; - mm_segment_t oldfs; - int err; - - karg = kmalloc(sizeof(*karg), GFP_USER); - if(!karg) - return -ENOMEM; - if(res32) { - kres = kmalloc(sizeof(*kres), GFP_USER); - if(!kres) { - kfree(karg); - return -ENOMEM; - } - } - switch(cmd) { - case NFSCTL_SVC: - err = nfs_svc32_trans(karg, arg32); - break; - case NFSCTL_ADDCLIENT: - err = nfs_clnt32_trans(karg, arg32); - break; - case NFSCTL_DELCLIENT: - err = nfs_clnt32_trans(karg, arg32); - break; - case NFSCTL_EXPORT: - case NFSCTL_UNEXPORT: - err = nfs_exp32_trans(karg, arg32); - break; - case NFSCTL_GETFD: - err = nfs_getfd32_trans(karg, arg32); - break; - case NFSCTL_GETFS: - err = nfs_getfs32_trans(karg, arg32); - break; - default: - err = -EINVAL; - break; - } - if(err) - goto done; - oldfs = get_fs(); - set_fs(KERNEL_DS); - err = sys_nfsservctl(cmd, karg, kres); - set_fs(oldfs); - - if (err) - goto done; - - if((cmd == NFSCTL_GETFD) || - (cmd == NFSCTL_GETFS)) - err = nfs_getfh32_res_trans(kres, res32); - -done: - if(karg) - kfree(karg); - if(kres) - kfree(kres); - return err; -} - -/* Translations due to time_t size differences. Which affects all - sorts of things, like timeval and itimerval. */ - -extern struct timezone sys_tz; -extern int do_sys_settimeofday(struct timeval *tv, struct timezone *tz); - -asmlinkage int sys32_gettimeofday(struct compat_timeval *tv, struct timezone *tz) -{ - if (tv) { - struct timeval ktv; - do_gettimeofday(&ktv); - if (put_tv32(tv, &ktv)) - return -EFAULT; - } - if (tz) { - if (copy_to_user(tz, &sys_tz, sizeof(sys_tz))) - return -EFAULT; - } - return 0; -} - -asmlinkage int sys32_settimeofday(struct compat_timeval *tv, struct timezone *tz) -{ - struct timeval ktv; - struct timezone ktz; - - if (tv) { - if (get_tv32(&ktv, tv)) - return -EFAULT; - } - if (tz) { - if (copy_from_user(&ktz, tz, sizeof(ktz))) - return -EFAULT; - } - - return do_sys_settimeofday(tv ? &ktv : NULL, tz ? &ktz : NULL); -} - -asmlinkage int sys_utimes(char *, struct timeval *); - -asmlinkage int sys32_utimes(char *filename, struct compat_timeval *tvs) -{ - char *kfilename; - struct timeval ktvs[2]; - mm_segment_t old_fs; - int ret; - - kfilename = getname(filename); - ret = PTR_ERR(kfilename); - if (!IS_ERR(kfilename)) { - if (tvs) { - if (get_tv32(&ktvs[0], tvs) || - get_tv32(&ktvs[1], 1+tvs)) - return -EFAULT; - } - - old_fs = get_fs(); - set_fs(KERNEL_DS); - ret = sys_utimes(kfilename, &ktvs[0]); - set_fs(old_fs); - - putname(kfilename); - } - return ret; -} - -/* These are here just in case some old sparc32 binary calls it. */ -asmlinkage int sys32_pause(void) -{ - current->state = TASK_INTERRUPTIBLE; - schedule(); - return -ERESTARTNOHAND; -} - -extern asmlinkage int sys_prctl(int option, unsigned long arg2, unsigned long arg3, - unsigned long arg4, unsigned long arg5); - -asmlinkage int sys32_prctl(int option, u32 arg2, u32 arg3, u32 arg4, u32 arg5) -{ - return sys_prctl(option, - (unsigned long) arg2, - (unsigned long) arg3, - (unsigned long) arg4, - (unsigned long) arg5); -} - - -extern asmlinkage ssize_t sys_pread64(unsigned int fd, char * buf, - size_t count, loff_t pos); - -extern asmlinkage ssize_t sys_pwrite64(unsigned int fd, const char * buf, - size_t count, loff_t pos); - -asmlinkage compat_ssize_t sys32_pread64(unsigned int fd, char *ubuf, - compat_size_t count, u32 poshi, u32 poslo) -{ - if ((compat_ssize_t) count < 0) - return -EINVAL; - return sys_pread64(fd, ubuf, count, ((loff_t)AA(poshi) << 32) | AA(poslo)); -} - -asmlinkage compat_ssize_t sys32_pwrite64(unsigned int fd, char *ubuf, - compat_size_t count, u32 poshi, u32 poslo) -{ - if ((compat_ssize_t) count < 0) - return -EINVAL; - return sys_pwrite64(fd, ubuf, count, ((loff_t)AA(poshi) << 32) | AA(poslo)); -} - -extern asmlinkage ssize_t sys_readahead(int fd, loff_t offset, size_t count); - -asmlinkage compat_ssize_t sys32_readahead(int fd, u32 offhi, u32 offlo, s32 count) -{ - return sys_readahead(fd, ((loff_t)AA(offhi) << 32) | AA(offlo), count); -} - -extern asmlinkage ssize_t sys_sendfile(int out_fd, int in_fd, off_t *offset, size_t count); - -asmlinkage int sys32_sendfile(int out_fd, int in_fd, compat_off_t *offset, s32 count) -{ - mm_segment_t old_fs = get_fs(); - int ret; - off_t of; - - if (offset && get_user(of, offset)) - return -EFAULT; - - set_fs(KERNEL_DS); - ret = sys_sendfile(out_fd, in_fd, offset ? &of : NULL, count); - set_fs(old_fs); - - if (!ret && offset && put_user(of, offset)) - return -EFAULT; - - return ret; -} - -extern asmlinkage ssize_t sys_sendfile64(int out_fd, int in_fd, - loff_t *offset, size_t count); - -asmlinkage int sys32_sendfile64(int out_fd, int in_fd, - compat_loff_t *offset, s32 count) -{ - mm_segment_t old_fs = get_fs(); - int ret; - loff_t lof; - - if (offset && get_user(lof, offset)) - return -EFAULT; - - set_fs(KERNEL_DS); - ret = sys_sendfile64(out_fd, in_fd, offset ? &lof : NULL, count); - set_fs(old_fs); - - if (offset && put_user(lof, offset)) - return -EFAULT; - - return ret; -} - -/* Handle adjtimex compatibility. */ - -struct timex32 { - u32 modes; - s32 offset, freq, maxerror, esterror; - s32 status, constant, precision, tolerance; - struct compat_timeval time; - s32 tick; - s32 ppsfreq, jitter, shift, stabil; - s32 jitcnt, calcnt, errcnt, stbcnt; - s32 :32; s32 :32; s32 :32; s32 :32; - s32 :32; s32 :32; s32 :32; s32 :32; - s32 :32; s32 :32; s32 :32; s32 :32; -}; - -extern int do_adjtimex(struct timex *); - -asmlinkage int sys32_adjtimex(struct timex32 *utp) -{ - struct timex txc; - int ret; - - memset(&txc, 0, sizeof(struct timex)); - - if(get_user(txc.modes, &utp->modes) || - __get_user(txc.offset, &utp->offset) || - __get_user(txc.freq, &utp->freq) || - __get_user(txc.maxerror, &utp->maxerror) || - __get_user(txc.esterror, &utp->esterror) || - __get_user(txc.status, &utp->status) || - __get_user(txc.constant, &utp->constant) || - __get_user(txc.precision, &utp->precision) || - __get_user(txc.tolerance, &utp->tolerance) || - __get_user(txc.time.tv_sec, &utp->time.tv_sec) || - __get_user(txc.time.tv_usec, &utp->time.tv_usec) || - __get_user(txc.tick, &utp->tick) || - __get_user(txc.ppsfreq, &utp->ppsfreq) || - __get_user(txc.jitter, &utp->jitter) || - __get_user(txc.shift, &utp->shift) || - __get_user(txc.stabil, &utp->stabil) || - __get_user(txc.jitcnt, &utp->jitcnt) || - __get_user(txc.calcnt, &utp->calcnt) || - __get_user(txc.errcnt, &utp->errcnt) || - __get_user(txc.stbcnt, &utp->stbcnt)) - return -EFAULT; - - ret = do_adjtimex(&txc); - - if(put_user(txc.modes, &utp->modes) || - __put_user(txc.offset, &utp->offset) || - __put_user(txc.freq, &utp->freq) || - __put_user(txc.maxerror, &utp->maxerror) || - __put_user(txc.esterror, &utp->esterror) || - __put_user(txc.status, &utp->status) || - __put_user(txc.constant, &utp->constant) || - __put_user(txc.precision, &utp->precision) || - __put_user(txc.tolerance, &utp->tolerance) || - __put_user(txc.time.tv_sec, &utp->time.tv_sec) || - __put_user(txc.time.tv_usec, &utp->time.tv_usec) || - __put_user(txc.tick, &utp->tick) || - __put_user(txc.ppsfreq, &utp->ppsfreq) || - __put_user(txc.jitter, &utp->jitter) || - __put_user(txc.shift, &utp->shift) || - __put_user(txc.stabil, &utp->stabil) || - __put_user(txc.jitcnt, &utp->jitcnt) || - __put_user(txc.calcnt, &utp->calcnt) || - __put_user(txc.errcnt, &utp->errcnt) || - __put_user(txc.stbcnt, &utp->stbcnt)) - ret = -EFAULT; - - return ret; -} - -extern asmlinkage long sys_setpriority(int which, int who, int niceval); - -asmlinkage int sys_setpriority32(u32 which, u32 who, u32 niceval) -{ - return sys_setpriority((int) which, - (int) who, - (int) niceval); -} - -struct __sysctl_args32 { - u32 name; - int nlen; - u32 oldval; - u32 oldlenp; - u32 newval; - u32 newlen; - u32 __unused[4]; -}; - -extern asmlinkage long sys32_sysctl(struct __sysctl_args32 *args) -{ - struct __sysctl_args32 tmp; - int error; - size_t oldlen, *oldlenp = NULL; - unsigned long addr = (((long)&args->__unused[0]) + 7) & ~7; - - if (copy_from_user(&tmp, args, sizeof(tmp))) - return -EFAULT; - - if (tmp.oldval && tmp.oldlenp) { - /* Duh, this is ugly and might not work if sysctl_args - is in read-only memory, but do_sysctl does indirectly - a lot of uaccess in both directions and we'd have to - basically copy the whole sysctl.c here, and - glibc's __sysctl uses rw memory for the structure - anyway. */ - if (get_user(oldlen, (u32 *)A(tmp.oldlenp)) || - put_user(oldlen, (size_t *)addr)) - return -EFAULT; - oldlenp = (size_t *)addr; - } - - lock_kernel(); - error = do_sysctl((int *)A(tmp.name), tmp.nlen, (void *)A(tmp.oldval), - oldlenp, (void *)A(tmp.newval), tmp.newlen); - unlock_kernel(); - if (oldlenp) { - if (!error) { - if (get_user(oldlen, (size_t *)addr) || - put_user(oldlen, (u32 *)A(tmp.oldlenp))) - error = -EFAULT; - } - copy_to_user(args->__unused, tmp.__unused, sizeof(tmp.__unused)); - } - return error; -} - -struct stat64_emu31 { - unsigned char __pad0[6]; - unsigned short st_dev; - unsigned int __pad1; -#define STAT64_HAS_BROKEN_ST_INO 1 - u32 __st_ino; - unsigned int st_mode; - unsigned int st_nlink; - u32 st_uid; - u32 st_gid; - unsigned char __pad2[6]; - unsigned short st_rdev; - unsigned int __pad3; - long st_size; - u32 st_blksize; - unsigned char __pad4[4]; - u32 __pad5; /* future possible st_blocks high bits */ - u32 st_blocks; /* Number 512-byte blocks allocated. */ - u32 st_atime; - u32 __pad6; - u32 st_mtime; - u32 __pad7; - u32 st_ctime; - u32 __pad8; /* will be high 32 bits of ctime someday */ - unsigned long st_ino; -}; - -static inline int -putstat64 (struct stat64_emu31 *ubuf, struct stat *kbuf) -{ - struct stat64_emu31 tmp; - - memset(&tmp, 0, sizeof(tmp)); - - tmp.st_dev = (unsigned short)kbuf->st_dev; - tmp.st_ino = kbuf->st_ino; - tmp.__st_ino = (u32)kbuf->st_ino; - tmp.st_mode = kbuf->st_mode; - tmp.st_nlink = (unsigned int)kbuf->st_nlink; - tmp.st_uid = kbuf->st_uid; - tmp.st_gid = kbuf->st_gid; - tmp.st_rdev = (unsigned short)kbuf->st_rdev; - tmp.st_size = kbuf->st_size; - tmp.st_blksize = (u32)kbuf->st_blksize; - tmp.st_blocks = (u32)kbuf->st_blocks; - tmp.st_atime = (u32)kbuf->st_atime; - tmp.st_mtime = (u32)kbuf->st_mtime; - tmp.st_ctime = (u32)kbuf->st_ctime; - - return copy_to_user(ubuf,&tmp,sizeof(tmp)) ? -EFAULT : 0; -} - -extern asmlinkage long sys_newstat(char * filename, struct stat * statbuf); - -asmlinkage long sys32_stat64(char * filename, struct stat64_emu31 * statbuf, long flags) -{ - int ret; - struct stat s; - char * tmp; - int err; - mm_segment_t old_fs = get_fs(); - - tmp = getname(filename); - err = PTR_ERR(tmp); - if (IS_ERR(tmp)) - return err; - - set_fs (KERNEL_DS); - ret = sys_newstat(tmp, &s); - set_fs (old_fs); - putname(tmp); - if (putstat64 (statbuf, &s)) - return -EFAULT; - return ret; -} - -extern asmlinkage long sys_newlstat(char * filename, struct stat * statbuf); - -asmlinkage long sys32_lstat64(char * filename, struct stat64_emu31 * statbuf, long flags) -{ - int ret; - struct stat s; - char * tmp; - int err; - mm_segment_t old_fs = get_fs(); - - tmp = getname(filename); - err = PTR_ERR(tmp); - if (IS_ERR(tmp)) - return err; - - set_fs (KERNEL_DS); - ret = sys_newlstat(tmp, &s); - set_fs (old_fs); - putname(tmp); - if (putstat64 (statbuf, &s)) - return -EFAULT; - return ret; -} - -extern asmlinkage long sys_newfstat(unsigned int fd, struct stat * statbuf); - -asmlinkage long sys32_fstat64(unsigned long fd, struct stat64_emu31 * statbuf, long flags) -{ - int ret; - struct stat s; - mm_segment_t old_fs = get_fs(); - - set_fs (KERNEL_DS); - ret = sys_newfstat(fd, &s); - set_fs (old_fs); - if (putstat64 (statbuf, &s)) - return -EFAULT; - return ret; -} - -/* - * Linux/i386 didn't use to be able to handle more than - * 4 system call parameters, so these system calls used a memory - * block for parameter passing.. - */ - -struct mmap_arg_struct_emu31 { - u32 addr; - u32 len; - u32 prot; - u32 flags; - u32 fd; - u32 offset; -}; - -/* common code for old and new mmaps */ -static inline long do_mmap2( - unsigned long addr, unsigned long len, - unsigned long prot, unsigned long flags, - unsigned long fd, unsigned long pgoff) -{ - struct file * file = NULL; - unsigned long error = -EBADF; - - flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE); - if (!(flags & MAP_ANONYMOUS)) { - file = fget(fd); - if (!file) - goto out; - } - - down_write(¤t->mm->mmap_sem); - error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff); - if (!IS_ERR((void *) error) && error + len >= 0x80000000ULL) { - /* Result is out of bounds. */ - do_munmap(current->mm, addr, len); - error = -ENOMEM; - } - up_write(¤t->mm->mmap_sem); - - if (file) - fput(file); -out: - return error; -} - - -asmlinkage unsigned long -old32_mmap(struct mmap_arg_struct_emu31 *arg) -{ - struct mmap_arg_struct_emu31 a; - int error = -EFAULT; - - if (copy_from_user(&a, arg, sizeof(a))) - goto out; - - error = -EINVAL; - if (a.offset & ~PAGE_MASK) - goto out; - - error = do_mmap2(a.addr, a.len, a.prot, a.flags, a.fd, a.offset >> PAGE_SHIFT); -out: - return error; -} - -asmlinkage long -sys32_mmap2(struct mmap_arg_struct_emu31 *arg) -{ - struct mmap_arg_struct_emu31 a; - int error = -EFAULT; - - if (copy_from_user(&a, arg, sizeof(a))) - goto out; - error = do_mmap2(a.addr, a.len, a.prot, a.flags, a.fd, a.offset); -out: - return error; -} - -extern asmlinkage int sys_sched_setaffinity(pid_t pid, unsigned int len, - unsigned long *user_mask_ptr); - -asmlinkage int sys32_sched_setaffinity(compat_pid_t pid, unsigned int len, - u32 *user_mask_ptr) -{ - unsigned long kernel_mask; - mm_segment_t old_fs; - int ret; - - if (get_user(kernel_mask, user_mask_ptr)) - return -EFAULT; - - old_fs = get_fs(); - set_fs(KERNEL_DS); - ret = sys_sched_setaffinity(pid, - /* XXX Nice api... */ - sizeof(kernel_mask), - &kernel_mask); - set_fs(old_fs); - - return ret; -} - -extern asmlinkage int sys_sched_getaffinity(pid_t pid, unsigned int len, - unsigned long *user_mask_ptr); - -asmlinkage int sys32_sched_getaffinity(compat_pid_t pid, unsigned int len, - u32 *user_mask_ptr) -{ - unsigned long kernel_mask; - mm_segment_t old_fs; - int ret; - - old_fs = get_fs(); - set_fs(KERNEL_DS); - ret = sys_sched_getaffinity(pid, - /* XXX Nice api... */ - sizeof(kernel_mask), - &kernel_mask); - set_fs(old_fs); - - if (ret == 0) { - if (put_user(kernel_mask, user_mask_ptr)) - ret = -EFAULT; - } - - return ret; -} - -asmlinkage ssize_t sys_read(unsigned int fd, char * buf, size_t count); - -asmlinkage compat_ssize_t sys32_read(unsigned int fd, char * buf, size_t count) -{ - if ((compat_ssize_t) count < 0) - return -EINVAL; - - return sys_read(fd, buf, count); -} - -asmlinkage ssize_t sys_write(unsigned int fd, const char * buf, size_t count); - -asmlinkage compat_ssize_t sys32_write(unsigned int fd, char * buf, size_t count) -{ - if ((compat_ssize_t) count < 0) - return -EINVAL; - - return sys_write(fd, buf, count); -} - -asmlinkage int sys32_clone(struct pt_regs regs) -{ - unsigned long clone_flags; - unsigned long newsp; - struct task_struct *p; - int *parent_tidptr, *child_tidptr; - - clone_flags = regs.gprs[3] & 0xffffffffUL; - newsp = regs.orig_gpr2 & 0x7fffffffUL; - parent_tidptr = (int *) (regs.gprs[4] & 0x7fffffffUL); - child_tidptr = (int *) (regs.gprs[5] & 0x7fffffffUL); - if (!newsp) - newsp = regs.gprs[15]; - p = do_fork(clone_flags & ~CLONE_IDLETASK, newsp, ®s, 0, - parent_tidptr, child_tidptr); - return IS_ERR(p) ? PTR_ERR(p) : p->pid; -} diff --git a/arch/s390x/kernel/linux32.h b/arch/s390x/kernel/linux32.h deleted file mode 100644 index b6ddb140e7eac..0000000000000 --- a/arch/s390x/kernel/linux32.h +++ /dev/null @@ -1,193 +0,0 @@ -#ifndef _ASM_S390X_S390_H -#define _ASM_S390X_S390_H - -#include -#include -#include -#include -#include -#include -#include - -/* Macro that masks the high order bit of an 32 bit pointer and converts it*/ -/* to a 64 bit pointer */ -#define A(__x) ((unsigned long)((__x) & 0x7FFFFFFFUL)) -#define AA(__x) \ - ((unsigned long)(__x)) - -/* Now 32bit compatibility types */ -struct ipc_kludge_32 { - __u32 msgp; /* pointer */ - __s32 msgtyp; -}; - -struct old_sigaction32 { - __u32 sa_handler; /* Really a pointer, but need to deal with 32 bits */ - compat_old_sigset_t sa_mask; /* A 32 bit mask */ - __u32 sa_flags; - __u32 sa_restorer; /* Another 32 bit pointer */ -}; - -typedef union sigval32 { - int sival_int; - __u32 sival_ptr; -} sigval_t32; - -typedef struct siginfo32 { - int si_signo; - int si_errno; - int si_code; - - union { - int _pad[((128/sizeof(int)) - 3)]; - - /* kill() */ - struct { - pid_t _pid; /* sender's pid */ - uid_t _uid; /* sender's uid */ - } _kill; - - /* POSIX.1b timers */ - struct { - unsigned int _timer1; - unsigned int _timer2; - - } _timer; - - /* POSIX.1b signals */ - struct { - pid_t _pid; /* sender's pid */ - uid_t _uid; /* sender's uid */ - sigval_t32 _sigval; - } _rt; - - /* SIGCHLD */ - struct { - pid_t _pid; /* which child */ - uid_t _uid; /* sender's uid */ - int _status;/* exit code */ - compat_clock_t _utime; - compat_clock_t _stime; - } _sigchld; - - /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ - struct { - __u32 _addr; /* faulting insn/memory ref. - pointer */ - } _sigfault; - - /* SIGPOLL */ - struct { - int _band; /* POLL_IN, POLL_OUT, POLL_MSG */ - int _fd; - } _sigpoll; - } _sifields; -} siginfo_t32; - -/* - * How these fields are to be accessed. - */ -#define si_pid _sifields._kill._pid -#define si_uid _sifields._kill._uid -#define si_status _sifields._sigchld._status -#define si_utime _sifields._sigchld._utime -#define si_stime _sifields._sigchld._stime -#define si_value _sifields._rt._sigval -#define si_int _sifields._rt._sigval.sival_int -#define si_ptr _sifields._rt._sigval.sival_ptr -#define si_addr _sifields._sigfault._addr -#define si_band _sifields._sigpoll._band -#define si_fd _sifields._sigpoll._fd - -/* asm/sigcontext.h */ -typedef union -{ - __u64 d; - __u32 f; -} freg_t32; - -typedef struct -{ - unsigned int fpc; - freg_t32 fprs[__NUM_FPRS]; -} _s390_fp_regs32; - -typedef struct -{ - __u32 mask; - __u32 addr; -} _psw_t32 __attribute__ ((aligned(8))); - -#define PSW32_MASK_PER 0x40000000UL -#define PSW32_MASK_DAT 0x04000000UL -#define PSW32_MASK_IO 0x02000000UL -#define PSW32_MASK_EXT 0x01000000UL -#define PSW32_MASK_KEY 0x00F00000UL -#define PSW32_MASK_MCHECK 0x00040000UL -#define PSW32_MASK_WAIT 0x00020000UL -#define PSW32_MASK_PSTATE 0x00010000UL -#define PSW32_MASK_ASC 0x0000C000UL -#define PSW32_MASK_CC 0x00003000UL -#define PSW32_MASK_PM 0x00000f00UL - -#define PSW32_ADDR_AMODE31 0x80000000UL -#define PSW32_ADDR_INSN 0x7FFFFFFFUL - -#define PSW32_BASE_BITS 0x00080000UL - -#define PSW32_ASC_PRIMARY 0x00000000UL -#define PSW32_ASC_ACCREG 0x00004000UL -#define PSW32_ASC_SECONDARY 0x00008000UL -#define PSW32_ASC_HOME 0x0000C000UL - -#define PSW32_USER_BITS (PSW32_BASE_BITS | PSW32_MASK_DAT | PSW32_ASC_HOME | \ - PSW32_MASK_IO | PSW32_MASK_EXT | PSW32_MASK_MCHECK | \ - PSW32_MASK_PSTATE) - -typedef struct -{ - _psw_t32 psw; - __u32 gprs[__NUM_GPRS]; - __u32 acrs[__NUM_ACRS]; -} _s390_regs_common32; - -typedef struct -{ - _s390_regs_common32 regs; - _s390_fp_regs32 fpregs; -} _sigregs32; - -#define _SIGCONTEXT_NSIG32 64 -#define _SIGCONTEXT_NSIG_BPW32 32 -#define __SIGNAL_FRAMESIZE32 96 -#define _SIGMASK_COPY_SIZE32 (sizeof(u32)*2) - -struct sigcontext32 -{ - __u32 oldmask[_COMPAT_NSIG_WORDS]; - __u32 sregs; /* pointer */ -}; - -/* asm/signal.h */ -struct sigaction32 { - __u32 sa_handler; /* pointer */ - __u32 sa_flags; - __u32 sa_restorer; /* pointer */ - compat_sigset_t sa_mask; /* mask last for extensibility */ -}; - -typedef struct { - __u32 ss_sp; /* pointer */ - int ss_flags; - compat_size_t ss_size; -} stack_t32; - -/* asm/ucontext.h */ -struct ucontext32 { - __u32 uc_flags; - __u32 uc_link; /* pointer */ - stack_t32 uc_stack; - _sigregs32 uc_mcontext; - compat_sigset_t uc_sigmask; /* mask last for extensibility */ -}; - -#endif /* _ASM_S390X_S390_H */ diff --git a/arch/s390x/kernel/module.c b/arch/s390x/kernel/module.c deleted file mode 100644 index 42bf461425a62..0000000000000 --- a/arch/s390x/kernel/module.c +++ /dev/null @@ -1,376 +0,0 @@ -/* - * arch/s390x/kernel/module.c - Kernel module help for s390x. - * - * S390 version - * Copyright (C) 2002, 2003 IBM Deutschland Entwicklung GmbH, - * IBM Corporation - * Author(s): Arnd Bergmann (arndb@de.ibm.com) - * Martin Schwidefsky (schwidefsky@de.ibm.com) - * - * based on i386 version - * Copyright (C) 2001 Rusty Russell. - * - * 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -#include -#include -#include -#include -#include -#include - -#if 0 -#define DEBUGP printk -#else -#define DEBUGP(fmt , ...) -#endif - -#define GOT_ENTRY_SIZE 8 -#define PLT_ENTRY_SIZE 20 - -void *module_alloc(unsigned long size) -{ - if (size == 0) - return NULL; - return vmalloc(size); -} - -/* Free memory returned from module_alloc */ -void module_free(struct module *mod, void *module_region) -{ - vfree(module_region); - /* FIXME: If module_region == mod->init_region, trim exception - table entries. */ -} - -static inline void -check_rela(Elf64_Rela *rela, struct module *me) -{ - struct mod_arch_syminfo *info; - - info = me->arch.syminfo + ELF64_R_SYM (rela->r_info); - switch (ELF64_R_TYPE (rela->r_info)) { - case R_390_GOT12: /* 12 bit GOT offset. */ - case R_390_GOT16: /* 16 bit GOT offset. */ - case R_390_GOT32: /* 32 bit GOT offset. */ - case R_390_GOT64: /* 64 bit GOT offset. */ - case R_390_GOTENT: /* 32 bit PC rel. to GOT entry shifted by 1. */ - case R_390_GOTPLT12: /* 12 bit offset to jump slot. */ - case R_390_GOTPLT16: /* 16 bit offset to jump slot. */ - case R_390_GOTPLT32: /* 32 bit offset to jump slot. */ - case R_390_GOTPLT64: /* 64 bit offset to jump slot. */ - case R_390_GOTPLTENT: /* 32 bit rel. offset to jump slot >> 1. */ - if (info->got_offset == -1UL) { - info->got_offset = me->arch.got_size; - me->arch.got_size += GOT_ENTRY_SIZE; - } - break; - case R_390_PLT16DBL: /* 16 bit PC rel. PLT shifted by 1. */ - case R_390_PLT32DBL: /* 32 bit PC rel. PLT shifted by 1. */ - case R_390_PLT32: /* 32 bit PC relative PLT address. */ - case R_390_PLT64: /* 64 bit PC relative PLT address. */ - case R_390_PLTOFF16: /* 16 bit offset from GOT to PLT. */ - case R_390_PLTOFF32: /* 32 bit offset from GOT to PLT. */ - case R_390_PLTOFF64: /* 16 bit offset from GOT to PLT. */ - if (info->plt_offset == -1UL) { - info->plt_offset = me->arch.plt_size; - me->arch.plt_size += PLT_ENTRY_SIZE; - } - break; - case R_390_COPY: - case R_390_GLOB_DAT: - case R_390_JMP_SLOT: - case R_390_RELATIVE: - /* Only needed if we want to support loading of - modules linked with -shared. */ - break; - } -} - -/* - * Account for GOT and PLT relocations. We can't add sections for - * got and plt but we can increase the core module size. - */ -int -module_frob_arch_sections(Elf64_Ehdr *hdr, Elf64_Shdr *sechdrs, - char *secstrings, struct module *me) -{ - Elf64_Shdr *symtab; - Elf64_Sym *symbols; - Elf64_Rela *rela; - char *strings; - int nrela, i, j; - - /* Find symbol table and string table. */ - symtab = 0; - for (i = 0; i < hdr->e_shnum; i++) - switch (sechdrs[i].sh_type) { - case SHT_SYMTAB: - symtab = sechdrs + i; - break; - } - if (!symtab) { - printk(KERN_ERR "module %s: no symbol table\n", me->name); - return -ENOEXEC; - } - - /* Allocate one syminfo structure per symbol. */ - me->arch.nsyms = symtab->sh_size / sizeof(Elf64_Sym); - me->arch.syminfo = kmalloc(me->arch.nsyms * - sizeof(struct mod_arch_syminfo), - GFP_KERNEL); - if (!me->arch.syminfo) - return -ENOMEM; - symbols = (void *) hdr + symtab->sh_offset; - strings = (void *) hdr + sechdrs[symtab->sh_link].sh_offset; - for (i = 0; i < me->arch.nsyms; i++) { - if (symbols[i].st_shndx == SHN_UNDEF && - strcmp(strings + symbols[i].st_name, - "_GLOBAL_OFFSET_TABLE_") == 0) - /* "Define" it as absolute. */ - symbols[i].st_shndx = SHN_ABS; - me->arch.syminfo[i].got_offset = -1UL; - me->arch.syminfo[i].plt_offset = -1UL; - me->arch.syminfo[i].got_initialized = 0; - me->arch.syminfo[i].plt_initialized = 0; - } - - /* Search for got/plt relocations. */ - me->arch.got_size = me->arch.plt_size = 0; - for (i = 0; i < hdr->e_shnum; i++) { - if (sechdrs[i].sh_type != SHT_RELA) - continue; - nrela = sechdrs[i].sh_size / sizeof(Elf64_Rela); - rela = (void *) hdr + sechdrs[i].sh_offset; - for (j = 0; j < nrela; j++) - check_rela(rela + j, me); - } - - /* Increase core size by size of got & plt and set start - offsets for got and plt. */ - me->core_size = ALIGN(me->core_size, 4); - me->arch.got_offset = me->core_size; - me->core_size += me->arch.got_size; - me->arch.plt_offset = me->core_size; - me->core_size += me->arch.plt_size; - return 0; -} - -int -apply_relocate(Elf_Shdr *sechdrs, const char *strtab, unsigned int symindex, - unsigned int relsec, struct module *me) -{ - printk(KERN_ERR "module %s: RELOCATION unsupported\n", - me->name); - return -ENOEXEC; -} - -static inline int -apply_rela(Elf64_Rela *rela, Elf64_Addr base, Elf64_Sym *symtab, - struct module *me) -{ - struct mod_arch_syminfo *info; - Elf64_Addr loc, val; - int r_type, r_sym; - - /* This is where to make the change */ - loc = base + rela->r_offset; - /* This is the symbol it is referring to. Note that all - undefined symbols have been resolved. */ - r_sym = ELF64_R_SYM(rela->r_info); - r_type = ELF64_R_TYPE(rela->r_info); - info = me->arch.syminfo + r_sym; - val = symtab[r_sym].st_value; - - switch (r_type) { - case R_390_8: /* Direct 8 bit. */ - case R_390_12: /* Direct 12 bit. */ - case R_390_16: /* Direct 16 bit. */ - case R_390_32: /* Direct 32 bit. */ - case R_390_64: /* Direct 64 bit. */ - val += rela->r_addend; - if (r_type == R_390_8) - *(unsigned char *) loc = val; - else if (r_type == R_390_12) - *(unsigned short *) loc = (val & 0xfff) | - (*(unsigned short *) loc & 0xf000); - else if (r_type == R_390_16) - *(unsigned short *) loc = val; - else if (r_type == R_390_32) - *(unsigned int *) loc = val; - else if (r_type == R_390_64) - *(unsigned long *) loc = val; - break; - case R_390_PC16: /* PC relative 16 bit. */ - case R_390_PC16DBL: /* PC relative 16 bit shifted by 1. */ - case R_390_PC32DBL: /* PC relative 32 bit shifted by 1. */ - case R_390_PC32: /* PC relative 32 bit. */ - case R_390_PC64: /* PC relative 64 bit. */ - val += rela->r_addend - loc; - if (r_type == R_390_PC16) - *(unsigned short *) loc = val; - else if (r_type == R_390_PC16DBL) - *(unsigned short *) loc = val >> 1; - else if (r_type == R_390_PC32DBL) - *(unsigned int *) loc = val >> 1; - else if (r_type == R_390_PC32) - *(unsigned int *) loc = val; - else if (r_type == R_390_PC64) - *(unsigned long *) loc = val; - break; - case R_390_GOT12: /* 12 bit GOT offset. */ - case R_390_GOT16: /* 16 bit GOT offset. */ - case R_390_GOT32: /* 32 bit GOT offset. */ - case R_390_GOT64: /* 64 bit GOT offset. */ - case R_390_GOTENT: /* 32 bit PC rel. to GOT entry shifted by 1. */ - case R_390_GOTPLT12: /* 12 bit offset to jump slot. */ - case R_390_GOTPLT16: /* 16 bit offset to jump slot. */ - case R_390_GOTPLT32: /* 32 bit offset to jump slot. */ - case R_390_GOTPLT64: /* 64 bit offset to jump slot. */ - case R_390_GOTPLTENT: /* 32 bit rel. offset to jump slot >> 1. */ - if (info->got_initialized == 0) { - Elf64_Addr *gotent; - gotent = me->module_core + me->arch.got_offset + - info->got_offset; - *gotent = val; - info->got_initialized = 1; - } - val = info->got_offset + rela->r_addend; - if (r_type == R_390_GOT12 || - r_type == R_390_GOTPLT12) - *(unsigned short *) loc = (val & 0xfff) | - (*(unsigned short *) loc & 0xf000); - else if (r_type == R_390_GOT16 || - r_type == R_390_GOTPLT16) - *(unsigned short *) loc = val; - else if (r_type == R_390_GOT32 || - r_type == R_390_GOTPLT32) - *(unsigned int *) loc = val; - else if (r_type == R_390_GOTENT || - r_type == R_390_GOTPLTENT) - *(unsigned int *) loc = val >> 1; - else if (r_type == R_390_GOT64 || - r_type == R_390_GOTPLT64) - *(unsigned long *) loc = val; - break; - case R_390_PLT16DBL: /* 16 bit PC rel. PLT shifted by 1. */ - case R_390_PLT32DBL: /* 32 bit PC rel. PLT shifted by 1. */ - case R_390_PLT32: /* 32 bit PC relative PLT address. */ - case R_390_PLT64: /* 64 bit PC relative PLT address. */ - case R_390_PLTOFF16: /* 16 bit offset from GOT to PLT. */ - case R_390_PLTOFF32: /* 32 bit offset from GOT to PLT. */ - case R_390_PLTOFF64: /* 16 bit offset from GOT to PLT. */ - if (info->plt_initialized == 0) { - unsigned int *ip; - ip = me->module_core + me->arch.plt_offset + - info->plt_offset; - ip[0] = 0x0d10e310; /* basr 1,0; lg 1,10(1); br 1 */ - ip[1] = 0x100a0004; - ip[2] = 0x07f10000; - ip[3] = (unsigned int) (val >> 32); - ip[4] = (unsigned int) val; - info->plt_initialized = 1; - } - if (r_type == R_390_PLTOFF16 || - r_type == R_390_PLTOFF32 || - r_type == R_390_PLTOFF64) - val = me->arch.plt_offset - me->arch.got_offset + - info->plt_offset + rela->r_addend; - else - val = (Elf64_Addr) me->module_core + - me->arch.plt_offset + info->plt_offset + - rela->r_addend - loc; - if (r_type == R_390_PLT16DBL) - *(unsigned short *) loc = val >> 1; - else if (r_type == R_390_PLTOFF16) - *(unsigned short *) loc = val; - else if (r_type == R_390_PLT32DBL) - *(unsigned int *) loc = val >> 1; - else if (r_type == R_390_PLT32 || - r_type == R_390_PLTOFF32) - *(unsigned int *) loc = val; - else if (r_type == R_390_PLT64 || - r_type == R_390_PLTOFF64) - *(unsigned long *) loc = val; - break; - case R_390_GOTOFF16: /* 16 bit offset to GOT. */ - case R_390_GOTOFF32: /* 32 bit offset to GOT. */ - case R_390_GOTOFF64: /* 64 bit offset to GOT. */ - val = val + rela->r_addend - - ((Elf64_Addr) me->module_core + me->arch.got_offset); - if (r_type == R_390_GOTOFF16) - *(unsigned short *) loc = val; - else if (r_type == R_390_GOTOFF32) - *(unsigned int *) loc = val; - else if (r_type == R_390_GOTOFF64) - *(unsigned long *) loc = val; - break; - case R_390_GOTPC: /* 32 bit PC relative offset to GOT. */ - case R_390_GOTPCDBL: /* 32 bit PC rel. off. to GOT shifted by 1. */ - val = (Elf64_Addr) me->module_core + me->arch.got_offset + - rela->r_addend - loc; - if (r_type == R_390_GOTPC) - *(unsigned int *) loc = val; - else if (r_type == R_390_GOTPCDBL) - *(unsigned int *) loc = val >> 1; - break; - case R_390_COPY: - case R_390_GLOB_DAT: /* Create GOT entry. */ - case R_390_JMP_SLOT: /* Create PLT entry. */ - case R_390_RELATIVE: /* Adjust by program base. */ - /* Only needed if we want to support loading of - modules linked with -shared. */ - break; - default: - printk(KERN_ERR "module %s: Unknown relocation: %u\n", - me->name, r_type); - return -ENOEXEC; - } - return 0; -} - -int -apply_relocate_add(Elf64_Shdr *sechdrs, const char *strtab, - unsigned int symindex, unsigned int relsec, - struct module *me) -{ - Elf64_Addr base; - Elf64_Sym *symtab; - Elf64_Rela *rela; - unsigned long i, n; - int rc; - - DEBUGP("Applying relocate section %u to %u\n", - relsec, sechdrs[relsec].sh_info); - base = sechdrs[sechdrs[relsec].sh_info].sh_addr; - symtab = (Elf64_Sym *) sechdrs[symindex].sh_addr; - rela = (Elf64_Rela *) sechdrs[relsec].sh_addr; - n = sechdrs[relsec].sh_size / sizeof(Elf64_Rela); - for (i = 0; i < n; i++, rela++) { - rc = apply_rela(rela, base, symtab, me); - if (rc) - return rc; - } - return 0; -} - -int module_finalize(const Elf_Ehdr *hdr, - const Elf_Shdr *sechdrs, - struct module *me) -{ - if (me->arch.syminfo) - kfree(me->arch.syminfo); - return 0; -} diff --git a/arch/s390x/kernel/process.c b/arch/s390x/kernel/process.c deleted file mode 100644 index e5aac6e59e770..0000000000000 --- a/arch/s390x/kernel/process.c +++ /dev/null @@ -1,352 +0,0 @@ -/* - * arch/s390/kernel/process.c - * - * S390 version - * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation - * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com), - * Hartmut Penner (hp@de.ibm.com), - * Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com), - * - * Derived from "arch/i386/kernel/process.c" - * Copyright (C) 1995, Linus Torvalds - */ - -/* - * This file handles the architecture-dependent parts of process handling.. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -asmlinkage void ret_from_fork(void) __asm__("ret_from_fork"); - -/* - * Return saved PC of a blocked thread. used in kernel/sched - * resume in entry.S does not create a new stack frame, it - * just stores the registers %r6-%r15 to the frame given by - * schedule. We want to return the address of the caller of - * schedule, so we have to walk the backchain one time to - * find the frame schedule() store its return address. - */ -unsigned long thread_saved_pc(struct task_struct *tsk) -{ - unsigned long bc; - - bc = *((unsigned long *) tsk->thread.ksp); - return *((unsigned long *) (bc+112)); -} - -/* - * The idle loop on a S390... - */ - -void default_idle(void) -{ - psw_t wait_psw; - unsigned long reg; - - if (need_resched()) { - schedule(); - return; - } - - /* - * Wait for external, I/O or machine check interrupt and - * switch off machine check bit after the wait has ended. - */ - wait_psw.mask = PSW_KERNEL_BITS | PSW_MASK_MCHECK | PSW_MASK_WAIT | - PSW_MASK_IO | PSW_MASK_EXT; - asm volatile ( - " larl %0,0f\n" - " stg %0,8(%1)\n" - " lpswe 0(%1)\n" - "0: larl %0,1f\n" - " stg %0,8(%1)\n" - " ni 1(%1),0xf9\n" - " lpswe 0(%1)\n" - "1:" - : "=&a" (reg) : "a" (&wait_psw) : "memory", "cc" ); -} - -int cpu_idle(void) -{ - for (;;) - default_idle(); - return 0; -} - -extern void show_registers(struct pt_regs *regs); -extern void show_trace(unsigned long *sp); - -void show_regs(struct pt_regs *regs) -{ - struct task_struct *tsk = current; - - printk("CPU: %d %s\n", tsk->thread_info->cpu, print_tainted()); - printk("Process %s (pid: %d, task: %016lx, ksp: %016lx)\n", - current->comm, current->pid, (unsigned long) tsk, - tsk->thread.ksp); - - show_registers(regs); - /* Show stack backtrace if pt_regs is from kernel mode */ - if (!(regs->psw.mask & PSW_MASK_PSTATE)) - show_trace((unsigned long *) regs->gprs[15]); -} - -extern void kernel_thread_starter(void); -__asm__(".align 4\n" - "kernel_thread_starter:\n" - " lg 15,0(8)\n" - " sgr 15,7\n" - " stosm 48(15),3\n" - " lgr 2,10\n" - " basr 14,9\n" - " sgr 2,2\n" - " br 11\n"); - -int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags) -{ - struct task_struct *p; - struct pt_regs regs; - - memset(®s, 0, sizeof(regs)); - regs.psw.mask = PSW_KERNEL_BITS; - regs.psw.addr = (__u64) kernel_thread_starter; - regs.gprs[7] = STACK_FRAME_OVERHEAD; - regs.gprs[8] = __LC_KERNEL_STACK; - regs.gprs[9] = (unsigned long) fn; - regs.gprs[10] = (unsigned long) arg; - regs.gprs[11] = (unsigned long) do_exit; - regs.orig_gpr2 = -1; - - /* Ok, create the new process.. */ - p = do_fork(flags | CLONE_VM | CLONE_UNTRACED, 0, ®s, 0, NULL, NULL); - return IS_ERR(p) ? PTR_ERR(p) : p->pid; -} - -/* - * Free current thread data structures etc.. - */ -void exit_thread(void) -{ -} - -void flush_thread(void) -{ - - current->used_math = 0; - clear_tsk_thread_flag(current, TIF_USEDFPU); -} - -void release_thread(struct task_struct *dead_task) -{ -} - -int copy_thread(int nr, unsigned long clone_flags, unsigned long new_stackp, - unsigned long unused, - struct task_struct * p, struct pt_regs * regs) -{ - struct stack_frame - { - unsigned long back_chain; - unsigned long eos; - unsigned long glue1; - unsigned long glue2; - unsigned long scratch[2]; - unsigned long gprs[10]; /* gprs 6 -15 */ - unsigned long fprs[2]; /* fpr 4 and 6 */ - unsigned long empty[2]; - struct pt_regs childregs; - } *frame; - - frame = ((struct stack_frame *) - (THREAD_SIZE + (unsigned long) p->thread_info)) - 1; - p->thread.ksp = (unsigned long) frame; - p->set_child_tid = p->clear_child_tid = NULL; - frame->childregs = *regs; - frame->childregs.gprs[2] = 0; /* child returns 0 on fork. */ - frame->childregs.gprs[15] = new_stackp; - frame->back_chain = frame->eos = 0; - - /* new return point is ret_from_fork */ - frame->gprs[8] = (unsigned long) ret_from_fork; - - /* fake return stack for resume(), don't go back to schedule */ - frame->gprs[9] = (unsigned long) frame; - /* save fprs */ - save_fp_regs(&p->thread.fp_regs); - p->thread.user_seg = __pa((unsigned long) p->mm->pgd) | _REGION_TABLE; - /* start new process with ar4 pointing to the correct address space */ - p->thread.ar4 = get_fs().ar4; - /* Don't copy debug registers */ - memset(&p->thread.per_info,0,sizeof(p->thread.per_info)); - - /* Set a new TLS ? */ - if (clone_flags & CLONE_SETTLS) { - if (test_thread_flag(TIF_31BIT)) { - frame->childregs.acrs[0] = - (unsigned int) regs->gprs[6]; - } else { - frame->childregs.acrs[0] = - (unsigned int)(regs->gprs[6] >> 32); - frame->childregs.acrs[1] = - (unsigned int) regs->gprs[6]; - } - } - return 0; -} - -asmlinkage int sys_fork(struct pt_regs regs) -{ - struct task_struct *p; - p = do_fork(SIGCHLD, regs.gprs[15], ®s, 0, NULL, NULL); - return IS_ERR(p) ? PTR_ERR(p) : p->pid; -} - -asmlinkage int sys_clone(struct pt_regs regs) -{ - unsigned long clone_flags; - unsigned long newsp; - struct task_struct *p; - int *parent_tidptr, *child_tidptr; - - clone_flags = regs.gprs[3]; - newsp = regs.orig_gpr2; - parent_tidptr = (int *) regs.gprs[4]; - child_tidptr = (int *) regs.gprs[5]; - if (!newsp) - newsp = regs.gprs[15]; - p = do_fork(clone_flags & ~CLONE_IDLETASK, newsp, ®s, 0, - parent_tidptr, child_tidptr); - return IS_ERR(p) ? PTR_ERR(p) : p->pid; -} - -/* - * This is trivial, and on the face of it looks like it - * could equally well be done in user mode. - * - * Not so, for quite unobvious reasons - register pressure. - * In user mode vfork() cannot have a stack frame, and if - * done by calling the "clone()" system call directly, you - * do not have enough call-clobbered registers to hold all - * the information you need. - */ -asmlinkage int sys_vfork(struct pt_regs regs) -{ - struct task_struct *p; - p = do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, - regs.gprs[15], ®s, 0, NULL, NULL); - return IS_ERR(p) ? PTR_ERR(p) : p->pid; -} - -/* - * sys_execve() executes a new program. - */ -asmlinkage int sys_execve(struct pt_regs regs) -{ - int error; - char * filename; - - filename = getname((char *) regs.orig_gpr2); - error = PTR_ERR(filename); - if (IS_ERR(filename)) - goto out; - error = do_execve(filename, (char **) regs.gprs[3], - (char **) regs.gprs[4], ®s); - if (error == 0) { - current->ptrace &= ~PT_DTRACE; - current->thread.fp_regs.fpc = 0; - asm volatile("sfpc %0,%0" : : "d" (0)); - } - putname(filename); -out: - return error; -} - - -/* - * fill in the FPU structure for a core dump. - */ -int dump_fpu (struct pt_regs * regs, s390_fp_regs *fpregs) -{ - save_fp_regs(fpregs); - return 1; -} - -/* - * fill in the user structure for a core dump.. - */ -void dump_thread(struct pt_regs * regs, struct user * dump) -{ - -/* changed the size calculations - should hopefully work better. lbt */ - dump->magic = CMAGIC; - dump->start_code = 0; - dump->start_stack = regs->gprs[15] & ~(PAGE_SIZE - 1); - dump->u_tsize = current->mm->end_code >> PAGE_SHIFT; - dump->u_dsize = (current->mm->brk + PAGE_SIZE - 1) >> PAGE_SHIFT; - dump->u_dsize -= dump->u_tsize; - dump->u_ssize = 0; - if (dump->start_stack < TASK_SIZE) - dump->u_ssize = (TASK_SIZE - dump->start_stack) >> PAGE_SHIFT; - memcpy(&dump->regs, regs, sizeof(s390_regs)); - dump_fpu (regs, &dump->regs.fp_regs); - dump->regs.per_info = current->thread.per_info; -} - -/* - * These bracket the sleeping functions.. - */ -extern void scheduling_functions_start_here(void); -extern void scheduling_functions_end_here(void); -#define first_sched ((unsigned long) scheduling_functions_start_here) -#define last_sched ((unsigned long) scheduling_functions_end_here) - -unsigned long get_wchan(struct task_struct *p) -{ - unsigned long r14, r15, bc; - unsigned long stack_page; - int count = 0; - if (!p || p == current || p->state == TASK_RUNNING) - return 0; - stack_page = (unsigned long) p->thread_info; - r15 = p->thread.ksp; - if (!stack_page || r15 < stack_page || r15 >= 16380+stack_page) - return 0; - bc = *(unsigned long *) r15; - do { - if (bc < stack_page || bc >= 16380+stack_page) - return 0; - r14 = *(unsigned long *) (bc+112); - if (r14 < first_sched || r14 >= last_sched) - return r14; - bc = *(unsigned long *) bc; - } while (count++ < 16); - return 0; -} -#undef last_sched -#undef first_sched - diff --git a/arch/s390x/kernel/ptrace.c b/arch/s390x/kernel/ptrace.c deleted file mode 100644 index acc3583819fb1..0000000000000 --- a/arch/s390x/kernel/ptrace.c +++ /dev/null @@ -1,612 +0,0 @@ -/* - * arch/s390/kernel/ptrace.c - * - * S390 version - * Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation - * Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com), - * Martin Schwidefsky (schwidefsky@de.ibm.com) - * - * Based on PowerPC version - * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org) - * - * Derived from "arch/m68k/kernel/ptrace.c" - * Copyright (C) 1994 by Hamish Macdonald - * Taken from linux/kernel/ptrace.c and modified for M680x0. - * linux/kernel/ptrace.c is by Ross Biro 1/23/92, edited by Linus Torvalds - * - * Modified by Cort Dougan (cort@cs.nmt.edu) - * - * - * This file is subject to the terms and conditions of the GNU General - * Public License. See the file README.legal in the main directory of - * this archive for more details. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#ifdef CONFIG_S390_SUPPORT -#include "ptrace32.h" -#endif - -static void FixPerRegisters(struct task_struct *task) -{ - struct pt_regs *regs; - per_struct *per_info; - - regs = __KSTK_PTREGS(task); - per_info = (per_struct *) &task->thread.per_info; - per_info->control_regs.bits.em_instruction_fetch = - per_info->single_step | per_info->instruction_fetch; - - if (per_info->single_step) { - per_info->control_regs.bits.starting_addr = 0; -#ifdef CONFIG_S390_SUPPORT - if (test_thread_flag(TIF_31BIT)) - per_info->control_regs.bits.ending_addr = 0x7fffffffUL; - else -#endif - per_info->control_regs.bits.ending_addr = -1; - } else { - per_info->control_regs.bits.starting_addr = - per_info->starting_addr; - per_info->control_regs.bits.ending_addr = - per_info->ending_addr; - } - /* - * if any of the control reg tracing bits are on - * we switch on per in the psw - */ - if (per_info->control_regs.words.cr[0] & PER_EM_MASK) - regs->psw.mask |= PSW_MASK_PER; - else - regs->psw.mask &= ~PSW_MASK_PER; - - if (per_info->control_regs.bits.em_storage_alteration) - per_info->control_regs.bits.storage_alt_space_ctl = 1; - else - per_info->control_regs.bits.storage_alt_space_ctl = 0; -} - -void set_single_step(struct task_struct *task) -{ - per_struct *per_info= (per_struct *) &task->thread.per_info; - - per_info->single_step = 1; /* Single step */ - FixPerRegisters (task); -} - -void clear_single_step(struct task_struct *task) -{ - per_struct *per_info= (per_struct *) &task->thread.per_info; - - per_info->single_step = 0; - FixPerRegisters (task); -} - -/* - * Called by kernel/ptrace.c when detaching.. - * - * Make sure single step bits etc are not set. - */ -void ptrace_disable(struct task_struct *child) -{ - /* make sure the single step bit is not set. */ - clear_single_step(child); -} - -/* - * Read the word at offset addr from the user area of a process. The - * trouble here is that the information is littered over different - * locations. The process registers are found on the kernel stack, - * the floating point stuff and the trace settings are stored in - * the task structure. In addition the different structures in - * struct user contain pad bytes that should be read as zeroes. - * Lovely... - */ -static int peek_user(struct task_struct *child, addr_t addr, addr_t data) -{ - struct user *dummy = NULL; - addr_t offset; - __u64 tmp; - - if ((addr & 7) || addr > sizeof(struct user) - 7) - return -EIO; - - if (addr <= (addr_t) &dummy->regs.orig_gpr2) { - /* - * psw, gprs, acrs and orig_gpr2 are stored on the stack - */ - tmp = *(__u64 *)((addr_t) __KSTK_PTREGS(child) + addr); - - } else if (addr >= (addr_t) &dummy->regs.fp_regs && - addr < (addr_t) (&dummy->regs.fp_regs + 1)) { - /* - * floating point regs. are stored in the thread structure - */ - offset = addr - (addr_t) &dummy->regs.fp_regs; - tmp = *(__u64 *)((addr_t) &child->thread.fp_regs + offset); - - } else if (addr >= (addr_t) &dummy->regs.per_info && - addr < (addr_t) (&dummy->regs.per_info + 1)) { - /* - * per_info is found in the thread structure - */ - offset = addr - (addr_t) &dummy->regs.per_info; - tmp = *(__u64 *)((addr_t) &child->thread.per_info + offset); - - } else - tmp = 0; - - return put_user(tmp, (__u64 *) data); -} - -/* - * Write a word to the user area of a process at location addr. This - * operation does have an additional problem compared to peek_user. - * Stores to the program status word and on the floating point - * control register needs to get checked for validity. - */ -static int poke_user(struct task_struct *child, addr_t addr, addr_t data) -{ - struct user *dummy = NULL; - addr_t offset; - - if ((addr & 7) || addr > sizeof(struct user) - 7) - return -EIO; - - if (addr <= (addr_t) &dummy->regs.orig_gpr2) { - /* - * psw, gprs, acrs and orig_gpr2 are stored on the stack - */ - if (addr == (addr_t) &dummy->regs.psw.mask && -#ifdef CONFIG_S390_SUPPORT - (data & ~PSW_MASK_CC) != PSW_USER32_BITS && -#endif - (data & ~PSW_MASK_CC) != PSW_USER_BITS) - /* Invalid psw mask. */ - return -EINVAL; - *(__u64 *)((addr_t) __KSTK_PTREGS(child) + addr) = data; - - } else if (addr >= (addr_t) &dummy->regs.fp_regs && - addr < (addr_t) (&dummy->regs.fp_regs + 1)) { - /* - * floating point regs. are stored in the thread structure - */ - if (addr == (addr_t) &dummy->regs.fp_regs.fpc && - ((data >> 32) & ~FPC_VALID_MASK) != 0) - /* Invalid floating pointer control. */ - return -EINVAL; - offset = addr - (addr_t) &dummy->regs.fp_regs; - *(__u64 *)((addr_t) &child->thread.fp_regs + offset) = data; - - } else if (addr >= (addr_t) &dummy->regs.per_info && - addr < (addr_t) (&dummy->regs.per_info + 1)) { - /* - * per_info is found in the thread structure - */ - offset = addr - (addr_t) &dummy->regs.per_info; - *(__u64 *)((addr_t) &child->thread.per_info + offset) = data; - - } - - FixPerRegisters(child); - return 0; -} - -static int -do_ptrace_normal(struct task_struct *child, long request, long addr, long data) -{ - unsigned long tmp; - ptrace_area parea; - int copied, ret; - - switch (request) { - case PTRACE_PEEKTEXT: - case PTRACE_PEEKDATA: - /* read word at location addr. */ - copied = access_process_vm(child, addr, &tmp, sizeof(tmp), 0); - if (copied != sizeof(tmp)) - return -EIO; - return put_user(tmp, (unsigned long *) data); - - case PTRACE_PEEKUSR: - /* read the word at location addr in the USER area. */ - return peek_user(child, addr, data); - - case PTRACE_POKETEXT: - case PTRACE_POKEDATA: - /* write the word at location addr. */ - copied = access_process_vm(child, addr, &data, sizeof(data),1); - if (copied != sizeof(data)) - return -EIO; - return 0; - - case PTRACE_POKEUSR: - /* write the word at location addr in the USER area */ - return poke_user(child, addr, data); - - case PTRACE_PEEKUSR_AREA: - case PTRACE_POKEUSR_AREA: - if (!copy_from_user(&parea, (void *) addr, sizeof(parea))) - return -EFAULT; - addr = parea.kernel_addr; - data = parea.process_addr; - copied = 0; - while (copied < parea.len) { - if (request == PTRACE_PEEKUSR_AREA) - ret = peek_user(child, addr, data); - else - ret = poke_user(child, addr, data); - if (ret) - return ret; - addr += sizeof(unsigned long); - data += sizeof(unsigned long); - copied += sizeof(unsigned long); - } - return 0; - } - return ptrace_request(child, request, addr, data); -} - -#ifdef CONFIG_S390_SUPPORT -/* - * Now the fun part starts... a 31 bit program running in the - * 31 bit emulation tracing another program. PTRACE_PEEKTEXT, - * PTRACE_PEEKDATA, PTRACE_POKETEXT and PTRACE_POKEDATA are easy - * to handle, the difference to the 64 bit versions of the requests - * is that the access is done in multiples of 4 byte instead of - * 8 bytes (sizeof(unsigned long) on 31/64 bit). - * The ugly part are PTRACE_PEEKUSR, PTRACE_PEEKUSR_AREA, - * PTRACE_POKEUSR and PTRACE_POKEUSR_AREA. If the traced program - * is a 31 bit program too, the content of struct user can be - * emulated. A 31 bit program peeking into the struct user of - * a 64 bit program is a no-no. - */ - -/* - * Same as peek_user but for a 31 bit program. - */ -static int peek_user_emu31(struct task_struct *child, addr_t addr, addr_t data) -{ - struct user32 *dummy32 = NULL; - per_struct32 *dummy_per32 = NULL; - addr_t offset; - __u32 tmp; - - if (!test_thread_flag(TIF_31BIT) || - (addr & 3) || addr > sizeof(struct user) - 3) - return -EIO; - - if (addr <= (addr_t) &dummy32->regs.orig_gpr2) { - /* - * psw, gprs, acrs and orig_gpr2 are stored on the stack - */ - if (addr == (addr_t) &dummy32->regs.psw.mask) { - /* Fake a 31 bit psw mask. */ - tmp = (__u32)(__KSTK_PTREGS(child)->psw.mask >> 32); - tmp = (tmp & PSW32_MASK_CC) | PSW32_USER_BITS; - } else if (addr == (addr_t) &dummy32->regs.psw.addr) { - /* Fake a 31 bit psw address. */ - tmp = (__u32) __KSTK_PTREGS(child)->psw.addr | - PSW32_ADDR_AMODE31; - } else - tmp = *(__u32 *)((addr_t) __KSTK_PTREGS(child) + - addr*2 + 4); - } else if (addr >= (addr_t) &dummy32->regs.fp_regs && - addr < (addr_t) (&dummy32->regs.fp_regs + 1)) { - /* - * floating point regs. are stored in the thread structure - */ - offset = addr - (addr_t) &dummy32->regs.fp_regs; - tmp = *(__u32 *)((addr_t) &child->thread.fp_regs + offset); - - } else if (addr >= (addr_t) &dummy32->regs.per_info && - addr < (addr_t) (&dummy32->regs.per_info + 1)) { - /* - * per_info is found in the thread structure - */ - offset = addr - (addr_t) &dummy32->regs.per_info; - /* This is magic. See per_struct and per_struct32. */ - if ((offset >= (addr_t) &dummy_per32->control_regs && - offset < (addr_t) (&dummy_per32->control_regs + 1)) || - (offset >= (addr_t) &dummy_per32->starting_addr && - offset <= (addr_t) &dummy_per32->ending_addr) || - offset == (addr_t) &dummy_per32->lowcore.words.address) - offset = offset*2 + 4; - else - offset = offset*2; - tmp = *(__u32 *)((addr_t) &child->thread.per_info + offset); - - } else - tmp = 0; - - return put_user(tmp, (__u32 *) data); -} - -/* - * Same as poke_user but for a 31 bit program. - */ -static int poke_user_emu31(struct task_struct *child, addr_t addr, addr_t data) -{ - struct user32 *dummy32 = NULL; - per_struct32 *dummy_per32 = NULL; - addr_t offset; - __u32 tmp; - - if (!test_thread_flag(TIF_31BIT) || - (addr & 3) || addr > sizeof(struct user32) - 3) - return -EIO; - - tmp = (__u32) data; - - if (addr <= (addr_t) &dummy32->regs.orig_gpr2) { - /* - * psw, gprs, acrs and orig_gpr2 are stored on the stack - */ - if (addr == (addr_t) &dummy32->regs.psw.mask) { - /* Build a 64 bit psw mask from 31 bit mask. */ - if ((tmp & ~PSW32_MASK_CC) != PSW32_USER_BITS) - /* Invalid psw mask. */ - return -EINVAL; - __KSTK_PTREGS(child)->psw.mask = PSW_USER_BITS | - ((tmp & PSW32_MASK_CC) << 32); - } else if (addr == (addr_t) &dummy32->regs.psw.addr) { - /* Build a 64 bit psw address from 31 bit address. */ - __KSTK_PTREGS(child)->psw.addr = - (__u64) tmp & PSW32_ADDR_INSN; - } else - *(__u32*)((addr_t) __KSTK_PTREGS(child) + addr*2 + 4) = - tmp; - } else if (addr >= (addr_t) &dummy32->regs.fp_regs && - addr < (addr_t) (&dummy32->regs.fp_regs + 1)) { - /* - * floating point regs. are stored in the thread structure - */ - if (addr == (addr_t) &dummy32->regs.fp_regs.fpc && - (tmp & ~FPC_VALID_MASK) != 0) - /* Invalid floating point control. */ - return -EINVAL; - offset = addr - (addr_t) &dummy32->regs.fp_regs; - *(__u32 *)((addr_t) &child->thread.fp_regs + offset) = tmp; - - } else if (addr >= (addr_t) &dummy32->regs.per_info && - addr < (addr_t) (&dummy32->regs.per_info + 1)) { - /* - * per_info is found in the thread structure. - */ - offset = addr - (addr_t) &dummy32->regs.per_info; - /* - * This is magic. See per_struct and per_struct32. - * By incident the offsets in per_struct are exactly - * twice the offsets in per_struct32 for all fields. - * The 8 byte fields need special handling though, - * because the second half (bytes 4-7) is needed and - * not the first half. - */ - if ((offset >= (addr_t) &dummy_per32->control_regs && - offset < (addr_t) (&dummy_per32->control_regs + 1)) || - (offset >= (addr_t) &dummy_per32->starting_addr && - offset <= (addr_t) &dummy_per32->ending_addr) || - offset == (addr_t) &dummy_per32->lowcore.words.address) - offset = offset*2 + 4; - else - offset = offset*2; - *(__u32 *)((addr_t) &child->thread.per_info + offset) = tmp; - - } - - FixPerRegisters(child); - return 0; -} - -static int -do_ptrace_emu31(struct task_struct *child, long request, long addr, long data) -{ - unsigned int tmp; /* 4 bytes !! */ - ptrace_area_emu31 parea; - int copied, ret; - - switch (request) { - case PTRACE_PEEKTEXT: - case PTRACE_PEEKDATA: - /* read word at location addr. */ - copied = access_process_vm(child, addr, &tmp, sizeof(tmp), 0); - if (copied != sizeof(tmp)) - return -EIO; - return put_user(tmp, (unsigned int *) data); - - case PTRACE_PEEKUSR: - /* read the word at location addr in the USER area. */ - return peek_user_emu31(child, addr, data); - - case PTRACE_POKETEXT: - case PTRACE_POKEDATA: - /* write the word at location addr. */ - tmp = data; - copied = access_process_vm(child, addr, &tmp, sizeof(tmp), 1); - if (copied != sizeof(tmp)) - return -EIO; - return 0; - - case PTRACE_POKEUSR: - /* write the word at location addr in the USER area */ - return poke_user_emu31(child, addr, data); - - case PTRACE_PEEKUSR_AREA: - case PTRACE_POKEUSR_AREA: - if (!copy_from_user(&parea, (void *) addr, sizeof(parea))) - return -EFAULT; - addr = parea.kernel_addr; - data = parea.process_addr; - copied = 0; - while (copied < parea.len) { - if (request == PTRACE_PEEKUSR_AREA) - ret = peek_user_emu31(child, addr, data); - else - ret = poke_user_emu31(child, addr, data); - if (ret) - return ret; - addr += sizeof(unsigned int); - data += sizeof(unsigned int); - copied += sizeof(unsigned int); - } - return 0; - } - return ptrace_request(child, request, addr, data); -} -#endif - -static int -do_ptrace(struct task_struct *child, long request, long addr, long data) -{ - int ret; - - if (request == PTRACE_ATTACH) - return ptrace_attach(child); - - /* - * I added child != current line so we can get the - * ieee_instruction_pointer from the user structure DJB - */ - if (child != current) { - ret = ptrace_check_attach(child, request == PTRACE_KILL); - if (ret < 0) - return ret; - } - - switch (request) { - /* First the common request for 31/64 bit */ - case PTRACE_SYSCALL: - /* continue and stop at next (return from) syscall */ - case PTRACE_CONT: - /* restart after signal. */ - if ((unsigned long) data >= _NSIG) - return -EIO; - if (request == PTRACE_SYSCALL) - set_tsk_thread_flag(child, TIF_SYSCALL_TRACE); - else - clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); - child->exit_code = data; - /* make sure the single step bit is not set. */ - clear_single_step(child); - wake_up_process(child); - return 0; - - case PTRACE_KILL: - /* - * make the child exit. Best I can do is send it a sigkill. - * perhaps it should be put in the status that it wants to - * exit. - */ - if (child->state == TASK_ZOMBIE) /* already dead */ - return 0; - child->exit_code = SIGKILL; - /* make sure the single step bit is not set. */ - clear_single_step(child); - wake_up_process(child); - return 0; - - case PTRACE_SINGLESTEP: - /* set the trap flag. */ - if ((unsigned long) data >= _NSIG) - return -EIO; - clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); - child->exit_code = data; - set_single_step(child); - /* give it a chance to run. */ - wake_up_process(child); - return 0; - - case PTRACE_DETACH: - /* detach a process that was attached. */ - return ptrace_detach(child, data); - - /* Do requests that differ for 31/64 bit */ - default: -#ifdef CONFIG_S390_SUPPORT - if (test_thread_flag(TIF_31BIT)) - return do_ptrace_emu31(child, request, addr, data); -#endif - return do_ptrace_normal(child, request, addr, data); - } - /* Not reached. */ - return -EIO; -} - -asmlinkage int sys_ptrace(long request, long pid, long addr, long data) -{ - struct task_struct *child; - int ret; - - lock_kernel(); - - if (request == PTRACE_TRACEME) { - /* are we already being traced? */ - ret = -EPERM; - if (current->ptrace & PT_PTRACED) - goto out; - ret = security_ptrace(current->parent, current); - if (ret) - goto out; - /* set the ptrace bit in the process flags. */ - current->ptrace |= PT_PTRACED; - goto out; - } - - ret = -EPERM; - if (pid == 1) /* you may not mess with init */ - goto out; - - ret = -ESRCH; - read_lock(&tasklist_lock); - child = find_task_by_pid(pid); - if (child) - get_task_struct(child); - read_unlock(&tasklist_lock); - if (!child) - goto out; - - ret = do_ptrace(child, request, addr, data); - - put_task_struct(child); -out: - unlock_kernel(); - return ret; -} - -asmlinkage void syscall_trace(void) -{ - if (!test_thread_flag(TIF_SYSCALL_TRACE)) - return; - if (!(current->ptrace & PT_PTRACED)) - return; - ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD) - ? 0x80 : 0)); - - /* - * this isn't the same as continuing with a signal, but it will do - * for normal use. strace only continues with a signal if the - * stopping signal is not SIGTRAP. -brl - */ - if (current->exit_code) { - send_sig(current->exit_code, current, 1); - current->exit_code = 0; - } -} diff --git a/arch/s390x/kernel/ptrace32.h b/arch/s390x/kernel/ptrace32.h deleted file mode 100644 index f5d221acddc79..0000000000000 --- a/arch/s390x/kernel/ptrace32.h +++ /dev/null @@ -1,86 +0,0 @@ -#ifndef _PTRACE32_H -#define _PTRACE32_H - -#include "linux32.h" /* needed for _psw_t32 */ - -typedef struct -{ - __u32 cr[3]; -} per_cr_words32 __attribute__((packed)); - -typedef struct -{ - __u16 perc_atmid; /* 0x096 */ - __u32 address; /* 0x098 */ - __u8 access_id; /* 0x0a1 */ -} per_lowcore_words32 __attribute__((packed)); - -typedef struct -{ - union { - per_cr_words32 words; - } control_regs __attribute__((packed)); - /* - * Use these flags instead of setting em_instruction_fetch - * directly they are used so that single stepping can be - * switched on & off while not affecting other tracing - */ - unsigned single_step : 1; - unsigned instruction_fetch : 1; - unsigned : 30; - /* - * These addresses are copied into cr10 & cr11 if single - * stepping is switched off - */ - __u32 starting_addr; - __u32 ending_addr; - union { - per_lowcore_words32 words; - } lowcore; -} per_struct32 __attribute__((packed)); - -struct user_regs_struct32 -{ - _psw_t32 psw; - u32 gprs[NUM_GPRS]; - u32 acrs[NUM_ACRS]; - u32 orig_gpr2; - s390_fp_regs fp_regs; - /* - * These per registers are in here so that gdb can modify them - * itself as there is no "official" ptrace interface for hardware - * watchpoints. This is the way intel does it. - */ - per_struct32 per_info; - u32 ieee_instruction_pointer; - /* Used to give failing instruction back to user for ieee exceptions */ -}; - -struct user32 { - /* We start with the registers, to mimic the way that "memory" - is returned from the ptrace(3,...) function. */ - struct user_regs_struct32 regs; /* Where the registers are actually stored */ - /* The rest of this junk is to help gdb figure out what goes where */ - u32 u_tsize; /* Text segment size (pages). */ - u32 u_dsize; /* Data segment size (pages). */ - u32 u_ssize; /* Stack segment size (pages). */ - u32 start_code; /* Starting virtual address of text. */ - u32 start_stack; /* Starting virtual address of stack area. - This is actually the bottom of the stack, - the top of the stack is always found in the - esp register. */ - s32 signal; /* Signal that caused the core dump. */ - u32 u_ar0; /* Used by gdb to help find the values for */ - /* the registers. */ - u32 magic; /* To uniquely identify a core file */ - char u_comm[32]; /* User command that was responsible */ -}; - -typedef struct -{ - __u32 len; - __u32 kernel_addr; - __u32 process_addr; -} ptrace_area_emu31; - -#endif /* _PTRACE32_H */ diff --git a/arch/s390x/kernel/reipl.S b/arch/s390x/kernel/reipl.S deleted file mode 100644 index 4d090d60f3efd..0000000000000 --- a/arch/s390x/kernel/reipl.S +++ /dev/null @@ -1,96 +0,0 @@ -/* - * arch/s390/kernel/reipl.S - * - * S390 version - * Copyright (C) 2000 IBM Deutschland Entwicklung GmbH, IBM Corporation - * Author(s): Holger Smolinski (Holger.Smolinski@de.ibm.com) - Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com) - */ - -#include - .globl do_reipl -do_reipl: basr %r13,0 -.Lpg0: lpswe .Lnewpsw-.Lpg0(%r13) -.Lpg1: lctlg %c6,%c6,.Lall-.Lpg0(%r13) - stctg %c0,%c0,.Lctlsave-.Lpg0(%r13) - ni .Lctlsave+4-.Lpg0(%r13),0xef - lctlg %c0,%c0,.Lctlsave-.Lpg0(%r13) - lgr %r1,%r2 - mvc __LC_PGM_NEW_PSW(16),.Lpcnew-.Lpg0(%r13) - stsch .Lschib-.Lpg0(%r13) - oi .Lschib+5-.Lpg0(%r13),0x84 -.Lecs: xi .Lschib+27-.Lpg0(%r13),0x01 - msch .Lschib-.Lpg0(%r13) - lghi %r0,5 -.Lssch: ssch .Liplorb-.Lpg0(%r13) - jz .L001 - brct %r0,.Lssch - bas %r14,.Ldisab-.Lpg0(%r13) -.L001: mvc __LC_IO_NEW_PSW(16),.Lionew-.Lpg0(%r13) -.Ltpi: lpswe .Lwaitpsw-.Lpg0(%r13) -.Lcont: c %r1,__LC_SUBCHANNEL_ID - jnz .Ltpi - clc __LC_IO_INT_PARM(4),.Liplorb-.Lpg0(%r13) - jnz .Ltpi - tsch .Liplirb-.Lpg0(%r13) - tm .Liplirb+9-.Lpg0(%r13),0xbf - jz .L002 - bas %r14,.Ldisab-.Lpg0(%r13) -.L002: tm .Liplirb+8-.Lpg0(%r13),0xf3 - jz .L003 - bas %r14,.Ldisab-.Lpg0(%r13) -.L003: spx .Lnull-.Lpg0(%r13) - st %r1,__LC_SUBCHANNEL_ID - lhi %r1,0 # mode 0 = esa - slr %r0,%r0 # set cpuid to zero - sigp %r1,%r0,0x12 # switch to esa mode - lpsw 0 -.Ldisab: sll %r14,1 - srl %r14,1 # need to kill hi bit to avoid specification exceptions. - st %r14,.Ldispsw+12-.Lpg0(%r13) - lpswe .Ldispsw-.Lpg0(%r13) - .align 8 -.Lall: .quad 0x00000000ff000000 -.Lctlsave: .quad 0x0000000000000000 -.Lnull: .long 0x0000000000000000 - .align 16 -/* - * These addresses have to be 31 bit otherwise - * the sigp will throw a specifcation exception - * when switching to ESA mode as bit 31 be set - * in the ESA psw. - * Bit 31 of the addresses has to be 0 for the - * 31bit lpswe instruction a fact they appear to have - * ommited from the pop. - */ -.Lnewpsw: .quad 0x0000000080000000 - .quad .Lpg1 -.Lpcnew: .quad 0x0000000080000000 - .quad .Lecs -.Lionew: .quad 0x0000000080000000 - .quad .Lcont -.Lwaitpsw: .quad 0x0202000080000000 - .quad .Ltpi -.Ldispsw: .quad 0x0002000080000000 - .quad 0x0000000000000000 -.Liplccws: .long 0x02000000,0x60000018 - .long 0x08000008,0x20000001 -.Liplorb: .long 0x0049504c,0x0040ff80 - .long 0x00000000+.Liplccws -.Lschib: .long 0x00000000,0x00000000 - .long 0x00000000,0x00000000 - .long 0x00000000,0x00000000 - .long 0x00000000,0x00000000 - .long 0x00000000,0x00000000 - .long 0x00000000,0x00000000 -.Liplirb: .long 0x00000000,0x00000000 - .long 0x00000000,0x00000000 - .long 0x00000000,0x00000000 - .long 0x00000000,0x00000000 - .long 0x00000000,0x00000000 - .long 0x00000000,0x00000000 - .long 0x00000000,0x00000000 - .long 0x00000000,0x00000000 - - - diff --git a/arch/s390x/kernel/s390_ext.c b/arch/s390x/kernel/s390_ext.c deleted file mode 100644 index a1ebcd81bf3a4..0000000000000 --- a/arch/s390x/kernel/s390_ext.c +++ /dev/null @@ -1,103 +0,0 @@ -/* - * arch/s390/kernel/s390_ext.c - * - * S390 version - * Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation - * Author(s): Holger Smolinski (Holger.Smolinski@de.ibm.com), - * Martin Schwidefsky (schwidefsky@de.ibm.com) - */ - -#include -#include -#include -#include -#include -#include - -/* - * Simple hash strategy: index = code & 0xff; - * ext_int_hash[index] is the start of the list for all external interrupts - * that hash to this index. With the current set of external interrupts - * (0x1202 external call, 0x1004 cpu timer, 0x2401 hwc console, 0x4000 - * iucv and 0x2603 pfault) this is always the first element. - */ -ext_int_info_t *ext_int_hash[256] = { 0, }; - -int register_external_interrupt(__u16 code, ext_int_handler_t handler) { - ext_int_info_t *p; - int index; - - p = (ext_int_info_t *) kmalloc(sizeof(ext_int_info_t), GFP_ATOMIC); - if (p == NULL) - return -ENOMEM; - p->code = code; - p->handler = handler; - index = code & 0xff; - p->next = ext_int_hash[index]; - ext_int_hash[index] = p; - return 0; -} - -int register_early_external_interrupt(__u16 code, ext_int_handler_t handler, - ext_int_info_t *p) { - int index; - - if (p == NULL) - return -EINVAL; - p->code = code; - p->handler = handler; - index = code & 0xff; - p->next = ext_int_hash[index]; - ext_int_hash[index] = p; - return 0; -} - -int unregister_external_interrupt(__u16 code, ext_int_handler_t handler) { - ext_int_info_t *p, *q; - int index; - - index = code & 0xff; - q = NULL; - p = ext_int_hash[index]; - while (p != NULL) { - if (p->code == code && p->handler == handler) - break; - q = p; - p = p->next; - } - if (p == NULL) - return -ENOENT; - if (q != NULL) - q->next = p->next; - else - ext_int_hash[index] = p->next; - kfree(p); - return 0; -} - -int unregister_early_external_interrupt(__u16 code, ext_int_handler_t handler, - ext_int_info_t *p) { - ext_int_info_t *q; - int index; - - if (p == NULL || p->code != code || p->handler != handler) - return -EINVAL; - index = code & 0xff; - q = ext_int_hash[index]; - if (p != q) { - while (q != NULL) { - if (q->next == p) - break; - q = q->next; - } - if (q == NULL) - return -ENOENT; - q->next = p->next; - } else - ext_int_hash[index] = p->next; - return 0; -} - -EXPORT_SYMBOL(register_external_interrupt); -EXPORT_SYMBOL(unregister_external_interrupt); - diff --git a/arch/s390x/kernel/s390_ksyms.c b/arch/s390x/kernel/s390_ksyms.c deleted file mode 100644 index d7b3fac0b5fc8..0000000000000 --- a/arch/s390x/kernel/s390_ksyms.c +++ /dev/null @@ -1,86 +0,0 @@ -/* - * arch/s390/kernel/s390_ksyms.c - * - * S390 version - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#if CONFIG_IP_MULTICAST -#include -#endif - -/* - * memory management - */ -EXPORT_SYMBOL_NOVERS(_oi_bitmap); -EXPORT_SYMBOL_NOVERS(_ni_bitmap); -EXPORT_SYMBOL_NOVERS(_zb_findmap); -EXPORT_SYMBOL_NOVERS(__copy_from_user_asm); -EXPORT_SYMBOL_NOVERS(__copy_to_user_asm); -EXPORT_SYMBOL_NOVERS(__clear_user_asm); - -/* - * semaphore ops - */ -EXPORT_SYMBOL(__up); -EXPORT_SYMBOL(__down); -EXPORT_SYMBOL(__down_interruptible); - -/* - * string functions - */ -EXPORT_SYMBOL_NOVERS(memcmp); -EXPORT_SYMBOL_NOVERS(memset); -EXPORT_SYMBOL_NOVERS(memmove); -EXPORT_SYMBOL_NOVERS(memscan); -EXPORT_SYMBOL_NOVERS(strlen); -EXPORT_SYMBOL_NOVERS(strchr); -EXPORT_SYMBOL_NOVERS(strcmp); -EXPORT_SYMBOL_NOVERS(strncat); -EXPORT_SYMBOL_NOVERS(strncmp); -EXPORT_SYMBOL_NOVERS(strncpy); -EXPORT_SYMBOL_NOVERS(strnlen); -EXPORT_SYMBOL_NOVERS(strrchr); -EXPORT_SYMBOL_NOVERS(strstr); -EXPORT_SYMBOL_NOVERS(strpbrk); - -/* - * binfmt_elf loader - */ -extern int dump_fpu (struct pt_regs * regs, s390_fp_regs *fpregs); -EXPORT_SYMBOL(dump_fpu); -EXPORT_SYMBOL(overflowuid); -EXPORT_SYMBOL(overflowgid); - -#ifdef CONFIG_S390_SUPPORT -/* - * Dynamically add/remove 31 bit ioctl conversion functions. - */ -extern int register_ioctl32_conversion(unsigned int cmd, - int (*handler)(unsigned int, - unsigned int, - unsigned long, - struct file *)); -int unregister_ioctl32_conversion(unsigned int cmd); -EXPORT_SYMBOL(register_ioctl32_conversion); -EXPORT_SYMBOL(unregister_ioctl32_conversion); -#endif - -/* - * misc. - */ -EXPORT_SYMBOL(machine_flags); -EXPORT_SYMBOL(__udelay); -EXPORT_SYMBOL(kernel_thread); -EXPORT_SYMBOL(console_mode); -EXPORT_SYMBOL(console_device); -EXPORT_SYMBOL_NOVERS(do_call_softirq); -EXPORT_SYMBOL(sys_wait4); diff --git a/arch/s390x/kernel/semaphore.c b/arch/s390x/kernel/semaphore.c deleted file mode 100644 index 883d58205413f..0000000000000 --- a/arch/s390x/kernel/semaphore.c +++ /dev/null @@ -1,106 +0,0 @@ -/* - * linux/arch/s390x/kernel/semaphore.c - * - * S390 version - * Copyright (C) 1998-2000 IBM Corporation - * Author(s): Martin Schwidefsky - * - * Derived from "linux/arch/i386/kernel/semaphore.c - * Copyright (C) 1999, Linus Torvalds - * - */ -#include -#include - -#include - -/* - * Atomically update sem->count. Equivalent to: - * old_val = sem->count.counter; - * new_val = ((old_val >= 0) ? old_val : 0) + incr; - * sem->count.counter = new_val; - * return old_val; - */ -static inline int __sem_update_count(struct semaphore *sem, int incr) -{ - int old_val, new_val; - - __asm__ __volatile__(" l %0,0(%3)\n" - "0: ltr %1,%0\n" - " jhe 1f\n" - " lhi %1,0\n" - "1: ar %1,%4\n" - " cs %0,%1,0(%3)\n" - " jl 0b\n" - : "=&d" (old_val), "=&d" (new_val), - "+m" (sem->count) - : "a" (&sem->count), "d" (incr) : "cc" ); - return old_val; -} - -/* - * The inline function up() incremented count but the result - * was <= 0. This indicates that some process is waiting on - * the semaphore. The semaphore is free and we'll wake the - * first sleeping process, so we set count to 1 unless some - * other cpu has called up in the meantime in which case - * we just increment count by 1. - */ -void __up(struct semaphore *sem) -{ - __sem_update_count(sem, 1); - wake_up(&sem->wait); -} - -/* - * The inline function down() decremented count and the result - * was < 0. The wait loop will atomically test and update the - * semaphore counter following the rules: - * count > 0: decrement count, wake up queue and exit. - * count <= 0: set count to -1, go to sleep. - */ -void __down(struct semaphore * sem) -{ - struct task_struct *tsk = current; - DECLARE_WAITQUEUE(wait, tsk); - - tsk->state = TASK_UNINTERRUPTIBLE; - add_wait_queue_exclusive(&sem->wait, &wait); - while (__sem_update_count(sem, -1) <= 0) { - schedule(); - tsk->state = TASK_UNINTERRUPTIBLE; - } - remove_wait_queue(&sem->wait, &wait); - tsk->state = TASK_RUNNING; - wake_up(&sem->wait); -} - -/* - * Same as __down() with an additional test for signals. - * If a signal is pending the count is updated as follows: - * count > 0: wake up queue and exit. - * count <= 0: set count to 0, wake up queue and exit. - */ -int __down_interruptible(struct semaphore * sem) -{ - int retval = 0; - struct task_struct *tsk = current; - DECLARE_WAITQUEUE(wait, tsk); - - tsk->state = TASK_INTERRUPTIBLE; - add_wait_queue_exclusive(&sem->wait, &wait); - while (__sem_update_count(sem, -1) <= 0) { - if (signal_pending(current)) { - __sem_update_count(sem, 0); - retval = -EINTR; - break; - } - schedule(); - tsk->state = TASK_INTERRUPTIBLE; - } - remove_wait_queue(&sem->wait, &wait); - tsk->state = TASK_RUNNING; - wake_up(&sem->wait); - return retval; -} - diff --git a/arch/s390x/kernel/setup.c b/arch/s390x/kernel/setup.c deleted file mode 100644 index fe555761856d5..0000000000000 --- a/arch/s390x/kernel/setup.c +++ /dev/null @@ -1,563 +0,0 @@ -/* - * arch/s390/kernel/setup.c - * - * S390 version - * Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation - * Author(s): Hartmut Penner (hp@de.ibm.com), - * Martin Schwidefsky (schwidefsky@de.ibm.com) - * - * Derived from "arch/i386/kernel/setup.c" - * Copyright (C) 1995, Linus Torvalds - */ - -/* - * This file handles the architecture-dependent parts of initialization - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef CONFIG_BLK_DEV_RAM -#include -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* - * Machine setup.. - */ -unsigned int console_mode = 0; -unsigned int console_device = -1; -unsigned int console_irq = -1; -unsigned long memory_size = 0; -unsigned long machine_flags = 0; -struct { unsigned long addr, size, type; } memory_chunk[16] = { { 0 } }; -#define CHUNK_READ_WRITE 0 -#define CHUNK_READ_ONLY 1 -int cpus_initialized = 0; -unsigned long cpu_initialized = 0; -volatile int __cpu_logical_map[NR_CPUS]; /* logical cpu to cpu address */ - -/* - * Setup options - */ -extern int _text,_etext, _edata, _end; - -/* - * This is set up by the setup-routine at boot-time - * for S390 need to find out, what we have to setup - * using address 0x10400 ... - */ - -#include - -static char command_line[COMMAND_LINE_SIZE] = { 0, }; - char saved_command_line[COMMAND_LINE_SIZE]; - -static struct resource code_resource = { "Kernel code", 0x100000, 0 }; -static struct resource data_resource = { "Kernel data", 0, 0 }; - -/* - * cpu_init() initializes state that is per-CPU. - */ -void __devinit cpu_init (void) -{ - int nr = smp_processor_id(); - int addr = hard_smp_processor_id(); - - if (test_and_set_bit(nr,&cpu_initialized)) { - printk("CPU#%d ALREADY INITIALIZED!!!!!!!!!\n", nr); - for (;;) local_irq_enable(); - } - cpus_initialized++; - - /* - * Store processor id in lowcore (used e.g. in timer_interrupt) - */ - asm volatile ("stidp %0": "=m" (S390_lowcore.cpu_data.cpu_id)); - S390_lowcore.cpu_data.cpu_addr = addr; - S390_lowcore.cpu_data.cpu_nr = nr; - - /* - * Force FPU initialization: - */ - clear_thread_flag(TIF_USEDFPU); - current->used_math = 0; - - /* Setup active_mm for idle_task */ - atomic_inc(&init_mm.mm_count); - current->active_mm = &init_mm; - if (current->mm) - BUG(); - enter_lazy_tlb(&init_mm, current, nr); -} - -/* - * VM halt and poweroff setup routines - */ -char vmhalt_cmd[128] = ""; -char vmpoff_cmd[128] = ""; - -static inline void strncpy_skip_quote(char *dst, char *src, int n) -{ - int sx, dx; - - dx = 0; - for (sx = 0; src[sx] != 0; sx++) { - if (src[sx] == '"') continue; - dst[dx++] = src[sx]; - if (dx >= n) break; - } -} - -static int __init vmhalt_setup(char *str) -{ - strncpy_skip_quote(vmhalt_cmd, str, 127); - vmhalt_cmd[127] = 0; - return 1; -} - -__setup("vmhalt=", vmhalt_setup); - -static int __init vmpoff_setup(char *str) -{ - strncpy_skip_quote(vmpoff_cmd, str, 127); - vmpoff_cmd[127] = 0; - return 1; -} - -__setup("vmpoff=", vmpoff_setup); - -/* - * condev= and conmode= setup parameter. - */ - -static int __init condev_setup(char *str) -{ - int vdev; - - vdev = simple_strtoul(str, &str, 0); - if (vdev >= 0 && vdev < 65536) - console_device = vdev; - return 1; -} - -__setup("condev=", condev_setup); - -static int __init conmode_setup(char *str) -{ -#if defined(CONFIG_SCLP_CONSOLE) - if (strncmp(str, "hwc", 4) == 0 || strncmp(str, "sclp", 5) == 0) - SET_CONSOLE_SCLP; -#endif -#if defined(CONFIG_TN3215_CONSOLE) - if (strncmp(str, "3215", 5) == 0) - SET_CONSOLE_3215; -#endif -#if defined(CONFIG_TN3270_CONSOLE) - if (strncmp(str, "3270", 5) == 0) - SET_CONSOLE_3270; -#endif - return 1; -} - -__setup("conmode=", conmode_setup); - -static void __init conmode_default(void) -{ - char query_buffer[1024]; - char *ptr; - - if (MACHINE_IS_VM) { - cpcmd("QUERY CONSOLE", query_buffer, 1024); - console_device = simple_strtoul(query_buffer + 5, NULL, 16); - ptr = strstr(query_buffer, "SUBCHANNEL ="); - console_irq = simple_strtoul(ptr + 13, NULL, 16); - cpcmd("QUERY TERM", query_buffer, 1024); - ptr = strstr(query_buffer, "CONMODE"); - /* - * Set the conmode to 3215 so that the device recognition - * will set the cu_type of the console to 3215. If the - * conmode is 3270 and we don't set it back then both - * 3215 and the 3270 driver will try to access the console - * device (3215 as console and 3270 as normal tty). - */ - cpcmd("TERM CONMODE 3215", NULL, 0); - if (ptr == NULL) { -#if defined(CONFIG_SCLP_CONSOLE) - SET_CONSOLE_SCLP; -#endif - return; - } - if (strncmp(ptr + 8, "3270", 4) == 0) { -#if defined(CONFIG_TN3270_CONSOLE) - SET_CONSOLE_3270; -#elif defined(CONFIG_TN3215_CONSOLE) - SET_CONSOLE_3215; -#elif defined(CONFIG_SCLP_CONSOLE) - SET_CONSOLE_SCLP; -#endif - } else if (strncmp(ptr + 8, "3215", 4) == 0) { -#if defined(CONFIG_TN3215_CONSOLE) - SET_CONSOLE_3215; -#elif defined(CONFIG_TN3270_CONSOLE) - SET_CONSOLE_3270; -#elif defined(CONFIG_SCLP_CONSOLE) - SET_CONSOLE_SCLP; -#endif - } - } else if (MACHINE_IS_P390) { -#if defined(CONFIG_TN3215_CONSOLE) - SET_CONSOLE_3215; -#elif defined(CONFIG_TN3270_CONSOLE) - SET_CONSOLE_3270; -#endif - } else { -#if defined(CONFIG_SCLP_CONSOLE) - SET_CONSOLE_SCLP; -#endif - } -} - -#ifdef CONFIG_SMP -extern void machine_restart_smp(char *); -extern void machine_halt_smp(void); -extern void machine_power_off_smp(void); - -void (*_machine_restart)(char *command) = machine_restart_smp; -void (*_machine_halt)(void) = machine_halt_smp; -void (*_machine_power_off)(void) = machine_power_off_smp; -#else -/* - * Reboot, halt and power_off routines for non SMP. - */ -extern void do_reipl(unsigned long devno); -static void do_machine_restart_nonsmp(char * __unused) -{ - if (MACHINE_IS_VM) - cpcmd ("IPL", NULL, 0); - else - do_reipl (0x10000 | S390_lowcore.ipl_device); -} - -static void do_machine_halt_nonsmp(void) -{ - if (MACHINE_IS_VM && strlen(vmhalt_cmd) > 0) - cpcmd(vmhalt_cmd, NULL, 0); - signal_processor(smp_processor_id(), sigp_stop_and_store_status); -} - -static void do_machine_power_off_nonsmp(void) -{ - if (MACHINE_IS_VM && strlen(vmpoff_cmd) > 0) - cpcmd(vmpoff_cmd, NULL, 0); - signal_processor(smp_processor_id(), sigp_stop_and_store_status); -} - -void (*_machine_restart)(char *command) = do_machine_restart_nonsmp; -void (*_machine_halt)(void) = do_machine_halt_nonsmp; -void (*_machine_power_off)(void) = do_machine_power_off_nonsmp; -#endif - -/* - * Reboot, halt and power_off stubs. They just call _machine_restart, - * _machine_halt or _machine_power_off. - */ - -void machine_restart(char *command) -{ - _machine_restart(command); -} - -void machine_halt(void) -{ - _machine_halt(); -} - -void machine_power_off(void) -{ - _machine_power_off(); -} - -/* - * Setup function called from init/main.c just after the banner - * was printed. - */ -extern char _pstart, _pend, _stext; - -void __init setup_arch(char **cmdline_p) -{ - unsigned long bootmap_size; - unsigned long memory_start, memory_end; - char c = ' ', cn, *to = command_line, *from = COMMAND_LINE; - struct resource *res; - unsigned long start_pfn, end_pfn; - static unsigned int smptrap=0; - unsigned long delay = 0; - struct _lowcore *lc; - int i; - - if (smptrap) - return; - smptrap=1; - - /* - * print what head.S has found out about the machine - */ - printk((MACHINE_IS_VM) ? - "We are running under VM (64 bit mode)\n" : - "We are running native (64 bit mode)\n"); - - ROOT_DEV = Root_RAM0; - memory_start = (unsigned long) &_end; /* fixit if use $CODELO etc*/ - memory_end = memory_size & ~0x200000UL; /* detected in head.s */ - init_mm.start_code = PAGE_OFFSET; - init_mm.end_code = (unsigned long) &_etext; - init_mm.end_data = (unsigned long) &_edata; - init_mm.brk = (unsigned long) &_end; - - code_resource.start = (unsigned long) &_text; - code_resource.end = (unsigned long) &_etext - 1; - data_resource.start = (unsigned long) &_etext; - data_resource.end = (unsigned long) &_edata - 1; - - /* Save unparsed command line copy for /proc/cmdline */ - memcpy(saved_command_line, COMMAND_LINE, COMMAND_LINE_SIZE); - saved_command_line[COMMAND_LINE_SIZE-1] = '\0'; - - for (;;) { - /* - * "mem=XXX[kKmM]" sets memsize - */ - if (c == ' ' && strncmp(from, "mem=", 4) == 0) { - memory_end = simple_strtoul(from+4, &from, 0); - if ( *from == 'K' || *from == 'k' ) { - memory_end = memory_end << 10; - from++; - } else if ( *from == 'M' || *from == 'm' ) { - memory_end = memory_end << 20; - from++; - } - } - /* - * "ipldelay=XXX[sm]" sets ipl delay in seconds or minutes - */ - if (c == ' ' && strncmp(from, "ipldelay=", 9) == 0) { - delay = simple_strtoul(from+9, &from, 0); - if (*from == 's' || *from == 'S') { - delay = delay*1000000; - from++; - } else if (*from == 'm' || *from == 'M') { - delay = delay*60*1000000; - from++; - } - /* now wait for the requested amount of time */ - udelay(delay); - } - cn = *(from++); - if (!cn) - break; - if (cn == '\n') - cn = ' '; /* replace newlines with space */ - if (cn == 0x0d) - cn = ' '; /* replace 0x0d with space */ - if (cn == ' ' && c == ' ') - continue; /* remove additional spaces */ - c = cn; - if (to - command_line >= COMMAND_LINE_SIZE) - break; - *(to++) = c; - } - if (c == ' ' && to > command_line) to--; - *to = '\0'; - *cmdline_p = command_line; - - /* - * partially used pages are not usable - thus - * we are rounding upwards: - */ - start_pfn = (__pa(&_end) + PAGE_SIZE - 1) >> PAGE_SHIFT; - end_pfn = memory_end >> PAGE_SHIFT; - - /* - * Initialize the boot-time allocator - */ - bootmap_size = init_bootmem(start_pfn, end_pfn); - - /* - * Register RAM areas with the bootmem allocator. - */ - for (i = 0; i < 16 && memory_chunk[i].size > 0; i++) { - unsigned long start_chunk, end_chunk; - - if (memory_chunk[i].type != CHUNK_READ_WRITE) - continue; - start_chunk = (memory_chunk[i].addr + PAGE_SIZE - 1); - start_chunk >>= PAGE_SHIFT; - end_chunk = (memory_chunk[i].addr + memory_chunk[i].size); - end_chunk >>= PAGE_SHIFT; - if (start_chunk < start_pfn) - start_chunk = start_pfn; - if (end_chunk > end_pfn) - end_chunk = end_pfn; - if (start_chunk < end_chunk) - free_bootmem(start_chunk << PAGE_SHIFT, - (end_chunk - start_chunk) << PAGE_SHIFT); - } - - /* - * Reserve the bootmem bitmap itself as well. We do this in two - * steps (first step was init_bootmem()) because this catches - * the (very unlikely) case of us accidentally initializing the - * bootmem allocator with an invalid RAM area. - */ - reserve_bootmem(start_pfn << PAGE_SHIFT, bootmap_size); - -#ifdef CONFIG_BLK_DEV_INITRD - if (INITRD_START) { - if (INITRD_START + INITRD_SIZE <= memory_end) { - reserve_bootmem(INITRD_START, INITRD_SIZE); - initrd_start = INITRD_START; - initrd_end = initrd_start + INITRD_SIZE; - } else { - printk("initrd extends beyond end of memory " - "(0x%08lx > 0x%08lx)\ndisabling initrd\n", - initrd_start + INITRD_SIZE, memory_end); - initrd_start = initrd_end = 0; - } - } -#endif - - /* - * Setup lowcore for boot cpu - */ - lc = (struct _lowcore *) __alloc_bootmem(2*PAGE_SIZE, 2*PAGE_SIZE, 0); - memset(lc, 0, 2*PAGE_SIZE); - lc->restart_psw.mask = PSW_BASE_BITS; - lc->restart_psw.addr = (addr_t) &restart_int_handler; - lc->external_new_psw.mask = PSW_KERNEL_BITS; - lc->external_new_psw.addr = (addr_t) &ext_int_handler; - lc->svc_new_psw.mask = PSW_KERNEL_BITS; - lc->svc_new_psw.addr = (addr_t) &system_call; - lc->program_new_psw.mask = PSW_KERNEL_BITS; - lc->program_new_psw.addr = (addr_t) &pgm_check_handler; - lc->mcck_new_psw.mask = PSW_KERNEL_BITS; - lc->mcck_new_psw.addr = (addr_t) &mcck_int_handler; - lc->io_new_psw.mask = PSW_KERNEL_BITS; - lc->io_new_psw.addr = (addr_t) &io_int_handler; - lc->ipl_device = S390_lowcore.ipl_device; - lc->kernel_stack = ((__u64) &init_thread_union) + 16384; - lc->async_stack = (__u64) - __alloc_bootmem(4*PAGE_SIZE, 4*PAGE_SIZE, 0) + 16384; - lc->jiffy_timer = -1LL; - if (MACHINE_HAS_DIAG44) - lc->diag44_opcode = 0x83000044; - else - lc->diag44_opcode = 0x07000700; - set_prefix((__u32)(__u64) lc); - cpu_init(); - __cpu_logical_map[0] = S390_lowcore.cpu_data.cpu_addr; - - /* - * Create kernel page tables and switch to virtual addressing. - */ - paging_init(); - - res = alloc_bootmem_low(sizeof(struct resource)); - res->start = 0; - res->end = memory_end; - res->flags = IORESOURCE_MEM | IORESOURCE_BUSY; - request_resource(&iomem_resource, res); - request_resource(res, &code_resource); - request_resource(res, &data_resource); - - /* Setup default console */ - conmode_default(); -} - -void print_cpu_info(struct cpuinfo_S390 *cpuinfo) -{ - printk("cpu %d " -#ifdef CONFIG_SMP - "phys_idx=%d " -#endif - "vers=%02X ident=%06X machine=%04X unused=%04X\n", - cpuinfo->cpu_nr, -#ifdef CONFIG_SMP - cpuinfo->cpu_addr, -#endif - cpuinfo->cpu_id.version, - cpuinfo->cpu_id.ident, - cpuinfo->cpu_id.machine, - cpuinfo->cpu_id.unused); -} - -/* - * show_cpuinfo - Get information on one CPU for use by procfs. - */ - -static int show_cpuinfo(struct seq_file *m, void *v) -{ - struct cpuinfo_S390 *cpuinfo; - unsigned long n = (unsigned long) v - 1; - - if (!n) { - seq_printf(m, "vendor_id : IBM/S390\n" - "# processors : %i\n" - "bogomips per cpu: %lu.%02lu\n", - num_online_cpus(), loops_per_jiffy/(500000/HZ), - (loops_per_jiffy/(5000/HZ))%100); - } - if (cpu_online_map & (1 << n)) { - if (smp_processor_id() == n) - cpuinfo = &S390_lowcore.cpu_data; - else - cpuinfo = &lowcore_ptr[n]->cpu_data; - seq_printf(m, "processor %li: " - "version = %02X, " - "identification = %06X, " - "machine = %04X\n", - n, cpuinfo->cpu_id.version, - cpuinfo->cpu_id.ident, - cpuinfo->cpu_id.machine); - } - return 0; -} - -static void *c_start(struct seq_file *m, loff_t *pos) -{ - return *pos < NR_CPUS ? (void *)((unsigned long) *pos + 1) : NULL; -} -static void *c_next(struct seq_file *m, void *v, loff_t *pos) -{ - ++*pos; - return c_start(m, pos); -} -static void c_stop(struct seq_file *m, void *v) -{ -} -struct seq_operations cpuinfo_op = { - .start = c_start, - .next = c_next, - .stop = c_stop, - .show = show_cpuinfo, -}; diff --git a/arch/s390x/kernel/signal.c b/arch/s390x/kernel/signal.c deleted file mode 100644 index 8ab3cc518536f..0000000000000 --- a/arch/s390x/kernel/signal.c +++ /dev/null @@ -1,487 +0,0 @@ -/* - * arch/s390/kernel/signal.c - * - * S390 version - * Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation - * Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com) - * - * Based on Intel version - * - * Copyright (C) 1991, 1992 Linus Torvalds - * - * 1997-11-28 Modified for POSIX.1b signals by Richard Henderson - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) - - -typedef struct -{ - __u8 callee_used_stack[__SIGNAL_FRAMESIZE]; - struct sigcontext sc; - _sigregs sregs; - __u8 retcode[S390_SYSCALL_SIZE]; -} sigframe; - -typedef struct -{ - __u8 callee_used_stack[__SIGNAL_FRAMESIZE]; - __u8 retcode[S390_SYSCALL_SIZE]; - struct siginfo info; - struct ucontext uc; -} rt_sigframe; - -asmlinkage int FASTCALL(do_signal(struct pt_regs *regs, sigset_t *oldset)); - -/* - * Atomically swap in the new signal mask, and wait for a signal. - */ -asmlinkage int -sys_sigsuspend(struct pt_regs * regs,int history0, int history1, old_sigset_t mask) -{ - sigset_t saveset; - - mask &= _BLOCKABLE; - spin_lock_irq(¤t->sighand->siglock); - saveset = current->blocked; - siginitset(¤t->blocked, mask); - recalc_sigpending(); - spin_unlock_irq(¤t->sighand->siglock); - regs->gprs[2] = -EINTR; - - while (1) { - set_current_state(TASK_INTERRUPTIBLE); - schedule(); - if (do_signal(regs, &saveset)) - return -EINTR; - } -} - -asmlinkage int -sys_rt_sigsuspend(struct pt_regs * regs,sigset_t *unewset, size_t sigsetsize) -{ - sigset_t saveset, newset; - - /* XXX: Don't preclude handling different sized sigset_t's. */ - if (sigsetsize != sizeof(sigset_t)) - return -EINVAL; - - if (copy_from_user(&newset, unewset, sizeof(newset))) - return -EFAULT; - sigdelsetmask(&newset, ~_BLOCKABLE); - - spin_lock_irq(¤t->sighand->siglock); - saveset = current->blocked; - current->blocked = newset; - recalc_sigpending(); - spin_unlock_irq(¤t->sighand->siglock); - regs->gprs[2] = -EINTR; - - while (1) { - set_current_state(TASK_INTERRUPTIBLE); - schedule(); - if (do_signal(regs, &saveset)) - return -EINTR; - } -} - -asmlinkage int -sys_sigaction(int sig, const struct old_sigaction *act, - struct old_sigaction *oact) -{ - struct k_sigaction new_ka, old_ka; - int ret; - - if (act) { - old_sigset_t mask; - if (verify_area(VERIFY_READ, act, sizeof(*act)) || - __get_user(new_ka.sa.sa_handler, &act->sa_handler) || - __get_user(new_ka.sa.sa_restorer, &act->sa_restorer)) - return -EFAULT; - __get_user(new_ka.sa.sa_flags, &act->sa_flags); - __get_user(mask, &act->sa_mask); - siginitset(&new_ka.sa.sa_mask, mask); - } - - ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL); - - if (!ret && oact) { - if (verify_area(VERIFY_WRITE, oact, sizeof(*oact)) || - __put_user(old_ka.sa.sa_handler, &oact->sa_handler) || - __put_user(old_ka.sa.sa_restorer, &oact->sa_restorer)) - return -EFAULT; - __put_user(old_ka.sa.sa_flags, &oact->sa_flags); - __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask); - } - - return ret; -} - -asmlinkage int -sys_sigaltstack(const stack_t *uss, stack_t *uoss, struct pt_regs *regs) -{ - return do_sigaltstack(uss, uoss, regs->gprs[15]); -} - - - -/* Returns non-zero on fault */ -static int save_sigregs(struct pt_regs *regs, _sigregs *sregs) -{ - int err; - - err = __copy_to_user(&sregs->regs, regs, sizeof(_s390_regs_common)); - if (err != 0) - return err; - save_fp_regs(¤t->thread.fp_regs); - return __copy_to_user(&sregs->fpregs, ¤t->thread.fp_regs, - sizeof(s390_fp_regs)); -} - -/* Returns positive number on error */ -static int restore_sigregs(struct pt_regs *regs, _sigregs *sregs) -{ - int err; - - err = __copy_from_user(regs, &sregs->regs, sizeof(_s390_regs_common)); - regs->psw.mask = PSW_USER_BITS | (regs->psw.mask & PSW_MASK_CC); - if (err) - return err; - - err = __copy_from_user(¤t->thread.fp_regs, &sregs->fpregs, - sizeof(s390_fp_regs)); - current->thread.fp_regs.fpc &= FPC_VALID_MASK; - if (err) - return err; - - restore_fp_regs(¤t->thread.fp_regs); - regs->trap = -1; /* disable syscall checks */ - return 0; -} - -asmlinkage long sys_sigreturn(struct pt_regs *regs) -{ - sigframe *frame = (sigframe *)regs->gprs[15]; - sigset_t set; - - if (verify_area(VERIFY_READ, frame, sizeof(*frame))) - goto badframe; - if (__copy_from_user(&set.sig, &frame->sc.oldmask, _SIGMASK_COPY_SIZE)) - goto badframe; - - sigdelsetmask(&set, ~_BLOCKABLE); - spin_lock_irq(¤t->sighand->siglock); - current->blocked = set; - recalc_sigpending(); - spin_unlock_irq(¤t->sighand->siglock); - - if (restore_sigregs(regs, &frame->sregs)) - goto badframe; - - return regs->gprs[2]; - -badframe: - force_sig(SIGSEGV, current); - return 0; -} - -asmlinkage long sys_rt_sigreturn(struct pt_regs *regs) -{ - rt_sigframe *frame = (rt_sigframe *)regs->gprs[15]; - sigset_t set; - - if (verify_area(VERIFY_READ, frame, sizeof(*frame))) - goto badframe; - if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) - goto badframe; - - sigdelsetmask(&set, ~_BLOCKABLE); - spin_lock_irq(¤t->sighand->siglock); - current->blocked = set; - recalc_sigpending(); - spin_unlock_irq(¤t->sighand->siglock); - - if (restore_sigregs(regs, &frame->uc.uc_mcontext)) - goto badframe; - - /* It is more difficult to avoid calling this function than to - call it and ignore errors. */ - do_sigaltstack(&frame->uc.uc_stack, NULL, regs->gprs[15]); - return regs->gprs[2]; - -badframe: - force_sig(SIGSEGV, current); - return 0; -} - -/* - * Set up a signal frame. - */ - - -/* - * Determine which stack to use.. - */ -static inline void * -get_sigframe(struct k_sigaction *ka, struct pt_regs * regs, size_t frame_size) -{ - unsigned long sp; - - /* Default to using normal stack */ - sp = regs->gprs[15]; - - /* This is the X/Open sanctioned signal stack switching. */ - if (ka->sa.sa_flags & SA_ONSTACK) { - if (! on_sig_stack(sp)) - sp = current->sas_ss_sp + current->sas_ss_size; - } - - /* This is the legacy signal stack switching. */ - else if (!user_mode(regs) && - !(ka->sa.sa_flags & SA_RESTORER) && - ka->sa.sa_restorer) { - sp = (unsigned long) ka->sa.sa_restorer; - } - - return (void *)((sp - frame_size) & -8ul); -} - -static inline int map_signal(int sig) -{ - if (current_thread_info()->exec_domain - && current_thread_info()->exec_domain->signal_invmap - && sig < 32) - return current_thread_info()->exec_domain->signal_invmap[sig]; - else - return sig; -} - -static void setup_frame(int sig, struct k_sigaction *ka, - sigset_t *set, struct pt_regs * regs) -{ - sigframe *frame = get_sigframe(ka, regs, sizeof(sigframe)); - if (!access_ok(VERIFY_WRITE, frame, sizeof(sigframe))) - goto give_sigsegv; - - if (__copy_to_user(&frame->sc.oldmask, &set->sig, _SIGMASK_COPY_SIZE)) - goto give_sigsegv; - - if (save_sigregs(regs, &frame->sregs)) - goto give_sigsegv; - if (__put_user(&frame->sregs, &frame->sc.sregs)) - goto give_sigsegv; - - /* Set up to return from userspace. If provided, use a stub - already in userspace. */ - if (ka->sa.sa_flags & SA_RESTORER) { - regs->gprs[14] = (__u64) ka->sa.sa_restorer; - } else { - regs->gprs[14] = (__u64) frame->retcode; - if (__put_user(S390_SYSCALL_OPCODE | __NR_sigreturn, - (u16 *)(frame->retcode))) - goto give_sigsegv; - } - - /* Set up backchain. */ - if (__put_user(regs->gprs[15], (addr_t *) frame)) - goto give_sigsegv; - - /* Set up registers for signal handler */ - regs->gprs[15] = (__u64) frame; - regs->psw.addr = (__u64) ka->sa.sa_handler; - regs->psw.mask = PSW_USER_BITS; - - regs->gprs[2] = map_signal(sig); - regs->gprs[3] = (__u64) &frame->sc; - - /* We forgot to include these in the sigcontext. - To avoid breaking binary compatibility, they are passed as args. */ - regs->gprs[4] = current->thread.trap_no; - regs->gprs[5] = current->thread.prot_addr; - return; - -give_sigsegv: - if (sig == SIGSEGV) - ka->sa.sa_handler = SIG_DFL; - force_sig(SIGSEGV, current); -} - -static void setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, - sigset_t *set, struct pt_regs * regs) -{ - int err = 0; - rt_sigframe *frame = get_sigframe(ka, regs, sizeof(rt_sigframe)); - if (!access_ok(VERIFY_WRITE, frame, sizeof(rt_sigframe))) - goto give_sigsegv; - - if (copy_siginfo_to_user(&frame->info, info)) - goto give_sigsegv; - - /* Create the ucontext. */ - err |= __put_user(0, &frame->uc.uc_flags); - err |= __put_user(0, &frame->uc.uc_link); - err |= __put_user((void*)current->sas_ss_sp, &frame->uc.uc_stack.ss_sp); - err |= __put_user(sas_ss_flags(regs->gprs[15]), - &frame->uc.uc_stack.ss_flags); - err |= __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size); - err |= save_sigregs(regs, &frame->uc.uc_mcontext); - err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); - if (err) - goto give_sigsegv; - - /* Set up to return from userspace. If provided, use a stub - already in userspace. */ - if (ka->sa.sa_flags & SA_RESTORER) { - regs->gprs[14] = (__u64) ka->sa.sa_restorer; - } else { - regs->gprs[14] = (__u64) frame->retcode; - err |= __put_user(S390_SYSCALL_OPCODE | __NR_rt_sigreturn, - (u16 *)(frame->retcode)); - } - - /* Set up backchain. */ - if (__put_user(regs->gprs[15], (addr_t *) frame)) - goto give_sigsegv; - - /* Set up registers for signal handler */ - regs->gprs[15] = (__u64) frame; - regs->psw.addr = (__u64) ka->sa.sa_handler; - regs->psw.mask = PSW_USER_BITS; - - regs->gprs[2] = map_signal(sig); - regs->gprs[3] = (__u64) &frame->info; - regs->gprs[4] = (__u64) &frame->uc; - return; - -give_sigsegv: - if (sig == SIGSEGV) - ka->sa.sa_handler = SIG_DFL; - force_sig(SIGSEGV, current); -} - -/* - * OK, we're invoking a handler - */ - -static void -handle_signal(unsigned long sig, siginfo_t *info, sigset_t *oldset, - struct pt_regs * regs) -{ - struct k_sigaction *ka = ¤t->sighand->action[sig-1]; - - /* Are we from a system call? */ - if (regs->trap == __LC_SVC_OLD_PSW) { - /* If so, check system call restarting.. */ - switch (regs->gprs[2]) { - case -ERESTART_RESTARTBLOCK: - current_thread_info()->restart_block.fn = - do_no_restart_syscall; - clear_thread_flag(TIF_RESTART_SVC); - case -ERESTARTNOHAND: - regs->gprs[2] = -EINTR; - break; - - case -ERESTARTSYS: - if (!(ka->sa.sa_flags & SA_RESTART)) { - regs->gprs[2] = -EINTR; - break; - } - /* fallthrough */ - case -ERESTARTNOINTR: - regs->gprs[2] = regs->orig_gpr2; - regs->psw.addr -= 2; - } - } - - /* Set up the stack frame */ - if (ka->sa.sa_flags & SA_SIGINFO) - setup_rt_frame(sig, ka, info, oldset, regs); - else - setup_frame(sig, ka, oldset, regs); - - if (ka->sa.sa_flags & SA_ONESHOT) - ka->sa.sa_handler = SIG_DFL; - - if (!(ka->sa.sa_flags & SA_NODEFER)) { - spin_lock_irq(¤t->sighand->siglock); - sigorsets(¤t->blocked,¤t->blocked,&ka->sa.sa_mask); - sigaddset(¤t->blocked,sig); - recalc_sigpending(); - spin_unlock_irq(¤t->sighand->siglock); - } -} - -/* - * Note that 'init' is a special process: it doesn't get signals it doesn't - * want to handle. Thus you cannot kill init even with a SIGKILL even by - * mistake. - * - * Note that we go through the signals twice: once to check the signals that - * the kernel can handle, and then we build all the user-level signal handling - * stack-frames in one go after that. - */ -int do_signal(struct pt_regs *regs, sigset_t *oldset) -{ - siginfo_t info; - int signr; - - /* - * We want the common case to go fast, which - * is why we may in certain cases get here from - * kernel mode. Just return without doing anything - * if so. - */ - if (!user_mode(regs)) - return 1; - - if (!oldset) - oldset = ¤t->blocked; -#ifdef CONFIG_S390_SUPPORT - if (test_thread_flag(TIF_31BIT)) { - extern asmlinkage int do_signal32(struct pt_regs *regs, sigset_t *oldset); - return do_signal32(regs, oldset); - } -#endif - - signr = get_signal_to_deliver(&info, regs, NULL); - if (signr > 0) { - /* Whee! Actually deliver the signal. */ - handle_signal(signr, &info, oldset, regs); - return 1; - } - - /* Did we come from a system call? */ - if ( regs->trap == __LC_SVC_OLD_PSW /* System Call! */ ) { - /* Restart the system call - no handlers present */ - if (regs->gprs[2] == -ERESTARTNOHAND || - regs->gprs[2] == -ERESTARTSYS || - regs->gprs[2] == -ERESTARTNOINTR) { - regs->gprs[2] = regs->orig_gpr2; - regs->psw.addr -= 2; - } - /* Restart the system call with a new system call number */ - if (regs->gprs[2] == -ERESTART_RESTARTBLOCK) { - regs->gprs[2] = __NR_restart_syscall; - set_thread_flag(TIF_RESTART_SVC); - } - } - return 0; -} diff --git a/arch/s390x/kernel/signal32.c b/arch/s390x/kernel/signal32.c deleted file mode 100644 index cb63aa5739a10..0000000000000 --- a/arch/s390x/kernel/signal32.c +++ /dev/null @@ -1,643 +0,0 @@ -/* - * arch/s390/kernel/signal32.c - * - * S390 version - * Copyright (C) 2000 IBM Deutschland Entwicklung GmbH, IBM Corporation - * Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com) - * Gerhard Tonn (ton@de.ibm.com) - * - * Copyright (C) 1991, 1992 Linus Torvalds - * - * 1997-11-28 Modified for POSIX.1b signals by Richard Henderson - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "linux32.h" -#include "ptrace32.h" - -#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) - -typedef struct -{ - __u8 callee_used_stack[__SIGNAL_FRAMESIZE32]; - struct sigcontext32 sc; - _sigregs32 sregs; - __u8 retcode[S390_SYSCALL_SIZE]; -} sigframe32; - -typedef struct -{ - __u8 callee_used_stack[__SIGNAL_FRAMESIZE32]; - __u8 retcode[S390_SYSCALL_SIZE]; - struct siginfo32 info; - struct ucontext32 uc; -} rt_sigframe32; - -asmlinkage int FASTCALL(do_signal(struct pt_regs *regs, sigset_t *oldset)); - -int do_signal32(struct pt_regs *regs, sigset_t *oldset); - -int copy_siginfo_to_user32(siginfo_t32 *to, siginfo_t *from) -{ - int err; - - if (!access_ok (VERIFY_WRITE, to, sizeof(siginfo_t32))) - return -EFAULT; - - /* If you change siginfo_t structure, please be sure - this code is fixed accordingly. - It should never copy any pad contained in the structure - to avoid security leaks, but must copy the generic - 3 ints plus the relevant union member. - This routine must convert siginfo from 64bit to 32bit as well - at the same time. */ - err = __put_user(from->si_signo, &to->si_signo); - err |= __put_user(from->si_errno, &to->si_errno); - err |= __put_user((short)from->si_code, &to->si_code); - if (from->si_code < 0) - err |= __copy_to_user(&to->_sifields._pad, &from->_sifields._pad, SI_PAD_SIZE); - else { - switch (from->si_code >> 16) { - case __SI_KILL >> 16: - err |= __put_user(from->si_pid, &to->si_pid); - err |= __put_user(from->si_uid, &to->si_uid); - break; - case __SI_CHLD >> 16: - err |= __put_user(from->si_pid, &to->si_pid); - err |= __put_user(from->si_uid, &to->si_uid); - err |= __put_user(from->si_utime, &to->si_utime); - err |= __put_user(from->si_stime, &to->si_stime); - err |= __put_user(from->si_status, &to->si_status); - break; - case __SI_FAULT >> 16: - err |= __put_user((unsigned long) from->si_addr, - &to->si_addr); - break; - case __SI_POLL >> 16: - case __SI_TIMER >> 16: - err |= __put_user(from->si_band, &to->si_band); - err |= __put_user(from->si_fd, &to->si_fd); - break; - default: - break; - /* case __SI_RT: This is not generated by the kernel as of now. */ - } - } - return err; -} - -/* - * Atomically swap in the new signal mask, and wait for a signal. - */ -asmlinkage int -sys32_sigsuspend(struct pt_regs * regs,int history0, int history1, old_sigset_t mask) -{ - sigset_t saveset; - - mask &= _BLOCKABLE; - spin_lock_irq(¤t->sighand->siglock); - saveset = current->blocked; - siginitset(¤t->blocked, mask); - recalc_sigpending(); - spin_unlock_irq(¤t->sighand->siglock); - regs->gprs[2] = -EINTR; - - while (1) { - set_current_state(TASK_INTERRUPTIBLE); - schedule(); - if (do_signal32(regs, &saveset)) - return -EINTR; - } -} - -asmlinkage int -sys32_rt_sigsuspend(struct pt_regs * regs,compat_sigset_t *unewset, size_t sigsetsize) -{ - sigset_t saveset, newset; - compat_sigset_t set32; - - /* XXX: Don't preclude handling different sized sigset_t's. */ - if (sigsetsize != sizeof(sigset_t)) - return -EINVAL; - - if (copy_from_user(&set32, unewset, sizeof(set32))) - return -EFAULT; - switch (_NSIG_WORDS) { - case 4: newset.sig[3] = set32.sig[6] + (((long)set32.sig[7]) << 32); - case 3: newset.sig[2] = set32.sig[4] + (((long)set32.sig[5]) << 32); - case 2: newset.sig[1] = set32.sig[2] + (((long)set32.sig[3]) << 32); - case 1: newset.sig[0] = set32.sig[0] + (((long)set32.sig[1]) << 32); - } - sigdelsetmask(&newset, ~_BLOCKABLE); - - spin_lock_irq(¤t->sighand->siglock); - saveset = current->blocked; - current->blocked = newset; - recalc_sigpending(); - spin_unlock_irq(¤t->sighand->siglock); - regs->gprs[2] = -EINTR; - - while (1) { - set_current_state(TASK_INTERRUPTIBLE); - schedule(); - if (do_signal32(regs, &saveset)) - return -EINTR; - } -} - -asmlinkage int -sys32_sigaction(int sig, const struct old_sigaction32 *act, - struct old_sigaction32 *oact) -{ - struct k_sigaction new_ka, old_ka; - int ret; - - if (act) { - compat_old_sigset_t mask; - if (verify_area(VERIFY_READ, act, sizeof(*act)) || - __get_user((unsigned long)new_ka.sa.sa_handler, &act->sa_handler) || - __get_user((unsigned long)new_ka.sa.sa_restorer, &act->sa_restorer)) - return -EFAULT; - __get_user(new_ka.sa.sa_flags, &act->sa_flags); - __get_user(mask, &act->sa_mask); - siginitset(&new_ka.sa.sa_mask, mask); - } - - ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL); - - if (!ret && oact) { - if (verify_area(VERIFY_WRITE, oact, sizeof(*oact)) || - __put_user((unsigned long)old_ka.sa.sa_handler, &oact->sa_handler) || - __put_user((unsigned long)old_ka.sa.sa_restorer, &oact->sa_restorer)) - return -EFAULT; - __put_user(old_ka.sa.sa_flags, &oact->sa_flags); - __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask); - } - - return ret; -} - -int -do_sigaction(int sig, const struct k_sigaction *act, struct k_sigaction *oact); - -asmlinkage long -sys32_rt_sigaction(int sig, const struct sigaction32 *act, - struct sigaction32 *oact, size_t sigsetsize) -{ - struct k_sigaction new_ka, old_ka; - int ret; - compat_sigset_t set32; - - /* XXX: Don't preclude handling different sized sigset_t's. */ - if (sigsetsize != sizeof(compat_sigset_t)) - return -EINVAL; - - if (act) { - ret = get_user((unsigned long)new_ka.sa.sa_handler, &act->sa_handler); - ret |= __copy_from_user(&set32, &act->sa_mask, - sizeof(compat_sigset_t)); - switch (_NSIG_WORDS) { - case 4: new_ka.sa.sa_mask.sig[3] = set32.sig[6] - | (((long)set32.sig[7]) << 32); - case 3: new_ka.sa.sa_mask.sig[2] = set32.sig[4] - | (((long)set32.sig[5]) << 32); - case 2: new_ka.sa.sa_mask.sig[1] = set32.sig[2] - | (((long)set32.sig[3]) << 32); - case 1: new_ka.sa.sa_mask.sig[0] = set32.sig[0] - | (((long)set32.sig[1]) << 32); - } - ret |= __get_user(new_ka.sa.sa_flags, &act->sa_flags); - - if (ret) - return -EFAULT; - } - - ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL); - - if (!ret && oact) { - switch (_NSIG_WORDS) { - case 4: - set32.sig[7] = (old_ka.sa.sa_mask.sig[3] >> 32); - set32.sig[6] = old_ka.sa.sa_mask.sig[3]; - case 3: - set32.sig[5] = (old_ka.sa.sa_mask.sig[2] >> 32); - set32.sig[4] = old_ka.sa.sa_mask.sig[2]; - case 2: - set32.sig[3] = (old_ka.sa.sa_mask.sig[1] >> 32); - set32.sig[2] = old_ka.sa.sa_mask.sig[1]; - case 1: - set32.sig[1] = (old_ka.sa.sa_mask.sig[0] >> 32); - set32.sig[0] = old_ka.sa.sa_mask.sig[0]; - } - ret = put_user((unsigned long)old_ka.sa.sa_handler, &oact->sa_handler); - ret |= __copy_to_user(&oact->sa_mask, &set32, - sizeof(compat_sigset_t)); - ret |= __put_user(old_ka.sa.sa_flags, &oact->sa_flags); - } - - return ret; -} - -asmlinkage int -sys32_sigaltstack(const stack_t32 *uss, stack_t32 *uoss, struct pt_regs *regs) -{ - stack_t kss, koss; - int ret, err = 0; - mm_segment_t old_fs = get_fs(); - - if (uss) { - if (!access_ok(VERIFY_READ, uss, sizeof(*uss))) - return -EFAULT; - err |= __get_user((unsigned long) kss.ss_sp, &uss->ss_sp); - err |= __get_user(kss.ss_size, &uss->ss_size); - err |= __get_user(kss.ss_flags, &uss->ss_flags); - if (err) - return -EFAULT; - } - - set_fs (KERNEL_DS); - ret = do_sigaltstack(uss ? &kss : NULL , uoss ? &koss : NULL, regs->gprs[15]); - set_fs (old_fs); - - if (!ret && uoss) { - if (!access_ok(VERIFY_WRITE, uoss, sizeof(*uoss))) - return -EFAULT; - err |= __put_user((unsigned long) koss.ss_sp, &uoss->ss_sp); - err |= __put_user(koss.ss_size, &uoss->ss_size); - err |= __put_user(koss.ss_flags, &uoss->ss_flags); - if (err) - return -EFAULT; - } - return ret; -} - -static int save_sigregs32(struct pt_regs *regs,_sigregs32 *sregs) -{ - _s390_regs_common32 regs32; - int err, i; - - regs32.psw.mask = PSW32_USER_BITS | - ((__u32)(regs->psw.mask >> 32) & PSW32_MASK_CC); - regs32.psw.addr = PSW32_ADDR_AMODE31 | (__u32) regs->psw.addr; - for (i = 0; i < NUM_GPRS; i++) - regs32.gprs[i] = (__u32) regs->gprs[i]; - memcpy(regs32.acrs, regs->acrs, sizeof(regs32.acrs)); - err = __copy_to_user(&sregs->regs, ®s32, sizeof(regs32)); - if (err) - return err; - save_fp_regs(¤t->thread.fp_regs); - /* s390_fp_regs and _s390_fp_regs32 are the same ! */ - return __copy_to_user(&sregs->fpregs, ¤t->thread.fp_regs, - sizeof(_s390_fp_regs32)); -} - -static int restore_sigregs32(struct pt_regs *regs,_sigregs32 *sregs) -{ - _s390_regs_common32 regs32; - int err, i; - - err = __copy_from_user(®s32, &sregs->regs, sizeof(regs32)); - if (err) - return err; - regs->psw.mask = PSW_USER32_BITS | - (__u64)(regs32.psw.mask & PSW32_MASK_CC) << 32; - regs->psw.addr = (__u64)(regs32.psw.addr & PSW32_ADDR_INSN); - for (i = 0; i < NUM_GPRS; i++) - regs->gprs[i] = (__u64) regs32.gprs[i]; - memcpy(regs->acrs, regs32.acrs, sizeof(regs32.acrs)); - - err = __copy_from_user(¤t->thread.fp_regs, &sregs->fpregs, - sizeof(_s390_fp_regs32)); - current->thread.fp_regs.fpc &= FPC_VALID_MASK; - if (err) - return err; - - restore_fp_regs(¤t->thread.fp_regs); - regs->trap = -1; /* disable syscall checks */ - return 0; -} - -asmlinkage long sys32_sigreturn(struct pt_regs *regs) -{ - sigframe32 *frame = (sigframe32 *)regs->gprs[15]; - sigset_t set; - - if (verify_area(VERIFY_READ, frame, sizeof(*frame))) - goto badframe; - if (__copy_from_user(&set.sig, &frame->sc.oldmask, _SIGMASK_COPY_SIZE32)) - goto badframe; - - sigdelsetmask(&set, ~_BLOCKABLE); - spin_lock_irq(¤t->sighand->siglock); - current->blocked = set; - recalc_sigpending(); - spin_unlock_irq(¤t->sighand->siglock); - - if (restore_sigregs32(regs, &frame->sregs)) - goto badframe; - - return regs->gprs[2]; - -badframe: - force_sig(SIGSEGV, current); - return 0; -} - -asmlinkage long sys32_rt_sigreturn(struct pt_regs *regs) -{ - rt_sigframe32 *frame = (rt_sigframe32 *)regs->gprs[15]; - sigset_t set; - stack_t st; - __u32 ss_sp; - int err; - mm_segment_t old_fs = get_fs(); - - if (verify_area(VERIFY_READ, frame, sizeof(*frame))) - goto badframe; - if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) - goto badframe; - - sigdelsetmask(&set, ~_BLOCKABLE); - spin_lock_irq(¤t->sighand->siglock); - current->blocked = set; - recalc_sigpending(); - spin_unlock_irq(¤t->sighand->siglock); - - if (restore_sigregs32(regs, &frame->uc.uc_mcontext)) - goto badframe; - - err = __get_user(ss_sp, &frame->uc.uc_stack.ss_sp); - st.ss_sp = (void *) A((unsigned long)ss_sp); - err |= __get_user(st.ss_size, &frame->uc.uc_stack.ss_size); - err |= __get_user(st.ss_flags, &frame->uc.uc_stack.ss_flags); - if (err) - goto badframe; - - /* It is more difficult to avoid calling this function than to - call it and ignore errors. */ - set_fs (KERNEL_DS); - do_sigaltstack(&st, NULL, regs->gprs[15]); - set_fs (old_fs); - - return regs->gprs[2]; - -badframe: - force_sig(SIGSEGV, current); - return 0; -} - -/* - * Set up a signal frame. - */ - - -/* - * Determine which stack to use.. - */ -static inline void * -get_sigframe(struct k_sigaction *ka, struct pt_regs * regs, size_t frame_size) -{ - unsigned long sp; - - /* Default to using normal stack */ - sp = (unsigned long) A(regs->gprs[15]); - - /* This is the X/Open sanctioned signal stack switching. */ - if (ka->sa.sa_flags & SA_ONSTACK) { - if (! on_sig_stack(sp)) - sp = current->sas_ss_sp + current->sas_ss_size; - } - - /* This is the legacy signal stack switching. */ - else if (!user_mode(regs) && - !(ka->sa.sa_flags & SA_RESTORER) && - ka->sa.sa_restorer) { - sp = (unsigned long) ka->sa.sa_restorer; - } - - return (void *)((sp - frame_size) & -8ul); -} - -static inline int map_signal(int sig) -{ - if (current_thread_info()->exec_domain - && current_thread_info()->exec_domain->signal_invmap - && sig < 32) - return current_thread_info()->exec_domain->signal_invmap[sig]; - else - return sig; -} - -static void setup_frame32(int sig, struct k_sigaction *ka, - sigset_t *set, struct pt_regs * regs) -{ - sigframe32 *frame = get_sigframe(ka, regs, sizeof(sigframe32)); - if (!access_ok(VERIFY_WRITE, frame, sizeof(sigframe32))) - goto give_sigsegv; - - if (__copy_to_user(&frame->sc.oldmask, &set->sig, _SIGMASK_COPY_SIZE32)) - goto give_sigsegv; - - if (save_sigregs32(regs, &frame->sregs)) - goto give_sigsegv; - if (__put_user((unsigned long) &frame->sregs, &frame->sc.sregs)) - goto give_sigsegv; - - /* Set up to return from userspace. If provided, use a stub - already in userspace. */ - if (ka->sa.sa_flags & SA_RESTORER) { - regs->gprs[14] = (__u64) ka->sa.sa_restorer; - } else { - regs->gprs[14] = (__u64) frame->retcode; - if (__put_user(S390_SYSCALL_OPCODE | __NR_sigreturn, - (u16 *)(frame->retcode))) - goto give_sigsegv; - } - - /* Set up backchain. */ - if (__put_user(regs->gprs[15], (unsigned int *) frame)) - goto give_sigsegv; - - /* Set up registers for signal handler */ - regs->gprs[15] = (__u64) frame; - regs->psw.addr = (__u64) ka->sa.sa_handler; - regs->psw.mask = PSW_USER32_BITS; - - regs->gprs[2] = map_signal(sig); - regs->gprs[3] = (__u64) &frame->sc; - - /* We forgot to include these in the sigcontext. - To avoid breaking binary compatibility, they are passed as args. */ - regs->gprs[4] = current->thread.trap_no; - regs->gprs[5] = current->thread.prot_addr; - return; - -give_sigsegv: - if (sig == SIGSEGV) - ka->sa.sa_handler = SIG_DFL; - force_sig(SIGSEGV, current); -} - -static void setup_rt_frame32(int sig, struct k_sigaction *ka, siginfo_t *info, - sigset_t *set, struct pt_regs * regs) -{ - int err = 0; - rt_sigframe32 *frame = get_sigframe(ka, regs, sizeof(rt_sigframe32)); - if (!access_ok(VERIFY_WRITE, frame, sizeof(rt_sigframe32))) - goto give_sigsegv; - - if (copy_siginfo_to_user32(&frame->info, info)) - goto give_sigsegv; - - /* Create the ucontext. */ - err |= __put_user(0, &frame->uc.uc_flags); - err |= __put_user(0, &frame->uc.uc_link); - err |= __put_user(current->sas_ss_sp, &frame->uc.uc_stack.ss_sp); - err |= __put_user(sas_ss_flags(regs->gprs[15]), - &frame->uc.uc_stack.ss_flags); - err |= __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size); - err |= save_sigregs32(regs, &frame->uc.uc_mcontext); - err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); - if (err) - goto give_sigsegv; - - /* Set up to return from userspace. If provided, use a stub - already in userspace. */ - if (ka->sa.sa_flags & SA_RESTORER) { - regs->gprs[14] = (__u64) ka->sa.sa_restorer; - } else { - regs->gprs[14] = (__u64) frame->retcode; - err |= __put_user(S390_SYSCALL_OPCODE | __NR_rt_sigreturn, - (u16 *)(frame->retcode)); - } - - /* Set up backchain. */ - if (__put_user(regs->gprs[15], (unsigned int *) frame)) - goto give_sigsegv; - - /* Set up registers for signal handler */ - regs->gprs[15] = (__u64) frame; - regs->psw.addr = (__u64) ka->sa.sa_handler; - regs->psw.mask = PSW_USER32_BITS; - - regs->gprs[2] = map_signal(sig); - regs->gprs[3] = (__u64) &frame->info; - regs->gprs[4] = (__u64) &frame->uc; - return; - -give_sigsegv: - if (sig == SIGSEGV) - ka->sa.sa_handler = SIG_DFL; - force_sig(SIGSEGV, current); -} - -/* - * OK, we're invoking a handler - */ - -static void -handle_signal32(unsigned long sig, siginfo_t *info, sigset_t *oldset, - struct pt_regs * regs) -{ - struct k_sigaction *ka = ¤t->sighand->action[sig-1]; - - /* Are we from a system call? */ - if (regs->trap == __LC_SVC_OLD_PSW) { - /* If so, check system call restarting.. */ - switch (regs->gprs[2]) { - case -ERESTARTNOHAND: - regs->gprs[2] = -EINTR; - break; - - case -ERESTARTSYS: - if (!(ka->sa.sa_flags & SA_RESTART)) { - regs->gprs[2] = -EINTR; - break; - } - /* fallthrough */ - case -ERESTARTNOINTR: - regs->gprs[2] = regs->orig_gpr2; - regs->psw.addr -= 2; - } - } - - /* Set up the stack frame */ - if (ka->sa.sa_flags & SA_SIGINFO) - setup_rt_frame32(sig, ka, info, oldset, regs); - else - setup_frame32(sig, ka, oldset, regs); - - if (ka->sa.sa_flags & SA_ONESHOT) - ka->sa.sa_handler = SIG_DFL; - - if (!(ka->sa.sa_flags & SA_NODEFER)) { - spin_lock_irq(¤t->sighand->siglock); - sigorsets(¤t->blocked,¤t->blocked,&ka->sa.sa_mask); - sigaddset(¤t->blocked,sig); - recalc_sigpending(); - spin_unlock_irq(¤t->sighand->siglock); - } -} - -/* - * Note that 'init' is a special process: it doesn't get signals it doesn't - * want to handle. Thus you cannot kill init even with a SIGKILL even by - * mistake. - * - * Note that we go through the signals twice: once to check the signals that - * the kernel can handle, and then we build all the user-level signal handling - * stack-frames in one go after that. - */ -int do_signal32(struct pt_regs *regs, sigset_t *oldset) -{ - siginfo_t info; - int signr; - - /* - * We want the common case to go fast, which - * is why we may in certain cases get here from - * kernel mode. Just return without doing anything - * if so. - */ - if (!user_mode(regs)) - return 1; - - if (!oldset) - oldset = ¤t->blocked; - - signr = get_signal_to_deliver(&info, regs, NULL); - if (signr > 0) { - /* Whee! Actually deliver the signal. */ - handle_signal32(signr, &info, oldset, regs); - return 1; - } - - /* Did we come from a system call? */ - if ( regs->trap == __LC_SVC_OLD_PSW /* System Call! */ ) { - /* Restart the system call - no handlers present */ - if (regs->gprs[2] == -ERESTARTNOHAND || - regs->gprs[2] == -ERESTARTSYS || - regs->gprs[2] == -ERESTARTNOINTR) { - regs->gprs[2] = regs->orig_gpr2; - regs->psw.addr -= 2; - } - } - return 0; -} diff --git a/arch/s390x/kernel/smp.c b/arch/s390x/kernel/smp.c deleted file mode 100644 index 469a9f647d440..0000000000000 --- a/arch/s390x/kernel/smp.c +++ /dev/null @@ -1,582 +0,0 @@ -/* - * arch/s390/kernel/smp.c - * - * S390 version - * Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation - * Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com), - * Martin Schwidefsky (schwidefsky@de.ibm.com) - * - * based on other smp stuff by - * (c) 1995 Alan Cox, CymruNET Ltd - * (c) 1998 Ingo Molnar - * - * We work with logical cpu numbering everywhere we can. The only - * functions using the real cpu address (got from STAP) are the sigp - * functions. For all other functions we use the identity mapping. - * That means that cpu_number_map[i] == i for every cpu. cpu_number_map is - * used e.g. to find the idle task belonging to a logical cpu. Every array - * in the kernel is sorted by the logical cpu number and not by the physical - * one which is causing all the confusion with __cpu_logical_map and - * cpu_number_map in other architectures. - */ - -#include -#include - -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include - -/* prototypes */ -extern int cpu_idle(void * unused); - -extern volatile int __cpu_logical_map[]; - -/* - * An array with a pointer the lowcore of every CPU. - */ - -struct _lowcore *lowcore_ptr[NR_CPUS]; -cycles_t cacheflush_time=0; -int smp_threads_ready=0; /* Set when the idlers are all forked. */ - -volatile unsigned long cpu_online_map; -volatile unsigned long cpu_possible_map; -unsigned long cache_decay_ticks = 0; - -/* - * Reboot, halt and power_off routines for SMP. - */ -extern char vmhalt_cmd[]; -extern char vmpoff_cmd[]; - -extern void do_reipl(unsigned long devno); - -static sigp_ccode smp_ext_bitcall(int, ec_bit_sig); -static void smp_ext_bitcall_others(ec_bit_sig); - -/* - * Structure and data for smp_call_function(). This is designed to minimise - * static memory requirements. It also looks cleaner. - */ -static spinlock_t call_lock = SPIN_LOCK_UNLOCKED; - -struct call_data_struct { - void (*func) (void *info); - void *info; - atomic_t started; - atomic_t finished; - int wait; -}; - -static struct call_data_struct * call_data; - -/* - * 'Call function' interrupt callback - */ -static void do_call_function(void) -{ - void (*func) (void *info) = call_data->func; - void *info = call_data->info; - int wait = call_data->wait; - - atomic_inc(&call_data->started); - (*func)(info); - if (wait) - atomic_inc(&call_data->finished); -} - -/* - * this function sends a 'generic call function' IPI to all other CPUs - * in the system. - */ - -int smp_call_function (void (*func) (void *info), void *info, int nonatomic, - int wait) -/* - * [SUMMARY] Run a function on all other CPUs. - * The function to run. This must be fast and non-blocking. - * An arbitrary pointer to pass to the function. - * currently unused. - * If true, wait (atomically) until function has completed on other CPUs. - * [RETURNS] 0 on success, else a negative status code. Does not return until - * remote CPUs are nearly ready to execute <> or are or have executed. - * - * You must not call this function with disabled interrupts or from a - * hardware interrupt handler or from a bottom half handler. - */ -{ - struct call_data_struct data; - int cpus = num_online_cpus()-1; - - /* FIXME: get cpu lock -hc */ - if (cpus <= 0) - return 0; - - data.func = func; - data.info = info; - atomic_set(&data.started, 0); - data.wait = wait; - if (wait) - atomic_set(&data.finished, 0); - - spin_lock(&call_lock); - call_data = &data; - /* Send a message to all other CPUs and wait for them to respond */ - smp_ext_bitcall_others(ec_call_function); - - /* Wait for response */ - while (atomic_read(&data.started) != cpus) - barrier(); - - if (wait) - while (atomic_read(&data.finished) != cpus) - barrier(); - spin_unlock(&call_lock); - - return 0; -} - -static inline void do_send_stop(void) -{ - u32 dummy; - int i, rc; - - /* stop all processors */ - for (i = 0; i < NR_CPUS; i++) { - if (!cpu_online(i) || smp_processor_id() == i) - continue; - do { - rc = signal_processor_ps(&dummy, 0, i, sigp_stop); - } while (rc == sigp_busy); - } -} - -static inline void do_store_status(void) -{ - unsigned long low_core_addr; - u32 dummy; - int i, rc; - - /* store status of all processors in their lowcores (real 0) */ - for (i = 0; i < NR_CPUS; i++) { - if (!cpu_online(i) || smp_processor_id() == i) - continue; - low_core_addr = (unsigned long) lowcore_ptr[i]; - do { - rc = signal_processor_ps(&dummy, low_core_addr, i, - sigp_store_status_at_address); - } while(rc == sigp_busy); - } -} - -/* - * this function sends a 'stop' sigp to all other CPUs in the system. - * it goes straight through. - */ -void smp_send_stop(void) -{ - /* write magic number to zero page (absolute 0) */ - lowcore_ptr[smp_processor_id()]->panic_magic = __PANIC_MAGIC; - - /* stop other processors. */ - do_send_stop(); - - /* store status of other processors. */ - do_store_status(); -} - -/* - * Reboot, halt and power_off routines for SMP. - */ -static volatile unsigned long cpu_restart_map; - -static void do_machine_restart(void * __unused) -{ - clear_bit(smp_processor_id(), &cpu_restart_map); - if (smp_processor_id() == 0) { - /* Wait for all other cpus to enter do_machine_restart. */ - while (cpu_restart_map != 0); - /* Store status of other cpus. */ - do_store_status(); - /* - * Finally call reipl. Because we waited for all other - * cpus to enter this function we know that they do - * not hold any s390irq-locks (the cpus have been - * interrupted by an external interrupt and s390irq - * locks are always held disabled). - */ - if (MACHINE_IS_VM) - cpcmd ("IPL", NULL, 0); - else - do_reipl (0x10000 | S390_lowcore.ipl_device); - } - signal_processor(smp_processor_id(), sigp_stop); -} - -void machine_restart_smp(char * __unused) -{ - cpu_restart_map = cpu_online_map; - on_each_cpu(do_machine_restart, NULL, 0, 0); -} - -static void do_machine_halt(void * __unused) -{ - if (smp_processor_id() == 0) { - smp_send_stop(); - if (MACHINE_IS_VM && strlen(vmhalt_cmd) > 0) - cpcmd(vmhalt_cmd, NULL, 0); - signal_processor(smp_processor_id(), - sigp_stop_and_store_status); - } - for (;;) - enabled_wait(); -} - -void machine_halt_smp(void) -{ - on_each_cpu(do_machine_halt, NULL, 0, 0); -} - -static void do_machine_power_off(void * __unused) -{ - if (smp_processor_id() == 0) { - smp_send_stop(); - if (MACHINE_IS_VM && strlen(vmpoff_cmd) > 0) - cpcmd(vmpoff_cmd, NULL, 0); - signal_processor(smp_processor_id(), - sigp_stop_and_store_status); - } - for (;;) - enabled_wait(); -} - -void machine_power_off_smp(void) -{ - on_each_cpu(do_machine_power_off, NULL, 0, 0); -} - -/* - * This is the main routine where commands issued by other - * cpus are handled. - */ - -void do_ext_call_interrupt(struct pt_regs *regs, __u16 code) -{ - unsigned long bits; - - /* - * handle bit signal external calls - * - * For the ec_schedule signal we have to do nothing. All the work - * is done automatically when we return from the interrupt. - */ - bits = xchg(&S390_lowcore.ext_call_fast, 0); - - if (test_bit(ec_call_function, &bits)) - do_call_function(); -} - -/* - * Send an external call sigp to another cpu and return without waiting - * for its completion. - */ -static sigp_ccode smp_ext_bitcall(int cpu, ec_bit_sig sig) -{ - sigp_ccode ccode; - - /* - * Set signaling bit in lowcore of target cpu and kick it - */ - set_bit(sig, &lowcore_ptr[cpu]->ext_call_fast); - ccode = signal_processor(cpu, sigp_external_call); - return ccode; -} - -/* - * Send an external call sigp to every other cpu in the system and - * return without waiting for its completion. - */ -static void smp_ext_bitcall_others(ec_bit_sig sig) -{ - int i; - - for (i = 0; i < NR_CPUS; i++) { - if (!cpu_online(i) || smp_processor_id() == i) - continue; - /* - * Set signaling bit in lowcore of target cpu and kick it - */ - set_bit(sig, &lowcore_ptr[i]->ext_call_fast); - while (signal_processor(i, sigp_external_call) == sigp_busy) - udelay(10); - } -} - -/* - * this function sends a 'reschedule' IPI to another CPU. - * it goes straight through and wastes no time serializing - * anything. Worst case is that we lose a reschedule ... - */ - -void smp_send_reschedule(int cpu) -{ - smp_ext_bitcall(cpu, ec_schedule); -} - -/* - * parameter area for the set/clear control bit callbacks - */ -typedef struct -{ - __u16 start_ctl; - __u16 end_ctl; - __u64 orvals[16]; - __u64 andvals[16]; -} ec_creg_mask_parms; - -/* - * callback for setting/clearing control bits - */ -void smp_ctl_bit_callback(void *info) { - ec_creg_mask_parms *pp; - u64 cregs[16]; - int i; - - pp = (ec_creg_mask_parms *) info; - asm volatile (" bras 1,0f\n" - " stctg 0,0,0(%0)\n" - "0: ex %1,0(1)\n" - : : "a" (cregs+pp->start_ctl), - "a" ((pp->start_ctl<<4) + pp->end_ctl) - : "memory", "1" ); - for (i = pp->start_ctl; i <= pp->end_ctl; i++) - cregs[i] = (cregs[i] & pp->andvals[i]) | pp->orvals[i]; - asm volatile (" bras 1,0f\n" - " lctlg 0,0,0(%0)\n" - "0: ex %1,0(1)\n" - : : "a" (cregs+pp->start_ctl), - "a" ((pp->start_ctl<<4) + pp->end_ctl) - : "memory", "1" ); -} - -/* - * Set a bit in a control register of all cpus - */ -void smp_ctl_set_bit(int cr, int bit) { - ec_creg_mask_parms parms; - - parms.start_ctl = cr; - parms.end_ctl = cr; - parms.orvals[cr] = 1 << bit; - parms.andvals[cr] = -1L; - preempt_disable(); - smp_call_function(smp_ctl_bit_callback, &parms, 0, 1); - __ctl_set_bit(cr, bit); - preempt_enable(); -} - -/* - * Clear a bit in a control register of all cpus - */ -void smp_ctl_clear_bit(int cr, int bit) { - ec_creg_mask_parms parms; - - parms.start_ctl = cr; - parms.end_ctl = cr; - parms.orvals[cr] = 0; - parms.andvals[cr] = ~(1L << bit); - preempt_disable(); - smp_call_function(smp_ctl_bit_callback, &parms, 0, 1); - __ctl_clear_bit(cr, bit); - preempt_enable(); -} - - -/* - * Lets check how many CPUs we have. - */ - -void __init smp_check_cpus(unsigned int max_cpus) -{ - int curr_cpu, num_cpus; - __u16 boot_cpu_addr; - - boot_cpu_addr = S390_lowcore.cpu_data.cpu_addr; - current_thread_info()->cpu = 0; - num_cpus = 1; - cpu_possible_map = 1; - cpu_online_map = 1; - for (curr_cpu = 0; - curr_cpu <= 65535 && num_cpus < max_cpus; curr_cpu++) { - if ((__u16) curr_cpu == boot_cpu_addr) - continue; - __cpu_logical_map[num_cpus] = (__u16) curr_cpu; - if (signal_processor(num_cpus, sigp_sense) == - sigp_not_operational) - continue; - set_bit(num_cpus, &cpu_possible_map); - num_cpus++; - } - printk("Detected %d CPU's\n",(int) num_cpus); - printk("Boot cpu address %2X\n", boot_cpu_addr); -} - - -/* - * Activate a secondary processor. - */ -extern void init_cpu_timer(void); -extern int pfault_init(void); - -int __devinit start_secondary(void *cpuvoid) -{ - /* Setup the cpu */ - cpu_init(); - /* init per CPU timer */ - init_cpu_timer(); -#ifdef CONFIG_PFAULT - /* Enable pfault pseudo page faults on this cpu. */ - pfault_init(); -#endif - /* Mark this cpu as online. */ - set_bit(smp_processor_id(), &cpu_online_map); - /* Switch on interrupts */ - local_irq_enable(); - /* Print info about this processor */ - print_cpu_info(&S390_lowcore.cpu_data); - /* cpu_idle will call schedule for us */ - return cpu_idle(NULL); -} - -static struct task_struct * __devinit fork_by_hand(void) -{ - struct pt_regs regs; - /* don't care about the psw and regs settings since we'll never - reschedule the forked task. */ - memset(®s,0,sizeof(struct pt_regs)); - return do_fork(CLONE_VM|CLONE_IDLETASK, 0, ®s, 0, NULL, NULL); -} - -int __cpu_up(unsigned int cpu) -{ - struct task_struct *idle; - struct _lowcore *cpu_lowcore; - sigp_ccode ccode; - - /* - * Set prefix page for new cpu - */ - - ccode = signal_processor_p((u64) lowcore_ptr[cpu], - cpu, sigp_set_prefix); - if(ccode){ - printk("sigp_set_prefix failed for cpu %d " - "with condition code %d\n", - (int) cpu, (int) ccode); - return -EIO; - } - - /* We can't use kernel_thread since we must _avoid_ to reschedule - the child. */ - idle = fork_by_hand(); - if (IS_ERR(idle)){ - printk("failed fork for CPU %d", cpu); - return -EIO; - } - - /* - * We remove it from the pidhash and the runqueue - * once we got the process: - */ - init_idle(idle, cpu); - - unhash_process(idle); - - cpu_lowcore = lowcore_ptr[cpu]; - cpu_lowcore->save_area[15] = idle->thread.ksp; - cpu_lowcore->kernel_stack = (__u64) idle->thread_info + (4*PAGE_SIZE); - __asm__ __volatile__("la 1,%0\n\t" - "stctg 0,15,0(1)\n\t" - "la 1,%1\n\t" - "stam 0,15,0(1)" - : "=m" (cpu_lowcore->cregs_save_area[0]), - "=m" (cpu_lowcore->access_regs_save_area[0]) - : : "1", "memory"); - - eieio(); - signal_processor(cpu,sigp_restart); - - while (!cpu_online(cpu)); - return 0; -} - -/* - * Cycle through the processors and setup structures. - */ - -void __init smp_prepare_cpus(unsigned int max_cpus) -{ - unsigned long async_stack; - int i; - - /* request the 0x1202 external interrupt */ - if (register_external_interrupt(0x1202, do_ext_call_interrupt) != 0) - panic("Couldn't request external interrupt 0x1202"); - smp_check_cpus(max_cpus); - memset(lowcore_ptr,0,sizeof(lowcore_ptr)); - - /* - * Initialize prefix pages and stacks for all possible cpus - */ - print_cpu_info(&S390_lowcore.cpu_data); - - for(i = 0; i < NR_CPUS; i++) { - if (!cpu_possible(i)) - continue; - lowcore_ptr[i] = (struct _lowcore *) - __get_free_pages(GFP_KERNEL|GFP_DMA, 1); - async_stack = __get_free_pages(GFP_KERNEL,2); - if (lowcore_ptr[i] == NULL || async_stack == 0ULL) - panic("smp_boot_cpus failed to allocate memory\n"); - memcpy(lowcore_ptr[i], &S390_lowcore, sizeof(struct _lowcore)); - lowcore_ptr[i]->async_stack = async_stack + (4 * PAGE_SIZE); - } - set_prefix((u32)(u64) lowcore_ptr[smp_processor_id()]); -} - -void __devinit smp_prepare_boot_cpu(void) -{ - set_bit(smp_processor_id(), &cpu_online_map); - set_bit(smp_processor_id(), &cpu_possible_map); -} - -void smp_cpus_done(unsigned int max_cpis) -{ -} - -/* - * the frequency of the profiling timer can be changed - * by writing a multiplier value into /proc/profile. - * - * usually you want to run this on all CPUs ;) - */ -int setup_profiling_timer(unsigned int multiplier) -{ - return 0; -} - -EXPORT_SYMBOL(lowcore_ptr); -EXPORT_SYMBOL(smp_ctl_set_bit); -EXPORT_SYMBOL(smp_ctl_clear_bit); -EXPORT_SYMBOL(smp_call_function); diff --git a/arch/s390x/kernel/sys_s390.c b/arch/s390x/kernel/sys_s390.c deleted file mode 100644 index 19688fd669d00..0000000000000 --- a/arch/s390x/kernel/sys_s390.c +++ /dev/null @@ -1,258 +0,0 @@ -/* - * arch/s390/kernel/sys_s390.c - * - * S390 version - * Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation - * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com), - * - * Derived from "arch/i386/kernel/sys_i386.c" - * - * This file contains various random system calls that - * have a non-standard calling sequence on the Linux/s390 - * platform. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -/* - * sys_pipe() is the normal C calling standard for creating - * a pipe. It's not the way Unix traditionally does this, though. - */ -asmlinkage long sys_pipe(unsigned long * fildes) -{ - int fd[2]; - int error; - - error = do_pipe(fd); - if (!error) { - if (copy_to_user(fildes, fd, 2*sizeof(int))) - error = -EFAULT; - } - return error; -} - -/* common code for old and new mmaps */ -static inline long do_mmap2( - unsigned long addr, unsigned long len, - unsigned long prot, unsigned long flags, - unsigned long fd, unsigned long pgoff) -{ - long error = -EBADF; - struct file * file = NULL; - - flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE); - if (!(flags & MAP_ANONYMOUS)) { - file = fget(fd); - if (!file) - goto out; - } - - down_write(¤t->mm->mmap_sem); - error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff); - up_write(¤t->mm->mmap_sem); - - if (file) - fput(file); -out: - return error; -} - -/* - * Perform the select(nd, in, out, ex, tv) and mmap() system - * calls. Linux/i386 didn't use to be able to handle more than - * 4 system call parameters, so these system calls used a memory - * block for parameter passing.. - */ - -struct mmap_arg_struct { - unsigned long addr; - unsigned long len; - unsigned long prot; - unsigned long flags; - unsigned long fd; - unsigned long offset; -}; - -asmlinkage long sys_mmap2(struct mmap_arg_struct *arg) -{ - struct mmap_arg_struct a; - int error = -EFAULT; - - if (copy_from_user(&a, arg, sizeof(a))) - goto out; - error = do_mmap2(a.addr, a.len, a.prot, a.flags, a.fd, a.offset); -out: - return error; -} - -asmlinkage long old_mmap(struct mmap_arg_struct *arg) -{ - struct mmap_arg_struct a; - long error = -EFAULT; - - if (copy_from_user(&a, arg, sizeof(a))) - goto out; - - error = -EINVAL; - if (a.offset & ~PAGE_MASK) - goto out; - - error = do_mmap2(a.addr, a.len, a.prot, a.flags, a.fd, a.offset >> PAGE_SHIFT); -out: - return error; -} - -unsigned long -arch_get_unmapped_area(struct file *filp, unsigned long addr, - unsigned long len, unsigned long pgoff, - unsigned long flags) -{ - struct vm_area_struct *vma; - unsigned long end; - - if (test_thread_flag(TIF_31BIT)) { - if (!addr) - addr = 0x40000000; - end = 0x80000000; - } else { - if (!addr) - addr = TASK_SIZE / 2; - end = TASK_SIZE; - } - - if (len > end) - return -ENOMEM; - addr = PAGE_ALIGN(addr); - - for (vma = find_vma(current->mm, addr); ; vma = vma->vm_next) { - /* At this point: (!vma || addr < vma->vm_end). */ - if (end - len < addr) - return -ENOMEM; - if (!vma || addr + len <= vma->vm_start) - return addr; - addr = vma->vm_end; - } -} - -extern asmlinkage int sys_select(int, fd_set *, fd_set *, fd_set *, struct timeval *); - -/* - * sys_ipc() is the de-multiplexer for the SysV IPC calls.. - * - * This is really horribly ugly. - */ -asmlinkage int sys_ipc (uint call, int first, long second, - unsigned long third, void *ptr) -{ - struct ipc_kludge tmp; - int ret; - - switch (call) { - case SEMOP: - return sys_semop (first, (struct sembuf *)ptr, second); - case SEMGET: - return sys_semget (first, second, third); - case SEMCTL: { - union semun fourth; - if (!ptr) - return -EINVAL; - if (get_user(fourth.__pad, (void **) ptr)) - return -EFAULT; - return sys_semctl (first, second, third, fourth); - } - case MSGSND: - return sys_msgsnd (first, (struct msgbuf *) ptr, - second, third); - break; - case MSGRCV: - if (!ptr) - return -EINVAL; - if (copy_from_user (&tmp, (struct ipc_kludge *) ptr, - sizeof (struct ipc_kludge))) - return -EFAULT; - return sys_msgrcv (first, tmp.msgp, - second, tmp.msgtyp, third); - case MSGGET: - return sys_msgget ((key_t) first, second); - case MSGCTL: - return sys_msgctl (first, second, (struct msqid_ds *) ptr); - - case SHMAT: { - ulong raddr; - ret = sys_shmat (first, (char *) ptr, second, &raddr); - if (ret) - return ret; - return put_user (raddr, (ulong *) third); - break; - } - case SHMDT: - return sys_shmdt ((char *)ptr); - case SHMGET: - return sys_shmget (first, second, third); - case SHMCTL: - return sys_shmctl (first, second, - (struct shmid_ds *) ptr); - default: - return -EINVAL; - - } - - return -EINVAL; -} - -/* - * Old cruft - */ -asmlinkage int sys_uname(struct old_utsname * name) -{ - int err; - if (!name) - return -EFAULT; - down_read(&uts_sem); - err=copy_to_user(name, &system_utsname, sizeof (*name)); - up_read(&uts_sem); - return err?-EFAULT:0; -} - -extern asmlinkage int sys_newuname(struct new_utsname * name); - -asmlinkage int s390x_newuname(struct new_utsname * name) -{ - int ret = sys_newuname(name); - - if (current->personality == PER_LINUX32 && !ret) { - ret = copy_to_user(name->machine, "s390\0\0\0\0", 8); - if (ret) ret = -EFAULT; - } - return ret; -} - -extern asmlinkage long sys_personality(unsigned long); - -asmlinkage int s390x_personality(unsigned long personality) -{ - int ret; - - if (current->personality == PER_LINUX32 && personality == PER_LINUX) - personality = PER_LINUX32; - ret = sys_personality(personality); - if (ret == PER_LINUX32) - ret = PER_LINUX; - - return ret; -} diff --git a/arch/s390x/kernel/time.c b/arch/s390x/kernel/time.c deleted file mode 100644 index 53809f47e4b33..0000000000000 --- a/arch/s390x/kernel/time.c +++ /dev/null @@ -1,241 +0,0 @@ -/* - * arch/s390/kernel/time.c - * - * S390 version - * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation - * Author(s): Hartmut Penner (hp@de.ibm.com), - * Martin Schwidefsky (schwidefsky@de.ibm.com), - * Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com) - * - * Derived from "arch/i386/kernel/time.c" - * Copyright (C) 1991, 1992, 1995 Linus Torvalds - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include - -#include -#include - -/* change this if you have some constant time drift */ -#define USECS_PER_JIFFY ((unsigned long) 1000000/HZ) -#define CLK_TICKS_PER_JIFFY ((unsigned long) USECS_PER_JIFFY << 12) - -/* - * Create a small time difference between the timer interrupts - * on the different cpus to avoid lock contention. - */ -#define CPU_DEVIATION (smp_processor_id() << 12) - -#define TICK_SIZE tick - -u64 jiffies_64 = INITIAL_JIFFIES; - -static ext_int_info_t ext_int_info_timer; -static uint64_t xtime_cc; -static uint64_t init_timer_cc; - -extern unsigned long wall_jiffies; - -void tod_to_timeval(__u64 todval, struct timespec *xtime) -{ - xtime->tv_sec = (todval >> 12) / 1000000; - todval -= (xtime->tv_sec * 1000000) << 12; - xtime->tv_nsec = ((todval * 1000) >> 12); -} - -static inline unsigned long do_gettimeoffset(void) -{ - __u64 now; - - asm volatile ("STCK 0(%0)" : : "a" (&now) : "memory", "cc"); - now = (now - init_timer_cc) >> 12; - /* We require the offset from the latest update of xtime */ - now -= (__u64) wall_jiffies*USECS_PER_JIFFY; - return (unsigned long) now; -} - -/* - * This version of gettimeofday has microsecond resolution. - */ -void do_gettimeofday(struct timeval *tv) -{ - unsigned long flags; - unsigned long seq; - unsigned long usec, sec; - - do { - seq = read_seqbegin_irqsave(&xtime_lock, flags); - sec = xtime.tv_sec; - usec = xtime.tv_nsec + do_gettimeoffset(); - } while (read_seqretry_irqrestore(&xtime_lock, seq, flags)); - - while (usec >= 1000000) { - usec -= 1000000; - sec++; - } - - tv->tv_sec = sec; - tv->tv_usec = usec; -} - -void do_settimeofday(struct timeval *tv) -{ - - write_seqlock_irq(&xtime_lock); - /* This is revolting. We need to set the xtime.tv_usec - * correctly. However, the value in this location is - * is value at the last tick. - * Discover what correction gettimeofday - * would have done, and then undo it! - */ - tv->tv_usec -= do_gettimeoffset(); - - while (tv->tv_usec < 0) { - tv->tv_usec += 1000000; - tv->tv_sec--; - } - - xtime.tv_sec = tv->tv_sec; - xtime.tv_nsec = tv->tv_usec * 1000; - time_adjust = 0; /* stop active adjtime() */ - time_status |= STA_UNSYNC; - time_maxerror = NTP_PHASE_LIMIT; - time_esterror = NTP_PHASE_LIMIT; - write_sequnlock_irq(&xtime_lock); -} - -/* - * timer_interrupt() needs to keep up the real-time clock, - * as well as call the "do_timer()" routine every clocktick - */ -static void do_comparator_interrupt(struct pt_regs *regs, __u16 error_code) -{ - __u64 tmp; - __u32 ticks; - - /* Calculate how many ticks have passed. */ - asm volatile ("STCK 0(%0)" : : "a" (&tmp) : "memory", "cc"); - tmp = tmp - S390_lowcore.jiffy_timer; - if (tmp >= 2*CLK_TICKS_PER_JIFFY) { /* more than one tick ? */ - ticks = tmp / CLK_TICKS_PER_JIFFY; - S390_lowcore.jiffy_timer += - CLK_TICKS_PER_JIFFY * (__u64) ticks; - } else { - ticks = 1; - S390_lowcore.jiffy_timer += CLK_TICKS_PER_JIFFY; - } - - /* set clock comparator for next tick */ - tmp = S390_lowcore.jiffy_timer + CLK_TICKS_PER_JIFFY + CPU_DEVIATION; - asm volatile ("SCKC %0" : : "m" (tmp)); - - irq_enter(); - -#ifdef CONFIG_SMP - /* - * Do not rely on the boot cpu to do the calls to do_timer. - * Spread it over all cpus instead. - */ - write_seqlock(&xtime_lock); - if (S390_lowcore.jiffy_timer > xtime_cc) { - __u32 xticks; - - tmp = S390_lowcore.jiffy_timer - xtime_cc; - if (tmp >= 2*CLK_TICKS_PER_JIFFY) { - xticks = tmp / CLK_TICKS_PER_JIFFY; - xtime_cc += (__u64) xticks * CLK_TICKS_PER_JIFFY; - } else { - xticks = 1; - xtime_cc += CLK_TICKS_PER_JIFFY; - } - while (xticks--) - do_timer(regs); - } - write_sequnlock(&xtime_lock); - while (ticks--) - update_process_times(user_mode(regs)); -#else - while (ticks--) - do_timer(regs); -#endif - - irq_exit(); -} - -/* - * Start the clock comparator on the current CPU. - */ -void init_cpu_timer(void) -{ - unsigned long cr0; - __u64 timer; - - /* allow clock comparator timer interrupt */ - asm volatile ("STCTG 0,0,%0" : "=m" (cr0) : : "memory"); - cr0 |= 0x800; - asm volatile ("LCTLG 0,0,%0" : : "m" (cr0) : "memory"); - timer = init_timer_cc + jiffies_64 * CLK_TICKS_PER_JIFFY; - S390_lowcore.jiffy_timer = timer; - timer += CLK_TICKS_PER_JIFFY + CPU_DEVIATION; - asm volatile ("SCKC %0" : : "m" (timer)); -} - -/* - * Initialize the TOD clock and the CPU timer of - * the boot cpu. - */ -void __init time_init(void) -{ - __u64 set_time_cc; - int cc; - - /* kick the TOD clock */ - asm volatile ("STCK 0(%1)\n\t" - "IPM %0\n\t" - "SRL %0,28" : "=r" (cc) : "a" (&init_timer_cc) - : "memory", "cc"); - switch (cc) { - case 0: /* clock in set state: all is fine */ - break; - case 1: /* clock in non-set state: FIXME */ - printk("time_init: TOD clock in non-set state\n"); - break; - case 2: /* clock in error state: FIXME */ - printk("time_init: TOD clock in error state\n"); - break; - case 3: /* clock in stopped or not-operational state: FIXME */ - printk("time_init: TOD clock stopped/non-operational\n"); - break; - } - - /* set xtime */ - xtime_cc = init_timer_cc; - set_time_cc = init_timer_cc - 0x8126d60e46000000LL + - (0x3c26700LL*1000000*4096); - tod_to_timeval(set_time_cc, &xtime); - - /* request the 0x1004 external interrupt */ - if (register_early_external_interrupt(0x1004, do_comparator_interrupt, - &ext_int_info_timer) != 0) - panic("Couldn't request external interrupt 0x1004"); - - /* init CPU timer */ - init_cpu_timer(); -} diff --git a/arch/s390x/kernel/traps.c b/arch/s390x/kernel/traps.c deleted file mode 100644 index f90c3602c3b30..0000000000000 --- a/arch/s390x/kernel/traps.c +++ /dev/null @@ -1,503 +0,0 @@ -/* - * arch/s390/kernel/traps.c - * - * S390 version - * Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation - * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com), - * Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com), - * - * Derived from "arch/i386/kernel/traps.c" - * Copyright (C) 1991, 1992 Linus Torvalds - */ - -/* - * 'Traps.c' handles hardware traps and faults after we have saved some - * state in 'asm.s'. - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#if CONFIG_REMOTE_DEBUG -#include -#endif -#include -#include - -/* Called from entry.S only */ -extern void handle_per_exception(struct pt_regs *regs); - -typedef void pgm_check_handler_t(struct pt_regs *, long); -pgm_check_handler_t *pgm_check_table[128]; - -#ifdef CONFIG_SYSCTL -#ifdef CONFIG_PROCESS_DEBUG -int sysctl_userprocess_debug = 1; -#else -int sysctl_userprocess_debug = 0; -#endif -#endif - -extern pgm_check_handler_t do_protection_exception; -extern pgm_check_handler_t do_segment_exception; -extern pgm_check_handler_t do_region_exception; -extern pgm_check_handler_t do_page_exception; -#ifdef CONFIG_PFAULT -extern int pfault_init(void); -extern void pfault_fini(void); -extern void pfault_interrupt(struct pt_regs *regs, __u16 error_code); -static ext_int_info_t ext_int_pfault; -#endif - -static int kstack_depth_to_print = 20; - -void show_trace(unsigned long * stack) -{ - unsigned long backchain, low_addr, high_addr, ret_addr; - int i; - - if (!stack) - stack = (unsigned long*)&stack; - - printk("Call Trace: "); - low_addr = (unsigned long) stack; - high_addr = (low_addr & (-THREAD_SIZE)) + THREAD_SIZE; - /* Skip the first frame (biased stack) */ - backchain = *(unsigned long *) low_addr; - /* Print up to 8 lines */ - for (i = 0; i < 8; i++) { - if (backchain < low_addr || backchain >= high_addr) - break; - ret_addr = *(unsigned long *) (backchain+112); - if (!kernel_text_address(ret_addr)) - break; - if (i && ((i % 3) == 0)) - printk("\n "); - printk("[<%016lx>] ", ret_addr); - low_addr = backchain; - backchain = *(unsigned long *) backchain; - } - printk("\n"); -} - -void show_trace_task(struct task_struct *tsk) -{ - /* - * We can't print the backtrace of a running process. It is - * unreliable at best and can cause kernel oopses. - */ - if (tsk->state == TASK_RUNNING) - return; - show_trace((unsigned long *) tsk->thread.ksp); -} - -void show_stack(unsigned long *sp) -{ - unsigned long *stack; - int i; - - // debugging aid: "show_stack(NULL);" prints the - // back trace for this cpu. - - if (sp == NULL) - sp = (unsigned long*) &sp; - - stack = sp; - for (i = 0; i < kstack_depth_to_print; i++) { - if (((addr_t) stack & (THREAD_SIZE-1)) == 0) - break; - if (i && ((i % 4) == 0)) - printk("\n "); - printk("%016lx ", *stack++); - } - printk("\n"); - show_trace(sp); -} - -/* - * The architecture-independent dump_stack generator - */ -void dump_stack(void) -{ - show_stack(0); -} - -void show_registers(struct pt_regs *regs) -{ - mm_segment_t old_fs; - char *mode; - int i; - - mode = (regs->psw.mask & PSW_MASK_PSTATE) ? "User" : "Krnl"; - printk("%s PSW : %016lx %016lx\n", - mode, (unsigned long) regs->psw.mask, - (unsigned long) regs->psw.addr); - printk("%s GPRS: %016lx %016lx %016lx %016lx\n", mode, - regs->gprs[0], regs->gprs[1], regs->gprs[2], regs->gprs[3]); - printk(" %016lx %016lx %016lx %016lx\n", - regs->gprs[4], regs->gprs[5], regs->gprs[6], regs->gprs[7]); - printk(" %016lx %016lx %016lx %016lx\n", - regs->gprs[8], regs->gprs[9], regs->gprs[10], regs->gprs[11]); - printk(" %016lx %016lx %016lx %016lx\n", - regs->gprs[12], regs->gprs[13], regs->gprs[14], regs->gprs[15]); - printk("%s ACRS: %08x %08x %08x %08x\n", mode, - regs->acrs[0], regs->acrs[1], regs->acrs[2], regs->acrs[3]); - printk(" %08x %08x %08x %08x\n", - regs->acrs[4], regs->acrs[5], regs->acrs[6], regs->acrs[7]); - printk(" %08x %08x %08x %08x\n", - regs->acrs[8], regs->acrs[9], regs->acrs[10], regs->acrs[11]); - printk(" %08x %08x %08x %08x\n", - regs->acrs[12], regs->acrs[13], regs->acrs[14], regs->acrs[15]); - - /* - * Print the first 20 byte of the instruction stream at the - * time of the fault. - */ - old_fs = get_fs(); - if (regs->psw.mask & PSW_MASK_PSTATE) - set_fs(USER_DS); - else - set_fs(KERNEL_DS); - printk("%s Code: ", mode); - for (i = 0; i < 20; i++) { - unsigned char c; - if (__get_user(c, (char *)(regs->psw.addr + i))) { - printk(" Bad PSW."); - break; - } - printk("%02x ", c); - } - set_fs(old_fs); - - printk("\n"); -} - -/* This is called from fs/proc/array.c */ -char *task_show_regs(struct task_struct *task, char *buf) -{ - struct pt_regs *regs; - - regs = __KSTK_PTREGS(task); - buf += sprintf(buf, "task: %016lx, ksp: %016lx\n", - (unsigned long) task, task->thread.ksp); - buf += sprintf(buf, "User PSW : %016lx %016lx\n", - (unsigned long) regs->psw.mask, - (unsigned long) regs->psw.addr); - buf += sprintf(buf, "User GPRS: %016lx %016lx %016lx %016lx\n", - regs->gprs[0], regs->gprs[1], - regs->gprs[2], regs->gprs[3]); - buf += sprintf(buf, " %016lx %016lx %016lx %016lx\n", - regs->gprs[4], regs->gprs[5], - regs->gprs[6], regs->gprs[7]); - buf += sprintf(buf, " %016lx %016lx %016lx %016lx\n", - regs->gprs[8], regs->gprs[9], - regs->gprs[10], regs->gprs[11]); - buf += sprintf(buf, " %016lx %016lx %016lx %016lx\n", - regs->gprs[12], regs->gprs[13], - regs->gprs[14], regs->gprs[15]); - buf += sprintf(buf, "User ACRS: %08x %08x %08x %08x\n", - regs->acrs[0], regs->acrs[1], - regs->acrs[2], regs->acrs[3]); - buf += sprintf(buf, " %08x %08x %08x %08x\n", - regs->acrs[4], regs->acrs[5], - regs->acrs[6], regs->acrs[7]); - buf += sprintf(buf, " %08x %08x %08x %08x\n", - regs->acrs[8], regs->acrs[9], - regs->acrs[10], regs->acrs[11]); - buf += sprintf(buf, " %08x %08x %08x %08x\n", - regs->acrs[12], regs->acrs[13], - regs->acrs[14], regs->acrs[15]); - return buf; -} - -spinlock_t die_lock = SPIN_LOCK_UNLOCKED; - -void die(const char * str, struct pt_regs * regs, long err) -{ - static int die_counter; - console_verbose(); - spin_lock_irq(&die_lock); - bust_spinlocks(1); - printk("%s: %04lx [#%d]\n", str, err & 0xffff, ++die_counter); - show_regs(regs); - bust_spinlocks(0); - spin_unlock_irq(&die_lock); - do_exit(SIGSEGV); -} - -static void inline do_trap(long interruption_code, int signr, char *str, - struct pt_regs *regs, siginfo_t *info) -{ - /* - * We got all needed information from the lowcore and can - * now safely switch on interrupts. - */ - if (regs->psw.mask & PSW_MASK_PSTATE) - local_irq_enable(); - - if (regs->psw.mask & PSW_MASK_PSTATE) { - struct task_struct *tsk = current; - tsk->thread.trap_no = interruption_code & 0xffff; - if (info) - force_sig_info(signr, info, tsk); - else - force_sig(signr, tsk); -#ifndef CONFIG_SYSCTL -#ifdef CONFIG_PROCESS_DEBUG - printk("User process fault: interruption code 0x%lX\n", - interruption_code); - show_regs(regs); -#endif -#else - if (sysctl_userprocess_debug) { - printk("User process fault: interruption code 0x%lX\n", - interruption_code); - show_regs(regs); - } -#endif - } else { - const struct exception_table_entry *fixup; - fixup = search_exception_tables(regs->psw.addr); - if (fixup) - regs->psw.addr = fixup->fixup; - else - die(str, regs, interruption_code); - } -} - -static inline void *get_check_address(struct pt_regs *regs) -{ - return (void *)(regs->psw.addr - S390_lowcore.pgm_ilc); -} - -int do_debugger_trap(struct pt_regs *regs,int signal) -{ - if(regs->psw.mask&PSW_MASK_PSTATE) - { - if(current->ptrace & PT_PTRACED) - force_sig(signal,current); - else - return 1; - } - else - { -#if CONFIG_REMOTE_DEBUG - if(gdb_stub_initialised) - { - gdb_stub_handle_exception(regs, signal); - return 0; - } -#endif - return 1; - } - return 0; -} - -#define DO_ERROR(signr, str, name) \ -asmlinkage void name(struct pt_regs * regs, long interruption_code) \ -{ \ - do_trap(interruption_code, signr, str, regs, NULL); \ -} - -#define DO_ERROR_INFO(signr, str, name, sicode, siaddr) \ -asmlinkage void name(struct pt_regs * regs, long interruption_code) \ -{ \ - siginfo_t info; \ - info.si_signo = signr; \ - info.si_errno = 0; \ - info.si_code = sicode; \ - info.si_addr = (void *)siaddr; \ - do_trap(interruption_code, signr, str, regs, &info); \ -} - -DO_ERROR(SIGSEGV, "Unknown program exception", default_trap_handler) - -DO_ERROR_INFO(SIGBUS, "addressing exception", addressing_exception, - BUS_ADRERR, get_check_address(regs)) -DO_ERROR_INFO(SIGILL, "execute exception", execute_exception, - ILL_ILLOPN, get_check_address(regs)) -DO_ERROR_INFO(SIGFPE, "fixpoint divide exception", divide_exception, - FPE_INTDIV, get_check_address(regs)) -DO_ERROR_INFO(SIGILL, "operand exception", operand_exception, - ILL_ILLOPN, get_check_address(regs)) -DO_ERROR_INFO(SIGILL, "privileged operation", privileged_op, - ILL_PRVOPC, get_check_address(regs)) -DO_ERROR_INFO(SIGILL, "special operation exception", special_op_exception, - ILL_ILLOPN, get_check_address(regs)) -DO_ERROR_INFO(SIGILL, "specification exception", specification_exception, - ILL_ILLOPN, get_check_address(regs)) -DO_ERROR_INFO(SIGILL, "translation exception", translation_exception, - ILL_ILLOPN, get_check_address(regs)) - -static inline void -do_fp_trap(struct pt_regs *regs, void *location, - int fpc, long interruption_code) -{ - siginfo_t si; - - si.si_signo = SIGFPE; - si.si_errno = 0; - si.si_addr = location; - si.si_code = 0; - /* FPC[2] is Data Exception Code */ - if ((fpc & 0x00000300) == 0) { - /* bits 6 and 7 of DXC are 0 iff IEEE exception */ - if (fpc & 0x8000) /* invalid fp operation */ - si.si_code = FPE_FLTINV; - else if (fpc & 0x4000) /* div by 0 */ - si.si_code = FPE_FLTDIV; - else if (fpc & 0x2000) /* overflow */ - si.si_code = FPE_FLTOVF; - else if (fpc & 0x1000) /* underflow */ - si.si_code = FPE_FLTUND; - else if (fpc & 0x0800) /* inexact */ - si.si_code = FPE_FLTRES; - } - current->thread.ieee_instruction_pointer = (addr_t) location; - do_trap(interruption_code, SIGFPE, - "floating point exception", regs, &si); -} - -asmlinkage void illegal_op(struct pt_regs * regs, long interruption_code) -{ - __u8 opcode[6]; - __u16 *location; - int do_sig = 0; - - location = (__u16 *) get_check_address(regs); - - /* - * We got all needed information from the lowcore and can - * now safely switch on interrupts. - */ - if (regs->psw.mask & PSW_MASK_PSTATE) - local_irq_enable(); - - /* WARNING don't change this check back to */ - /* int problem_state=(regs->psw.mask & PSW_MASK_PSTATE); */ - /* & then doing if(problem_state) an int is too small for this */ - /* check on 64 bit. */ - if(regs->psw.mask & PSW_MASK_PSTATE) - get_user(*((__u16 *) opcode), location); - else - *((__u16 *)opcode)=*((__u16 *)location); - if(*((__u16 *)opcode)==S390_BREAKPOINT_U16) - { - if(do_debugger_trap(regs,SIGTRAP)) - do_sig=1; - } - else - do_sig = 1; - if (do_sig) - do_trap(interruption_code, SIGILL, - "illegal operation", regs, NULL); -} - -asmlinkage void data_exception(struct pt_regs * regs, long interruption_code) -{ - __u16 *location; - - location = (__u16 *) get_check_address(regs); - - /* - * We got all needed information from the lowcore and can - * now safely switch on interrupts. - */ - if (regs->psw.mask & PSW_MASK_PSTATE) - local_irq_enable(); - - __asm__ volatile ("stfpc %0\n\t" - : "=m" (current->thread.fp_regs.fpc)); - - if (current->thread.fp_regs.fpc & FPC_DXC_MASK) - do_fp_trap(regs, location, - current->thread.fp_regs.fpc, interruption_code); - else { - siginfo_t info; - info.si_signo = SIGILL; - info.si_errno = 0; - info.si_code = ILL_ILLOPN; - info.si_addr = location; - do_trap(interruption_code, SIGILL, - "data exception", regs, &info); - } -} - - - -/* init is done in lowcore.S and head.S */ - -void __init trap_init(void) -{ - int i; - - for (i = 0; i < 128; i++) - pgm_check_table[i] = &default_trap_handler; - pgm_check_table[1] = &illegal_op; - pgm_check_table[2] = &privileged_op; - pgm_check_table[3] = &execute_exception; - pgm_check_table[4] = &do_protection_exception; - pgm_check_table[5] = &addressing_exception; - pgm_check_table[6] = &specification_exception; - pgm_check_table[7] = &data_exception; - pgm_check_table[9] = ÷_exception; - pgm_check_table[0x12] = &translation_exception; - pgm_check_table[0x13] = &special_op_exception; - pgm_check_table[0x15] = &operand_exception; - pgm_check_table[0x10] = &do_segment_exception; - pgm_check_table[0x11] = &do_page_exception; - pgm_check_table[0x1C] = &privileged_op; - pgm_check_table[0x38] = &addressing_exception; - pgm_check_table[0x3B] = &do_region_exception; -#ifdef CONFIG_PFAULT - if (MACHINE_IS_VM) { - /* request the 0x2603 external interrupt */ - if (register_early_external_interrupt(0x2603, pfault_interrupt, - &ext_int_pfault) != 0) - panic("Couldn't request external interrupt 0x2603"); - /* - * Try to get pfault pseudo page faults going. - */ - if (pfault_init() != 0) { - /* Tough luck, no pfault. */ - unregister_early_external_interrupt(0x2603, - pfault_interrupt, - &ext_int_pfault); - } - } -#endif -} - - -void handle_per_exception(struct pt_regs *regs) -{ - if (regs->psw.mask&PSW_MASK_PSTATE) { - per_struct *per_info=¤t->thread.per_info; - per_info->lowcore.words.perc_atmid=S390_lowcore.per_perc_atmid; - per_info->lowcore.words.address=S390_lowcore.per_address; - per_info->lowcore.words.access_id=S390_lowcore.per_access_id; - } - if (do_debugger_trap(regs,SIGTRAP)) { - /* I've seen this possibly a task structure being reused ? */ - printk("Spurious per exception detected\n"); - printk("switching off per tracing for this task.\n"); - show_regs(regs); - /* Hopefully switching off per tracing will help us survive */ - regs->psw.mask &= ~PSW_MASK_PER; - } -} - diff --git a/arch/s390x/kernel/wrapper32.S b/arch/s390x/kernel/wrapper32.S deleted file mode 100644 index 6b45e7f1ee37d..0000000000000 --- a/arch/s390x/kernel/wrapper32.S +++ /dev/null @@ -1,1211 +0,0 @@ -/* -* arch/s390/kernel/sys_wrapper31.S -* wrapper for 31 bit compatible system calls. -* -* S390 version -* Copyright (C) 2000 IBM Deutschland Entwicklung GmbH, IBM Corporation -* Author(s): Gerhard Tonn (ton@de.ibm.com), -*/ - - .globl sys32_exit_wrapper -sys32_exit_wrapper: - lgfr %r2,%r2 # int - jg sys_exit # branch to sys_exit - - .globl sys32_read_wrapper -sys32_read_wrapper: - llgfr %r2,%r2 # unsigned int - llgtr %r3,%r3 # char * - llgfr %r4,%r4 # size_t - jg sys32_read # branch to sys_read - - .globl sys32_write_wrapper -sys32_write_wrapper: - llgfr %r2,%r2 # unsigned int - llgtr %r3,%r3 # const char * - llgfr %r4,%r4 # size_t - jg sys32_write # branch to system call - - .globl sys32_open_wrapper -sys32_open_wrapper: - llgtr %r2,%r2 # const char * - lgfr %r3,%r3 # int - lgfr %r4,%r4 # int - jg sys_open # branch to system call - - .globl sys32_close_wrapper -sys32_close_wrapper: - llgfr %r2,%r2 # unsigned int - jg sys_close # branch to system call - - .globl sys32_creat_wrapper -sys32_creat_wrapper: - llgtr %r2,%r2 # const char * - lgfr %r3,%r3 # int - jg sys_creat # branch to system call - - .globl sys32_link_wrapper -sys32_link_wrapper: - llgtr %r2,%r2 # const char * - llgtr %r3,%r3 # const char * - jg sys_link # branch to system call - - .globl sys32_unlink_wrapper -sys32_unlink_wrapper: - llgtr %r2,%r2 # const char * - jg sys_unlink # branch to system call - - .globl sys32_chdir_wrapper -sys32_chdir_wrapper: - llgtr %r2,%r2 # const char * - jg sys_chdir # branch to system call - - .globl sys32_time_wrapper -sys32_time_wrapper: - llgtr %r2,%r2 # int * - jg sys_time # branch to system call - - .globl sys32_mknod_wrapper -sys32_mknod_wrapper: - llgtr %r2,%r2 # const char * - lgfr %r3,%r3 # int - llgfr %r4,%r4 # dev - jg sys_mknod # branch to system call - - .globl sys32_chmod_wrapper -sys32_chmod_wrapper: - llgtr %r2,%r2 # const char * - llgfr %r3,%r3 # mode_t - jg sys_chmod # branch to system call - - .globl sys32_lchown16_wrapper -sys32_lchown16_wrapper: - llgtr %r2,%r2 # const char * - llgfr %r3,%r3 # __kernel_old_uid_emu31_t - llgfr %r4,%r4 # __kernel_old_uid_emu31_t - jg sys32_lchown16 # branch to system call - - .globl sys32_lseek_wrapper -sys32_lseek_wrapper: - llgfr %r2,%r2 # unsigned int - lgfr %r3,%r3 # off_t - llgfr %r4,%r4 # unsigned int - jg sys_lseek # branch to system call - -#sys32_getpid_wrapper # void - - .globl sys32_mount_wrapper -sys32_mount_wrapper: - llgtr %r2,%r2 # char * - llgtr %r3,%r3 # char * - llgtr %r4,%r4 # char * - llgfr %r5,%r5 # unsigned long - llgtr %r6,%r6 # void * - jg sys32_mount # branch to system call - - .globl sys32_oldumount_wrapper -sys32_oldumount_wrapper: - llgtr %r2,%r2 # char * - jg sys_oldumount # branch to system call - - .globl sys32_setuid16_wrapper -sys32_setuid16_wrapper: - llgfr %r2,%r2 # __kernel_old_uid_emu31_t - jg sys32_setuid16 # branch to system call - -#sys32_getuid16_wrapper # void - - .globl sys32_ptrace_wrapper -sys32_ptrace_wrapper: - lgfr %r2,%r2 # long - lgfr %r3,%r3 # long - llgtr %r4,%r4 # long - llgfr %r5,%r5 # long - jg sys_ptrace # branch to system call - - .globl sys32_alarm_wrapper -sys32_alarm_wrapper: - llgtr %r2,%r2 # unsigned int - jg sys_alarm # branch to system call - -#sys32_pause_wrapper # void - - .globl compat_sys_utime_wrapper -compat_sys_utime_wrapper: - llgtr %r2,%r2 # char * - llgtr %r3,%r3 # struct compat_utimbuf * - jg compat_sys_utime # branch to system call - - .globl sys32_access_wrapper -sys32_access_wrapper: - llgtr %r2,%r2 # const char * - lgfr %r3,%r3 # int - jg sys_access # branch to system call - - .globl sys32_nice_wrapper -sys32_nice_wrapper: - lgfr %r2,%r2 # int - jg sys_nice # branch to system call - -#sys32_sync_wrapper # void - - .globl sys32_kill_wrapper -sys32_kill_wrapper: - lgfr %r2,%r2 # int - lgfr %r3,%r3 # int - jg sys_kill # branch to system call - - .globl sys32_rename_wrapper -sys32_rename_wrapper: - llgtr %r2,%r2 # const char * - llgtr %r3,%r3 # const char * - jg sys_rename # branch to system call - - .globl sys32_mkdir_wrapper -sys32_mkdir_wrapper: - llgtr %r2,%r2 # const char * - lgfr %r3,%r3 # int - jg sys_mkdir # branch to system call - - .globl sys32_rmdir_wrapper -sys32_rmdir_wrapper: - llgtr %r2,%r2 # const char * - jg sys_rmdir # branch to system call - - .globl sys32_dup_wrapper -sys32_dup_wrapper: - llgfr %r2,%r2 # unsigned int - jg sys_dup # branch to system call - - .globl sys32_pipe_wrapper -sys32_pipe_wrapper: - llgtr %r2,%r2 # u32 * - jg sys_pipe # branch to system call - - .globl compat_sys_times_wrapper -compat_sys_times_wrapper: - llgtr %r2,%r2 # struct compat_tms * - jg compat_sys_times # branch to system call - - .globl sys32_brk_wrapper -sys32_brk_wrapper: - llgtr %r2,%r2 # unsigned long - jg sys_brk # branch to system call - - .globl sys32_setgid16_wrapper -sys32_setgid16_wrapper: - llgfr %r2,%r2 # __kernel_old_gid_emu31_t - jg sys32_setgid16 # branch to system call - -#sys32_getgid16_wrapper # void - - .globl sys32_signal_wrapper -sys32_signal_wrapper: - lgfr %r2,%r2 # int - llgfr %r3,%r3 # __sighandler_t - jg sys_signal - -#sys32_geteuid16_wrapper # void - -#sys32_getegid16_wrapper # void - - .globl sys32_acct_wrapper -sys32_acct_wrapper: - llgtr %r2,%r2 # char * - jg sys_acct # branch to system call - - .globl sys32_umount_wrapper -sys32_umount_wrapper: - llgtr %r2,%r2 # char * - lgfr %r3,%r3 # int - jg sys_umount # branch to system call - - .globl sys32_ioctl_wrapper -sys32_ioctl_wrapper: - llgfr %r2,%r2 # unsigned int - llgfr %r3,%r3 # unsigned int - llgfr %r4,%r4 # unsigned int - jg sys32_ioctl # branch to system call - - .globl compat_sys_fcntl_wrapper -compat_sys_fcntl_wrapper: - llgfr %r2,%r2 # unsigned int - llgfr %r3,%r3 # unsigned int - llgfr %r4,%r4 # unsigned long - jg compat_sys_fcntl # branch to system call - - .globl sys32_setpgid_wrapper -sys32_setpgid_wrapper: - lgfr %r2,%r2 # pid_t - lgfr %r3,%r3 # pid_t - jg sys_setpgid # branch to system call - - .globl sys32_umask_wrapper -sys32_umask_wrapper: - lgfr %r3,%r3 # int - jg sys_umask # branch to system call - - .globl sys32_chroot_wrapper -sys32_chroot_wrapper: - llgtr %r2,%r2 # char * - jg sys_chroot # branch to system call - - .globl sys32_ustat_wrapper -sys32_ustat_wrapper: - llgfr %r2,%r2 # dev_t - llgtr %r3,%r3 # struct ustat * - jg sys_ustat - - .globl sys32_dup2_wrapper -sys32_dup2_wrapper: - llgfr %r2,%r2 # unsigned int - llgfr %r3,%r3 # unsigned int - jg sys_dup2 # branch to system call - -#sys32_getppid_wrapper # void - -#sys32_getpgrp_wrapper # void - -#sys32_setsid_wrapper # void - - .globl sys32_sigaction_wrapper -sys32_sigaction_wrapper: - lgfr %r2,%r2 # int - llgtr %r3,%r3 # const struct old_sigaction * - jg sys32_sigaction # branch to system call - - .globl sys32_setreuid16_wrapper -sys32_setreuid16_wrapper: - llgfr %r2,%r2 # __kernel_old_uid_emu31_t - llgfr %r3,%r3 # __kernel_old_uid_emu31_t - jg sys32_setreuid16 # branch to system call - - .globl sys32_setregid16_wrapper -sys32_setregid16_wrapper: - llgfr %r2,%r2 # __kernel_old_gid_emu31_t - llgfr %r3,%r3 # __kernel_old_gid_emu31_t - jg sys32_setregid16 # branch to system call - -#sys32_sigsuspend_wrapper # done in sigsuspend_glue - - .globl compat_sys_sigpending_wrapper -compat_sys_sigpending_wrapper: - llgtr %r2,%r2 # compat_old_sigset_t * - jg compat_sys_sigpending # branch to system call - - .globl sys32_sethostname_wrapper -sys32_sethostname_wrapper: - llgtr %r2,%r2 # char * - lgfr %r3,%r3 # int - jg sys_sethostname # branch to system call - - .globl sys32_setrlimit_wrapper -sys32_setrlimit_wrapper: - llgfr %r2,%r2 # unsigned int - llgtr %r3,%r3 # struct rlimit_emu31 * - jg sys32_setrlimit # branch to system call - - .globl sys32_old_getrlimit_wrapper -sys32_old_getrlimit_wrapper: - llgfr %r2,%r2 # unsigned int - llgtr %r3,%r3 # struct rlimit_emu31 * - jg sys32_old_getrlimit # branch to system call - - .globl sys32_getrlimit_wrapper -sys32_getrlimit_wrapper: - llgfr %r2,%r2 # unsigned int - llgtr %r3,%r3 # struct rlimit_emu31 * - jg sys32_getrlimit # branch to system call - - .globl sys32_mmap2_wrapper -sys32_mmap2_wrapper: - llgtr %r2,%r2 # struct mmap_arg_struct_emu31 * - jg sys32_mmap2 # branch to system call - - .globl sys32_getrusage_wrapper -sys32_getrusage_wrapper: - lgfr %r2,%r2 # int - llgtr %r3,%r3 # struct rusage_emu31 * - jg sys32_getrusage # branch to system call - - .globl sys32_gettimeofday_wrapper -sys32_gettimeofday_wrapper: - llgtr %r2,%r2 # struct timeval_emu31 * - llgtr %r3,%r3 # struct timezone * - jg sys32_gettimeofday # branch to system call - - .globl sys32_settimeofday_wrapper -sys32_settimeofday_wrapper: - llgtr %r2,%r2 # struct timeval_emu31 * - llgtr %r3,%r3 # struct timezone * - jg sys32_settimeofday # branch to system call - - .globl sys32_getgroups16_wrapper -sys32_getgroups16_wrapper: - lgfr %r2,%r2 # int - llgtr %r3,%r3 # __kernel_old_gid_emu31_t * - jg sys32_getgroups16 # branch to system call - - .globl sys32_setgroups16_wrapper -sys32_setgroups16_wrapper: - lgfr %r2,%r2 # int - llgtr %r3,%r3 # __kernel_old_gid_emu31_t * - jg sys32_setgroups16 # branch to system call - - .globl sys32_symlink_wrapper -sys32_symlink_wrapper: - llgtr %r2,%r2 # const char * - llgtr %r3,%r3 # const char * - jg sys_symlink # branch to system call - - .globl sys32_readlink_wrapper -sys32_readlink_wrapper: - llgtr %r2,%r2 # const char * - llgtr %r3,%r3 # char * - lgfr %r4,%r4 # int - jg sys_readlink # branch to system call - - .globl sys32_uselib_wrapper -sys32_uselib_wrapper: - llgtr %r2,%r2 # const char * - jg sys_uselib # branch to system call - - .globl sys32_swapon_wrapper -sys32_swapon_wrapper: - llgtr %r2,%r2 # const char * - lgfr %r3,%r3 # int - jg sys_swapon # branch to system call - - .globl sys32_reboot_wrapper -sys32_reboot_wrapper: - lgfr %r2,%r2 # int - lgfr %r3,%r3 # int - llgfr %r4,%r4 # unsigned int - llgtr %r5,%r5 # void * - jg sys_reboot # branch to system call - - .globl old32_readdir_wrapper -old32_readdir_wrapper: - llgfr %r2,%r2 # unsigned int - llgtr %r3,%r3 # void * - llgfr %r4,%r4 # unsigned int - jg old32_readdir # branch to system call - - .globl old32_mmap_wrapper -old32_mmap_wrapper: - llgtr %r2,%r2 # struct mmap_arg_struct_emu31 * - jg old32_mmap # branch to system call - - .globl sys32_munmap_wrapper -sys32_munmap_wrapper: - llgfr %r2,%r2 # unsigned long - llgfr %r3,%r3 # size_t - jg sys_munmap # branch to system call - - .globl sys32_truncate_wrapper -sys32_truncate_wrapper: - llgtr %r2,%r2 # const char * - llgfr %r3,%r3 # unsigned long - jg sys_truncate # branch to system call - - .globl sys32_ftruncate_wrapper -sys32_ftruncate_wrapper: - llgfr %r2,%r2 # unsigned int - llgfr %r3,%r3 # unsigned long - jg sys_ftruncate # branch to system call - - .globl sys32_fchmod_wrapper -sys32_fchmod_wrapper: - llgfr %r2,%r2 # unsigned int - llgfr %r3,%r3 # mode_t - jg sys_fchmod # branch to system call - - .globl sys32_fchown16_wrapper -sys32_fchown16_wrapper: - llgfr %r2,%r2 # unsigned int - llgtr %r3,%r3 # __kernel_old_uid_emu31_t * - llgtr %r4,%r4 # __kernel_old_gid_emu31_t * - jg sys32_fchown16 # branch to system call - - .globl sys32_getpriority_wrapper -sys32_getpriority_wrapper: - lgfr %r2,%r2 # int - lgfr %r3,%r3 # int - jg sys_getpriority # branch to system call - - .globl sys32_setpriority_wrapper -sys32_setpriority_wrapper: - lgfr %r2,%r2 # int - lgfr %r3,%r3 # int - lgfr %r4,%r4 # int - jg sys_setpriority # branch to system call - - .globl compat_sys_statfs_wrapper -compat_sys_statfs_wrapper: - llgtr %r2,%r2 # char * - llgtr %r3,%r3 # struct compat_statfs * - jg compat_sys_statfs # branch to system call - - .globl compat_sys_fstatfs_wrapper -compat_sys_fstatfs_wrapper: - llgfr %r2,%r2 # unsigned int - llgtr %r3,%r3 # struct compat_statfs * - jg compat_sys_fstatfs # branch to system call - - .globl compat_sys_socketcall_wrapper -compat_sys_socketcall_wrapper: - lgfr %r2,%r2 # int - llgtr %r3,%r3 # u32 * - jg compat_sys_socketcall # branch to system call - - .globl sys32_syslog_wrapper -sys32_syslog_wrapper: - lgfr %r2,%r2 # int - llgtr %r3,%r3 # char * - lgfr %r4,%r4 # int - jg sys_syslog # branch to system call - - .globl compat_sys_setitimer_wrapper -compat_sys_setitimer_wrapper: - lgfr %r2,%r2 # int - llgtr %r3,%r3 # struct itimerval_emu31 * - llgtr %r4,%r4 # struct itimerval_emu31 * - jg compat_sys_setitimer # branch to system call - - .globl compat_sys_getitimer_wrapper -compat_sys_getitimer_wrapper: - lgfr %r2,%r2 # int - llgtr %r3,%r3 # struct itimerval_emu31 * - jg compat_sys_getitimer # branch to system call - - .globl compat_sys_newstat_wrapper -compat_sys_newstat_wrapper: - llgtr %r2,%r2 # char * - llgtr %r3,%r3 # struct stat_emu31 * - jg compat_sys_newstat # branch to system call - - .globl compat_sys_newlstat_wrapper -compat_sys_newlstat_wrapper: - llgtr %r2,%r2 # char * - llgtr %r3,%r3 # struct stat_emu31 * - jg compat_sys_newlstat # branch to system call - - .globl compat_sys_newfstat_wrapper -compat_sys_newfstat_wrapper: - llgfr %r2,%r2 # unsigned int - llgtr %r3,%r3 # struct stat_emu31 * - jg compat_sys_newfstat # branch to system call - -#sys32_vhangup_wrapper # void - - .globl sys32_wait4_wrapper -sys32_wait4_wrapper: - lgfr %r2,%r2 # pid_t - llgtr %r3,%r3 # unsigned int * - lgfr %r4,%r4 # int - llgtr %r5,%r5 # struct rusage * - jg sys32_wait4 # branch to system call - - .globl sys32_swapoff_wrapper -sys32_swapoff_wrapper: - llgtr %r2,%r2 # const char * - jg sys_swapoff # branch to system call - - .globl sys32_sysinfo_wrapper -sys32_sysinfo_wrapper: - llgtr %r2,%r2 # struct sysinfo_emu31 * - jg sys32_sysinfo # branch to system call - - .globl sys32_ipc_wrapper -sys32_ipc_wrapper: - llgfr %r2,%r2 # uint - lgfr %r3,%r3 # int - lgfr %r4,%r4 # int - lgfr %r5,%r5 # int - llgtr %r6,%r6 # void * - jg sys32_ipc # branch to system call - - .globl sys32_fsync_wrapper -sys32_fsync_wrapper: - llgfr %r2,%r2 # unsigned int - jg sys_fsync # branch to system call - -#sys32_sigreturn_wrapper # done in sigreturn_glue - -#sys32_clone_wrapper # done in clone_glue - - .globl sys32_setdomainname_wrapper -sys32_setdomainname_wrapper: - llgtr %r2,%r2 # char * - lgfr %r3,%r3 # int - jg sys_setdomainname # branch to system call - - .globl sys32_newuname_wrapper -sys32_newuname_wrapper: - llgtr %r2,%r2 # struct new_utsname * - jg s390x_newuname # branch to system call - - .globl sys32_adjtimex_wrapper -sys32_adjtimex_wrapper: - llgtr %r2,%r2 # struct timex_emu31 * - jg sys32_adjtimex # branch to system call - - .globl sys32_mprotect_wrapper -sys32_mprotect_wrapper: - llgtr %r2,%r2 # unsigned long (actually pointer - llgfr %r3,%r3 # size_t - llgfr %r4,%r4 # unsigned long - jg sys_mprotect # branch to system call - - .globl compat_sys_sigprocmask_wrapper -compat_sys_sigprocmask_wrapper: - lgfr %r2,%r2 # int - llgtr %r3,%r3 # compat_old_sigset_t * - llgtr %r4,%r4 # compat_old_sigset_t * - jg compat_sys_sigprocmask # branch to system call - - .globl sys32_init_module_wrapper -sys32_init_module_wrapper: - llgtr %r2,%r2 # const char * - llgtr %r3,%r3 # struct module * - jg sys32_init_module # branch to system call - - .globl sys32_delete_module_wrapper -sys32_delete_module_wrapper: - llgtr %r2,%r2 # const char * - jg sys32_delete_module # branch to system call - - .globl sys32_quotactl_wrapper -sys32_quotactl_wrapper: - lgfr %r2,%r2 # int - llgtr %r3,%r3 # const char * - lgfr %r4,%r4 # int - llgtr %r5,%r5 # caddr_t - jg sys_quotactl # branch to system call - - .globl sys32_getpgid_wrapper -sys32_getpgid_wrapper: - lgfr %r2,%r2 # pid_t - jg sys_getpgid # branch to system call - - .globl sys32_fchdir_wrapper -sys32_fchdir_wrapper: - llgfr %r2,%r2 # unsigned int - jg sys_fchdir # branch to system call - - .globl sys32_bdflush_wrapper -sys32_bdflush_wrapper: - lgfr %r2,%r2 # int - lgfr %r3,%r3 # long - jg sys_bdflush # branch to system call - - .globl sys32_sysfs_wrapper -sys32_sysfs_wrapper: - lgfr %r2,%r2 # int - llgfr %r3,%r3 # unsigned long - llgfr %r4,%r4 # unsigned long - jg sys_sysfs # branch to system call - - .globl sys32_personality_wrapper -sys32_personality_wrapper: - llgfr %r2,%r2 # unsigned long - jg s390x_personality # branch to system call - - .globl sys32_setfsuid16_wrapper -sys32_setfsuid16_wrapper: - llgfr %r2,%r2 # __kernel_old_uid_emu31_t - jg sys32_setfsuid16 # branch to system call - - .globl sys32_setfsgid16_wrapper -sys32_setfsgid16_wrapper: - llgfr %r2,%r2 # __kernel_old_gid_emu31_t - jg sys32_setfsgid16 # branch to system call - - .globl sys32_llseek_wrapper -sys32_llseek_wrapper: - llgfr %r2,%r2 # unsigned int - llgfr %r3,%r3 # unsigned long - llgfr %r4,%r4 # unsigned long - llgtr %r5,%r5 # loff_t * - llgfr %r6,%r6 # unsigned int - jg sys_llseek # branch to system call - - .globl sys32_getdents_wrapper -sys32_getdents_wrapper: - llgfr %r2,%r2 # unsigned int - llgtr %r3,%r3 # void * - llgfr %r4,%r4 # unsigned int - jg sys32_getdents # branch to system call - - .globl sys32_select_wrapper -sys32_select_wrapper: - lgfr %r2,%r2 # int - llgtr %r3,%r3 # fd_set * - llgtr %r4,%r4 # fd_set * - llgtr %r5,%r5 # fd_set * - llgtr %r6,%r6 # struct timeval_emu31 * - jg sys32_select # branch to system call - - .globl sys32_flock_wrapper -sys32_flock_wrapper: - llgfr %r2,%r2 # unsigned int - llgfr %r3,%r3 # unsigned int - jg sys_flock # branch to system call - - .globl sys32_msync_wrapper -sys32_msync_wrapper: - llgfr %r2,%r2 # unsigned long - llgfr %r3,%r3 # size_t - lgfr %r4,%r4 # int - jg sys_msync # branch to system call - - .globl sys32_readv_wrapper -sys32_readv_wrapper: - llgfr %r2,%r2 # unsigned long - llgtr %r3,%r3 # const struct iovec_emu31 * - llgfr %r4,%r4 # unsigned long - jg sys32_readv # branch to system call - - .globl sys32_writev_wrapper -sys32_writev_wrapper: - llgfr %r2,%r2 # unsigned long - llgtr %r3,%r3 # const struct iovec_emu31 * - llgfr %r4,%r4 # unsigned long - jg sys32_writev # branch to system call - - .globl sys32_getsid_wrapper -sys32_getsid_wrapper: - lgfr %r2,%r2 # pid_t - jg sys_getsid # branch to system call - - .globl sys32_fdatasync_wrapper -sys32_fdatasync_wrapper: - llgfr %r2,%r2 # unsigned int - jg sys_fdatasync # branch to system call - -#sys32_sysctl_wrapper # tbd - - .globl sys32_mlock_wrapper -sys32_mlock_wrapper: - llgfr %r2,%r2 # unsigned long - llgfr %r3,%r3 # size_t - jg sys_mlock # branch to system call - - .globl sys32_munlock_wrapper -sys32_munlock_wrapper: - llgfr %r2,%r2 # unsigned long - llgfr %r3,%r3 # size_t - jg sys_munlock # branch to system call - - .globl sys32_mlockall_wrapper -sys32_mlockall_wrapper: - lgfr %r2,%r2 # int - jg sys_mlockall # branch to system call - -#sys32_munlockall_wrapper # void - - .globl sys32_sched_setparam_wrapper -sys32_sched_setparam_wrapper: - lgfr %r2,%r2 # pid_t - llgtr %r3,%r3 # struct sched_param * - jg sys_sched_setparam # branch to system call - - .globl sys32_sched_getparam_wrapper -sys32_sched_getparam_wrapper: - lgfr %r2,%r2 # pid_t - llgtr %r3,%r3 # struct sched_param * - jg sys_sched_getparam # branch to system call - - .globl sys32_sched_setscheduler_wrapper -sys32_sched_setscheduler_wrapper: - lgfr %r2,%r2 # pid_t - lgfr %r3,%r3 # int - llgtr %r4,%r4 # struct sched_param * - jg sys_sched_setscheduler # branch to system call - - .globl sys32_sched_getscheduler_wrapper -sys32_sched_getscheduler_wrapper: - lgfr %r2,%r2 # pid_t - jg sys_sched_getscheduler # branch to system call - -#sys32_sched_yield_wrapper # void - - .globl sys32_sched_get_priority_max_wrapper -sys32_sched_get_priority_max_wrapper: - lgfr %r2,%r2 # int - jg sys_sched_get_priority_max # branch to system call - - .globl sys32_sched_get_priority_min_wrapper -sys32_sched_get_priority_min_wrapper: - lgfr %r2,%r2 # int - jg sys_sched_get_priority_min # branch to system call - - .globl sys32_sched_rr_get_interval_wrapper -sys32_sched_rr_get_interval_wrapper: - lgfr %r2,%r2 # pid_t - llgtr %r3,%r3 # struct compat_timespec * - jg sys32_sched_rr_get_interval # branch to system call - - .globl compat_sys_nanosleep_wrapper -compat_sys_nanosleep_wrapper: - llgtr %r2,%r2 # struct compat_timespec * - llgtr %r3,%r3 # struct compat_timespec * - jg compat_sys_nanosleep # branch to system call - - .globl sys32_mremap_wrapper -sys32_mremap_wrapper: - llgfr %r2,%r2 # unsigned long - llgfr %r3,%r3 # unsigned long - llgfr %r4,%r4 # unsigned long - llgfr %r5,%r5 # unsigned long - llgfr %r6,%r6 # unsigned long - jg sys_mremap # branch to system call - - .globl sys32_setresuid16_wrapper -sys32_setresuid16_wrapper: - llgfr %r2,%r2 # __kernel_old_uid_emu31_t - llgfr %r3,%r3 # __kernel_old_uid_emu31_t - llgfr %r4,%r4 # __kernel_old_uid_emu31_t - jg sys32_setresuid16 # branch to system call - - .globl sys32_getresuid16_wrapper -sys32_getresuid16_wrapper: - llgtr %r2,%r2 # __kernel_old_uid_emu31_t * - llgtr %r3,%r3 # __kernel_old_uid_emu31_t * - llgtr %r4,%r4 # __kernel_old_uid_emu31_t * - jg sys32_getresuid16 # branch to system call - - .globl sys32_poll_wrapper -sys32_poll_wrapper: - llgtr %r2,%r2 # struct pollfd * - llgfr %r3,%r3 # unsigned int - lgfr %r4,%r4 # long - jg sys_poll # branch to system call - - .globl sys32_nfsservctl_wrapper -sys32_nfsservctl_wrapper: - lgfr %r2,%r2 # int - llgtr %r3,%r3 # struct nfsctl_arg_emu31 * - llgtr %r4,%r4 # union nfsctl_res_emu31 * - jg sys32_nfsservctl # branch to system call - - .globl sys32_setresgid16_wrapper -sys32_setresgid16_wrapper: - llgfr %r2,%r2 # __kernel_old_gid_emu31_t - llgfr %r3,%r3 # __kernel_old_gid_emu31_t - llgfr %r4,%r4 # __kernel_old_gid_emu31_t - jg sys32_setresgid16 # branch to system call - - .globl sys32_getresgid16_wrapper -sys32_getresgid16_wrapper: - llgtr %r2,%r2 # __kernel_old_gid_emu31_t * - llgtr %r3,%r3 # __kernel_old_gid_emu31_t * - llgtr %r4,%r4 # __kernel_old_gid_emu31_t * - jg sys32_getresgid16 # branch to system call - - .globl sys32_prctl_wrapper -sys32_prctl_wrapper: - lgfr %r2,%r2 # int - llgfr %r3,%r3 # unsigned long - llgfr %r4,%r4 # unsigned long - llgfr %r5,%r5 # unsigned long - llgfr %r6,%r6 # unsigned long - jg sys_prctl # branch to system call - -#sys32_rt_sigreturn_wrapper # done in rt_sigreturn_glue - - .globl sys32_rt_sigaction_wrapper -sys32_rt_sigaction_wrapper: - lgfr %r2,%r2 # int - llgtr %r3,%r3 # const struct sigaction_emu31 * - llgtr %r4,%r4 # const struct sigaction_emu31 * - llgfr %r5,%r5 # size_t - jg sys32_rt_sigaction # branch to system call - - .globl sys32_rt_sigprocmask_wrapper -sys32_rt_sigprocmask_wrapper: - lgfr %r2,%r2 # int - llgtr %r3,%r3 # old_sigset_emu31 * - llgtr %r4,%r4 # old_sigset_emu31 * - jg sys32_rt_sigprocmask # branch to system call - - .globl sys32_rt_sigpending_wrapper -sys32_rt_sigpending_wrapper: - llgtr %r2,%r2 # sigset_emu31 * - llgfr %r3,%r3 # size_t - jg sys32_rt_sigpending # branch to system call - - .globl sys32_rt_sigtimedwait_wrapper -sys32_rt_sigtimedwait_wrapper: - llgtr %r2,%r2 # const sigset_emu31_t * - llgtr %r3,%r3 # siginfo_emu31_t * - llgtr %r4,%r4 # const struct compat_timespec * - llgfr %r5,%r5 # size_t - jg sys32_rt_sigtimedwait # branch to system call - - .globl sys32_rt_sigqueueinfo_wrapper -sys32_rt_sigqueueinfo_wrapper: - lgfr %r2,%r2 # int - lgfr %r3,%r3 # int - llgtr %r4,%r4 # siginfo_emu31_t * - jg sys32_rt_sigqueueinfo # branch to system call - -#sys32_rt_sigsuspend_wrapper # done in rt_sigsuspend_glue - - .globl sys32_pread64_wrapper -sys32_pread64_wrapper: - llgfr %r2,%r2 # unsigned int - llgtr %r3,%r3 # char * - llgfr %r4,%r4 # size_t - llgfr %r5,%r5 # u32 - llgfr %r6,%r6 # u32 - jg sys32_pread64 # branch to system call - - .globl sys32_pwrite64_wrapper -sys32_pwrite64_wrapper: - llgfr %r2,%r2 # unsigned int - llgtr %r3,%r3 # const char * - llgfr %r4,%r4 # size_t - llgfr %r5,%r5 # u32 - llgfr %r6,%r6 # u32 - jg sys32_pwrite64 # branch to system call - - .globl sys32_chown16_wrapper -sys32_chown16_wrapper: - llgtr %r2,%r2 # const char * - llgfr %r3,%r3 # __kernel_old_uid_emu31_t - llgfr %r4,%r4 # __kernel_old_gid_emu31_t - jg sys32_chown16 # branch to system call - - .globl sys32_getcwd_wrapper -sys32_getcwd_wrapper: - llgtr %r2,%r2 # char * - llgfr %r3,%r3 # unsigned long - jg sys_getcwd # branch to system call - - .globl sys32_capget_wrapper -sys32_capget_wrapper: - llgtr %r2,%r2 # cap_user_header_t - llgtr %r3,%r3 # cap_user_data_t - jg sys_capget # branch to system call - - .globl sys32_capset_wrapper -sys32_capset_wrapper: - llgtr %r2,%r2 # cap_user_header_t - llgtr %r3,%r3 # const cap_user_data_t - jg sys_capset # branch to system call - - .globl sys32_sigaltstack_wrapper -sys32_sigaltstack_wrapper: - llgtr %r2,%r2 # const stack_emu31_t * - llgtr %r3,%r3 # stack_emu31_t * - jg sys32_sigaltstack - - .globl sys32_sendfile_wrapper -sys32_sendfile_wrapper: - lgfr %r2,%r2 # int - lgfr %r3,%r3 # int - llgtr %r4,%r4 # __kernel_off_emu31_t * - llgfr %r5,%r5 # size_t - jg sys32_sendfile # branch to system call - -#sys32_vfork_wrapper # done in vfork_glue - - .globl sys32_truncate64_wrapper -sys32_truncate64_wrapper: - llgtr %r2,%r2 # const char * - lgfr %r3,%r3 # s32 - llgfr %r4,%r4 # u32 - jg sys32_truncate64 # branch to system call - - .globl sys32_ftruncate64_wrapper -sys32_ftruncate64_wrapper: - llgfr %r2,%r2 # unsigned int - lgfr %r3,%r3 # s32 - llgfr %r4,%r4 # u32 - jg sys32_ftruncate64 # branch to system call - - .globl sys32_lchown_wrapper -sys32_lchown_wrapper: - llgtr %r2,%r2 # const char * - llgfr %r3,%r3 # uid_t - llgfr %r4,%r4 # gid_t - jg sys_lchown # branch to system call - -#sys32_getuid_wrapper # void -#sys32_getgid_wrapper # void -#sys32_geteuid_wrapper # void -#sys32_getegid_wrapper # void - - .globl sys32_setreuid_wrapper -sys32_setreuid_wrapper: - llgfr %r2,%r2 # uid_t - llgfr %r3,%r3 # uid_t - jg sys_setreuid # branch to system call - - .globl sys32_setregid_wrapper -sys32_setregid_wrapper: - llgfr %r2,%r2 # gid_t - llgfr %r3,%r3 # gid_t - jg sys_setregid # branch to system call - - .globl sys32_getgroups_wrapper -sys32_getgroups_wrapper: - lgfr %r2,%r2 # int - llgtr %r3,%r3 # gid_t * - jg sys_getgroups # branch to system call - - .globl sys32_setgroups_wrapper -sys32_setgroups_wrapper: - lgfr %r2,%r2 # int - llgtr %r3,%r3 # gid_t * - jg sys_setgroups # branch to system call - - .globl sys32_fchown_wrapper -sys32_fchown_wrapper: - llgfr %r2,%r2 # unsigned int - llgfr %r3,%r3 # uid_t - llgfr %r4,%r4 # gid_t - jg sys_fchown # branch to system call - - .globl sys32_setresuid_wrapper -sys32_setresuid_wrapper: - llgfr %r2,%r2 # uid_t - llgfr %r3,%r3 # uid_t - llgfr %r4,%r4 # uid_t - jg sys_setresuid # branch to system call - - .globl sys32_getresuid_wrapper -sys32_getresuid_wrapper: - llgtr %r2,%r2 # uid_t * - llgtr %r3,%r3 # uid_t * - llgtr %r4,%r4 # uid_t * - jg sys_getresuid # branch to system call - - .globl sys32_setresgid_wrapper -sys32_setresgid_wrapper: - llgfr %r2,%r2 # gid_t - llgfr %r3,%r3 # gid_t - llgfr %r4,%r4 # gid_t - jg sys_setresgid # branch to system call - - .globl sys32_getresgid_wrapper -sys32_getresgid_wrapper: - llgtr %r2,%r2 # gid_t * - llgtr %r3,%r3 # gid_t * - llgtr %r4,%r4 # gid_t * - jg sys_getresgid # branch to system call - - .globl sys32_chown_wrapper -sys32_chown_wrapper: - llgtr %r2,%r2 # const char * - llgfr %r3,%r3 # uid_t - llgfr %r4,%r4 # gid_t - jg sys_chown # branch to system call - - .globl sys32_setuid_wrapper -sys32_setuid_wrapper: - llgfr %r2,%r2 # uid_t - jg sys_setuid # branch to system call - - .globl sys32_setgid_wrapper -sys32_setgid_wrapper: - llgfr %r2,%r2 # gid_t - jg sys_setgid # branch to system call - - .globl sys32_setfsuid_wrapper -sys32_setfsuid_wrapper: - llgfr %r2,%r2 # uid_t - jg sys_setfsuid # branch to system call - - .globl sys32_setfsgid_wrapper -sys32_setfsgid_wrapper: - llgfr %r2,%r2 # gid_t - jg sys_setfsgid # branch to system call - - .globl sys32_pivot_root_wrapper -sys32_pivot_root_wrapper: - llgtr %r2,%r2 # const char * - llgtr %r3,%r3 # const char * - jg sys_pivot_root # branch to system call - - .globl sys32_mincore_wrapper -sys32_mincore_wrapper: - llgfr %r2,%r2 # unsigned long - llgfr %r3,%r3 # size_t - llgtr %r4,%r4 # unsigned char * - jg sys_mincore # branch to system call - - .globl sys32_madvise_wrapper -sys32_madvise_wrapper: - llgfr %r2,%r2 # unsigned long - llgfr %r3,%r3 # size_t - lgfr %r4,%r4 # int - jg sys_madvise # branch to system call - - .globl sys32_getdents64_wrapper -sys32_getdents64_wrapper: - llgfr %r2,%r2 # unsigned int - llgtr %r3,%r3 # void * - llgfr %r4,%r4 # unsigned int - jg sys_getdents64 # branch to system call - - .globl compat_sys_fcntl64_wrapper -compat_sys_fcntl64_wrapper: - llgfr %r2,%r2 # unsigned int - llgfr %r3,%r3 # unsigned int - llgfr %r4,%r4 # unsigned long - jg compat_sys_fcntl64 # branch to system call - - .globl sys32_stat64_wrapper -sys32_stat64_wrapper: - llgtr %r2,%r2 # char * - llgtr %r3,%r3 # struct stat64 * - llgfr %r4,%r4 # long - jg sys32_stat64 # branch to system call - - .globl sys32_lstat64_wrapper -sys32_lstat64_wrapper: - llgtr %r2,%r2 # char * - llgtr %r3,%r3 # struct stat64 * - llgfr %r4,%r4 # long - jg sys32_lstat64 # branch to system call - - .globl sys32_stime_wrapper -sys32_stime_wrapper: - llgtr %r2,%r2 # int * - jg sys_stime # branch to system call - - .globl sys32_sysctl_wrapper -sys32_sysctl_wrapper: - llgtr %r2,%r2 # struct __sysctl_args32 * - jg sys32_sysctl - - .globl sys32_fstat64_wrapper -sys32_fstat64_wrapper: - llgfr %r2,%r2 # unsigned long - llgtr %r3,%r3 # struct stat64 * - llgfr %r4,%r4 # long - jg sys32_fstat64 # branch to system call - - .globl compat_sys_futex_wrapper -compat_sys_futex_wrapper: - llgtr %r2,%r2 # u32 * - lgfr %r3,%r3 # int - lgfr %r4,%r4 # int - llgtr %r5,%r5 # struct compat_timespec * - jg compat_sys_futex # branch to system call - - .globl sys32_setxattr_wrapper -sys32_setxattr_wrapper: - llgtr %r2,%r2 # char * - llgtr %r3,%r3 # char * - llgtr %r4,%r4 # void * - llgfr %r5,%r5 # size_t - lgfr %r6,%r6 # int - jg sys_setxattr - - .globl sys32_lsetxattr_wrapper -sys32_lsetxattr_wrapper: - llgtr %r2,%r2 # char * - llgtr %r3,%r3 # char * - llgtr %r4,%r4 # void * - llgfr %r5,%r5 # size_t - lgfr %r6,%r6 # int - jg sys_lsetxattr - - .globl sys32_fsetxattr_wrapper -sys32_fsetxattr_wrapper: - lgfr %r2,%r2 # int - llgtr %r3,%r3 # char * - llgtr %r4,%r4 # void * - llgfr %r5,%r5 # size_t - lgfr %r6,%r6 # int - jg sys_fsetxattr - - .globl sys32_getxattr_wrapper -sys32_getxattr_wrapper: - llgtr %r2,%r2 # char * - llgtr %r3,%r3 # char * - llgtr %r4,%r4 # void * - llgfr %r5,%r5 # size_t - jg sys_getxattr - - .globl sys32_lgetxattr_wrapper -sys32_lgetxattr_wrapper: - llgtr %r2,%r2 # char * - llgtr %r3,%r3 # char * - llgtr %r4,%r4 # void * - llgfr %r5,%r5 # size_t - jg sys_lgetxattr - - .globl sys32_fgetxattr_wrapper -sys32_fgetxattr_wrapper: - lgfr %r2,%r2 # int - llgtr %r3,%r3 # char * - llgtr %r4,%r4 # void * - llgfr %r5,%r5 # size_t - jg sys_fgetxattr - - .globl sys32_listxattr_wrapper -sys32_listxattr_wrapper: - llgtr %r2,%r2 # char * - llgtr %r3,%r3 # char * - llgfr %r4,%r4 # size_t - jg sys_listxattr - - .globl sys32_llistxattr_wrapper -sys32_llistxattr_wrapper: - llgtr %r2,%r2 # char * - llgtr %r3,%r3 # char * - llgfr %r4,%r4 # size_t - jg sys_llistxattr - - .globl sys32_flistxattr_wrapper -sys32_flistxattr_wrapper: - lgfr %r2,%r2 # int - llgtr %r3,%r3 # char * - llgfr %r4,%r4 # size_t - jg sys_flistxattr - - .globl sys32_removexattr_wrapper -sys32_removexattr_wrapper: - llgtr %r2,%r2 # char * - llgtr %r3,%r3 # char * - jg sys_removexattr - - .globl sys32_lremovexattr_wrapper -sys32_lremovexattr_wrapper: - llgtr %r2,%r2 # char * - llgtr %r3,%r3 # char * - jg sys_lremovexattr - - .globl sys32_fremovexattr_wrapper -sys32_fremovexattr_wrapper: - lgfr %r2,%r2 # int - llgtr %r3,%r3 # char * - jg sys_fremovexattr - - .globl sys32_sched_setaffinity_wrapper -sys32_sched_setaffinity_wrapper: - lgfr %r2,%r2 # int - llgfr %r3,%r3 # unsigned int - llgtr %r4,%r4 # unsigned long * - jg sys32_sched_setaffinity - - .globl sys32_sched_getaffinity_wrapper -sys32_sched_getaffinity_wrapper: - lgfr %r2,%r2 # int - llgfr %r3,%r3 # unsigned int - llgtr %r4,%r4 # unsigned long * - jg sys32_sched_getaffinity - - .globl sys32_exit_group_wrapper -sys32_exit_group_wrapper: - lgfr %r2,%r2 # int - jg sys_exit_group # branch to system call - - .globl sys32_set_tid_address_wrapper -sys32_set_tid_address_wrapper: - llgtr %r2,%r2 # int * - jg sys_set_tid_address # branch to system call diff --git a/arch/s390x/lib/Makefile b/arch/s390x/lib/Makefile deleted file mode 100644 index 1c43a04ee3ccd..0000000000000 --- a/arch/s390x/lib/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -# -# Makefile for s390-specific library files.. -# - -L_TARGET = lib.a - -EXTRA_AFLAGS := -traditional - -obj-y = delay.o memset.o strcmp.o strncpy.o uaccess.o diff --git a/arch/s390x/lib/delay.c b/arch/s390x/lib/delay.c deleted file mode 100644 index 68f744e06968c..0000000000000 --- a/arch/s390x/lib/delay.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - * arch/s390x/kernel/delay.c - * Precise Delay Loops for S390 - * - * S390 version - * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation - * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com), - * - * Derived from "arch/i386/lib/delay.c" - * Copyright (C) 1993 Linus Torvalds - * Copyright (C) 1997 Martin Mares - */ - -#include -#include -#include - -#ifdef CONFIG_SMP -#include -#endif - -void __delay(unsigned long loops) -{ - /* - * To end the bloody studid and useless discussion about the - * BogoMips number I took the liberty to define the __delay - * function in a way that that resulting BogoMips number will - * yield the megahertz number of the cpu. The important function - * is udelay and that is done using the tod clock. -- martin. - */ - __asm__ __volatile__( - "0: brct %0,0b" - : /* no outputs */ : "r" (loops/2) ); -} - -/* - * Waits for 'usecs' microseconds using the tod clock - */ -void __udelay(unsigned long usecs) -{ - uint64_t start_cc, end_cc; - - if (usecs == 0) - return; - asm volatile ("STCK %0" : "=m" (start_cc)); - do { - asm volatile ("STCK %0" : "=m" (end_cc)); - } while (((end_cc - start_cc)/4096) < usecs); -} - diff --git a/arch/s390x/lib/memset.S b/arch/s390x/lib/memset.S deleted file mode 100644 index 1e4b035d26e4e..0000000000000 --- a/arch/s390x/lib/memset.S +++ /dev/null @@ -1,30 +0,0 @@ -/* - * arch/s390/lib/memset.S - * S390 fast memset routine - * - * S390 version - * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation - * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com), - */ - -/* - * R2 = address to memory area - * R3 = byte to fill memory with - * R4 = number of bytes to fill - */ - .globl memset -memset: - LTGR 4,4 - JZ memset_end - LGR 0,2 # save pointer to memory area - LGR 1,3 # move pad byte to R1 - LGR 3,4 - SGR 4,4 # no source for MVCLE, only a pad byte - SGR 5,5 - MVCLE 2,4,0(1) # thats it, MVCLE is your friend - JO .-4 - LGR 2,0 # return pointer to mem. -memset_end: - BR 14 - - diff --git a/arch/s390x/lib/strcmp.S b/arch/s390x/lib/strcmp.S deleted file mode 100644 index 124f3df26d603..0000000000000 --- a/arch/s390x/lib/strcmp.S +++ /dev/null @@ -1,27 +0,0 @@ -/* - * arch/s390/lib/strcmp.S - * S390 strcmp routine - * - * S390 version - * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation - * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com), - */ - -/* - * R2 = address of compare string - * R3 = address of test string - */ - .globl strcmp -strcmp: - SGR 0,0 - SGR 1,1 - CLST 2,3 - JO .-4 - JE strcmp_equal - IC 0,0(3) - IC 1,0(2) - SGR 1,0 -strcmp_equal: - LGR 2,1 - BR 14 - diff --git a/arch/s390x/lib/strncpy.S b/arch/s390x/lib/strncpy.S deleted file mode 100644 index 0360a38c3951c..0000000000000 --- a/arch/s390x/lib/strncpy.S +++ /dev/null @@ -1,30 +0,0 @@ -/* - * arch/s390/kernel/strncpy.S - * S390 strncpy routine - * - * S390 version - * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation - * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com), - */ - -/* - * R2 = address of destination - * R3 = address of source string - * R4 = max number of bytes to copy - */ - .globl strncpy -strncpy: - LGR 1,2 # don't touch address in R2 - LTR 4,4 - JZ strncpy_exit # 0 bytes -> nothing to do - SGR 0,0 -strncpy_loop: - ICM 0,1,0(3) # ICM sets the cc, IC does not - LA 3,1(3) - STC 0,0(1) - LA 1,1(1) - JZ strncpy_exit # ICM inserted a 0x00 - BRCTG 4,strncpy_loop # R4 -= 1, jump to strncpy_loop if > 0 -strncpy_exit: - BR 14 - diff --git a/arch/s390x/lib/uaccess.S b/arch/s390x/lib/uaccess.S deleted file mode 100644 index 7e90f205b3326..0000000000000 --- a/arch/s390x/lib/uaccess.S +++ /dev/null @@ -1,107 +0,0 @@ -/* - * arch/s390x/lib/uaccess.S - * __copy_{from|to}_user functions. - * - * s390 - * Copyright (C) 2000,2002 IBM Deutschland Entwicklung GmbH, IBM Corporation - * Authors(s): Martin Schwidefsky (schwidefsky@de.ibm.com) - * - * These functions have standard call interface - */ - -#include - - .text - .align 4 - .globl __copy_from_user_asm -__copy_from_user_asm: - lgr %r5,%r3 - sacf 512 -0: mvcle %r2,%r4,0 - jo 0b -1: sacf 0 - lgr %r2,%r5 - br %r14 -2: lghi %r1,-4096 - lgr %r3,%r4 - slgr %r3,%r1 # %r3 = %r4 + 4096 - ngr %r3,%r1 # %r3 = (%r4 + 4096) & -4096 - slgr %r3,%r4 # %r3 = #bytes to next user page boundary - clgr %r5,%r3 # copy crosses next page boundary ? - jnh 1b # no, this page fauled - # The page after the current user page might have faulted. - # We cant't find out which page because the program check handler - # might have callled schedule, destroying all lowcore information. - # We retry with the shortened length. -3: mvcle %r2,%r4,0 - jo 3b - j 1b - .section __ex_table,"a" - .quad 0b,2b - .quad 3b,1b - .previous - - .align 4 - .text - .globl __copy_to_user_asm -__copy_to_user_asm: - lgr %r5,%r3 - sacf 512 -0: mvcle %r4,%r2,0 - jo 0b -1: sacf 0 - lgr %r2,%r3 - br %r14 -2: lghi %r1,-4096 - lgr %r5,%r4 - slgr %r5,%r1 # %r5 = %r4 + 4096 - ngr %r5,%r1 # %r5 = (%r4 + 4096) & -4096 - slgr %r5,%r4 # %r5 = #bytes to next user page boundary - clgr %r3,%r5 # copy crosses next page boundary ? - jnh 1b # no, the current page fauled - # The page after the current user page might have faulted. - # We cant't find out which page because the program check handler - # might have callled schedule, destroying all lowcore information. - # We retry with the shortened length. -3: mvcle %r4,%r2,0 - jo 3b - j 1b - .section __ex_table,"a" - .quad 0b,2b - .quad 3b,1b - .previous - - .align 4 - .text - .globl __clear_user_asm -__clear_user_asm: - lgr %r4,%r2 - lgr %r5,%r3 - sgr %r2,%r2 - sgr %r3,%r3 - sacf 512 -0: mvcle %r4,%r2,0 - jo 0b -1: sacf 0 - br %r14 -2: lgr %r2,%r5 - lghi %r1,-4096 - slgr %r5,%r1 # %r5 = %r4 + 4096 - ngr %r5,%r1 # %r5 = (%r4 + 4096) & -4096 - slgr %r5,%r4 # %r5 = #bytes to next user page boundary - clgr %r2,%r5 # copy crosses next page boundary ? - jnh 1b # no, the current page fauled - # The page after the current user page might have faulted. - # We cant't find out which page because the program check handler - # might have callled schedule, destroying all lowcore information. - # We retry with the shortened length. - slgr %r2,%r5 -3: mvcle %r4,%r2,0 - jo 3b - j 1b -4: algr %r2,%r5 - j 1b - .section __ex_table,"a" - .quad 0b,2b - .quad 3b,4b - .previous diff --git a/arch/s390x/mm/Makefile b/arch/s390x/mm/Makefile deleted file mode 100644 index 2e0c10b51d84d..0000000000000 --- a/arch/s390x/mm/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -# -# Makefile for the linux s390-specific parts of the memory manager. -# - -obj-y := init.o fault.o ioremap.o extable.o diff --git a/arch/s390x/mm/extable.c b/arch/s390x/mm/extable.c deleted file mode 100644 index 8d13d710c6963..0000000000000 --- a/arch/s390x/mm/extable.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * arch/s390/mm/extable.c - * - * S390 version - * - * identical to arch/i386/mm/extable.c - */ - -#include -#include -#include -#include - -/* Simple binary search */ -const struct exception_table_entry * -search_extable(const struct exception_table_entry *first, - const struct exception_table_entry *last, - unsigned long value) -{ - while (first <= last) { - const struct exception_table_entry *mid; - long diff; - - mid = (last - first) / 2 + first; - diff = mid->insn - value; - if (diff == 0) - return mid; - else if (diff < 0) - first = mid+1; - else - last = mid-1; - } - return NULL; -} diff --git a/arch/s390x/mm/fault.c b/arch/s390x/mm/fault.c deleted file mode 100644 index 676b52fff3f0f..0000000000000 --- a/arch/s390x/mm/fault.c +++ /dev/null @@ -1,480 +0,0 @@ -/* - * arch/s390/mm/fault.c - * - * S390 version - * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation - * Author(s): Hartmut Penner (hp@de.ibm.com) - * Ulrich Weigand (uweigand@de.ibm.com) - * - * Derived from "arch/i386/mm/fault.c" - * Copyright (C) 1995 Linus Torvalds - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#ifdef CONFIG_SYSCTL -extern int sysctl_userprocess_debug; -#endif - -extern void die(const char *,struct pt_regs *,long); - -extern spinlock_t timerlist_lock; - -/* - * Unlock any spinlocks which will prevent us from getting the - * message out (timerlist_lock is acquired through the - * console unblank code) - */ -void bust_spinlocks(int yes) -{ - if (yes) { - oops_in_progress = 1; - } else { - int loglevel_save = console_loglevel; - oops_in_progress = 0; - console_unblank(); - /* - * OK, the message is on the console. Now we call printk() - * without oops_in_progress set so that printk will give klogd - * a poke. Hold onto your hats... - */ - console_loglevel = 15; - printk(" "); - console_loglevel = loglevel_save; - } -} - -/* - * Check which address space is addressed by the access - * register in S390_lowcore.exc_access_id. - * Returns 1 for user space and 0 for kernel space. - */ -static int __check_access_register(struct pt_regs *regs, int error_code) -{ - int areg = S390_lowcore.exc_access_id; - - if (areg == 0) - /* Access via access register 0 -> kernel address */ - return 0; - if (regs && areg < NUM_ACRS && regs->acrs[areg] <= 1) - /* - * access register contains 0 -> kernel address, - * access register contains 1 -> user space address - */ - return regs->acrs[areg]; - - /* Something unhealthy was done with the access registers... */ - die("page fault via unknown access register", regs, error_code); - do_exit(SIGKILL); - return 0; -} - -/* - * Check which address space the address belongs to. - * Returns 1 for user space and 0 for kernel space. - */ -static inline int check_user_space(struct pt_regs *regs, int error_code) -{ - /* - * The lowest two bits of S390_lowcore.trans_exc_code indicate - * which paging table was used: - * 0: Primary Segment Table Descriptor - * 1: STD determined via access register - * 2: Secondary Segment Table Descriptor - * 3: Home Segment Table Descriptor - */ - int descriptor = S390_lowcore.trans_exc_code & 3; - if (descriptor == 1) - return __check_access_register(regs, error_code); - return descriptor >> 1; -} - -/* - * Send SIGSEGV to task. This is an external routine - * to keep the stack usage of do_page_fault small. - */ -static void force_sigsegv(struct pt_regs *regs, unsigned long error_code, - int si_code, unsigned long address) -{ - struct siginfo si; - -#if defined(CONFIG_SYSCTL) || defined(CONFIG_PROCESS_DEBUG) -#if defined(CONFIG_SYSCTL) - if (sysctl_userprocess_debug) -#endif - { - printk("User process fault: interruption code 0x%lX\n", - error_code); - printk("failing address: %lX\n", address); - show_regs(regs); - } -#endif - si.si_signo = SIGSEGV; - si.si_code = si_code; - si.si_addr = (void *) address; - force_sig_info(SIGSEGV, &si, current); -} - -/* - * This routine handles page faults. It determines the address, - * and the problem, and then passes it off to one of the appropriate - * routines. - * - * error_code: - * 04 Protection -> Write-Protection (suprression) - * 10 Segment translation -> Not present (nullification) - * 11 Page translation -> Not present (nullification) - * 3b Region third trans. -> Not present (nullification) - */ -extern inline void do_exception(struct pt_regs *regs, unsigned long error_code) -{ - struct task_struct *tsk; - struct mm_struct *mm; - struct vm_area_struct * vma; - unsigned long address; - int user_address; - const struct exception_table_entry *fixup; - int si_code = SEGV_MAPERR; - - tsk = current; - mm = tsk->mm; - - /* - * Check for low-address protection. This needs to be treated - * as a special case because the translation exception code - * field is not guaranteed to contain valid data in this case. - */ - if (error_code == 4 && !(S390_lowcore.trans_exc_code & 4)) { - - /* Low-address protection hit in kernel mode means - NULL pointer write access in kernel mode. */ - if (!(regs->psw.mask & PSW_MASK_PSTATE)) { - address = 0; - user_address = 0; - goto no_context; - } - - /* Low-address protection hit in user mode 'cannot happen'. */ - die ("Low-address protection", regs, error_code); - do_exit(SIGKILL); - } - - /* - * get the failing address - * more specific the segment and page table portion of - * the address - */ - address = S390_lowcore.trans_exc_code & -4096L; - user_address = check_user_space(regs, error_code); - - /* - * Verify that the fault happened in user space, that - * we are not in an interrupt and that there is a - * user context. - */ - if (user_address == 0 || in_interrupt() || !mm) - goto no_context; - - /* - * When we get here, the fault happened in the current - * task's user address space, so we can switch on the - * interrupts again and then search the VMAs - */ - local_irq_enable(); - - down_read(&mm->mmap_sem); - - vma = find_vma(mm, address); - if (!vma) - goto bad_area; - if (vma->vm_start <= address) - goto good_area; - if (!(vma->vm_flags & VM_GROWSDOWN)) - goto bad_area; - if (expand_stack(vma, address)) - goto bad_area; -/* - * Ok, we have a good vm_area for this memory access, so - * we can handle it.. - */ -good_area: - si_code = SEGV_ACCERR; - if (error_code != 4) { - /* page not present, check vm flags */ - if (!(vma->vm_flags & (VM_READ | VM_EXEC | VM_WRITE))) - goto bad_area; - } else { - if (!(vma->vm_flags & VM_WRITE)) - goto bad_area; - } - -survive: - /* - * If for any reason at all we couldn't handle the fault, - * make sure we exit gracefully rather than endlessly redo - * the fault. - */ - switch (handle_mm_fault(mm, vma, address, error_code == 4)) { - case VM_FAULT_MINOR: - tsk->min_flt++; - break; - case VM_FAULT_MAJOR: - tsk->maj_flt++; - break; - case VM_FAULT_SIGBUS: - goto do_sigbus; - case VM_FAULT_OOM: - goto out_of_memory; - default: - BUG(); - } - - up_read(&mm->mmap_sem); - return; - -/* - * Something tried to access memory that isn't in our memory map.. - * Fix it, but check if it's kernel or user first.. - */ -bad_area: - up_read(&mm->mmap_sem); - - /* User mode accesses just cause a SIGSEGV */ - if (regs->psw.mask & PSW_MASK_PSTATE) { - tsk->thread.prot_addr = address; - tsk->thread.trap_no = error_code; - force_sigsegv(regs, error_code, si_code, address); - return; - } - -no_context: - /* Are we prepared to handle this kernel fault? */ - fixup = search_exception_tables(regs->psw.addr); - if (fixup) { - regs->psw.addr = fixup->fixup; - return; - } - -/* - * Oops. The kernel tried to access some bad page. We'll have to - * terminate things with extreme prejudice. - */ - if (user_address == 0) - printk(KERN_ALERT "Unable to handle kernel pointer dereference" - " at virtual kernel address %016lx\n", address); - else - printk(KERN_ALERT "Unable to handle kernel paging request" - " at virtual user address %016lx\n", address); - - die("Oops", regs, error_code); - do_exit(SIGKILL); - - -/* - * We ran out of memory, or some other thing happened to us that made - * us unable to handle the page fault gracefully. -*/ -out_of_memory: - up_read(&mm->mmap_sem); - if (tsk->pid == 1) { - yield(); - goto survive; - } - printk("VM: killing process %s\n", tsk->comm); - if (regs->psw.mask & PSW_MASK_PSTATE) - do_exit(SIGKILL); - goto no_context; - -do_sigbus: - up_read(&mm->mmap_sem); - - /* - * Send a sigbus, regardless of whether we were in kernel - * or user mode. - */ - tsk->thread.prot_addr = address; - tsk->thread.trap_no = error_code; - force_sig(SIGBUS, tsk); - - /* Kernel mode? Handle exceptions or die */ - if (!(regs->psw.mask & PSW_MASK_PSTATE)) - goto no_context; -} - -void do_protection_exception(struct pt_regs *regs, unsigned long error_code) -{ - regs->psw.addr -= (error_code >> 16); - do_exception(regs, 4); -} - -void do_segment_exception(struct pt_regs *regs, unsigned long error_code) -{ - do_exception(regs, 0x10); -} - -void do_page_exception(struct pt_regs *regs, unsigned long error_code) -{ - do_exception(regs, 0x11); -} - -void do_region_exception(struct pt_regs *regs, unsigned long error_code) -{ - do_exception(regs, 0x3b); -} - -#ifdef CONFIG_PFAULT -/* - * 'pfault' pseudo page faults routines. - */ -static int pfault_disable = 0; - -static int __init nopfault(char *str) -{ - pfault_disable = 1; - return 1; -} - -__setup("nopfault", nopfault); - -typedef struct { - __u16 refdiagc; - __u16 reffcode; - __u16 refdwlen; - __u16 refversn; - __u64 refgaddr; - __u64 refselmk; - __u64 refcmpmk; - __u64 reserved; -} __attribute__ ((packed)) pfault_refbk_t; - -typedef struct _pseudo_wait_t { - struct _pseudo_wait_t *next; - wait_queue_head_t queue; - unsigned long address; - int resolved; -} pseudo_wait_t; - -int pfault_init(void) -{ - pfault_refbk_t refbk = - { 0x258, 0, 5, 2, __LC_KERNEL_STACK, 1ULL << 48, 1ULL << 48, - 0x8000000000000000ULL }; - int rc; - - if (pfault_disable) - return -1; - __asm__ __volatile__( - " diag %1,%0,0x258\n" - "0: j 2f\n" - "1: la %0,8\n" - "2:\n" - ".section __ex_table,\"a\"\n" - " .align 4\n" - " .quad 0b,1b\n" - ".previous" - : "=d" (rc) : "a" (&refbk) : "cc" ); - __ctl_set_bit(0, 9); - return rc; -} - -void pfault_fini(void) -{ - pfault_refbk_t refbk = - { 0x258, 1, 5, 2, 0ULL, 0ULL, 0ULL, 0ULL }; - - if (pfault_disable) - return; - __ctl_clear_bit(0, 9); - __asm__ __volatile__( - " diag %0,0,0x258\n" - "0:\n" - ".section __ex_table,\"a\"\n" - " .align 4\n" - " .quad 0b,0b\n" - ".previous" - : : "a" (&refbk) : "cc" ); -} - -asmlinkage void -pfault_interrupt(struct pt_regs *regs, __u16 error_code) -{ - struct task_struct *tsk; - wait_queue_head_t queue; - wait_queue_head_t *qp; - __u16 subcode; - - /* - * Get the external interruption subcode & pfault - * initial/completion signal bit. VM stores this - * in the 'cpu address' field associated with the - * external interrupt. - */ - subcode = S390_lowcore.cpu_addr; - if ((subcode & 0xff00) != 0x0600) - return; - - /* - * Get the token (= address of kernel stack of affected task). - */ - tsk = (struct task_struct *) - (*((unsigned long *) __LC_PFAULT_INTPARM) - THREAD_SIZE); - - /* - * We got all needed information from the lowcore and can - * now safely switch on interrupts. - */ - if (regs->psw.mask & PSW_MASK_PSTATE) - local_irq_enable(); - - if (subcode & 0x0080) { - /* signal bit is set -> a page has been swapped in by VM */ - qp = (wait_queue_head_t *) - xchg(&tsk->thread.pfault_wait, -1); - if (qp != NULL) { - /* Initial interrupt was faster than the completion - * interrupt. pfault_wait is valid. Set pfault_wait - * back to zero and wake up the process. This can - * safely be done because the task is still sleeping - * and can't procude new pfaults. */ - tsk->thread.pfault_wait = 0ULL; - wake_up(qp); - } - } else { - /* signal bit not set -> a real page is missing. */ - init_waitqueue_head (&queue); - qp = (wait_queue_head_t *) - xchg(&tsk->thread.pfault_wait, (addr_t) &queue); - if (qp != NULL) { - /* Completion interrupt was faster than the initial - * interrupt (swapped in a -1 for pfault_wait). Set - * pfault_wait back to zero and exit. This can be - * done safely because tsk is running in kernel - * mode and can't produce new pfaults. */ - tsk->thread.pfault_wait = 0ULL; - } - - /* go to sleep */ - wait_event(queue, tsk->thread.pfault_wait == 0ULL); - } -} -#endif - diff --git a/arch/s390x/mm/init.c b/arch/s390x/mm/init.c deleted file mode 100644 index 374365a92e903..0000000000000 --- a/arch/s390x/mm/init.c +++ /dev/null @@ -1,238 +0,0 @@ -/* - * arch/s390/mm/init.c - * - * S390 version - * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation - * Author(s): Hartmut Penner (hpenner@de.ibm.com) - * - * Derived from "arch/i386/mm/init.c" - * Copyright (C) 1995 Linus Torvalds - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef CONFIG_BLK_DEV_INITRD -#include -#endif -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -struct mmu_gather mmu_gathers[NR_CPUS]; - -pgd_t swapper_pg_dir[PTRS_PER_PGD] __attribute__((__aligned__(PAGE_SIZE))); -char empty_zero_page[PAGE_SIZE] __attribute__((__aligned__(PAGE_SIZE))); - -void show_mem(void) -{ - int i, total = 0,reserved = 0; - int shared = 0, cached = 0; - - printk("Mem-info:\n"); - show_free_areas(); - printk("Free swap: %6dkB\n",nr_swap_pages<<(PAGE_SHIFT-10)); - i = max_mapnr; - while (i-- > 0) { - total++; - if (PageReserved(mem_map+i)) - reserved++; - else if (PageSwapCache(mem_map+i)) - cached++; - else if (page_count(mem_map+i)) - shared += atomic_read(&mem_map[i].count) - 1; - } - printk("%d pages of RAM\n",total); - printk("%d reserved pages\n",reserved); - printk("%d pages shared\n",shared); - printk("%d pages swap cached\n",cached); -} - -/* References to section boundaries */ - -extern unsigned long _text; -extern unsigned long _etext; -extern unsigned long _edata; -extern unsigned long __bss_start; -extern unsigned long _end; - -extern unsigned long __init_begin; -extern unsigned long __init_end; - -/* - * paging_init() sets up the page tables - */ - -unsigned long last_valid_pfn; - -void __init paging_init(void) -{ - pgd_t * pg_dir; - pmd_t * pm_dir; - pte_t * pt_dir; - pte_t pte; - int i,j,k; - unsigned long pfn = 0; - unsigned long pgdir_k = (__pa(swapper_pg_dir) & PAGE_MASK) | - _KERN_REGION_TABLE; - static const int ssm_mask = 0x04000000L; - - unsigned long zones_size[MAX_NR_ZONES] = {0, 0, 0}; - unsigned long dma_pfn, high_pfn; - - dma_pfn = MAX_DMA_ADDRESS >> PAGE_SHIFT; - high_pfn = max_low_pfn; - - if (dma_pfn > high_pfn) - zones_size[ZONE_DMA] = high_pfn; - else { - zones_size[ZONE_DMA] = dma_pfn; - zones_size[ZONE_NORMAL] = high_pfn - dma_pfn; - } - - /* Initialize mem_map[]. */ - free_area_init(zones_size); - - - /* - * map whole physical memory to virtual memory (identity mapping) - */ - - pg_dir = swapper_pg_dir; - - for (i = 0 ; i < PTRS_PER_PGD ; i++,pg_dir++) { - - if (pfn >= max_low_pfn) { - pgd_clear(pg_dir); - continue; - } - - pm_dir = (pmd_t *) alloc_bootmem_low_pages(PAGE_SIZE*4); - pgd_populate(&init_mm, pg_dir, pm_dir); - - for (j = 0 ; j < PTRS_PER_PMD ; j++,pm_dir++) { - if (pfn >= max_low_pfn) { - pmd_clear(pm_dir); - continue; - } - - pt_dir = (pte_t *) alloc_bootmem_low_pages(PAGE_SIZE); - pmd_populate_kernel(&init_mm, pm_dir, pt_dir); - - for (k = 0 ; k < PTRS_PER_PTE ; k++,pt_dir++) { - pte = pfn_pte(pfn, PAGE_KERNEL); - if (pfn >= max_low_pfn) { - pte_clear(&pte); - continue; - } - set_pte(pt_dir, pte); - pfn++; - } - } - } - - /* enable virtual mapping in kernel mode */ - __asm__ __volatile__("lctlg 1,1,%0\n\t" - "lctlg 7,7,%0\n\t" - "lctlg 13,13,%0\n\t" - "ssm %1" - : :"m" (pgdir_k), "m" (ssm_mask)); - - local_flush_tlb(); - - return; -} - -void __init mem_init(void) -{ - unsigned long codesize, reservedpages, datasize, initsize; - - max_mapnr = num_physpages = max_low_pfn; - high_memory = (void *) __va(max_low_pfn * PAGE_SIZE); - - /* clear the zero-page */ - memset(empty_zero_page, 0, PAGE_SIZE); - - /* this will put all low memory onto the freelists */ - totalram_pages += free_all_bootmem(); - - reservedpages = 0; - - codesize = (unsigned long) &_etext - (unsigned long) &_text; - datasize = (unsigned long) &_edata - (unsigned long) &_etext; - initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin; - printk("Memory: %luk/%luk available (%ldk kernel code, %ldk reserved, %ldk data, %ldk init)\n", - (unsigned long) nr_free_pages() << (PAGE_SHIFT-10), - max_mapnr << (PAGE_SHIFT-10), - codesize >> 10, - reservedpages << (PAGE_SHIFT-10), - datasize >>10, - initsize >> 10); -} - -void free_initmem(void) -{ - unsigned long addr; - - addr = (unsigned long)(&__init_begin); - for (; addr < (unsigned long)(&__init_end); addr += PAGE_SIZE) { - ClearPageReserved(virt_to_page(addr)); - set_page_count(virt_to_page(addr), 1); - free_page(addr); - totalram_pages++; - } - printk ("Freeing unused kernel memory: %ldk freed\n", - ((unsigned long)&__init_end - (unsigned long)&__init_begin) >> 10); -} - -#ifdef CONFIG_BLK_DEV_INITRD -void free_initrd_mem(unsigned long start, unsigned long end) -{ - if (start < end) - printk ("Freeing initrd memory: %ldk freed\n", (end - start) >> 10); - for (; start < end; start += PAGE_SIZE) { - ClearPageReserved(virt_to_page(start)); - set_page_count(virt_to_page(start), 1); - free_page(start); - totalram_pages++; - } -} -#endif - -/* - * Overrides for Emacs so that we follow Linus's tabbing style. - * Emacs will notice this stuff at the end of the file and automatically - * adjust the settings for this buffer only. This must remain at the end - * of the file. - * --------------------------------------------------------------------------- - * Local variables: - * c-indent-level: 4 - * c-brace-imaginary-offset: 0 - * c-brace-offset: -4 - * c-argdecl-indent: 4 - * c-label-offset: -4 - * c-continued-statement-offset: 4 - * c-continued-brace-offset: 0 - * indent-tabs-mode: nil - * tab-width: 8 - * End: - */ diff --git a/arch/s390x/mm/ioremap.c b/arch/s390x/mm/ioremap.c deleted file mode 100644 index 234940a558c8e..0000000000000 --- a/arch/s390x/mm/ioremap.c +++ /dev/null @@ -1,138 +0,0 @@ -/* - * arch/s390/mm/ioremap.c - * - * S390 version - * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation - * Author(s): Hartmut Penner (hp@de.ibm.com) - * - * Derived from "arch/i386/mm/extable.c" - * (C) Copyright 1995 1996 Linus Torvalds - * - * Re-map IO memory to kernel address space so that we can access it. - * This is needed for high PCI addresses that aren't mapped in the - * 640k-1MB IO memory area on PC's - */ - -#include -#include -#include -#include -#include -#include - -static inline void remap_area_pte(pte_t * pte, unsigned long address, unsigned long size, - unsigned long phys_addr, unsigned long flags) -{ - unsigned long end; - unsigned long pfn; - - address &= ~PMD_MASK; - end = address + size; - if (end > PMD_SIZE) - end = PMD_SIZE; - if (address >= end) - BUG(); - pfn = phys_addr >> PAGE_SHIFT; - do { - if (!pte_none(*pte)) { - printk("remap_area_pte: page already exists\n"); - BUG(); - } - set_pte(pte, pfn_pte(pfn, __pgprot(_PAGE_PRESENT | flags))); - address += PAGE_SIZE; - pfn++; - pte++; - } while (address && (address < end)); -} - -static inline int remap_area_pmd(pmd_t * pmd, unsigned long address, unsigned long size, - unsigned long phys_addr, unsigned long flags) -{ - unsigned long end; - - address &= ~PGDIR_MASK; - end = address + size; - if (end > PGDIR_SIZE) - end = PGDIR_SIZE; - phys_addr -= address; - if (address >= end) - BUG(); - do { - pte_t * pte = pte_alloc_kernel(&init_mm, pmd, address); - if (!pte) - return -ENOMEM; - remap_area_pte(pte, address, end - address, address + phys_addr, flags); - address = (address + PMD_SIZE) & PMD_MASK; - pmd++; - } while (address && (address < end)); - return 0; -} - -static int remap_area_pages(unsigned long address, unsigned long phys_addr, - unsigned long size, unsigned long flags) -{ - int error; - pgd_t * dir; - unsigned long end = address + size; - - phys_addr -= address; - dir = pgd_offset(&init_mm, address); - flush_cache_all(); - if (address >= end) - BUG(); - spin_lock(&init_mm.page_table_lock); - do { - pmd_t *pmd; - pmd = pmd_alloc(&init_mm, dir, address); - error = -ENOMEM; - if (!pmd) - break; - if (remap_area_pmd(pmd, address, end - address, - phys_addr + address, flags)) - break; - error = 0; - address = (address + PGDIR_SIZE) & PGDIR_MASK; - dir++; - } while (address && (address < end)); - spin_unlock(&init_mm.page_table_lock); - flush_tlb_all(); - return 0; -} - -/* - * Generic mapping function (not visible outside): - */ - -/* - * Remap an arbitrary physical address space into the kernel virtual - * address space. Needed when the kernel wants to access high addresses - * directly. - */ -void * __ioremap(unsigned long phys_addr, unsigned long size, unsigned long flags) -{ - void * addr; - struct vm_struct * area; - - if (phys_addr < virt_to_phys(high_memory)) - return phys_to_virt(phys_addr); - if (phys_addr & ~PAGE_MASK) - return NULL; - size = PAGE_ALIGN(size); - if (!size || size > phys_addr + size) - return NULL; - area = get_vm_area(size, VM_IOREMAP); - if (!area) - return NULL; - addr = area->addr; - if (remap_area_pages(VMALLOC_VMADDR(addr), phys_addr, size, flags)) { - vfree(addr); - return NULL; - } - return addr; -} - -void iounmap(void *addr) -{ - if (addr > high_memory) - return vfree(addr); -} diff --git a/arch/s390x/vmlinux.lds.S b/arch/s390x/vmlinux.lds.S deleted file mode 100644 index a6c179473e437..0000000000000 --- a/arch/s390x/vmlinux.lds.S +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Written by Martin Schwidefsky (schwidefsky@de.ibm.com) - */ - -#include - -OUTPUT_FORMAT("elf64-s390", "elf64-s390", "elf64-s390") -OUTPUT_ARCH(s390:64-bit) -ENTRY(_start) -jiffies = jiffies_64; -SECTIONS -{ - . = 0x00000000; - _text = .; /* Text and read-only data */ - .text : { - *(.text) - *(.fixup) - *(.gnu.warning) - } = 0x0700 - - _etext = .; /* End of text section */ - - . = ALIGN(16); /* Exception table */ - __start___ex_table = .; - __ex_table : { *(__ex_table) } - __stop___ex_table = .; - - RODATA - -#ifdef CONFIG_SHARED_KERNEL - . = ALIGN(1048576); /* VM shared segments are 1MB aligned */ - - _eshared = .; /* End of shareable data */ -#endif - - .data : { /* Data */ - *(.data) - CONSTRUCTORS - } - - . = ALIGN(4096); - __nosave_begin = .; - .data_nosave : { *(.data.nosave) } - . = ALIGN(4096); - __nosave_end = .; - - . = ALIGN(4096); - .data.page_aligned : { *(.data.idt) } - - . = ALIGN(32); - .data.cacheline_aligned : { *(.data.cacheline_aligned) } - - _edata = .; /* End of data section */ - - . = ALIGN(8192); /* init_task */ - .data.init_task : { *(.data.init_task) } - - /* will be freed after init */ - . = ALIGN(4096); /* Init code and data */ - __init_begin = .; - .init.text : { - _sinittext = .; - *(.init.text) - _einittext = .; - } - .init.data : { *(.init.data) } - . = ALIGN(256); - __setup_start = .; - .init.setup : { *(.init.setup) } - __setup_end = .; - __start___param = .; - __param : { *(__param) } - __stop___param = .; - __initcall_start = .; - .initcall.init : { - *(.initcall1.init) - *(.initcall2.init) - *(.initcall3.init) - *(.initcall4.init) - *(.initcall5.init) - *(.initcall6.init) - *(.initcall7.init) - } - __initcall_end = .; - __con_initcall_start = .; - .con_initcall.init : { *(.con_initcall.init) } - __con_initcall_end = .; - . = ALIGN(256); - __initramfs_start = .; - .init.ramfs : { *(.init.initramfs) } - __initramfs_end = .; - . = ALIGN(256); - __per_cpu_start = .; - .data.percpu : { *(.data.percpu) } - __per_cpu_end = .; - . = ALIGN(4096); - __init_end = .; - /* freed after init ends here */ - - __bss_start = .; /* BSS */ - .bss : { *(.bss) } - __bss_stop = .; - - _end = . ; - - /* Sections to be discarded */ - /DISCARD/ : { - *(.exit.text) - *(.exit.data) - *(.exitcall.exit) - *(.eh_frame) - } - - /* Stabs debugging sections. */ - .stab 0 : { *(.stab) } - .stabstr 0 : { *(.stabstr) } - .stab.excl 0 : { *(.stab.excl) } - .stab.exclstr 0 : { *(.stab.exclstr) } - .stab.index 0 : { *(.stab.index) } - .stab.indexstr 0 : { *(.stab.indexstr) } - .comment 0 : { *(.comment) } -} diff --git a/include/asm-s390x/a.out.h b/include/asm-s390x/a.out.h deleted file mode 100644 index 72adee6ef3383..0000000000000 --- a/include/asm-s390x/a.out.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * include/asm-s390/a.out.h - * - * S390 version - * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation - * - * Derived from "include/asm-i386/a.out.h" - * Copyright (C) 1992, Linus Torvalds - * - * I don't think we'll ever need a.out ... - */ - -#ifndef __S390_A_OUT_H__ -#define __S390_A_OUT_H__ - -struct exec -{ - unsigned long a_info; /* Use macros N_MAGIC, etc for access */ - unsigned a_text; /* length of text, in bytes */ - unsigned a_data; /* length of data, in bytes */ - unsigned a_bss; /* length of uninitialized data area for file, in bytes */ - unsigned a_syms; /* length of symbol table data in file, in bytes */ - unsigned a_entry; /* start address */ - unsigned a_trsize; /* length of relocation info for text, in bytes */ - unsigned a_drsize; /* length of relocation info for data, in bytes */ -}; - -#define N_TRSIZE(a) ((a).a_trsize) -#define N_DRSIZE(a) ((a).a_drsize) -#define N_SYMSIZE(a) ((a).a_syms) - -#ifdef __KERNEL__ - -#define STACK_TOP TASK_SIZE - -#endif - -#endif /* __A_OUT_GNU_H__ */ diff --git a/include/asm-s390x/atomic.h b/include/asm-s390x/atomic.h deleted file mode 100644 index 10938abe1c643..0000000000000 --- a/include/asm-s390x/atomic.h +++ /dev/null @@ -1,168 +0,0 @@ -#ifndef __ARCH_S390_ATOMIC__ -#define __ARCH_S390_ATOMIC__ - -/* - * include/asm-s390x/atomic.h - * - * S390 version - * Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation - * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com), - * Denis Joseph Barrow - * - * Derived from "include/asm-i386/bitops.h" - * Copyright (C) 1992, Linus Torvalds - * - */ - -/* - * Atomic operations that C can't guarantee us. Useful for - * resource counting etc.. - * S390 uses 'Compare And Swap' for atomicity in SMP enviroment - */ - -typedef struct { volatile int counter; } __attribute__ ((aligned (4))) atomic_t; -#define ATOMIC_INIT(i) { (i) } - -#define atomic_eieio() __asm__ __volatile__ ("BCR 15,0") - -#define __CS_LOOP(old_val, new_val, ptr, op_val, op_string) \ - __asm__ __volatile__(" l %0,0(%3)\n" \ - "0: lr %1,%0\n" \ - op_string " %1,%4\n" \ - " cs %0,%1,0(%3)\n" \ - " jl 0b" \ - : "=&d" (old_val), "=&d" (new_val), \ - "+m" (((atomic_t *)(ptr))->counter) \ - : "a" (ptr), "d" (op_val) : "cc" ); - -#define atomic_read(v) ((v)->counter) -#define atomic_set(v,i) (((v)->counter) = (i)) - -static __inline__ void atomic_add(int i, atomic_t *v) -{ - int old_val, new_val; - __CS_LOOP(old_val, new_val, v, i, "ar"); -} - -static __inline__ int atomic_add_return (int i, atomic_t *v) -{ - int old_val, new_val; - __CS_LOOP(old_val, new_val, v, i, "ar"); - return new_val; -} - -static __inline__ int atomic_add_negative(int i, atomic_t *v) -{ - int old_val, new_val; - __CS_LOOP(old_val, new_val, v, i, "ar"); - return new_val < 0; -} - -static __inline__ void atomic_sub(int i, atomic_t *v) -{ - int old_val, new_val; - __CS_LOOP(old_val, new_val, v, i, "sr"); -} - -static __inline__ void atomic_inc(volatile atomic_t *v) -{ - int old_val, new_val; - __CS_LOOP(old_val, new_val, v, 1, "ar"); -} - -static __inline__ int atomic_inc_return(volatile atomic_t *v) -{ - int old_val, new_val; - __CS_LOOP(old_val, new_val, v, 1, "ar"); - return new_val; -} - -static __inline__ int atomic_inc_and_test(volatile atomic_t *v) -{ - int old_val, new_val; - __CS_LOOP(old_val, new_val, v, 1, "ar"); - return new_val != 0; -} - -static __inline__ void atomic_dec(volatile atomic_t *v) -{ - int old_val, new_val; - __CS_LOOP(old_val, new_val, v, 1, "sr"); -} - -static __inline__ int atomic_dec_return(volatile atomic_t *v) -{ - int old_val, new_val; - __CS_LOOP(old_val, new_val, v, 1, "sr"); - return new_val; -} - -static __inline__ int atomic_dec_and_test(volatile atomic_t *v) -{ - int old_val, new_val; - __CS_LOOP(old_val, new_val, v, 1, "sr"); - return new_val == 0; -} - -static __inline__ void atomic_clear_mask(unsigned long mask, atomic_t *v) -{ - int old_val, new_val; - __CS_LOOP(old_val, new_val, v, ~mask, "nr"); -} - -static __inline__ void atomic_set_mask(unsigned long mask, atomic_t *v) -{ - int old_val, new_val; - __CS_LOOP(old_val, new_val, v, mask, "or"); -} - -/* - returns 0 if expected_oldval==value in *v ( swap was successful ) - returns 1 if unsuccessful. -*/ -static __inline__ int -atomic_compare_and_swap(int expected_oldval,int new_val,atomic_t *v) -{ - int retval; - - __asm__ __volatile__( - " lr %0,%3\n" - " cs %0,%4,0(%2)\n" - " ipm %0\n" - " srl %0,28\n" - "0:" - : "=&d" (retval), "+m" (v->counter) - : "a" (v), "d" (expected_oldval) , "d" (new_val) - : "cc"); - return retval; -} - -/* - Spin till *v = expected_oldval then swap with newval. - */ -static __inline__ void -atomic_compare_and_swap_spin(int expected_oldval,int new_val,atomic_t *v) -{ - unsigned long tmp; - __asm__ __volatile__( - "0: lr %1,%3\n" - " cs %1,%4,0(%2)\n" - " jl 0b\n" - : "+m" (v->counter), "=&d" (tmp) - : "a" (v), "d" (expected_oldval) , "d" (new_val) - : "cc" ); -} - -#define atomic_compare_and_swap_debug(where,from,to) \ -if (atomic_compare_and_swap ((from), (to), (where))) {\ - printk (KERN_WARNING"%s/%d atomic counter:%s couldn't be changed from %d(%s) to %d(%s), was %d\n",\ - __FILE__,__LINE__,#where,(from),#from,(to),#to,atomic_read (where));\ - atomic_set(where,(to));\ -} - -#define smp_mb__before_atomic_dec() smp_mb() -#define smp_mb__after_atomic_dec() smp_mb() -#define smp_mb__before_atomic_inc() smp_mb() -#define smp_mb__after_atomic_inc() smp_mb() - -#endif /* __ARCH_S390_ATOMIC __ */ diff --git a/include/asm-s390x/bitops.h b/include/asm-s390x/bitops.h deleted file mode 100644 index 18911f98504aa..0000000000000 --- a/include/asm-s390x/bitops.h +++ /dev/null @@ -1,950 +0,0 @@ -#ifndef _S390_BITOPS_H -#define _S390_BITOPS_H - -/* - * include/asm-s390/bitops.h - * - * S390 version - * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation - * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com) - * - * Derived from "include/asm-i386/bitops.h" - * Copyright (C) 1992, Linus Torvalds - * - */ -#include - -/* - * bit 0 is the LSB of *addr; bit 63 is the MSB of *addr; - * bit 64 is the LSB of *(addr+8). That combined with the - * big endian byte order on S390 give the following bit - * order in memory: - * 3f 3e 3d 3c 3b 3a 39 38 37 36 35 34 33 32 31 30 - * 2f 2e 2d 2c 2b 2a 29 28 27 26 25 24 23 22 21 20 - * 1f 1e 1d 1c 1b 1a 19 18 17 16 15 14 13 12 11 10 - * 0f 0e 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01 00 - * after that follows the next long with bit numbers - * 7f 7e 7d 7c 7b 7a 79 78 77 76 75 74 73 72 71 70 - * 6f 6e 6d 6c 6b 6a 69 68 67 66 65 64 63 62 61 60 - * 5f 5e 5d 5c 5b 5a 59 58 57 56 55 54 53 52 51 50 - * 4f 4e 4d 4c 4b 4a 49 48 47 46 45 44 43 42 41 40 - * The reason for this bit ordering is the fact that - * in the architecture independent code bits operations - * of the form "flags |= (1 << bitnr)" are used INTERMIXED - * with operation of the form "set_bit(bitnr, flags)". - */ - -/* set ALIGN_CS to 1 if the SMP safe bit operations should - * align the address to 4 byte boundary. It seems to work - * without the alignment. - */ -#ifdef __KERNEL__ -#define ALIGN_CS 0 -#else -#define ALIGN_CS 1 -#ifndef CONFIG_SMP -#error "bitops won't work without CONFIG_SMP" -#endif -#endif - -/* bitmap tables from arch/S390/kernel/bitmap.S */ -extern const char _oi_bitmap[]; -extern const char _ni_bitmap[]; -extern const char _zb_findmap[]; -extern const char _sb_findmap[]; - -#ifdef CONFIG_SMP -/* - * SMP safe set_bit routine based on compare and swap (CS) - */ -static inline void set_bit_cs(unsigned long nr, volatile unsigned long *ptr) -{ - unsigned long addr, old, new, mask; - - addr = (unsigned long) ptr; -#if ALIGN_CS == 1 - nr += (addr & 7) << 3; /* add alignment to bit number */ - addr ^= addr & 7; /* align address to 8 */ -#endif - addr += (nr ^ (nr & 63)) >> 3; /* calculate address for CS */ - mask = 1UL << (nr & 63); /* make OR mask */ - asm volatile( - " lg %0,0(%4)\n" - "0: lgr %1,%0\n" - " ogr %1,%3\n" - " csg %0,%1,0(%4)\n" - " jl 0b" - : "=&d" (old), "=&d" (new), "+m" (*(unsigned long *) addr) - : "d" (mask), "a" (addr) - : "cc" ); -} - -/* - * SMP safe clear_bit routine based on compare and swap (CS) - */ -static inline void clear_bit_cs(unsigned long nr, volatile unsigned long *ptr) -{ - unsigned long addr, old, new, mask; - - addr = (unsigned long) ptr; -#if ALIGN_CS == 1 - nr += (addr & 7) << 3; /* add alignment to bit number */ - addr ^= addr & 7; /* align address to 8 */ -#endif - addr += (nr ^ (nr & 63)) >> 3; /* calculate address for CS */ - mask = ~(1UL << (nr & 63)); /* make AND mask */ - asm volatile( - " lg %0,0(%4)\n" - "0: lgr %1,%0\n" - " ngr %1,%3\n" - " csg %0,%1,0(%4)\n" - " jl 0b" - : "=&d" (old), "=&d" (new), "+m" (*(unsigned long *) addr) - : "d" (mask), "a" (addr) - : "cc" ); -} - -/* - * SMP safe change_bit routine based on compare and swap (CS) - */ -static inline void change_bit_cs(unsigned long nr, volatile unsigned long *ptr) -{ - unsigned long addr, old, new, mask; - - addr = (unsigned long) ptr; -#if ALIGN_CS == 1 - nr += (addr & 7) << 3; /* add alignment to bit number */ - addr ^= addr & 7; /* align address to 8 */ -#endif - addr += (nr ^ (nr & 63)) >> 3; /* calculate address for CS */ - mask = 1UL << (nr & 63); /* make XOR mask */ - asm volatile( - " lg %0,0(%4)\n" - "0: lgr %1,%0\n" - " xgr %1,%3\n" - " csg %0,%1,0(%4)\n" - " jl 0b" - : "=&d" (old), "=&d" (new), "+m" (*(unsigned long *) addr) - : "d" (mask), "a" (addr) - : "cc" ); -} - -/* - * SMP safe test_and_set_bit routine based on compare and swap (CS) - */ -static inline int -test_and_set_bit_cs(unsigned long nr, volatile unsigned long *ptr) -{ - unsigned long addr, old, new, mask; - - addr = (unsigned long) ptr; -#if ALIGN_CS == 1 - nr += (addr & 7) << 3; /* add alignment to bit number */ - addr ^= addr & 7; /* align address to 8 */ -#endif - addr += (nr ^ (nr & 63)) >> 3; /* calculate address for CS */ - mask = 1UL << (nr & 63); /* make OR/test mask */ - asm volatile( - " lg %0,0(%4)\n" - "0: lgr %1,%0\n" - " ogr %1,%3\n" - " csg %0,%1,0(%4)\n" - " jl 0b" - : "=&d" (old), "=&d" (new), "+m" (*(unsigned long *) addr) - : "d" (mask), "a" (addr) - : "cc" ); - return (old & mask) != 0; -} - -/* - * SMP safe test_and_clear_bit routine based on compare and swap (CS) - */ -static inline int -test_and_clear_bit_cs(unsigned long nr, volatile unsigned long *ptr) -{ - unsigned long addr, old, new, mask; - - addr = (unsigned long) ptr; -#if ALIGN_CS == 1 - nr += (addr & 7) << 3; /* add alignment to bit number */ - addr ^= addr & 7; /* align address to 8 */ -#endif - addr += (nr ^ (nr & 63)) >> 3; /* calculate address for CS */ - mask = ~(1UL << (nr & 63)); /* make AND mask */ - asm volatile( - " lg %0,0(%4)\n" - "0: lgr %1,%0\n" - " ngr %1,%3\n" - " csg %0,%1,0(%4)\n" - " jl 0b" - : "=&d" (old), "=&d" (new), "+m" (*(unsigned long *) addr) - : "d" (mask), "a" (addr) - : "cc" ); - return (old ^ new) != 0; -} - -/* - * SMP safe test_and_change_bit routine based on compare and swap (CS) - */ -static inline int -test_and_change_bit_cs(unsigned long nr, volatile unsigned long *ptr) -{ - unsigned long addr, old, new, mask; - - addr = (unsigned long) ptr; -#if ALIGN_CS == 1 - nr += (addr & 7) << 3; /* add alignment to bit number */ - addr ^= addr & 7; /* align address to 8 */ -#endif - addr += (nr ^ (nr & 63)) >> 3; /* calculate address for CS */ - mask = 1UL << (nr & 63); /* make XOR mask */ - asm volatile( - " lg %0,0(%4)\n" - "0: lgr %1,%0\n" - " xgr %1,%3\n" - " csg %0,%1,0(%4)\n" - " jl 0b" - : "=&d" (old), "=&d" (new), "+m" (*(unsigned long *) addr) - : "d" (mask), "a" (addr) - : "cc" ); - return (old & mask) != 0; -} -#endif /* CONFIG_SMP */ - -/* - * fast, non-SMP set_bit routine - */ -static inline void __set_bit(unsigned long nr, volatile unsigned long *ptr) -{ - unsigned long addr; - - addr = (unsigned long) ptr + ((nr ^ 56) >> 3); - asm volatile("oc 0(1,%1),0(%2)" - : "+m" (*(char *) addr) - : "a" (addr), "a" (_oi_bitmap + (nr & 7)) - : "cc" ); -} - -static inline void -__constant_set_bit(const unsigned long nr, volatile unsigned long *ptr) -{ - unsigned long addr; - - addr = ((unsigned long) ptr) + ((nr >> 3) ^ 7); - switch (nr&7) { - case 0: - asm volatile ("oi 0(%1),0x01" - : "+m" (*(char *) addr) : "a" (addr) : "cc" ); - break; - case 1: - asm volatile ("oi 0(%1),0x02" - : "+m" (*(char *) addr) : "a" (addr) : "cc" ); - break; - case 2: - asm volatile ("oi 0(%1),0x04" - : "+m" (*(char *) addr) : "a" (addr) : "cc" ); - break; - case 3: - asm volatile ("oi 0(%1),0x08" - : "+m" (*(char *) addr) : "a" (addr) : "cc" ); - break; - case 4: - asm volatile ("oi 0(%1),0x10" - : "+m" (*(char *) addr) : "a" (addr) : "cc" ); - break; - case 5: - asm volatile ("oi 0(%1),0x20" - : "+m" (*(char *) addr) : "a" (addr) : "cc" ); - break; - case 6: - asm volatile ("oi 0(%1),0x40" - : "+m" (*(char *) addr) : "a" (addr) : "cc" ); - break; - case 7: - asm volatile ("oi 0(%1),0x80" - : "+m" (*(char *) addr) : "a" (addr) : "cc" ); - break; - } -} - -#define set_bit_simple(nr,addr) \ -(__builtin_constant_p((nr)) ? \ - __constant_set_bit((nr),(addr)) : \ - __set_bit((nr),(addr)) ) - -/* - * fast, non-SMP clear_bit routine - */ -static inline void -__clear_bit(unsigned long nr, volatile unsigned long *ptr) -{ - unsigned long addr; - - addr = (unsigned long) ptr + ((nr ^ 56) >> 3); - asm volatile("nc 0(1,%1),0(%2)" - : "+m" (*(char *) addr) - : "a" (addr), "a" (_ni_bitmap + (nr & 7)) - : "cc" ); -} - -static inline void -__constant_clear_bit(const unsigned long nr, volatile unsigned long *ptr) -{ - unsigned long addr; - - addr = ((unsigned long) ptr) + ((nr >> 3) ^ 7); - switch (nr&7) { - case 0: - asm volatile ("ni 0(%1),0xFE" - : "+m" (*(char *) addr) : "a" (addr) : "cc" ); - break; - case 1: - asm volatile ("ni 0(%1),0xFD" - : "+m" (*(char *) addr) : "a" (addr) : "cc" ); - break; - case 2: - asm volatile ("ni 0(%1),0xFB" - : "+m" (*(char *) addr) : "a" (addr) : "cc" ); - break; - case 3: - asm volatile ("ni 0(%1),0xF7" - : "+m" (*(char *) addr) : "a" (addr) : "cc" ); - break; - case 4: - asm volatile ("ni 0(%1),0xEF" - : "+m" (*(char *) addr) : "a" (addr) : "cc" ); - break; - case 5: - asm volatile ("ni 0(%1),0xDF" - : "+m" (*(char *) addr) : "a" (addr) : "cc" ); - break; - case 6: - asm volatile ("ni 0(%1),0xBF" - : "+m" (*(char *) addr) : "a" (addr) : "cc" ); - break; - case 7: - asm volatile ("ni 0(%1),0x7F" - : "+m" (*(char *) addr) : "a" (addr) : "cc" ); - break; - } -} - -#define clear_bit_simple(nr,addr) \ -(__builtin_constant_p((nr)) ? \ - __constant_clear_bit((nr),(addr)) : \ - __clear_bit((nr),(addr)) ) - -/* - * fast, non-SMP change_bit routine - */ -static inline void __change_bit(unsigned long nr, volatile unsigned long *ptr) -{ - unsigned long addr; - - addr = (unsigned long) ptr + ((nr ^ 56) >> 3); - asm volatile("xc 0(1,%1),0(%2)" - : "+m" (*(char *) addr) - : "a" (addr), "a" (_oi_bitmap + (nr & 7)) - : "cc" ); -} - -static inline void -__constant_change_bit(const unsigned long nr, volatile unsigned long *ptr) -{ - unsigned long addr; - - addr = ((unsigned long) ptr) + ((nr >> 3) ^ 7); - switch (nr&7) { - case 0: - asm volatile ("xi 0(%1),0x01" - : "+m" (*(char *) addr) : "a" (addr) : "cc" ); - break; - case 1: - asm volatile ("xi 0(%1),0x02" - : "+m" (*(char *) addr) : "a" (addr) : "cc" ); - break; - case 2: - asm volatile ("xi 0(%1),0x04" - : "+m" (*(char *) addr) : "a" (addr) : "cc" ); - break; - case 3: - asm volatile ("xi 0(%1),0x08" - : "+m" (*(char *) addr) : "a" (addr) : "cc" ); - break; - case 4: - asm volatile ("xi 0(%1),0x10" - : "+m" (*(char *) addr) : "a" (addr) : "cc" ); - break; - case 5: - asm volatile ("xi 0(%1),0x20" - : "+m" (*(char *) addr) : "a" (addr) : "cc" ); - break; - case 6: - asm volatile ("xi 0(%1),0x40" - : "+m" (*(char *) addr) : "a" (addr) : "cc" ); - break; - case 7: - asm volatile ("xi 0(%1),0x80" - : "+m" (*(char *) addr) : "a" (addr) : "cc" ); - break; - } -} - -#define change_bit_simple(nr,addr) \ -(__builtin_constant_p((nr)) ? \ - __constant_change_bit((nr),(addr)) : \ - __change_bit((nr),(addr)) ) - -/* - * fast, non-SMP test_and_set_bit routine - */ -static inline int -test_and_set_bit_simple(unsigned long nr, volatile unsigned long *ptr) -{ - unsigned long addr; - unsigned char ch; - - addr = (unsigned long) ptr + ((nr ^ 56) >> 3); - ch = *(unsigned char *) addr; - asm volatile("oc 0(1,%1),0(%2)" - : "+m" (*(char *) addr) - : "a" (addr), "a" (_oi_bitmap + (nr & 7)) - : "cc" ); - return (ch >> (nr & 7)) & 1; -} -#define __test_and_set_bit(X,Y) test_and_set_bit_simple(X,Y) - -/* - * fast, non-SMP test_and_clear_bit routine - */ -static inline int -test_and_clear_bit_simple(unsigned long nr, volatile unsigned long *ptr) -{ - unsigned long addr; - unsigned char ch; - - addr = (unsigned long) ptr + ((nr ^ 56) >> 3); - ch = *(unsigned char *) addr; - asm volatile("nc 0(1,%1),0(%2)" - : "+m" (*(char *) addr) - : "a" (addr), "a" (_ni_bitmap + (nr & 7)) - : "cc" ); - return (ch >> (nr & 7)) & 1; -} -#define __test_and_clear_bit(X,Y) test_and_clear_bit_simple(X,Y) - -/* - * fast, non-SMP test_and_change_bit routine - */ -static inline int -test_and_change_bit_simple(unsigned long nr, volatile unsigned long *ptr) -{ - unsigned long addr; - unsigned char ch; - - addr = (unsigned long) ptr + ((nr ^ 56) >> 3); - ch = *(unsigned char *) addr; - asm volatile("xc 0(1,%1),0(%2)" - : "+m" (*(char *) addr) - : "a" (addr), "a" (_oi_bitmap + (nr & 7)) - : "cc" ); - return (ch >> (nr & 7)) & 1; -} -#define __test_and_change_bit(X,Y) test_and_change_bit_simple(X,Y) - -#ifdef CONFIG_SMP -#define set_bit set_bit_cs -#define clear_bit clear_bit_cs -#define change_bit change_bit_cs -#define test_and_set_bit test_and_set_bit_cs -#define test_and_clear_bit test_and_clear_bit_cs -#define test_and_change_bit test_and_change_bit_cs -#else -#define set_bit set_bit_simple -#define clear_bit clear_bit_simple -#define change_bit change_bit_simple -#define test_and_set_bit test_and_set_bit_simple -#define test_and_clear_bit test_and_clear_bit_simple -#define test_and_change_bit test_and_change_bit_simple -#endif - - -/* - * This routine doesn't need to be atomic. - */ - -static inline int __test_bit(unsigned long nr, const volatile unsigned long *ptr) -{ - unsigned long addr; - unsigned char ch; - - addr = (unsigned long) ptr + ((nr ^ 56) >> 3); - ch = *(unsigned char *) addr; - return (ch >> (nr & 7)) & 1; -} - -static inline int -__constant_test_bit(unsigned long nr, const volatile unsigned long *addr) { - return (((volatile char *) addr)[(nr>>3)^7] & (1<<(nr&7))) != 0; -} - -#define test_bit(nr,addr) \ -(__builtin_constant_p((nr)) ? \ - __constant_test_bit((nr),(addr)) : \ - __test_bit((nr),(addr)) ) - -/* - * Find-bit routines.. - */ -static inline unsigned long -find_first_zero_bit(unsigned long * addr, unsigned long size) -{ - unsigned long res, cmp, count; - - if (!size) - return 0; - __asm__(" lghi %1,-1\n" - " lgr %2,%3\n" - " slgr %0,%0\n" - " aghi %2,63\n" - " srlg %2,%2,6\n" - "0: cg %1,0(%0,%4)\n" - " jne 1f\n" - " aghi %0,8\n" - " brct %2,0b\n" - " lgr %0,%3\n" - " j 5f\n" - "1: lg %2,0(%0,%4)\n" - " sllg %0,%0,3\n" - " clr %2,%1\n" - " jne 2f\n" - " aghi %0,32\n" - " srlg %2,%2,32\n" - "2: lghi %1,0xff\n" - " tmll %2,0xffff\n" - " jno 3f\n" - " aghi %0,16\n" - " srl %2,16\n" - "3: tmll %2,0x00ff\n" - " jno 4f\n" - " aghi %0,8\n" - " srl %2,8\n" - "4: ngr %2,%1\n" - " ic %2,0(%2,%5)\n" - " algr %0,%2\n" - "5:" - : "=&a" (res), "=&d" (cmp), "=&a" (count) - : "a" (size), "a" (addr), "a" (&_zb_findmap) : "cc" ); - return (res < size) ? res : size; -} - -static inline unsigned long -find_first_bit(unsigned long * addr, unsigned long size) -{ - unsigned long res, cmp, count; - - if (!size) - return 0; - __asm__(" slgr %1,%1\n" - " lgr %2,%3\n" - " slgr %0,%0\n" - " aghi %2,63\n" - " srlg %2,%2,6\n" - "0: cg %1,0(%0,%4)\n" - " jne 1f\n" - " aghi %0,8\n" - " brct %2,0b\n" - " lgr %0,%3\n" - " j 5f\n" - "1: lg %2,0(%0,%4)\n" - " sllg %0,%0,3\n" - " clr %2,%1\n" - " jne 2f\n" - " aghi %0,32\n" - " srlg %2,%2,32\n" - "2: lghi %1,0xff\n" - " tmll %2,0xffff\n" - " jnz 3f\n" - " aghi %0,16\n" - " srl %2,16\n" - "3: tmll %2,0x00ff\n" - " jnz 4f\n" - " aghi %0,8\n" - " srl %2,8\n" - "4: ngr %2,%1\n" - " ic %2,0(%2,%5)\n" - " algr %0,%2\n" - "5:" - : "=&a" (res), "=&d" (cmp), "=&a" (count) - : "a" (size), "a" (addr), "a" (&_sb_findmap) : "cc" ); - return (res < size) ? res : size; -} - -static inline unsigned long -find_next_zero_bit (unsigned long * addr, unsigned long size, unsigned long offset) -{ - unsigned long * p = ((unsigned long *) addr) + (offset >> 6); - unsigned long bitvec, reg; - unsigned long set, bit = offset & 63, res; - - if (bit) { - /* - * Look for zero in first word - */ - bitvec = (*p) >> bit; - __asm__(" lhi %2,-1\n" - " slgr %0,%0\n" - " clr %1,%2\n" - " jne 0f\n" - " aghi %0,32\n" - " srlg %1,%1,32\n" - "0: lghi %2,0xff\n" - " tmll %1,0xffff\n" - " jno 1f\n" - " aghi %0,16\n" - " srlg %1,%1,16\n" - "1: tmll %1,0x00ff\n" - " jno 2f\n" - " aghi %0,8\n" - " srlg %1,%1,8\n" - "2: ngr %1,%2\n" - " ic %1,0(%1,%3)\n" - " algr %0,%1" - : "=&d" (set), "+a" (bitvec), "=&d" (reg) - : "a" (&_zb_findmap) : "cc" ); - if (set < (64 - bit)) - return set + offset; - offset += 64 - bit; - p++; - } - /* - * No zero yet, search remaining full words for a zero - */ - res = find_first_zero_bit (p, size - 64 * (p - (unsigned long *) addr)); - return (offset + res); -} - -static inline unsigned long -find_next_bit (unsigned long * addr, unsigned long size, unsigned long offset) -{ - unsigned long * p = ((unsigned long *) addr) + (offset >> 6); - unsigned long bitvec, reg; - unsigned long set, bit = offset & 63, res; - - if (bit) { - /* - * Look for zero in first word - */ - bitvec = (*p) >> bit; - __asm__(" slgr %0,%0\n" - " ltr %1,%1\n" - " jnz 0f\n" - " aghi %0,32\n" - " srlg %1,%1,32\n" - "0: lghi %2,0xff\n" - " tmll %1,0xffff\n" - " jnz 1f\n" - " aghi %0,16\n" - " srlg %1,%1,16\n" - "1: tmll %1,0x00ff\n" - " jnz 2f\n" - " aghi %0,8\n" - " srlg %1,%1,8\n" - "2: ngr %1,%2\n" - " ic %1,0(%1,%3)\n" - " algr %0,%1" - : "=&d" (set), "+a" (bitvec), "=&d" (reg) - : "a" (&_sb_findmap) : "cc" ); - if (set < (64 - bit)) - return set + offset; - offset += 64 - bit; - p++; - } - /* - * No set bit yet, search remaining full words for a bit - */ - res = find_first_bit (p, size - 64 * (p - (unsigned long *) addr)); - return (offset + res); -} - -/* - * ffz = Find First Zero in word. Undefined if no zero exists, - * so code should check against ~0UL first.. - */ -static inline unsigned long ffz(unsigned long word) -{ - unsigned long reg, result; - - __asm__(" lhi %2,-1\n" - " slgr %0,%0\n" - " clr %1,%2\n" - " jne 0f\n" - " aghi %0,32\n" - " srlg %1,%1,32\n" - "0: lghi %2,0xff\n" - " tmll %1,0xffff\n" - " jno 1f\n" - " aghi %0,16\n" - " srlg %1,%1,16\n" - "1: tmll %1,0x00ff\n" - " jno 2f\n" - " aghi %0,8\n" - " srlg %1,%1,8\n" - "2: ngr %1,%2\n" - " ic %1,0(%1,%3)\n" - " algr %0,%1" - : "=&d" (result), "+a" (word), "=&d" (reg) - : "a" (&_zb_findmap) : "cc" ); - return result; -} - -/* - * __ffs = find first bit in word. Undefined if no bit exists, - * so code should check against 0UL first.. - */ -static inline unsigned long __ffs (unsigned long word) -{ - unsigned long reg, result; - - __asm__(" slgr %0,%0\n" - " ltr %1,%1\n" - " jnz 0f\n" - " aghi %0,32\n" - " srlg %1,%1,32\n" - "0: lghi %2,0xff\n" - " tmll %1,0xffff\n" - " jnz 1f\n" - " aghi %0,16\n" - " srlg %1,%1,16\n" - "1: tmll %1,0x00ff\n" - " jnz 2f\n" - " aghi %0,8\n" - " srlg %1,%1,8\n" - "2: ngr %1,%2\n" - " ic %1,0(%1,%3)\n" - " algr %0,%1" - : "=&d" (result), "+a" (word), "=&d" (reg) - : "a" (&_sb_findmap) : "cc" ); - return result; -} - -/* - * Every architecture must define this function. It's the fastest - * way of searching a 140-bit bitmap where the first 100 bits are - * unlikely to be set. It's guaranteed that at least one of the 140 - * bits is cleared. - */ -static inline int sched_find_first_bit(unsigned long *b) -{ - return find_first_bit(b, 140); -} - -/* - * ffs: find first bit set. This is defined the same way as - * the libc and compiler builtin ffs routines, therefore - * differs in spirit from the above ffz (man ffs). - */ -extern inline int ffs (int x) -{ - int r = 1; - - if (x == 0) - return 0; - __asm__(" tml %1,0xffff\n" - " jnz 0f\n" - " srl %1,16\n" - " ahi %0,16\n" - "0: tml %1,0x00ff\n" - " jnz 1f\n" - " srl %1,8\n" - " ahi %0,8\n" - "1: tml %1,0x000f\n" - " jnz 2f\n" - " srl %1,4\n" - " ahi %0,4\n" - "2: tml %1,0x0003\n" - " jnz 3f\n" - " srl %1,2\n" - " ahi %0,2\n" - "3: tml %1,0x0001\n" - " jnz 4f\n" - " ahi %0,1\n" - "4:" - : "=&d" (r), "+d" (x) : : "cc" ); - return r; -} - -/* - * fls: find last bit set. - */ -extern __inline__ int fls(int x) -{ - int r = 32; - - if (x == 0) - return 0; - __asm__(" tmh %1,0xffff\n" - " jz 0f\n" - " sll %1,16\n" - " ahi %0,-16\n" - "0: tmh %1,0xff00\n" - " jz 1f\n" - " sll %1,8\n" - " ahi %0,-8\n" - "1: tmh %1,0xf000\n" - " jz 2f\n" - " sll %1,4\n" - " ahi %0,-4\n" - "2: tmh %1,0xc000\n" - " jz 3f\n" - " sll %1,2\n" - " ahi %0,-2\n" - "3: tmh %1,0x8000\n" - " jz 4f\n" - " ahi %0,-1\n" - "4:" - : "+d" (r), "+d" (x) : : "cc" ); - return r; -} - -/* - * hweightN: returns the hamming weight (i.e. the number - * of bits set) of a N-bit word - */ -#define hweight64(x) \ -({ \ - unsigned long __x = (x); \ - unsigned int __w; \ - __w = generic_hweight32((unsigned int) __x); \ - __w += generic_hweight32((unsigned int) (__x>>32)); \ - __w; \ -}) -#define hweight32(x) generic_hweight32(x) -#define hweight16(x) generic_hweight16(x) -#define hweight8(x) generic_hweight8(x) - - -#ifdef __KERNEL__ - -/* - * ATTENTION: intel byte ordering convention for ext2 and minix !! - * bit 0 is the LSB of addr; bit 31 is the MSB of addr; - * bit 32 is the LSB of (addr+4). - * That combined with the little endian byte order of Intel gives the - * following bit order in memory: - * 07 06 05 04 03 02 01 00 15 14 13 12 11 10 09 08 \ - * 23 22 21 20 19 18 17 16 31 30 29 28 27 26 25 24 - */ - -#define ext2_set_bit(nr, addr) \ - test_and_set_bit((nr)^56, (unsigned long *)addr) -#define ext2_set_bit_atomic(lock, nr, addr) \ - test_and_set_bit((nr)^56, (unsigned long *)addr) -#define ext2_clear_bit(nr, addr) \ - test_and_clear_bit((nr)^56, (unsigned long *)addr) -#define ext2_clear_bit_atomic(lock, nr, addr) \ - test_and_clear_bit((nr)^56, (unsigned long *)addr) -#define ext2_test_bit(nr, addr) \ - test_bit((nr)^56, (unsigned long *)addr) - -static inline unsigned long -ext2_find_first_zero_bit(void *vaddr, unsigned long size) -{ - unsigned long res, cmp, count; - - if (!size) - return 0; - __asm__(" lghi %1,-1\n" - " lgr %2,%3\n" - " aghi %2,63\n" - " srlg %2,%2,6\n" - " slgr %0,%0\n" - "0: clg %1,0(%0,%4)\n" - " jne 1f\n" - " aghi %0,8\n" - " brct %2,0b\n" - " lgr %0,%3\n" - " j 5f\n" - "1: cl %1,0(%0,%4)\n" - " jne 2f\n" - " aghi %0,4\n" - "2: l %2,0(%0,%4)\n" - " sllg %0,%0,3\n" - " aghi %0,24\n" - " lghi %1,0xff\n" - " tmlh %2,0xffff\n" - " jo 3f\n" - " aghi %0,-16\n" - " srl %2,16\n" - "3: tmll %2,0xff00\n" - " jo 4f\n" - " aghi %0,-8\n" - " srl %2,8\n" - "4: ngr %2,%1\n" - " ic %2,0(%2,%5)\n" - " algr %0,%2\n" - "5:" - : "=&a" (res), "=&d" (cmp), "=&a" (count) - : "a" (size), "a" (vaddr), "a" (&_zb_findmap) : "cc" ); - return (res < size) ? res : size; -} - -static inline unsigned long -ext2_find_next_zero_bit(void *vaddr, unsigned long size, unsigned long offset) -{ - unsigned long *addr = vaddr; - unsigned long *p = addr + (offset >> 6); - unsigned long word, reg; - unsigned long bit = offset & 63UL, res; - - if (offset >= size) - return size; - - if (bit) { - __asm__(" lrvg %0,%1" /* load reversed, neat instruction */ - : "=a" (word) : "m" (*p) ); - word >>= bit; - res = bit; - /* Look for zero in first 8 byte word */ - __asm__(" lghi %2,0xff\n" - " tmll %1,0xffff\n" - " jno 2f\n" - " ahi %0,16\n" - " srlg %1,%1,16\n" - "0: tmll %1,0xffff\n" - " jno 2f\n" - " ahi %0,16\n" - " srlg %1,%1,16\n" - "1: tmll %1,0xffff\n" - " jno 2f\n" - " ahi %0,16\n" - " srl %1,16\n" - "2: tmll %1,0x00ff\n" - " jno 3f\n" - " ahi %0,8\n" - " srl %1,8\n" - "3: ngr %1,%2\n" - " ic %1,0(%1,%3)\n" - " alr %0,%1" - : "+&d" (res), "+a" (word), "=&d" (reg) - : "a" (&_zb_findmap) : "cc" ); - if (res < 64) - return (p - addr)*64 + res; - p++; - } - /* No zero yet, search remaining full bytes for a zero */ - res = ext2_find_first_zero_bit (p, size - 64 * (p - addr)); - return (p - addr) * 64 + res; -} - -/* Bitmap functions for the minix filesystem. */ -/* FIXME !!! */ -#define minix_test_and_set_bit(nr,addr) test_and_set_bit(nr,addr) -#define minix_set_bit(nr,addr) set_bit(nr,addr) -#define minix_test_and_clear_bit(nr,addr) test_and_clear_bit(nr,addr) -#define minix_test_bit(nr,addr) test_bit(nr,addr) -#define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size) - -#endif /* __KERNEL__ */ - -#endif /* _S390_BITOPS_H */ diff --git a/include/asm-s390x/bug.h b/include/asm-s390x/bug.h deleted file mode 100644 index 38f2940e72dfc..0000000000000 --- a/include/asm-s390x/bug.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef _S390_BUG_H -#define _S390_BUG_H - -#define BUG() do { \ - printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \ - __asm__ __volatile__(".long 0"); \ -} while (0) - -#define PAGE_BUG(page) do { \ - BUG(); \ -} while (0) - -#endif diff --git a/include/asm-s390x/bugs.h b/include/asm-s390x/bugs.h deleted file mode 100644 index 2c36596213147..0000000000000 --- a/include/asm-s390x/bugs.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * include/asm-s390/bugs.h - * - * S390 version - * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation - * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com) - * - * Derived from "include/asm-i386/bugs.h" - * Copyright (C) 1994 Linus Torvalds - */ - -/* - * This is included by init/main.c to check for architecture-dependent bugs. - * - * Needs: - * void check_bugs(void); - */ - -static void __init check_bugs(void) -{ - /* s390 has no bugs ... */ -} diff --git a/include/asm-s390x/byteorder.h b/include/asm-s390x/byteorder.h deleted file mode 100644 index 9dec5f16cfced..0000000000000 --- a/include/asm-s390x/byteorder.h +++ /dev/null @@ -1,102 +0,0 @@ -#ifndef _S390_BYTEORDER_H -#define _S390_BYTEORDER_H - -/* - * include/asm-s390/byteorder.h - * - * S390 version - * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation - * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com) - */ - -#include - -#ifdef __GNUC__ - -static __inline__ __const__ __u64 ___arch__swab64p(__u64 *x) -{ - __u64 result; - - __asm__ __volatile__ ( - " lrvg %0,%1" - : "=d" (result) : "m" (*x) ); - return result; -} - -static __inline__ __const__ __u64 ___arch__swab64(__u64 x) -{ - __u64 result; - - __asm__ __volatile__ ( - " lrvgr %0,%1" - : "=d" (result) : "d" (x) ); - return result; -} - -static __inline__ void ___arch__swab64s(__u64 *x) -{ - *x = ___arch__swab64p(x); -} - -static __inline__ __const__ __u32 ___arch__swab32p(__u32 *x) -{ - __u32 result; - - __asm__ __volatile__ ( - " lrv %0,%1" - : "=d" (result) : "m" (*x) ); - return result; -} - -static __inline__ __const__ __u32 ___arch__swab32(__u32 x) -{ - __u32 result; - - __asm__ __volatile__ ( - " lrvr %0,%1" - : "=d" (result) : "d" (x) ); - return result; -} - -static __inline__ void ___arch__swab32s(__u32 *x) -{ - *x = ___arch__swab32p(x); -} - -static __inline__ __const__ __u16 ___arch__swab16p(__u16 *x) -{ - __u16 result; - - __asm__ __volatile__ ( - " lrvh %0,%1" - : "=d" (result) : "m" (*x) ); - return result; -} - -static __inline__ __const__ __u16 ___arch__swab16(__u16 x) -{ - return ___arch__swab16p(&x); -} - -static __inline__ void ___arch__swab16s(__u16 *x) -{ - *x = ___arch__swab16p(x); -} - -#define __arch__swab64(x) ___arch__swab64(x) -#define __arch__swab32(x) ___arch__swab32(x) -#define __arch__swab16(x) ___arch__swab16(x) -#define __arch__swab64p(x) ___arch__swab64p(x) -#define __arch__swab32p(x) ___arch__swab32p(x) -#define __arch__swab16p(x) ___arch__swab16p(x) -#define __arch__swab64s(x) ___arch__swab64s(x) -#define __arch__swab32s(x) ___arch__swab32s(x) -#define __arch__swab16s(x) ___arch__swab16s(x) - -#define __BYTEORDER_HAS_U64__ - -#endif /* __GNUC__ */ - -#include - -#endif /* _S390_BYTEORDER_H */ diff --git a/include/asm-s390x/cache.h b/include/asm-s390x/cache.h deleted file mode 100644 index dbe2584a3358b..0000000000000 --- a/include/asm-s390x/cache.h +++ /dev/null @@ -1,18 +0,0 @@ -/* - * include/asm-s390/cache.h - * - * S390 version - * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation - * - * Derived from "include/asm-i386/cache.h" - * Copyright (C) 1992, Linus Torvalds - */ - -#ifndef __ARCH_S390_CACHE_H -#define __ARCH_S390_CACHE_H - -#define L1_CACHE_BYTES 256 -#define L1_CACHE_SHIFT 8 -#define L1_CACHE_SHIFT_MAX 8 /* largest L1 which this arch supports */ - -#endif diff --git a/include/asm-s390x/cacheflush.h b/include/asm-s390x/cacheflush.h deleted file mode 100644 index 80be206eb4a52..0000000000000 --- a/include/asm-s390x/cacheflush.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef _S390X_CACHEFLUSH_H -#define _S390X_CACHEFLUSH_H - -/* Keep includes the same across arches. */ -#include - -/* Caches aren't brain-dead on the s390. */ -#define flush_cache_all() do { } while (0) -#define flush_cache_mm(mm) do { } while (0) -#define flush_cache_range(vma, start, end) do { } while (0) -#define flush_cache_page(vma, vmaddr) do { } while (0) -#define flush_dcache_page(page) do { } while (0) -#define flush_icache_range(start, end) do { } while (0) -#define flush_icache_page(vma,pg) do { } while (0) -#define flush_icache_user_range(vma,pg,adr,len) do { } while (0) - -#endif /* _S390X_CACHEFLUSH_H */ diff --git a/include/asm-s390x/ccwdev.h b/include/asm-s390x/ccwdev.h deleted file mode 100644 index 37a20bbced3fd..0000000000000 --- a/include/asm-s390x/ccwdev.h +++ /dev/null @@ -1,185 +0,0 @@ -/* - * include/asm-s390/ccwdev.h - * include/asm-s390x/ccwdev.h - * - * Copyright (C) 2002 IBM Deutschland Entwicklung GmbH, IBM Corporation - * Author(s): Arnd Bergmann - * - * Interface for CCW device drivers - */ -#ifndef _S390_CCWDEV_H_ -#define _S390_CCWDEV_H_ - -#include - -/* structs from asm/cio.h */ -struct irb; -struct ccw1; - -/* the id is used to identify what hardware a device driver supports. It - * is used both by the ccw subsystem driver for probing and from - * user space for automatic module loading. - * - * References: - * - struct usb_device_id (include/linux/usb.h) - * - devreg_hc_t (include/linux/s390dyn.h) - * - chandev_model_info (drivers/s390/misc/chandev.c) - */ -struct ccw_device_id { - __u16 match_flags; /* which fields to match against */ - - __u16 cu_type; /* control unit type */ - __u16 dev_type; /* device type */ - __u8 cu_model; /* control unit model */ - __u8 dev_model; /* device model */ - - unsigned long driver_info; -}; - -enum match_flag { - CCW_DEVICE_ID_MATCH_CU_TYPE = 0x01, - CCW_DEVICE_ID_MATCH_CU_MODEL = 0x02, - CCW_DEVICE_ID_MATCH_DEVICE_TYPE = 0x04, - CCW_DEVICE_ID_MATCH_DEVICE_MODEL = 0x08, - /* CCW_DEVICE_ID_MATCH_ANY = 0x10, */ -}; - -/* simplified initializers for struct ccw_device: - * CCW_DEVICE and CCW_DEVICE_DEVTYPE initialize one - * entry in your MODULE_DEVICE_TABLE and set the match_flag correctly */ -#define CCW_DEVICE(cu, cum) \ - .cu_type=(cu), .cu_model=(cum), \ - .match_flags=(CCW_DEVICE_ID_MATCH_CU_TYPE \ - | (cum ? CCW_DEVICE_ID_MATCH_CU_MODEL : 0)) - -#define CCW_DEVICE_DEVTYPE(cu, cum, dev, devm) \ - .cu_type=(cu), .cu_model=(cum), .dev_type=(dev), .dev_model=(devm),\ - .match_flags=CCW_DEVICE_ID_MATCH_CU_TYPE \ - | ((cum) ? CCW_DEVICE_ID_MATCH_CU_MODEL : 0) \ - | CCW_DEVICE_ID_MATCH_DEVICE_TYPE \ - | ((devm) ? CCW_DEVICE_ID_MATCH_DEVICE_MODEL : 0) - -/* scan through an array of device ids and return the first - * entry that matches the device. - * - * the array must end with an entry containing zero match_flags - */ -static inline const struct ccw_device_id * -ccw_device_id_match(const struct ccw_device_id *array, - const struct ccw_device_id *match) -{ - const struct ccw_device_id *id = array; - - for (id = array; id->match_flags; id++) { - if ((id->match_flags & CCW_DEVICE_ID_MATCH_CU_TYPE) - && (id->cu_type != match->cu_type)) - continue; - - if ((id->match_flags & CCW_DEVICE_ID_MATCH_CU_MODEL) - && (id->cu_model != match->cu_model)) - continue; - - if ((id->match_flags & CCW_DEVICE_ID_MATCH_DEVICE_TYPE) - && (id->dev_type != match->dev_type)) - continue; - - if ((id->match_flags & CCW_DEVICE_ID_MATCH_DEVICE_MODEL) - && (id->dev_model != match->dev_model)) - continue; - - return id; - } - - return 0; -} - -/* The struct ccw device is our replacement for the globally accessible - * ioinfo array. ioinfo will mutate into a subchannel device later. - * - * Reference: Documentation/driver-model.txt */ -struct ccw_device { - spinlock_t *ccwlock; - struct ccw_device_private *private; /* cio private information */ - struct ccw_device_id id; /* id of this device, driver_info is - set by ccw_find_driver */ - struct ccw_driver *drv; /* */ - struct device dev; /* */ - int online; - /* This is sick, but a driver can have different interrupt handlers - for different ccw_devices (multi-subchannel drivers)... */ - void (*handler) (struct ccw_device *, unsigned long, struct irb *); -}; - - -/* Each ccw driver registers with the ccw root bus */ -struct ccw_driver { - struct module *owner; /* for automatic MOD_INC_USE_COUNT */ - struct ccw_device_id *ids; /* probe driver with these devs */ - int (*probe) (struct ccw_device *); /* ask driver to probe dev */ - int (*remove) (struct ccw_device *); - /* device is no longer available */ - int (*set_online) (struct ccw_device *); - int (*set_offline) (struct ccw_device *); - struct device_driver driver; /* higher level structure, don't init - this from your driver */ - char *name; -}; - -extern struct ccw_device *get_ccwdev_by_busid(struct ccw_driver *cdrv, - const char *bus_id); - -/* devices drivers call these during module load and unload. - * When a driver is registered, its probe method is called - * when new devices for its type pop up */ -extern int ccw_driver_register (struct ccw_driver *driver); -extern void ccw_driver_unregister (struct ccw_driver *driver); - -struct ccw1; - -extern int ccw_device_set_options(struct ccw_device *, unsigned long); - -/* Allow for i/o completion notification after primary interrupt status. */ -#define CCWDEV_EARLY_NOTIFICATION 0x0001 -/* Report all interrupt conditions. */ -#define CCWDEV_REPORT_ALL 0x0002 - -/* - * ccw_device_start() - * - * Start a S/390 channel program. When the interrupt arrives, the - * IRQ handler is called, either immediately, delayed (dev-end missing, - * or sense required) or never (no IRQ handler registered). - * Depending on the action taken, ccw_device_start() returns: - * 0 - Success - * -EBUSY - Device busy, or status pending - * -ENODEV - Device not operational - * -EINVAL - Device invalid for operation - */ -extern int ccw_device_start(struct ccw_device *, struct ccw1 *, - unsigned long, __u8, unsigned long); -extern int ccw_device_resume(struct ccw_device *); -extern int ccw_device_halt(struct ccw_device *, unsigned long); -extern int ccw_device_clear(struct ccw_device *, unsigned long); - -extern int read_dev_chars(struct ccw_device *cdev, void **buffer, int length); -extern int read_conf_data(struct ccw_device *cdev, void **buffer, int *length); - -extern void ccw_device_set_online(struct ccw_device *cdev); -extern void ccw_device_set_offline(struct ccw_device *cdev); - - -extern struct ciw *ccw_device_get_ciw(struct ccw_device *, __u32 cmd); -extern __u8 ccw_device_get_path_mask(struct ccw_device *); - -#define get_ccwdev_lock(x) (x)->ccwlock - -#define to_ccwdev(n) container_of(n, struct ccw_device, dev) -#define to_ccwdrv(n) container_of(n, struct ccw_driver, driver) - -extern struct ccw_device *ccw_device_probe_console(void); - -// FIXME: these have to go -extern int _ccw_device_get_device_number(struct ccw_device *); -extern int _ccw_device_get_subchannel_number(struct ccw_device *); - -#endif /* _S390_CCWDEV_H_ */ diff --git a/include/asm-s390x/ccwgroup.h b/include/asm-s390x/ccwgroup.h deleted file mode 100644 index 8b1ae774341b5..0000000000000 --- a/include/asm-s390x/ccwgroup.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef S390_CCWGROUP_H -#define S390_CCWGROUP_H - -struct ccw_device; -struct ccw_driver; - -struct ccwgroup_device { - unsigned long creator_id; /* unique number of the driver */ - enum { - CCWGROUP_OFFLINE, - CCWGROUP_ONLINE, - } state; - unsigned int count; /* number of attached slave devices */ - struct device dev; /* master device */ - struct ccw_device *cdev[0]; /* variable number, allocate as needed */ -}; - -struct ccwgroup_driver { - char *name; - int max_slaves; - unsigned long driver_id; - - int (*probe) (struct ccwgroup_device *); - int (*remove) (struct ccwgroup_device *); - int (*release) (struct ccwgroup_driver *); - int (*set_online) (struct ccwgroup_device *); - int (*set_offline) (struct ccwgroup_device *); - - struct device_driver driver; /* this driver */ -}; - -extern int ccwgroup_driver_register (struct ccwgroup_driver *cdriver); -extern void ccwgroup_driver_unregister (struct ccwgroup_driver *cdriver); -extern int ccwgroup_create (struct device *root, - unsigned int creator_id, - struct ccw_driver *gdrv, - int argc, char *argv[]); - -extern int ccwgroup_probe_ccwdev(struct ccw_device *cdev); -extern int ccwgroup_remove_ccwdev(struct ccw_device *cdev); - -#define to_ccwgroupdev(x) container_of((x), struct ccwgroup_device, dev) -#define to_ccwgroupdrv(x) container_of((x), struct ccwgroup_driver, driver) -#endif diff --git a/include/asm-s390x/checksum.h b/include/asm-s390x/checksum.h deleted file mode 100644 index d6774b735b7b2..0000000000000 --- a/include/asm-s390x/checksum.h +++ /dev/null @@ -1,195 +0,0 @@ -#ifndef _S390_CHECKSUM_H -#define _S390_CHECKSUM_H - -/* - * include/asm-s390/checksum.h - * S390 fast network checksum routines - * see also arch/S390/lib/checksum.c - * - * S390 version - * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation - * Author(s): Ulrich Hild (first version) - * Martin Schwidefsky (heavily optimized CKSM version) - * D.J. Barrow (third attempt) - */ - -#include - -/* - * computes the checksum of a memory block at buff, length len, - * and adds in "sum" (32-bit) - * - * returns a 32-bit number suitable for feeding into itself - * or csum_tcpudp_magic - * - * this function must be called with even lengths, except - * for the last fragment, which may be odd - * - * it's best to have buff aligned on a 32-bit boundary - */ -static inline unsigned int -csum_partial(const unsigned char * buff, int len, unsigned int sum) -{ - /* - * Experiments with ethernet and slip connections show that buff - * is aligned on either a 2-byte or 4-byte boundary. - */ - __asm__ __volatile__ ( - " lgr 2,%1\n" /* address in gpr 2 */ - " lgfr 3,%2\n" /* length in gpr 3 */ - "0: cksm %0,2\n" /* do checksum on longs */ - " jo 0b\n" - : "+&d" (sum) - : "d" (buff), "d" (len) - : "cc", "2", "3" ); - return sum; - -} - -/* - * csum_partial as an inline function - */ -static inline unsigned int -csum_partial_inline(const unsigned char * buff, int len, unsigned int sum) -{ - __asm__ __volatile__ ( - " lgr 2,%1\n" /* address in gpr 2 */ - " lgfr 3,%2\n" /* length in gpr 3 */ - "0: cksm %0,2\n" /* do checksum on longs */ - " jo 0b\n" - : "+&d" (sum) - : "d" (buff), "d" (len) - : "cc", "2", "3" ); - return sum; -} - -/* - * the same as csum_partial_copy, but copies from user space. - * - * here even more important to align src and dst on a 32-bit (or even - * better 64-bit) boundary - * - * Copy from userspace and compute checksum. If we catch an exception - * then zero the rest of the buffer. - */ -static inline unsigned int -csum_partial_copy_from_user (const char *src, char *dst, - int len, unsigned int sum, - int *err_ptr) -{ - int missing; - - missing = copy_from_user(dst, src, len); - if (missing) { - memset(dst + len - missing, 0, missing); - *err_ptr = -EFAULT; - } - - return csum_partial(dst, len, sum); -} - -static inline unsigned int -csum_partial_copy_nocheck (const char *src, char *dst, int len, unsigned int sum) -{ - memcpy(dst,src,len); - return csum_partial_inline(dst, len, sum); -} - -/* - * Fold a partial checksum without adding pseudo headers - */ -static inline unsigned short -csum_fold(unsigned int sum) -{ - __asm__ __volatile__ ( - " sr 3,3\n" /* %0 = H*65536 + L */ - " lr 2,%0\n" /* %0 = H L, R2/R3 = H L / 0 0 */ - " srdl 2,16\n" /* %0 = H L, R2/R3 = 0 H / L 0 */ - " alr 2,3\n" /* %0 = H L, R2/R3 = L H / L 0 */ - " alr %0,2\n" /* %0 = H+L+C L+H */ - " srl %0,16\n" /* %0 = H+L+C */ - : "+&d" (sum) : : "cc", "2", "3"); - return ((unsigned short) ~sum); -} - -/* - * This is a version of ip_compute_csum() optimized for IP headers, - * which always checksum on 4 octet boundaries. - * - */ -static inline unsigned short -ip_fast_csum(unsigned char *iph, unsigned int ihl) -{ - unsigned long sum; - - __asm__ __volatile__ ( - " slgr %0,%0\n" /* set sum to zero */ - " lgr 2,%1\n" /* address in gpr 2 */ - " lgfr 3,%2\n" /* length in gpr 3 */ - "0: cksm %0,2\n" /* do checksum on ints */ - " jo 0b\n" - : "=&d" (sum) - : "d" (iph), "d" (ihl*4) - : "cc", "2", "3" ); - return csum_fold(sum); -} - -/* - * computes the checksum of the TCP/UDP pseudo-header - * returns a 32-bit checksum - */ -static inline unsigned int -csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr, - unsigned short len, unsigned short proto, - unsigned int sum) -{ - __asm__ __volatile__ ( - " lgfr %0,%0\n" - " algr %0,%1\n" /* sum += saddr */ - " brc 12,0f\n" - " aghi %0,1\n" /* add carry */ - "0: algr %0,%2\n" /* sum += daddr */ - " brc 12,1f\n" - " aghi %0,1\n" /* add carry */ - "1: algfr %0,%3\n" /* sum += (len<<16) + proto */ - " brc 12,2f\n" - " aghi %0,1\n" /* add carry */ - "2: srlg 0,%0,32\n" - " alr %0,0\n" /* fold to 32 bits */ - " brc 12,3f\n" - " ahi %0,1\n" /* add carry */ - "3: llgfr %0,%0" - : "+&d" (sum) - : "d" (saddr), "d" (daddr), - "d" (((unsigned int) len<<16) + (unsigned int) proto) - : "cc", "0" ); - return sum; -} - -/* - * computes the checksum of the TCP/UDP pseudo-header - * returns a 16-bit checksum, already complemented - */ - -static inline unsigned short int -csum_tcpudp_magic(unsigned long saddr, unsigned long daddr, - unsigned short len, unsigned short proto, - unsigned int sum) -{ - return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); -} - -/* - * this routine is used for miscellaneous IP-like checksums, mainly - * in icmp.c - */ - -static inline unsigned short -ip_compute_csum(unsigned char * buff, int len) -{ - return csum_fold(csum_partial_inline(buff, len, 0)); -} - -#endif /* _S390_CHECKSUM_H */ - - diff --git a/include/asm-s390x/cio.h b/include/asm-s390x/cio.h deleted file mode 100644 index 208de2e5822ce..0000000000000 --- a/include/asm-s390x/cio.h +++ /dev/null @@ -1,269 +0,0 @@ -/* - * include/asm-s390/cio.h - * include/asm-s390x/cio.h - * - * Common interface for I/O on S/390 - */ -#ifndef _ASM_S390_CIO_H_ -#define _ASM_S390_CIO_H_ - -#include -#include - -#ifdef __KERNEL__ - -#define LPM_ANYPATH 0xff - -/* - * subchannel status word - */ -struct scsw { - __u32 key : 4; /* subchannel key */ - __u32 sctl : 1; /* suspend control */ - __u32 eswf : 1; /* ESW format */ - __u32 cc : 2; /* deferred condition code */ - __u32 fmt : 1; /* format */ - __u32 pfch : 1; /* prefetch */ - __u32 isic : 1; /* initial-status interruption control */ - __u32 alcc : 1; /* address-limit checking control */ - __u32 ssi : 1; /* supress-suspended interruption */ - __u32 zcc : 1; /* zero condition code */ - __u32 ectl : 1; /* extended control */ - __u32 pno : 1; /* path not operational */ - __u32 res : 1; /* reserved */ - __u32 fctl : 3; /* function control */ - __u32 actl : 7; /* activity control */ - __u32 stctl : 5; /* status control */ - __u32 cpa; /* channel program address */ - __u32 dstat : 8; /* device status */ - __u32 cstat : 8; /* subchannel status */ - __u32 count : 16; /* residual count */ -} __attribute__ ((packed)); - -#define SCSW_FCTL_CLEAR_FUNC 0x1 -#define SCSW_FCTL_HALT_FUNC 0x2 -#define SCSW_FCTL_START_FUNC 0x4 - -#define SCSW_ACTL_SUSPENDED 0x1 -#define SCSW_ACTL_DEVACT 0x2 -#define SCSW_ACTL_SCHACT 0x4 -#define SCSW_ACTL_CLEAR_PEND 0x8 -#define SCSW_ACTL_HALT_PEND 0x10 -#define SCSW_ACTL_START_PEND 0x20 -#define SCSW_ACTL_RESUME_PEND 0x40 - -#define SCSW_STCTL_STATUS_PEND 0x1 -#define SCSW_STCTL_SEC_STATUS 0x2 -#define SCSW_STCTL_PRIM_STATUS 0x4 -#define SCSW_STCTL_INTER_STATUS 0x8 -#define SCSW_STCTL_ALERT_STATUS 0x10 - -#define DEV_STAT_ATTENTION 0x80 -#define DEV_STAT_STAT_MOD 0x40 -#define DEV_STAT_CU_END 0x20 -#define DEV_STAT_BUSY 0x10 -#define DEV_STAT_CHN_END 0x08 -#define DEV_STAT_DEV_END 0x04 -#define DEV_STAT_UNIT_CHECK 0x02 -#define DEV_STAT_UNIT_EXCEP 0x01 - -#define SCHN_STAT_PCI 0x80 -#define SCHN_STAT_INCORR_LEN 0x40 -#define SCHN_STAT_PROG_CHECK 0x20 -#define SCHN_STAT_PROT_CHECK 0x10 -#define SCHN_STAT_CHN_DATA_CHK 0x08 -#define SCHN_STAT_CHN_CTRL_CHK 0x04 -#define SCHN_STAT_INTF_CTRL_CHK 0x02 -#define SCHN_STAT_CHAIN_CHECK 0x01 - -/* - * architectured values for first sense byte - */ -#define SNS0_CMD_REJECT 0x80 -#define SNS_CMD_REJECT SNS0_CMD_REJEC -#define SNS0_INTERVENTION_REQ 0x40 -#define SNS0_BUS_OUT_CHECK 0x20 -#define SNS0_EQUIPMENT_CHECK 0x10 -#define SNS0_DATA_CHECK 0x08 -#define SNS0_OVERRUN 0x04 -#define SNS0_INCOMPL_DOMAIN 0x01 - -/* - * architectured values for second sense byte - */ -#define SNS1_PERM_ERR 0x80 -#define SNS1_INV_TRACK_FORMAT 0x40 -#define SNS1_EOC 0x20 -#define SNS1_MESSAGE_TO_OPER 0x10 -#define SNS1_NO_REC_FOUND 0x08 -#define SNS1_FILE_PROTECTED 0x04 -#define SNS1_WRITE_INHIBITED 0x02 -#define SNS1_INPRECISE_END 0x01 - -/* - * architectured values for third sense byte - */ -#define SNS2_REQ_INH_WRITE 0x80 -#define SNS2_CORRECTABLE 0x40 -#define SNS2_FIRST_LOG_ERR 0x20 -#define SNS2_ENV_DATA_PRESENT 0x10 -#define SNS2_INPRECISE_END 0x04 - -struct ccw1 { - __u8 cmd_code; /* command code */ - __u8 flags; /* flags, like IDA addressing, etc. */ - __u16 count; /* byte count */ - __u32 cda; /* data address */ -} __attribute__ ((packed,aligned(8))); - -#define CCW_FLAG_DC 0x80 -#define CCW_FLAG_CC 0x40 -#define CCW_FLAG_SLI 0x20 -#define CCW_FLAG_SKIP 0x10 -#define CCW_FLAG_PCI 0x08 -#define CCW_FLAG_IDA 0x04 -#define CCW_FLAG_SUSPEND 0x02 - -#define CCW_CMD_READ_IPL 0x02 -#define CCW_CMD_NOOP 0x03 -#define CCW_CMD_BASIC_SENSE 0x04 -#define CCW_CMD_TIC 0x08 -#define CCW_CMD_SENSE_PGID 0x34 -#define CCW_CMD_SUSPEND_RECONN 0x5B -#define CCW_CMD_RDC 0x64 -#define CCW_CMD_SET_PGID 0xAF -#define CCW_CMD_SENSE_ID 0xE4 -#define CCW_CMD_DCTL 0xF3 - -#define SENSE_MAX_COUNT 0x20 - -struct erw { - __u32 res0 : 3; /* reserved */ - __u32 auth : 1; /* Authorization check */ - __u32 pvrf : 1; /* path-verification-required flag */ - __u32 cpt : 1; /* channel-path timeout */ - __u32 fsavf : 1; /* Failing storage address validity flag */ - __u32 cons : 1; /* concurrent-sense */ - __u32 scavf : 1; /* Secondary ccw address validity flag */ - __u32 fsaf : 1; /* Failing storage address format */ - __u32 scnt : 6; /* sense count if cons == 1 */ - __u32 res16 : 16; /* reserved */ -} __attribute__ ((packed)); - -/* - * subchannel logout area - */ -struct sublog { - __u32 res0 : 1; /* reserved */ - __u32 esf : 7; /* extended status flags */ - __u32 lpum : 8; /* last path used mask */ - __u32 arep : 1; /* ancillary report */ - __u32 fvf : 5; /* field-validity flags */ - __u32 sacc : 2; /* storage access code */ - __u32 termc : 2; /* termination code */ - __u32 devsc : 1; /* device-status check */ - __u32 serr : 1; /* secondary error */ - __u32 ioerr : 1; /* i/o-error alert */ - __u32 seqc : 3; /* sequence code */ -} __attribute__ ((packed)); - -/* - * Format 0 Extended Status Word (ESW) - */ -struct esw0 { - struct sublog sublog; /* subchannel logout */ - struct erw erw; /* extended report word */ - __u32 faddr[2]; /* failing storage address */ - __u32 saddr; /* secondary ccw address */ -} __attribute__ ((packed)); - -/* - * Format 1 Extended Status Word (ESW) - */ -struct esw1 { - __u8 zero0; /* reserved zeros */ - __u8 lpum; /* last path used mask */ - __u16 zero16; /* reserved zeros */ - struct erw erw; /* extended report word */ - __u32 zeros[3]; /* 2 fullwords of zeros */ -} __attribute__ ((packed)); - -/* - * Format 2 Extended Status Word (ESW) - */ -struct esw2 { - __u8 zero0; /* reserved zeros */ - __u8 lpum; /* last path used mask */ - __u16 dcti; /* device-connect-time interval */ - struct erw erw; /* extended report word */ - __u32 zeros[3]; /* 2 fullwords of zeros */ -} __attribute__ ((packed)); - -/* - * Format 3 Extended Status Word (ESW) - */ -struct esw3 { - __u8 zero0; /* reserved zeros */ - __u8 lpum; /* last path used mask */ - __u16 res; /* reserved */ - struct erw erw; /* extended report word */ - __u32 zeros[3]; /* 2 fullwords of zeros */ -} __attribute__ ((packed)); - -/* - * interruption response block - */ -struct irb { - struct scsw scsw; /* subchannel status word */ - union { /* extended status word, 4 formats */ - struct esw0 esw0; - struct esw1 esw1; - struct esw2 esw2; - struct esw3 esw3; - } esw; - __u8 ecw[32]; /* extended control word */ -} __attribute__ ((packed,aligned(4))); - -/* - * command information word (CIW) layout - */ -struct ciw { - __u32 et : 2; /* entry type */ - __u32 reserved : 2; /* reserved */ - __u32 ct : 4; /* command type */ - __u32 cmd : 8; /* command */ - __u32 count : 16; /* coun */ -} __attribute__ ((packed)); - -#define CIW_TYPE_RCD 0x0 /* read configuration data */ -#define CIW_TYPE_SII 0x1 /* set interface identifier */ -#define CIW_TYPE_RNI 0x2 /* read node identifier */ - -/* - * Flags used as input parameters for do_IO() - */ -#define DOIO_ALLOW_SUSPEND 0x0001 /* allow for channel prog. suspend */ -#define DOIO_DENY_PREFETCH 0x0002 /* don't allow for CCW prefetch */ -#define DOIO_SUPPRESS_INTER 0x0004 /* suppress intermediate inter. */ - /* ... for suspended CCWs */ - -struct diag210 { - __u16 vrdcdvno : 16; /* device number (input) */ - __u16 vrdclen : 16; /* data block length (input) */ - __u32 vrdcvcla : 8; /* virtual device class (output) */ - __u32 vrdcvtyp : 8; /* virtual device type (output) */ - __u32 vrdcvsta : 8; /* virtual device status (output) */ - __u32 vrdcvfla : 8; /* virtual device flags (output) */ - __u32 vrdcrccl : 8; /* real device class (output) */ - __u32 vrdccrty : 8; /* real device type (output) */ - __u32 vrdccrmd : 8; /* real device model (output) */ - __u32 vrdccrft : 8; /* real device feature (output) */ -} __attribute__ ((packed,aligned(4))); - -extern int diag210(struct diag210 *addr); - -extern void wait_cons_dev(void); - -#endif - -#endif diff --git a/include/asm-s390x/compat.h b/include/asm-s390x/compat.h deleted file mode 100644 index 55966b41d2908..0000000000000 --- a/include/asm-s390x/compat.h +++ /dev/null @@ -1,122 +0,0 @@ -#ifndef _ASM_S390X_COMPAT_H -#define _ASM_S390X_COMPAT_H -/* - * Architecture specific compatibility types - */ -#include - -#define COMPAT_USER_HZ 100 - -typedef u32 compat_size_t; -typedef s32 compat_ssize_t; -typedef s32 compat_time_t; -typedef s32 compat_clock_t; -typedef s32 compat_pid_t; -typedef u16 compat_uid_t; -typedef u16 compat_gid_t; -typedef u16 compat_mode_t; -typedef u32 compat_ino_t; -typedef u16 compat_dev_t; -typedef s32 compat_off_t; -typedef s64 compat_loff_t; -typedef u16 compat_nlink_t; -typedef u16 compat_ipc_pid_t; -typedef s32 compat_daddr_t; -typedef u32 compat_caddr_t; -typedef __kernel_fsid_t compat_fsid_t; - -typedef s32 compat_int_t; -typedef s32 compat_long_t; -typedef u32 compat_uint_t; -typedef u32 compat_ulong_t; - -struct compat_timespec { - compat_time_t tv_sec; - s32 tv_nsec; -}; - -struct compat_timeval { - compat_time_t tv_sec; - s32 tv_usec; -}; - -struct compat_stat { - compat_dev_t st_dev; - u16 __pad1; - compat_ino_t st_ino; - compat_mode_t st_mode; - compat_nlink_t st_nlink; - compat_uid_t st_uid; - compat_gid_t st_gid; - compat_dev_t st_rdev; - u16 __pad2; - u32 st_size; - u32 st_blksize; - u32 st_blocks; - u32 st_atime; - u32 st_atime_nsec; - u32 st_mtime; - u32 st_mtime_nsec; - u32 st_ctime; - u32 st_ctime_nsec; - u32 __unused4; - u32 __unused5; -}; - -struct compat_flock { - short l_type; - short l_whence; - compat_off_t l_start; - compat_off_t l_len; - compat_pid_t l_pid; -}; - -#define F_GETLK64 12 -#define F_SETLK64 13 -#define F_SETLKW64 14 - -struct compat_flock64 { - short l_type; - short l_whence; - compat_loff_t l_start; - compat_loff_t l_len; - compat_pid_t l_pid; -}; - -struct compat_statfs { - s32 f_type; - s32 f_bsize; - s32 f_blocks; - s32 f_bfree; - s32 f_bavail; - s32 f_files; - s32 f_ffree; - compat_fsid_t f_fsid; - s32 f_namelen; - s32 f_spare[6]; -}; - -typedef u32 compat_old_sigset_t; /* at least 32 bits */ - -#define _COMPAT_NSIG 64 -#define _COMPAT_NSIG_BPW 32 - -typedef u32 compat_sigset_word; - -#define COMPAT_OFF_T_MAX 0x7fffffff -#define COMPAT_LOFF_T_MAX 0x7fffffffffffffffL - -/* - * A pointer passed in from user mode. This should not - * be used for syscall parameters, just declare them - * as pointers because the syscall entry code will have - * appropriately comverted them already. - */ -typedef u32 compat_uptr_t; - -static inline void *compat_ptr(compat_uptr_t uptr) -{ - return (void *)(unsigned long)(uptr & 0x7fffffffUL); -} - -#endif /* _ASM_S390X_COMPAT_H */ diff --git a/include/asm-s390x/cpcmd.h b/include/asm-s390x/cpcmd.h deleted file mode 100644 index 38b88d9eaf368..0000000000000 --- a/include/asm-s390x/cpcmd.h +++ /dev/null @@ -1,14 +0,0 @@ -/* - * arch/s390/kernel/cpcmd.h - * - * S390 version - * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation - * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com), - */ - -#ifndef __CPCMD__ -#define __CPCMD__ - -extern void cpcmd(char *cmd, char *response, int rlen); - -#endif diff --git a/include/asm-s390x/current.h b/include/asm-s390x/current.h deleted file mode 100644 index b8b52049cf8fb..0000000000000 --- a/include/asm-s390x/current.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * include/asm-s390/current.h - * - * S390 version - * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation - * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com) - * - * Derived from "include/asm-i386/current.h" - */ - -#ifndef _S390_CURRENT_H -#define _S390_CURRENT_H - -#ifdef __KERNEL__ - -#include - -struct task_struct; - -static inline struct task_struct * get_current(void) -{ - return current_thread_info()->task; -} - -#define current get_current() - -#endif - -#endif /* !(_S390_CURRENT_H) */ diff --git a/include/asm-s390x/dasd.h b/include/asm-s390x/dasd.h deleted file mode 100644 index b8b3d6c1d35b9..0000000000000 --- a/include/asm-s390x/dasd.h +++ /dev/null @@ -1,268 +0,0 @@ -/* - * File...........: linux/drivers/s390/block/dasd.c - * Author(s)......: Holger Smolinski - * Bugreports.to..: - * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999,2000 - * - * This file is the interface of the DASD device driver, which is exported to user space - * any future changes wrt the API will result in a change of the APIVERSION reported - * to userspace by the DASDAPIVER-ioctl - * - * $Revision: 1.3 $ - * - * History of changes (starts July 2000) - * 05/04/01 created by moving the kernel interface to drivers/s390/block/dasd_int.h - * 12/06/01 DASD_API_VERSION 2 - binary compatible to 0 (new BIODASDINFO2) - * 01/23/02 DASD_API_VERSION 3 - added BIODASDPSRD (and BIODASDENAPAV) IOCTL - * 02/15/02 DASD_API_VERSION 4 - added BIODASDSATTR IOCTL - * ##/##/## DASD_API_VERSION 5 - added boxed dasd support TOBEDONE - * 21/06/02 DASD_API_VERSION 6 - fixed HDIO_GETGEO: geo.start is in sectors! - * - */ - -#ifndef DASD_H -#define DASD_H -#include - -#define DASD_IOCTL_LETTER 'D' - -#define DASD_API_VERSION 6 - -/* - * struct dasd_information2_t - * represents any data about the device, which is visible to userspace. - * including foramt and featueres. - */ -typedef struct dasd_information2_t { - unsigned int devno; /* S/390 devno */ - unsigned int real_devno; /* for aliases */ - unsigned int schid; /* S/390 subchannel identifier */ - unsigned int cu_type : 16; /* from SenseID */ - unsigned int cu_model : 8; /* from SenseID */ - unsigned int dev_type : 16; /* from SenseID */ - unsigned int dev_model : 8; /* from SenseID */ - unsigned int open_count; - unsigned int req_queue_len; - unsigned int chanq_len; /* length of chanq */ - char type[4]; /* from discipline.name, 'none' for unknown */ - unsigned int status; /* current device level */ - unsigned int label_block; /* where to find the VOLSER */ - unsigned int FBA_layout; /* fixed block size (like AIXVOL) */ - unsigned int characteristics_size; - unsigned int confdata_size; - char characteristics[64]; /* from read_device_characteristics */ - char configuration_data[256]; /* from read_configuration_data */ - unsigned int format; /* format info like formatted/cdl/ldl/... */ - unsigned int features; /* dasd features like 'ro',... */ - unsigned int reserved0; /* reserved for further use ,... */ - unsigned int reserved1; /* reserved for further use ,... */ - unsigned int reserved2; /* reserved for further use ,... */ - unsigned int reserved3; /* reserved for further use ,... */ - unsigned int reserved4; /* reserved for further use ,... */ - unsigned int reserved5; /* reserved for further use ,... */ - unsigned int reserved6; /* reserved for further use ,... */ - unsigned int reserved7; /* reserved for further use ,... */ -} dasd_information2_t; - -/* - * values to be used for dasd_information_t.format - * 0x00: NOT formatted - * 0x01: Linux disc layout - * 0x02: Common disc layout - */ -#define DASD_FORMAT_NONE 0 -#define DASD_FORMAT_LDL 1 -#define DASD_FORMAT_CDL 2 -/* - * values to be used for dasd_information_t.features - * 0x00: default features - * 0x01: readonly (ro) - */ -#define DASD_FEATURE_DEFAULT 0 -#define DASD_FEATURE_READONLY 1 - -#define DASD_PARTN_BITS 2 - -/* - * struct dasd_information_t - * represents any data about the data, which is visible to userspace - */ -typedef struct dasd_information_t { - unsigned int devno; /* S/390 devno */ - unsigned int real_devno; /* for aliases */ - unsigned int schid; /* S/390 subchannel identifier */ - unsigned int cu_type : 16; /* from SenseID */ - unsigned int cu_model : 8; /* from SenseID */ - unsigned int dev_type : 16; /* from SenseID */ - unsigned int dev_model : 8; /* from SenseID */ - unsigned int open_count; - unsigned int req_queue_len; - unsigned int chanq_len; /* length of chanq */ - char type[4]; /* from discipline.name, 'none' for unknown */ - unsigned int status; /* current device level */ - unsigned int label_block; /* where to find the VOLSER */ - unsigned int FBA_layout; /* fixed block size (like AIXVOL) */ - unsigned int characteristics_size; - unsigned int confdata_size; - char characteristics[64]; /* from read_device_characteristics */ - char configuration_data[256]; /* from read_configuration_data */ -} dasd_information_t; - -/* - * Read Subsystem Data - Perfomance Statistics - */ -typedef struct dasd_rssd_perf_stats_t { - unsigned char invalid:1; - unsigned char format:3; - unsigned char data_format:4; - unsigned char unit_address; - unsigned short device_status; - unsigned int nr_read_normal; - unsigned int nr_read_normal_hits; - unsigned int nr_write_normal; - unsigned int nr_write_fast_normal_hits; - unsigned int nr_read_seq; - unsigned int nr_read_seq_hits; - unsigned int nr_write_seq; - unsigned int nr_write_fast_seq_hits; - unsigned int nr_read_cache; - unsigned int nr_read_cache_hits; - unsigned int nr_write_cache; - unsigned int nr_write_fast_cache_hits; - unsigned int nr_inhibit_cache; - unsigned int nr_bybass_cache; - unsigned int nr_seq_dasd_to_cache; - unsigned int nr_dasd_to_cache; - unsigned int nr_cache_to_dasd; - unsigned int nr_delayed_fast_write; - unsigned int nr_normal_fast_write; - unsigned int nr_seq_fast_write; - unsigned int nr_cache_miss; - unsigned char status2; - unsigned int nr_quick_write_promotes; - unsigned char reserved; - unsigned short ssid; - unsigned char reseved2[96]; -} __attribute__((packed)) dasd_rssd_perf_stats_t; - -/* - * struct profile_info_t - * holds the profinling information - */ -typedef struct dasd_profile_info_t { - unsigned int dasd_io_reqs; /* number of requests processed at all */ - unsigned int dasd_io_sects; /* number of sectors processed at all */ - unsigned int dasd_io_secs[32]; /* histogram of request's sizes */ - unsigned int dasd_io_times[32]; /* histogram of requests's times */ - unsigned int dasd_io_timps[32]; /* histogram of requests's times per sector */ - unsigned int dasd_io_time1[32]; /* histogram of time from build to start */ - unsigned int dasd_io_time2[32]; /* histogram of time from start to irq */ - unsigned int dasd_io_time2ps[32]; /* histogram of time from start to irq */ - unsigned int dasd_io_time3[32]; /* histogram of time from irq to end */ - unsigned int dasd_io_nr_req[32]; /* histogram of # of requests in chanq */ -} dasd_profile_info_t; - -/* - * struct format_data_t - * represents all data necessary to format a dasd - */ -typedef struct format_data_t { - int start_unit; /* from track */ - int stop_unit; /* to track */ - int blksize; /* sectorsize */ - int intensity; -} format_data_t; - -/* - * values to be used for format_data_t.intensity - * 0/8: normal format - * 1/9: also write record zero - * 3/11: also write home address - * 4/12: invalidate track - */ -#define DASD_FMT_INT_FMT_R0 1 /* write record zero */ -#define DASD_FMT_INT_FMT_HA 2 /* write home address, also set FMT_R0 ! */ -#define DASD_FMT_INT_INVAL 4 /* invalidate tracks */ -#define DASD_FMT_INT_COMPAT 8 /* use OS/390 compatible disk layout */ - - -/* - * struct attrib_data_t - * represents the operation (cache) bits for the device. - * Used in DE to influence caching of the DASD. - */ -typedef struct attrib_data_t { - unsigned char operation:3; /* cache operation mode */ - unsigned char reserved:5; /* cache operation mode */ - __u16 nr_cyl; /* no of cyliners for read ahaed */ - __u8 reserved2[29]; /* for future use */ -} __attribute__ ((packed)) attrib_data_t; - -/* definition of operation (cache) bits within attributes of DE */ -#define DASD_NORMAL_CACHE 0x0 -#define DASD_BYPASS_CACHE 0x1 -#define DASD_INHIBIT_LOAD 0x2 -#define DASD_SEQ_ACCESS 0x3 -#define DASD_SEQ_PRESTAGE 0x4 -#define DASD_REC_ACCESS 0x5 - - -/******************************************************************************** - * SECTION: Definition of IOCTLs - * - * Here ist how the ioctl-nr should be used: - * 0 - 31 DASD driver itself - * 32 - 239 still open - * 240 - 255 reserved for EMC - *******************************************************************************/ - -/* Disable the volume (for Linux) */ -#define BIODASDDISABLE _IO(DASD_IOCTL_LETTER,0) -/* Enable the volume (for Linux) */ -#define BIODASDENABLE _IO(DASD_IOCTL_LETTER,1) -/* Issue a reserve/release command, rsp. */ -#define BIODASDRSRV _IO(DASD_IOCTL_LETTER,2) /* reserve */ -#define BIODASDRLSE _IO(DASD_IOCTL_LETTER,3) /* release */ -#define BIODASDSLCK _IO(DASD_IOCTL_LETTER,4) /* steal lock */ -/* reset profiling information of a device */ -#define BIODASDPRRST _IO(DASD_IOCTL_LETTER,5) - - -/* retrieve API version number */ -#define DASDAPIVER _IOR(DASD_IOCTL_LETTER,0,int) -/* Get information on a dasd device */ -#define BIODASDINFO _IOR(DASD_IOCTL_LETTER,1,dasd_information_t) -/* retrieve profiling information of a device */ -#define BIODASDPRRD _IOR(DASD_IOCTL_LETTER,2,dasd_profile_info_t) -/* Get information on a dasd device (enhanced) */ -#define BIODASDINFO2 _IOR(DASD_IOCTL_LETTER,3,dasd_information2_t) -/* Performance Statistics Read */ -#define BIODASDPSRD _IOR(DASD_IOCTL_LETTER,4,dasd_rssd_perf_stats_t) - - -/* #define BIODASDFORMAT _IOW(IOCTL_LETTER,0,format_data_t) , deprecated */ -#define BIODASDFMT _IOW(DASD_IOCTL_LETTER,1,format_data_t) -/* Set Attributes (cache operations) */ -#define BIODASDSATTR _IOW(DASD_IOCTL_LETTER,2,attrib_data_t) - - -#endif /* DASD_H */ - -/* - * Overrides for Emacs so that we follow Linus's tabbing style. - * Emacs will notice this stuff at the end of the file and automatically - * adjust the settings for this buffer only. This must remain at the end - * of the file. - * --------------------------------------------------------------------------- - * Local variables: - * c-indent-level: 4 - * c-brace-imaginary-offset: 0 - * c-brace-offset: -4 - * c-argdecl-indent: 4 - * c-label-offset: -4 - * c-continued-statement-offset: 4 - * c-continued-brace-offset: 0 - * indent-tabs-mode: nil - * tab-width: 8 - * End: - */ diff --git a/include/asm-s390x/debug.h b/include/asm-s390x/debug.h deleted file mode 100644 index 2b3964b862833..0000000000000 --- a/include/asm-s390x/debug.h +++ /dev/null @@ -1,271 +0,0 @@ -/* - * include/asm-s390/debug.h - * S/390 debug facility - * - * Copyright (C) 1999, 2000 IBM Deutschland Entwicklung GmbH, - * IBM Corporation - */ - -#ifndef DEBUG_H -#define DEBUG_H - -#include - -/* Note: - * struct __debug_entry must be defined outside of #ifdef __KERNEL__ - * in order to allow a user program to analyze the 'raw'-view. - */ - -struct __debug_entry{ - union { - struct { - unsigned long long clock:52; - unsigned long long exception:1; - unsigned long long level:3; - unsigned long long cpuid:8; - } fields; - - unsigned long long stck; - } id; - void* caller; -} __attribute__((packed)); - - -#define __DEBUG_FEATURE_VERSION 1 /* version of debug feature */ - -#ifdef __KERNEL__ -#include -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0)) - #include -#else - #include -#endif /* LINUX_VERSION_CODE */ -#include -#include -#include - -#define DEBUG_MAX_LEVEL 6 /* debug levels range from 0 to 6 */ -#define DEBUG_OFF_LEVEL -1 /* level where debug is switched off */ -#define DEBUG_FLUSH_ALL -1 /* parameter to flush all areas */ -#define DEBUG_MAX_VIEWS 10 /* max number of views in proc fs */ -#define DEBUG_MAX_PROCF_LEN 16 /* max length for a proc file name */ -#define DEBUG_DEFAULT_LEVEL 3 /* initial debug level */ - -#define DEBUG_DIR_ROOT "s390dbf" /* name of debug root directory in proc fs */ - -#define DEBUG_DATA(entry) (char*)(entry + 1) /* data is stored behind */ - /* the entry information */ - -#define STCK(x) asm volatile ("STCK 0(%1)" : "=m" (x) : "a" (&(x)) : "cc") - -typedef struct __debug_entry debug_entry_t; - -struct debug_view; - -typedef struct debug_info { - struct debug_info* next; - struct debug_info* prev; - atomic_t ref_count; - spinlock_t lock; - int level; - int nr_areas; - int page_order; - int buf_size; - int entry_size; - debug_entry_t** areas; - int active_area; - int *active_entry; - struct proc_dir_entry* proc_root_entry; - struct proc_dir_entry* proc_entries[DEBUG_MAX_VIEWS]; - struct debug_view* views[DEBUG_MAX_VIEWS]; - char name[DEBUG_MAX_PROCF_LEN]; -} debug_info_t; - -typedef int (debug_header_proc_t) (debug_info_t* id, - struct debug_view* view, - int area, - debug_entry_t* entry, - char* out_buf); - -typedef int (debug_format_proc_t) (debug_info_t* id, - struct debug_view* view, char* out_buf, - const char* in_buf); -typedef int (debug_prolog_proc_t) (debug_info_t* id, - struct debug_view* view, - char* out_buf); -typedef int (debug_input_proc_t) (debug_info_t* id, - struct debug_view* view, - struct file* file, const char* user_buf, - size_t in_buf_size, loff_t* offset); - -int debug_dflt_header_fn(debug_info_t* id, struct debug_view* view, - int area, debug_entry_t* entry, char* out_buf); - -struct debug_view { - char name[DEBUG_MAX_PROCF_LEN]; - debug_prolog_proc_t* prolog_proc; - debug_header_proc_t* header_proc; - debug_format_proc_t* format_proc; - debug_input_proc_t* input_proc; - void* private_data; -}; - -extern struct debug_view debug_hex_ascii_view; -extern struct debug_view debug_raw_view; -extern struct debug_view debug_sprintf_view; - -/* do NOT use the _common functions */ - -debug_entry_t* debug_event_common(debug_info_t* id, int level, - const void* data, int length); - -debug_entry_t* debug_exception_common(debug_info_t* id, int level, - const void* data, int length); - -/* Debug Feature API: */ - -debug_info_t* debug_register(char* name, int pages_index, int nr_areas, - int buf_size); - -void debug_unregister(debug_info_t* id); - -void debug_set_level(debug_info_t* id, int new_level); - -extern inline debug_entry_t* -debug_event(debug_info_t* id, int level, void* data, int length) -{ - if ((!id) || (level > id->level)) return NULL; - return debug_event_common(id,level,data,length); -} - -extern inline debug_entry_t* -debug_int_event(debug_info_t* id, int level, unsigned int tag) -{ - unsigned int t=tag; - if ((!id) || (level > id->level)) return NULL; - return debug_event_common(id,level,&t,sizeof(unsigned int)); -} - -extern inline debug_entry_t * -debug_long_event (debug_info_t* id, int level, unsigned long tag) -{ - unsigned long t=tag; - if ((!id) || (level > id->level)) return NULL; - return debug_event_common(id,level,&t,sizeof(unsigned long)); -} - -extern inline debug_entry_t* -debug_text_event(debug_info_t* id, int level, const char* txt) -{ - if ((!id) || (level > id->level)) return NULL; - return debug_event_common(id,level,txt,strlen(txt)); -} - -extern debug_entry_t * -debug_sprintf_event(debug_info_t* id,int level,char *string,...) - __attribute__ ((format(printf, 3, 4))); - - -extern inline debug_entry_t* -debug_exception(debug_info_t* id, int level, void* data, int length) -{ - if ((!id) || (level > id->level)) return NULL; - return debug_exception_common(id,level,data,length); -} - -extern inline debug_entry_t* -debug_int_exception(debug_info_t* id, int level, unsigned int tag) -{ - unsigned int t=tag; - if ((!id) || (level > id->level)) return NULL; - return debug_exception_common(id,level,&t,sizeof(unsigned int)); -} - -extern inline debug_entry_t * -debug_long_exception (debug_info_t* id, int level, unsigned long tag) -{ - unsigned long t=tag; - if ((!id) || (level > id->level)) return NULL; - return debug_exception_common(id,level,&t,sizeof(unsigned long)); -} - -extern inline debug_entry_t* -debug_text_exception(debug_info_t* id, int level, const char* txt) -{ - if ((!id) || (level > id->level)) return NULL; - return debug_exception_common(id,level,txt,strlen(txt)); -} - - -extern debug_entry_t * -debug_sprintf_exception(debug_info_t* id,int level,char *string,...) - __attribute__ ((format(printf, 3, 4))); - -int debug_register_view(debug_info_t* id, struct debug_view* view); -int debug_unregister_view(debug_info_t* id, struct debug_view* view); - -/* - define the debug levels: - - 0 No debugging output to console or syslog - - 1 Log internal errors to syslog, ignore check conditions - - 2 Log internal errors and check conditions to syslog - - 3 Log internal errors to console, log check conditions to syslog - - 4 Log internal errors and check conditions to console - - 5 panic on internal errors, log check conditions to console - - 6 panic on both, internal errors and check conditions - */ - -#ifndef DEBUG_LEVEL -#define DEBUG_LEVEL 4 -#endif - -#define INTERNAL_ERRMSG(x,y...) "E" __FILE__ "%d: " x, __LINE__, y -#define INTERNAL_WRNMSG(x,y...) "W" __FILE__ "%d: " x, __LINE__, y -#define INTERNAL_INFMSG(x,y...) "I" __FILE__ "%d: " x, __LINE__, y -#define INTERNAL_DEBMSG(x,y...) "D" __FILE__ "%d: " x, __LINE__, y - -#if DEBUG_LEVEL > 0 -#define PRINT_DEBUG(x...) printk ( KERN_DEBUG PRINTK_HEADER x ) -#define PRINT_INFO(x...) printk ( KERN_INFO PRINTK_HEADER x ) -#define PRINT_WARN(x...) printk ( KERN_WARNING PRINTK_HEADER x ) -#define PRINT_ERR(x...) printk ( KERN_ERR PRINTK_HEADER x ) -#define PRINT_FATAL(x...) panic ( PRINTK_HEADER x ) -#else -#define PRINT_DEBUG(x...) printk ( KERN_DEBUG PRINTK_HEADER x ) -#define PRINT_INFO(x...) printk ( KERN_DEBUG PRINTK_HEADER x ) -#define PRINT_WARN(x...) printk ( KERN_DEBUG PRINTK_HEADER x ) -#define PRINT_ERR(x...) printk ( KERN_DEBUG PRINTK_HEADER x ) -#define PRINT_FATAL(x...) printk ( KERN_DEBUG PRINTK_HEADER x ) -#endif /* DASD_DEBUG */ - -#if DASD_DEBUG > 4 -#define INTERNAL_ERROR(x...) PRINT_FATAL ( INTERNAL_ERRMSG ( x ) ) -#elif DASD_DEBUG > 2 -#define INTERNAL_ERROR(x...) PRINT_ERR ( INTERNAL_ERRMSG ( x ) ) -#elif DASD_DEBUG > 0 -#define INTERNAL_ERROR(x...) PRINT_WARN ( INTERNAL_ERRMSG ( x ) ) -#else -#define INTERNAL_ERROR(x...) -#endif /* DASD_DEBUG */ - -#if DASD_DEBUG > 5 -#define INTERNAL_CHECK(x...) PRINT_FATAL ( INTERNAL_CHKMSG ( x ) ) -#elif DASD_DEBUG > 3 -#define INTERNAL_CHECK(x...) PRINT_ERR ( INTERNAL_CHKMSG ( x ) ) -#elif DASD_DEBUG > 1 -#define INTERNAL_CHECK(x...) PRINT_WARN ( INTERNAL_CHKMSG ( x ) ) -#else -#define INTERNAL_CHECK(x...) -#endif /* DASD_DEBUG */ - -#undef DEBUG_MALLOC -#ifdef DEBUG_MALLOC -void *b; -#define kmalloc(x...) (PRINT_INFO(" kmalloc %p\n",b=kmalloc(x)),b) -#define kfree(x) PRINT_INFO(" kfree %p\n",x);kfree(x) -#define get_zeroed_page(x...) (PRINT_INFO(" gfp %p\n",b=get_zeroed_page(x)),b) -#define __get_free_pages(x...) (PRINT_INFO(" gfps %p\n",b=__get_free_pages(x)),b) -#endif /* DEBUG_MALLOC */ - -#endif /* __KERNEL__ */ -#endif /* DEBUG_H */ diff --git a/include/asm-s390x/delay.h b/include/asm-s390x/delay.h deleted file mode 100644 index 6a0ffc8b45417..0000000000000 --- a/include/asm-s390x/delay.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * include/asm-s390/delay.h - * - * S390 version - * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation - * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com) - * - * Derived from "include/asm-i386/delay.h" - * Copyright (C) 1993 Linus Torvalds - * - * Delay routines calling functions in arch/s390x/lib/delay.c - */ - -#ifndef _S390_DELAY_H -#define _S390_DELAY_H - -extern void __udelay(unsigned long usecs); -extern void __delay(unsigned long loops); - -#define udelay(n) __udelay(n) - -#endif /* defined(_S390_DELAY_H) */ diff --git a/include/asm-s390x/div64.h b/include/asm-s390x/div64.h deleted file mode 100644 index 17824b1a2e5cd..0000000000000 --- a/include/asm-s390x/div64.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef __S390_DIV64 -#define __S390_DIV64 - -#define do_div(n,base) ({ \ -int __res; \ -__res = ((unsigned long) n) % (unsigned) base; \ -n = ((unsigned long) n) / (unsigned) base; \ -__res; }) - -#endif diff --git a/include/asm-s390x/dma-mapping.h b/include/asm-s390x/dma-mapping.h deleted file mode 100644 index e7e16901f686b..0000000000000 --- a/include/asm-s390x/dma-mapping.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/include/asm-s390x/dma.h b/include/asm-s390x/dma.h deleted file mode 100644 index ac8537e403497..0000000000000 --- a/include/asm-s390x/dma.h +++ /dev/null @@ -1,18 +0,0 @@ -/* - * include/asm-s390x/dma.h - * - * S390 version - */ - -#ifndef _ASM_DMA_H -#define _ASM_DMA_H - -#include /* need byte IO */ - -/* The I/O subsystem can access only memory below 2GB. - We use the existing DMA zone mechanism to handle this. */ -#define MAX_DMA_ADDRESS 0x80000000 - -#define free_dma(x) - -#endif /* _ASM_DMA_H */ diff --git a/include/asm-s390x/ebcdic.h b/include/asm-s390x/ebcdic.h deleted file mode 100644 index b26ac484d54ad..0000000000000 --- a/include/asm-s390x/ebcdic.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * include/asm-s390/ebcdic.h - * EBCDIC -> ASCII, ASCII -> EBCDIC conversion routines. - * - * S390 version - * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation - * Author(s): Martin Schwidefsky - */ - -#ifndef _EBCDIC_H -#define _EBCDIC_H - -#ifndef _S390_TYPES_H -#include -#endif - -extern __u8 _ascebc_500[]; /* ASCII -> EBCDIC 500 conversion table */ -extern __u8 _ebcasc_500[]; /* EBCDIC 500 -> ASCII conversion table */ -extern __u8 _ascebc[]; /* ASCII -> EBCDIC conversion table */ -extern __u8 _ebcasc[]; /* EBCDIC -> ASCII conversion table */ -extern __u8 _ebc_tolower[]; /* EBCDIC -> lowercase */ -extern __u8 _ebc_toupper[]; /* EBCDIC -> uppercase */ - -extern __inline__ void -codepage_convert(const __u8 *codepage, volatile __u8 * addr, unsigned long nr) -{ - if (nr-- <= 0) - return; - __asm__ __volatile__( - " bras 1,1f\n" - " tr 0(1,%0),0(%2)\n" - "0: tr 0(256,%0),0(%2)\n" - " la %0,256(%0)\n" - "1: ahi %1,-256\n" - " jnm 0b\n" - " ex %1,0(1)" - : "+&a" (addr), "+&a" (nr) - : "a" (codepage) : "cc", "memory", "1" ); -} - -#define ASCEBC(addr,nr) codepage_convert(_ascebc, addr, nr) -#define EBCASC(addr,nr) codepage_convert(_ebcasc, addr, nr) -#define ASCEBC_500(addr,nr) codepage_convert(_ascebc_500, addr, nr) -#define EBCASC_500(addr,nr) codepage_convert(_ebcasc_500, addr, nr) -#define EBC_TOLOWER(addr,nr) codepage_convert(_ebc_tolower, addr, nr) -#define EBC_TOUPPER(addr,nr) codepage_convert(_ebc_toupper, addr, nr) - -#endif - diff --git a/include/asm-s390x/elf.h b/include/asm-s390x/elf.h deleted file mode 100644 index 719d0afdc21d5..0000000000000 --- a/include/asm-s390x/elf.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * include/asm-s390/elf.h - * - * S390 version - * - * Derived from "include/asm-i386/elf.h" - */ - -#ifndef __ASMS390_ELF_H -#define __ASMS390_ELF_H - -/* - * ELF register definitions.. - */ - -#include -#include - - -typedef s390_fp_regs elf_fpregset_t; -typedef s390_regs elf_gregset_t; - -/* - * These are used to set parameters in the core dumps. - */ -#define ELF_CLASS ELFCLASS64 -#define ELF_DATA ELFDATA2MSB -#define ELF_ARCH EM_S390 - -/* - * This is used to ensure we don't load something for the wrong architecture. - */ -#define elf_check_arch(x) \ - (((x)->e_machine == EM_S390 || (x)->e_machine == EM_S390_OLD) \ - && (x)->e_ident[EI_CLASS] == ELF_CLASS) - -/* For SVR4/S390 the function pointer to be registered with `atexit` is - passed in R14. */ -#define ELF_PLAT_INIT(_r, load_addr) \ - do { \ - _r->gprs[14] = 0; \ - clear_thread_flag(TIF_31BIT); \ - } while(0) - -#define USE_ELF_CORE_DUMP -#define ELF_EXEC_PAGESIZE 4096 - -/* This is the location that an ET_DYN program is loaded if exec'ed. Typical - use of this is to invoke "./ld.so someprog" to test out a new version of - the loader. We need to make sure that it is out of the way of the program - that it will "exec", and that there is sufficient room for the brk. */ - -#define ELF_ET_DYN_BASE (TASK_SIZE / 3 * 2) - -/* Wow, the "main" arch needs arch dependent functions too.. :) */ - -/* regs is struct pt_regs, pr_reg is elf_gregset_t (which is - now struct_user_regs, they are different) */ - -#define ELF_CORE_COPY_REGS(pr_reg, regs) \ - memcpy(&pr_reg,regs,sizeof(elf_gregset_t)); \ - - - -/* This yields a mask that user programs can use to figure out what - instruction set this CPU supports. */ - -#define ELF_HWCAP (0) - -/* This yields a string that ld.so will use to load implementation - specific libraries for optimization. This is more specific in - intent than poking at uname or /proc/cpuinfo. - - For the moment, we have only optimizations for the Intel generations, - but that could change... */ - -#define ELF_PLATFORM (NULL) - -#ifdef __KERNEL__ -#define SET_PERSONALITY(ex, ibcs2) \ -do { \ - if (ibcs2) \ - set_personality(PER_SVR4); \ - else if (current->personality != PER_LINUX32) \ - set_personality(PER_LINUX); \ - clear_thread_flag(TIF_31BIT); \ -} while (0) -#endif - -#endif diff --git a/include/asm-s390x/errno.h b/include/asm-s390x/errno.h deleted file mode 100644 index 467a900b8ddeb..0000000000000 --- a/include/asm-s390x/errno.h +++ /dev/null @@ -1,12 +0,0 @@ -/* - * include/asm-s390/errno.h - * - * S390 version - */ - -#ifndef _S390_ERRNO_H -#define _S390_ERRNO_H - -#include - -#endif diff --git a/include/asm-s390x/fcntl.h b/include/asm-s390x/fcntl.h deleted file mode 100644 index eff0a9fc98e91..0000000000000 --- a/include/asm-s390x/fcntl.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * include/asm-s390/fcntl.h - * - * S390 version - * - * Derived from "include/asm-i386/fcntl.h" - */ -#ifndef _S390_FCNTL_H -#define _S390_FCNTL_H - -/* open/fcntl - O_SYNC is only implemented on blocks devices and on files - located on an ext2 file system */ -#define O_ACCMODE 0003 -#define O_RDONLY 00 -#define O_WRONLY 01 -#define O_RDWR 02 -#define O_CREAT 0100 /* not fcntl */ -#define O_EXCL 0200 /* not fcntl */ -#define O_NOCTTY 0400 /* not fcntl */ -#define O_TRUNC 01000 /* not fcntl */ -#define O_APPEND 02000 -#define O_NONBLOCK 04000 -#define O_NDELAY O_NONBLOCK -#define O_SYNC 010000 -#define FASYNC 020000 /* fcntl, for BSD compatibility */ -#define O_DIRECT 040000 /* direct disk access hint */ -#define O_LARGEFILE 0100000 -#define O_DIRECTORY 0200000 /* must be a directory */ -#define O_NOFOLLOW 0400000 /* don't follow links */ - -#define F_DUPFD 0 /* dup */ -#define F_GETFD 1 /* get close_on_exec */ -#define F_SETFD 2 /* set/clear close_on_exec */ -#define F_GETFL 3 /* get file->f_flags */ -#define F_SETFL 4 /* set file->f_flags */ -#define F_GETLK 5 -#define F_SETLK 6 -#define F_SETLKW 7 - -#define F_SETOWN 8 /* for sockets. */ -#define F_GETOWN 9 /* for sockets. */ -#define F_SETSIG 10 /* for sockets. */ -#define F_GETSIG 11 /* for sockets. */ - -/* for F_[GET|SET]FL */ -#define FD_CLOEXEC 1 /* actually anything with low bit set goes */ - -/* for posix fcntl() and lockf() */ -#define F_RDLCK 0 -#define F_WRLCK 1 -#define F_UNLCK 2 - -/* for old implementation of bsd flock () */ -#define F_EXLCK 4 /* or 3 */ -#define F_SHLCK 8 /* or 4 */ - -/* for leases */ -#define F_INPROGRESS 16 - -/* operations for bsd flock(), also used by the kernel implementation */ -#define LOCK_SH 1 /* shared lock */ -#define LOCK_EX 2 /* exclusive lock */ -#define LOCK_NB 4 /* or'd with one of the above to prevent - blocking */ -#define LOCK_UN 8 /* remove lock */ - -#define LOCK_MAND 32 /* This is a mandatory flock */ -#define LOCK_READ 64 /* ... Which allows concurrent read operations */ -#define LOCK_WRITE 128 /* ... Which allows concurrent write operations -*/ -#define LOCK_RW 192 /* ... Which allows concurrent read & write ops */ - -struct flock { - short l_type; - short l_whence; - __kernel_off_t l_start; - __kernel_off_t l_len; - __kernel_pid_t l_pid; -}; - -#define F_LINUX_SPECIFIC_BASE 1024 - -#endif diff --git a/include/asm-s390x/gdb-stub.h b/include/asm-s390x/gdb-stub.h deleted file mode 100644 index fa68800f4d475..0000000000000 --- a/include/asm-s390x/gdb-stub.h +++ /dev/null @@ -1,18 +0,0 @@ -/* - * include/asm-s390/gdb-stub.h - * - * S390 version - * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation - * Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com) - */ - -#ifndef __S390_GDB_STUB__ -#define __S390_GDB_STUB__ -#include -#if CONFIG_REMOTE_DEBUG -#include -#include -extern int gdb_stub_initialised; -extern void gdb_stub_handle_exception(gdb_pt_regs *regs,int sigval); -#endif -#endif diff --git a/include/asm-s390x/hardirq.h b/include/asm-s390x/hardirq.h deleted file mode 100644 index 05ead85061d9a..0000000000000 --- a/include/asm-s390x/hardirq.h +++ /dev/null @@ -1,109 +0,0 @@ -/* - * include/asm-s390/hardirq.h - * - * S390 version - * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation - * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com), - * Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com) - * - * Derived from "include/asm-i386/hardirq.h" - */ - -#ifndef __ASM_HARDIRQ_H -#define __ASM_HARDIRQ_H - -#include -#include -#include -#include -#include - -/* entry.S is sensitive to the offsets of these fields */ -typedef struct { - unsigned int __softirq_pending; - unsigned int __syscall_count; - struct task_struct * __ksoftirqd_task; /* waitqueue is too large */ -} ____cacheline_aligned irq_cpustat_t; - -#include /* Standard mappings for irq_cpustat_t above */ - -/* - * We put the hardirq and softirq counter into the preemption - * counter. The bitmask has the following meaning: - * - * - bits 0-7 are the preemption count (max preemption depth: 256) - * - bits 8-15 are the softirq count (max # of softirqs: 256) - * - bits 16-23 are the hardirq count (max # of hardirqs: 256) - * - * - ( bit 26 is the PREEMPT_ACTIVE flag. ) - * - * PREEMPT_MASK: 0x000000ff - * SOFTIRQ_MASK: 0x0000ff00 - * HARDIRQ_MASK: 0x00010000 - */ - -#define PREEMPT_BITS 8 -#define SOFTIRQ_BITS 8 -// FIXME: we have 2^16 i/o and 2^16 external interrupts... -#define HARDIRQ_BITS 1 - -#define PREEMPT_SHIFT 0 -#define SOFTIRQ_SHIFT (PREEMPT_SHIFT + PREEMPT_BITS) -#define HARDIRQ_SHIFT (SOFTIRQ_SHIFT + SOFTIRQ_BITS) - -#define __MASK(x) ((1UL << (x))-1) - -#define PREEMPT_MASK (__MASK(PREEMPT_BITS) << PREEMPT_SHIFT) -#define SOFTIRQ_MASK (__MASK(SOFTIRQ_BITS) << SOFTIRQ_SHIFT) -#define HARDIRQ_MASK (__MASK(HARDIRQ_BITS) << HARDIRQ_SHIFT) - -#define hardirq_count() (preempt_count() & HARDIRQ_MASK) -#define softirq_count() (preempt_count() & SOFTIRQ_MASK) -#define irq_count() (preempt_count() & (HARDIRQ_MASK | SOFTIRQ_MASK)) - -#define PREEMPT_OFFSET (1UL << PREEMPT_SHIFT) -#define SOFTIRQ_OFFSET (1UL << SOFTIRQ_SHIFT) -#define HARDIRQ_OFFSET (1UL << HARDIRQ_SHIFT) - -/* - * Are we doing bottom half or hardware interrupt processing? - * Are we in a softirq context? Interrupt context? - */ -#define in_irq() (hardirq_count()) -#define in_softirq() (softirq_count()) -#define in_interrupt() (irq_count()) - - -#define hardirq_trylock() (!in_interrupt()) -#define hardirq_endlock() do { } while (0) - -#define irq_enter() (preempt_count() += HARDIRQ_OFFSET) - -extern void do_call_softirq(void); - -#if CONFIG_PREEMPT -# define in_atomic() (in_interrupt() || preempt_count() == PREEMPT_ACTIVE) -# define IRQ_EXIT_OFFSET (HARDIRQ_OFFSET-1) -#else -# define in_atomic() (preempt_count() != 0) -# define IRQ_EXIT_OFFSET HARDIRQ_OFFSET -#endif - -#define irq_exit() \ -do { \ - preempt_count() -= IRQ_EXIT_OFFSET; \ - if (!in_interrupt() && softirq_pending(smp_processor_id())) \ - /* Use the async. stack for softirq */ \ - do_call_softirq(); \ - preempt_enable_no_resched(); \ -} while (0) - -#ifndef CONFIG_SMP -# define synchronize_irq(irq) barrier() -#else - extern void synchronize_irq(unsigned int irq); -#endif /* CONFIG_SMP */ - -extern void show_stack(unsigned long * esp); - -#endif /* __ASM_HARDIRQ_H */ diff --git a/include/asm-s390x/idals.h b/include/asm-s390x/idals.h deleted file mode 100644 index 5be57898cba96..0000000000000 --- a/include/asm-s390x/idals.h +++ /dev/null @@ -1,259 +0,0 @@ -/* - * File...........: linux/include/asm-s390x/idals.h - * Author(s)......: Holger Smolinski - * Martin Schwidefsky - * Bugreports.to..: - * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 2000a - - * History of changes - * 07/24/00 new file - * 05/04/02 code restructuring. - */ - -#ifndef _S390_IDALS_H -#define _S390_IDALS_H - -#include -#include -#include -#include -#include -#include -#include - -#ifdef CONFIG_ARCH_S390X -#define IDA_SIZE_LOG 12 /* 11 for 2k , 12 for 4k */ -#else -#define IDA_SIZE_LOG 11 /* 11 for 2k , 12 for 4k */ -#endif -#define IDA_BLOCK_SIZE (1L<> 31) != 0; -#else - return 0; -#endif -} - - -/* - * Return the number of idal words needed for an address/length pair. - */ -static inline unsigned int -idal_nr_words(void *vaddr, unsigned int length) -{ -#if defined(CONFIG_ARCH_S390X) - if (idal_is_needed(vaddr, length)) - return ((__pa(vaddr) & (IDA_BLOCK_SIZE-1)) + length + - (IDA_BLOCK_SIZE-1)) >> IDA_SIZE_LOG; -#endif - return 0; -} - -/* - * Create the list of idal words for an address/length pair. - */ -static inline unsigned long * -idal_create_words(unsigned long *idaws, void *vaddr, unsigned int length) -{ -#if defined(CONFIG_ARCH_S390X) - unsigned long paddr; - unsigned int cidaw; - - paddr = __pa(vaddr); - cidaw = ((paddr & (IDA_BLOCK_SIZE-1)) + length + - (IDA_BLOCK_SIZE-1)) >> IDA_SIZE_LOG; - *idaws++ = paddr; - paddr &= -IDA_BLOCK_SIZE; - while (--cidaw > 0) { - paddr += IDA_BLOCK_SIZE; - *idaws++ = paddr; - } -#endif - return idaws; -} - -/* - * Sets the address of the data in CCW. - * If necessary it allocates an IDAL and sets the appropriate flags. - */ -static inline int -set_normalized_cda(struct ccw1 * ccw, void *vaddr) -{ -#if defined (CONFIG_ARCH_S390X) - unsigned int nridaws; - unsigned long *idal; - - if (ccw->flags & CCW_FLAG_IDA) - return -EINVAL; - nridaws = idal_nr_words(vaddr, ccw->count); - if (nridaws > 0) { - idal = kmalloc(nridaws * sizeof(unsigned long), - GFP_ATOMIC | GFP_DMA ); - if (idal == NULL) - return -ENOMEM; - idal_create_words(idal, vaddr, ccw->count); - ccw->flags |= CCW_FLAG_IDA; - vaddr = idal; - } -#endif - ccw->cda = (__u32)(unsigned long) vaddr; - return 0; -} - -/* - * Releases any allocated IDAL related to the CCW. - */ -static inline void -clear_normalized_cda(struct ccw1 * ccw) -{ -#if defined(CONFIG_ARCH_S390X) - if (ccw->flags & CCW_FLAG_IDA) { - kfree((void *)(unsigned long) ccw->cda); - ccw->flags &= ~CCW_FLAG_IDA; - } -#endif - ccw->cda = 0; -} - -/* - * Idal buffer extension - */ -struct idal_buffer { - size_t size; - size_t page_order; - void *data[0]; -}; - -/* - * Allocate an idal buffer - */ -static inline struct idal_buffer * -idal_buffer_alloc(size_t size, int page_order) -{ - struct idal_buffer *ib; - int nr_chunks, nr_ptrs, i; - - nr_ptrs = (size + IDA_BLOCK_SIZE - 1) >> IDA_SIZE_LOG; - nr_chunks = (4096 << page_order) >> IDA_SIZE_LOG; - ib = kmalloc(sizeof(struct idal_buffer) + nr_ptrs*sizeof(void *), - GFP_DMA | GFP_KERNEL); - if (ib == NULL) - return ERR_PTR(-ENOMEM); - ib->size = size; - ib->page_order = page_order; - for (i = 0; i < nr_ptrs; i++) { - if ((i & (nr_chunks - 1)) != 0) { - ib->data[i] = ib->data[i-1] + IDA_BLOCK_SIZE; - continue; - } - ib->data[i] = (void *) - __get_free_pages(GFP_KERNEL, page_order); - if (ib->data[i] != NULL) - continue; - // Not enough memory - while (i >= nr_chunks) { - i -= nr_chunks; - free_pages((unsigned long) ib->data[i], - ib->page_order); - } - kfree(ib); - return ERR_PTR(-ENOMEM); - } - return ib; -} - -/* - * Free an idal buffer. - */ -static inline void -idal_buffer_free(struct idal_buffer *ib) -{ - int nr_chunks, nr_ptrs, i; - - nr_ptrs = (ib->size + IDA_BLOCK_SIZE - 1) >> IDA_SIZE_LOG; - nr_chunks = (4096 << ib->page_order) >> IDA_SIZE_LOG; - for (i = 0; i < nr_ptrs; i += nr_chunks) - free_pages((unsigned long) ib->data[i], ib->page_order); - kfree(ib); -} - -/* - * Test if a idal list is really needed. - */ -static inline int -__idal_buffer_is_needed(struct idal_buffer *ib) -{ -#ifdef CONFIG_ARCH_S390X - return ib->size > (4096ul << ib->page_order) || - idal_is_needed(ib->data[0], ib->size); -#else - return ib->size > (4096ul << ib->page_order); -#endif -} - -/* - * Set channel data address to idal buffer. - */ -static inline void -idal_buffer_set_cda(struct idal_buffer *ib, struct ccw1 *ccw) -{ - if (__idal_buffer_is_needed(ib)) { - // setup idals; - ccw->cda = (u32)(addr_t) ib->data; - ccw->flags |= CCW_FLAG_IDA; - } else - // we do not need idals - use direct addressing - ccw->cda = (u32)(addr_t) ib->data[0]; - ccw->count = ib->size; -} - -/* - * Copy count bytes from an idal buffer to user memory - */ -static inline size_t -idal_buffer_to_user(struct idal_buffer *ib, void *to, size_t count) -{ - size_t left; - int i; - - if (count > ib->size) - BUG(); - for (i = 0; count > IDA_BLOCK_SIZE; i++) { - left = copy_to_user(to, ib->data[i], IDA_BLOCK_SIZE); - if (left) - return left + count - IDA_BLOCK_SIZE; - (addr_t) to += IDA_BLOCK_SIZE; - count -= IDA_BLOCK_SIZE; - } - return copy_to_user(to, ib->data[i], count); -} - -/* - * Copy count bytes from user memory to an idal buffer - */ -static inline size_t -idal_buffer_from_user(struct idal_buffer *ib, const void *from, size_t count) -{ - size_t left; - int i; - - if (count > ib->size) - BUG(); - for (i = 0; count > IDA_BLOCK_SIZE; i++) { - left = copy_from_user(ib->data[i], from, IDA_BLOCK_SIZE); - if (left) - return left + count - IDA_BLOCK_SIZE; - (addr_t) from += IDA_BLOCK_SIZE; - count -= IDA_BLOCK_SIZE; - } - return copy_from_user(ib->data[i], from, count); -} - -#endif diff --git a/include/asm-s390x/init.h b/include/asm-s390x/init.h deleted file mode 100644 index fe0c0ebd15298..0000000000000 --- a/include/asm-s390x/init.h +++ /dev/null @@ -1,7 +0,0 @@ -/* - * include/asm-s390x/init.h - * - * S390 version (s390x) - */ - -#error " should never be used - use instead" diff --git a/include/asm-s390x/io.h b/include/asm-s390x/io.h deleted file mode 100644 index 357236dc8834b..0000000000000 --- a/include/asm-s390x/io.h +++ /dev/null @@ -1,99 +0,0 @@ -/* - * include/asm-s390/io.h - * - * S390 version - * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation - * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com) - * - * Derived from "include/asm-i386/io.h" - */ - -#ifndef _S390_IO_H -#define _S390_IO_H - -#ifdef __KERNEL__ - -#include -#include - -#define IO_SPACE_LIMIT 0xffffffff - -#define __io_virt(x) ((void *)(PAGE_OFFSET | (unsigned long)(x))) - -/* - * Change virtual addresses to physical addresses and vv. - * These are pretty trivial - */ -extern inline unsigned long virt_to_phys(volatile void * address) -{ - unsigned long real_address; - __asm__ (" lrag %0,0(%1)\n" - " jz 0f\n" - " slgr %0,%0\n" - "0:" - : "=a" (real_address) : "a" (address) : "cc" ); - return real_address; -} - -extern inline void * phys_to_virt(unsigned long address) -{ - return __io_virt(address); -} - -/* - * Change "struct page" to physical address. - */ -#define page_to_phys(page) ((page - mem_map) << PAGE_SHIFT) - -extern void * __ioremap(unsigned long offset, unsigned long size, unsigned long flags); - -extern inline void * ioremap (unsigned long offset, unsigned long size) -{ - return __ioremap(offset, size, 0); -} - -/* - * This one maps high address device memory and turns off caching for that area. - * it's useful if some control registers are in such an area and write combining - * or read caching is not desirable: - */ -extern inline void * ioremap_nocache (unsigned long offset, unsigned long size) -{ - return __ioremap(offset, size, 0); -} - -extern void iounmap(void *addr); - -/* - * IO bus memory addresses are also 1:1 with the physical address - */ -#define virt_to_bus virt_to_phys -#define bus_to_virt phys_to_virt - -/* - * readX/writeX() are used to access memory mapped devices. On some - * architectures the memory mapped IO stuff needs to be accessed - * differently. - */ - -#define readb(addr) (*(volatile unsigned char *) __io_virt(addr)) -#define readw(addr) (*(volatile unsigned short *) __io_virt(addr)) -#define readl(addr) (*(volatile unsigned int *) __io_virt(addr)) - -#define writeb(b,addr) (*(volatile unsigned char *) __io_virt(addr) = (b)) -#define writew(b,addr) (*(volatile unsigned short *) __io_virt(addr) = (b)) -#define writel(b,addr) (*(volatile unsigned int *) __io_virt(addr) = (b)) - -#define memset_io(a,b,c) memset(__io_virt(a),(b),(c)) -#define memcpy_fromio(a,b,c) memcpy((a),__io_virt(b),(c)) -#define memcpy_toio(a,b,c) memcpy(__io_virt(a),(b),(c)) - -#define inb_p(addr) readb(addr) -#define inb(addr) readb(addr) - -#define outb(x,addr) ((void) writeb(x,addr)) -#define outb_p(x,addr) outb(x,addr) - -#endif /* __KERNEL__ */ - -#endif diff --git a/include/asm-s390x/ioctl.h b/include/asm-s390x/ioctl.h deleted file mode 100644 index 35b4821e8d221..0000000000000 --- a/include/asm-s390x/ioctl.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * include/asm-s390/ioctl.h - * - * S390 version - * - * Derived from "include/asm-i386/ioctl.h" - */ - -#ifndef _S390_IOCTL_H -#define _S390_IOCTL_H - -/* ioctl command encoding: 32 bits total, command in lower 16 bits, - * size of the parameter structure in the lower 14 bits of the - * upper 16 bits. - * Encoding the size of the parameter structure in the ioctl request - * is useful for catching programs compiled with old versions - * and to avoid overwriting user space outside the user buffer area. - * The highest 2 bits are reserved for indicating the ``access mode''. - * NOTE: This limits the max parameter size to 16kB -1 ! - */ - -/* - * The following is for compatibility across the various Linux - * platforms. The i386 ioctl numbering scheme doesn't really enforce - * a type field. De facto, however, the top 8 bits of the lower 16 - * bits are indeed used as a type field, so we might just as well make - * this explicit here. Please be sure to use the decoding macros - * below from now on. - */ -#define _IOC_NRBITS 8 -#define _IOC_TYPEBITS 8 -#define _IOC_SIZEBITS 14 -#define _IOC_DIRBITS 2 - -#define _IOC_NRMASK ((1 << _IOC_NRBITS)-1) -#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1) -#define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1) -#define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1) - -#define _IOC_NRSHIFT 0 -#define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS) -#define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS) -#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS) - -/* - * Direction bits. - */ -#define _IOC_NONE 0U -#define _IOC_WRITE 1U -#define _IOC_READ 2U - -#define _IOC(dir,type,nr,size) \ - (((dir) << _IOC_DIRSHIFT) | \ - ((type) << _IOC_TYPESHIFT) | \ - ((nr) << _IOC_NRSHIFT) | \ - ((size) << _IOC_SIZESHIFT)) - -/* used to create numbers */ -#define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0) -#define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size)) -#define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size)) -#define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size)) - -/* used to decode ioctl numbers.. */ -#define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK) -#define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK) -#define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK) -#define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK) - -/* ...and for the drivers/sound files... */ - -#define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT) -#define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT) -#define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT) -#define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT) -#define IOCSIZE_SHIFT (_IOC_SIZESHIFT) - -#endif /* _S390_IOCTL_H */ diff --git a/include/asm-s390x/ioctls.h b/include/asm-s390x/ioctls.h deleted file mode 100644 index 07e19b2dd73fd..0000000000000 --- a/include/asm-s390x/ioctls.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * include/asm-s390/ioctls.h - * - * S390 version - * - * Derived from "include/asm-i386/ioctls.h" - */ - -#ifndef __ARCH_S390_IOCTLS_H__ -#define __ARCH_S390_IOCTLS_H__ - -#include - -/* 0x54 is just a magic number to make these relatively unique ('T') */ - -#define TCGETS 0x5401 -#define TCSETS 0x5402 -#define TCSETSW 0x5403 -#define TCSETSF 0x5404 -#define TCGETA 0x5405 -#define TCSETA 0x5406 -#define TCSETAW 0x5407 -#define TCSETAF 0x5408 -#define TCSBRK 0x5409 -#define TCXONC 0x540A -#define TCFLSH 0x540B -#define TIOCEXCL 0x540C -#define TIOCNXCL 0x540D -#define TIOCSCTTY 0x540E -#define TIOCGPGRP 0x540F -#define TIOCSPGRP 0x5410 -#define TIOCOUTQ 0x5411 -#define TIOCSTI 0x5412 -#define TIOCGWINSZ 0x5413 -#define TIOCSWINSZ 0x5414 -#define TIOCMGET 0x5415 -#define TIOCMBIS 0x5416 -#define TIOCMBIC 0x5417 -#define TIOCMSET 0x5418 -#define TIOCGSOFTCAR 0x5419 -#define TIOCSSOFTCAR 0x541A -#define FIONREAD 0x541B -#define TIOCINQ FIONREAD -#define TIOCLINUX 0x541C -#define TIOCCONS 0x541D -#define TIOCGSERIAL 0x541E -#define TIOCSSERIAL 0x541F -#define TIOCPKT 0x5420 -#define FIONBIO 0x5421 -#define TIOCNOTTY 0x5422 -#define TIOCSETD 0x5423 -#define TIOCGETD 0x5424 -#define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */ -#define TIOCSBRK 0x5427 /* BSD compatibility */ -#define TIOCCBRK 0x5428 /* BSD compatibility */ -#define TIOCGSID 0x5429 /* Return the session ID of FD */ -#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ -#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */ - -#define FIONCLEX 0x5450 /* these numbers need to be adjusted. */ -#define FIOCLEX 0x5451 -#define FIOASYNC 0x5452 -#define TIOCSERCONFIG 0x5453 -#define TIOCSERGWILD 0x5454 -#define TIOCSERSWILD 0x5455 -#define TIOCGLCKTRMIOS 0x5456 -#define TIOCSLCKTRMIOS 0x5457 -#define TIOCSERGSTRUCT 0x5458 /* For debugging only */ -#define TIOCSERGETLSR 0x5459 /* Get line status register */ -#define TIOCSERGETMULTI 0x545A /* Get multiport config */ -#define TIOCSERSETMULTI 0x545B /* Set multiport config */ - -#define TIOCMIWAIT 0x545C /* wait for a change on serial input line(s) */ -#define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */ -#define FIOQSIZE 0x545E - -/* Used for packet mode */ -#define TIOCPKT_DATA 0 -#define TIOCPKT_FLUSHREAD 1 -#define TIOCPKT_FLUSHWRITE 2 -#define TIOCPKT_STOP 4 -#define TIOCPKT_START 8 -#define TIOCPKT_NOSTOP 16 -#define TIOCPKT_DOSTOP 32 - -#define TIOCSER_TEMT 0x01 /* Transmitter physically empty */ - -#endif diff --git a/include/asm-s390x/ipc.h b/include/asm-s390x/ipc.h deleted file mode 100644 index 66d2b53debad3..0000000000000 --- a/include/asm-s390x/ipc.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * include/asm-s390/ipc.h - * - * S390 version - * - * Derived from "include/asm-i386/ipc.h" - */ - -#ifndef __s390_IPC_H__ -#define __s390_IPC_H__ - -/* - * These are used to wrap system calls on S390. - * - * See arch/s390/kernel/sys_s390.c for ugly details.. - */ -struct ipc_kludge { - struct msgbuf *msgp; - long msgtyp; -}; - -#define SEMOP 1 -#define SEMGET 2 -#define SEMCTL 3 -#define MSGSND 11 -#define MSGRCV 12 -#define MSGGET 13 -#define MSGCTL 14 -#define SHMAT 21 -#define SHMDT 22 -#define SHMGET 23 -#define SHMCTL 24 - -/* Used by the DIPC package, try and avoid reusing it */ -#define DIPC 25 - -#define IPCCALL(version,op) ((version)<<16 | (op)) - -#endif diff --git a/include/asm-s390x/ipcbuf.h b/include/asm-s390x/ipcbuf.h deleted file mode 100644 index d007272a8d14b..0000000000000 --- a/include/asm-s390x/ipcbuf.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef __S390_IPCBUF_H__ -#define __S390_IPCBUF_H__ - -/* - * The user_ipc_perm structure for S/390 architecture. - * Note extra padding because this structure is passed back and forth - * between kernel and user space. - * - * Pad space is left for: - * - 32-bit mode_t and seq - * - 2 miscellaneous 32-bit values - */ - -struct ipc64_perm -{ - __kernel_key_t key; - __kernel_uid32_t uid; - __kernel_gid32_t gid; - __kernel_uid32_t cuid; - __kernel_gid32_t cgid; - __kernel_mode_t mode; - unsigned short __pad1; - unsigned short seq; - unsigned long __unused1; - unsigned long __unused2; -}; - -#endif /* __S390_IPCBUF_H__ */ diff --git a/include/asm-s390x/irq.h b/include/asm-s390x/irq.h deleted file mode 100644 index 36027232a8205..0000000000000 --- a/include/asm-s390x/irq.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef _ASM_IRQ_H -#define _ASM_IRQ_H - -#ifdef __KERNEL__ -#include - -/* - * the definition of irqs has changed in 2.5.46: - * NR_IRQS is no longer the number of i/o - * interrupts (65536), but rather the number - * of interrupt classes (6). - */ - -enum interruption_class { - EXTERNAL_INTERRUPT, - IO_INTERRUPT, - MACHINE_CHECK_INTERRUPT, - PROGRAM_INTERRUPT, - RESTART_INTERRUPT, - SUPERVISOR_CALL, - - NR_IRQS, -}; - -#define touch_nmi_watchdog() do { } while(0) - -#endif /* __KERNEL__ */ -#endif - diff --git a/include/asm-s390x/kmap_types.h b/include/asm-s390x/kmap_types.h deleted file mode 100644 index fd1574648223b..0000000000000 --- a/include/asm-s390x/kmap_types.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifdef __KERNEL__ -#ifndef _ASM_KMAP_TYPES_H -#define _ASM_KMAP_TYPES_H - -enum km_type { - KM_BOUNCE_READ, - KM_SKB_SUNRPC_DATA, - KM_SKB_DATA_SOFTIRQ, - KM_USER0, - KM_USER1, - KM_BIO_SRC_IRQ, - KM_BIO_DST_IRQ, - KM_PTE0, - KM_PTE1, - KM_IRQ0, - KM_IRQ1, - KM_SOFTIRQ0, - KM_SOFTIRQ1, - KM_TYPE_NR -}; - -#endif -#endif /* __KERNEL__ */ diff --git a/include/asm-s390x/linkage.h b/include/asm-s390x/linkage.h deleted file mode 100644 index 291c2d01c44f2..0000000000000 --- a/include/asm-s390x/linkage.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef __ASM_LINKAGE_H -#define __ASM_LINKAGE_H - -/* Nothing to see here... */ - -#endif diff --git a/include/asm-s390x/lowcore.h b/include/asm-s390x/lowcore.h deleted file mode 100644 index eaa7a1b4cedc8..0000000000000 --- a/include/asm-s390x/lowcore.h +++ /dev/null @@ -1,184 +0,0 @@ - -/* - * include/asm-s390/lowcore.h - * - * S390 version - * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation - * Author(s): Hartmut Penner (hpenner@de.ibm.com), - * Martin Schwidefsky (schwidefsky@de.ibm.com), - * Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com) - */ - -#ifndef _ASM_S390_LOWCORE_H -#define _ASM_S390_LOWCORE_H - -#define __LC_EXT_OLD_PSW 0x0130 -#define __LC_SVC_OLD_PSW 0x0140 -#define __LC_PGM_OLD_PSW 0x0150 -#define __LC_MCK_OLD_PSW 0x0160 -#define __LC_IO_OLD_PSW 0x0170 -#define __LC_EXT_NEW_PSW 0x01b0 -#define __LC_SVC_NEW_PSW 0x01c0 -#define __LC_PGM_NEW_PSW 0x01d0 -#define __LC_MCK_NEW_PSW 0x01e0 -#define __LC_IO_NEW_PSW 0x01f0 -#define __LC_EXT_PARAMS 0x080 -#define __LC_CPU_ADDRESS 0x084 -#define __LC_EXT_INT_CODE 0x086 -#define __LC_SVC_ILC 0x088 -#define __LC_SVC_INT_CODE 0x08A -#define __LC_PGM_ILC 0x08C -#define __LC_PGM_INT_CODE 0x08E -#define __LC_TRANS_EXC_ADDR 0x0a8 -#define __LC_SUBCHANNEL_ID 0x0B8 -#define __LC_SUBCHANNEL_NR 0x0BA -#define __LC_IO_INT_PARM 0x0BC -#define __LC_IO_INT_WORD 0x0C0 -#define __LC_MCCK_CODE 0x0E8 - -#define __LC_RETURN_PSW 0x200 -#define __LC_IRB 0x210 -#define __LC_DIAG44_OPCODE 0x250 - -#define __LC_SAVE_AREA 0xC00 -#define __LC_KERNEL_STACK 0xD40 -#define __LC_ASYNC_STACK 0xD48 -#define __LC_CPUID 0xD90 -#define __LC_CPUADDR 0xD98 -#define __LC_IPLDEV 0xDB8 - -#define __LC_JIFFY_TIMER 0xDC0 - -#define __LC_PANIC_MAGIC 0xE00 - -#define __LC_AREGS_SAVE_AREA 0x1340 -#define __LC_CREGS_SAVE_AREA 0x1380 - -#define __LC_PFAULT_INTPARM 0x11B8 - -#ifndef __ASSEMBLY__ - -#include -#include -#include -#include -#include - -void restart_int_handler(void); -void ext_int_handler(void); -void system_call(void); -void pgm_check_handler(void); -void mcck_int_handler(void); -void io_int_handler(void); - -struct _lowcore -{ - /* prefix area: defined by architecture */ - __u32 ccw1[2]; /* 0x000 */ - __u32 ccw2[4]; /* 0x008 */ - __u8 pad1[0x80-0x18]; /* 0x018 */ - __u32 ext_params; /* 0x080 */ - __u16 cpu_addr; /* 0x084 */ - __u16 ext_int_code; /* 0x086 */ - __u16 svc_ilc; /* 0x088 */ - __u16 svc_code; /* 0x08a */ - __u16 pgm_ilc; /* 0x08c */ - __u16 pgm_code; /* 0x08e */ - __u32 data_exc_code; /* 0x090 */ - __u16 mon_class_num; /* 0x094 */ - __u16 per_perc_atmid; /* 0x096 */ - addr_t per_address; /* 0x098 */ - __u8 exc_access_id; /* 0x0a0 */ - __u8 per_access_id; /* 0x0a1 */ - __u8 op_access_id; /* 0x0a2 */ - __u8 ar_access_id; /* 0x0a3 */ - __u8 pad2[0xA8-0xA4]; /* 0x0a4 */ - addr_t trans_exc_code; /* 0x0A0 */ - addr_t monitor_code; /* 0x09c */ - __u16 subchannel_id; /* 0x0b8 */ - __u16 subchannel_nr; /* 0x0ba */ - __u32 io_int_parm; /* 0x0bc */ - __u32 io_int_word; /* 0x0c0 */ - __u8 pad3[0xc8-0xc4]; /* 0x0c4 */ - __u32 stfl_fac_list; /* 0x0c8 */ - __u8 pad4[0xe8-0xcc]; /* 0x0cc */ - __u32 mcck_interruption_code[2]; /* 0x0e8 */ - __u8 pad5[0xf4-0xf0]; /* 0x0f0 */ - __u32 external_damage_code; /* 0x0f4 */ - addr_t failing_storage_address; /* 0x0f8 */ - __u8 pad6[0x120-0x100]; /* 0x100 */ - psw_t restart_old_psw; /* 0x120 */ - psw_t external_old_psw; /* 0x130 */ - psw_t svc_old_psw; /* 0x140 */ - psw_t program_old_psw; /* 0x150 */ - psw_t mcck_old_psw; /* 0x160 */ - psw_t io_old_psw; /* 0x170 */ - __u8 pad7[0x1a0-0x180]; /* 0x180 */ - psw_t restart_psw; /* 0x1a0 */ - psw_t external_new_psw; /* 0x1b0 */ - psw_t svc_new_psw; /* 0x1c0 */ - psw_t program_new_psw; /* 0x1d0 */ - psw_t mcck_new_psw; /* 0x1e0 */ - psw_t io_new_psw; /* 0x1f0 */ - psw_t return_psw; /* 0x200 */ - __u8 irb[64]; /* 0x210 */ - __u32 diag44_opcode; /* 0x250 */ - __u8 pad8[0xc00-0x254]; /* 0x254 */ - /* System info area */ - __u64 save_area[16]; /* 0xc00 */ - __u8 pad9[0xd40-0xc80]; /* 0xc80 */ - __u64 kernel_stack; /* 0xd40 */ - __u64 async_stack; /* 0xd48 */ - /* entry.S sensitive area start */ - __u8 pad10[0xd80-0xd50]; /* 0xd64 */ - struct cpuinfo_S390 cpu_data; /* 0xd80 */ - __u32 ipl_device; /* 0xdb8 */ - __u32 pad11; /* 0xdbc */ - /* entry.S sensitive area end */ - - /* SMP info area: defined by DJB */ - __u64 jiffy_timer; /* 0xdc0 */ - __u64 ext_call_fast; /* 0xdc8 */ - __u8 pad12[0xe00-0xdd0]; /* 0xdd0 */ - - /* 0xe00 is used as indicator for dump tools */ - /* whether the kernel died with panic() or not */ - __u32 panic_magic; /* 0xe00 */ - - __u8 pad13[0x1200-0xe04]; /* 0xe04 */ - - /* System info area */ - - __u64 floating_pt_save_area[16]; /* 0x1200 */ - __u64 gpregs_save_area[16]; /* 0x1280 */ - __u32 st_status_fixed_logout[4]; /* 0x1300 */ - __u8 pad14[0x1318-0x1310]; /* 0x1310 */ - __u32 prefixreg_save_area; /* 0x1318 */ - __u32 fpt_creg_save_area; /* 0x131c */ - __u8 pad15[0x1324-0x1320]; /* 0x1320 */ - __u32 tod_progreg_save_area; /* 0x1324 */ - __u32 cpu_timer_save_area[2]; /* 0x1328 */ - __u32 clock_comp_save_area[2]; /* 0x1330 */ - __u8 pad16[0x1340-0x1338]; /* 0x1338 */ - __u32 access_regs_save_area[16]; /* 0x1340 */ - __u64 cregs_save_area[16]; /* 0x1380 */ - - /* align to the top of the prefix area */ - - __u8 pad17[0x2000-0x1400]; /* 0x1400 */ -} __attribute__((packed)); /* End structure*/ - -#define S390_lowcore (*((struct _lowcore *) 0)) -extern struct _lowcore *lowcore_ptr[]; - -extern __inline__ void set_prefix(__u32 address) -{ - __asm__ __volatile__ ("spx %0" : : "m" (address) : "memory" ); -} - -#define __PANIC_MAGIC 0xDEADC0DE - -#endif - -#endif - diff --git a/include/asm-s390x/mman.h b/include/asm-s390x/mman.h deleted file mode 100644 index b90e013966176..0000000000000 --- a/include/asm-s390x/mman.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * include/asm-s390/mman.h - * - * S390 version - * - * Derived from "include/asm-i386/mman.h" - */ - -#ifndef __S390_MMAN_H__ -#define __S390_MMAN_H__ - -#define PROT_READ 0x1 /* page can be read */ -#define PROT_WRITE 0x2 /* page can be written */ -#define PROT_EXEC 0x4 /* page can be executed */ -#define PROT_SEM 0x8 /* page may be used for atomic ops */ -#define PROT_NONE 0x0 /* page can not be accessed */ - -#define MAP_SHARED 0x01 /* Share changes */ -#define MAP_PRIVATE 0x02 /* Changes are private */ -#define MAP_TYPE 0x0f /* Mask for type of mapping */ -#define MAP_FIXED 0x10 /* Interpret addr exactly */ -#define MAP_ANONYMOUS 0x20 /* don't use a file */ - -#define MAP_GROWSDOWN 0x0100 /* stack-like segment */ -#define MAP_DENYWRITE 0x0800 /* ETXTBSY */ -#define MAP_EXECUTABLE 0x1000 /* mark it as an executable */ -#define MAP_LOCKED 0x2000 /* pages are locked */ -#define MAP_NORESERVE 0x4000 /* don't check for reservations */ -#define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ -#define MAP_NONBLOCK 0x10000 /* do not block on IO */ - -#define MS_ASYNC 1 /* sync memory asynchronously */ -#define MS_INVALIDATE 2 /* invalidate the caches */ -#define MS_SYNC 4 /* synchronous memory sync */ - -#define MCL_CURRENT 1 /* lock all current mappings */ -#define MCL_FUTURE 2 /* lock all future mappings */ - -#define MADV_NORMAL 0x0 /* default page-in behavior */ -#define MADV_RANDOM 0x1 /* page-in minimum required */ -#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */ -#define MADV_WILLNEED 0x3 /* pre-fault pages */ -#define MADV_DONTNEED 0x4 /* discard these pages */ - -/* compatibility flags */ -#define MAP_ANON MAP_ANONYMOUS -#define MAP_FILE 0 - -#endif /* __S390_MMAN_H__ */ diff --git a/include/asm-s390x/mmu.h b/include/asm-s390x/mmu.h deleted file mode 100644 index ccd36d26615a7..0000000000000 --- a/include/asm-s390x/mmu.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef __MMU_H -#define __MMU_H - -/* Default "unsigned long" context */ -typedef unsigned long mm_context_t; - -#endif diff --git a/include/asm-s390x/mmu_context.h b/include/asm-s390x/mmu_context.h deleted file mode 100644 index 8d07debc38663..0000000000000 --- a/include/asm-s390x/mmu_context.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * include/asm-s390/mmu_context.h - * - * S390 version - * - * Derived from "include/asm-i386/mmu_context.h" - */ - -#ifndef __S390_MMU_CONTEXT_H -#define __S390_MMU_CONTEXT_H - -/* - * get a new mmu context.. S390 don't know about contexts. - */ -#define init_new_context(tsk,mm) 0 - -#define destroy_context(mm) flush_tlb_mm(mm) - -static inline void enter_lazy_tlb(struct mm_struct *mm, - struct task_struct *tsk, unsigned cpu) -{ -} - -static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, - struct task_struct *tsk, unsigned cpu) -{ - unsigned long pgd; - - if (prev != next) { - pgd = (__pa(next->pgd)&PAGE_MASK) | (_REGION_TABLE|USER_STD_MASK); - /* Load page tables */ - asm volatile(" lctlg 7,7,%0\n" /* secondary space */ - " lctlg 13,13,%0\n" /* home space */ - : : "m" (pgd) ); - } - set_bit(cpu, &next->cpu_vm_mask); -} - -#define deactivate_mm(tsk,mm) do { } while (0) - -extern inline void activate_mm(struct mm_struct *prev, - struct mm_struct *next) -{ - switch_mm(prev, next, current, smp_processor_id()); -} - -#endif diff --git a/include/asm-s390x/module.h b/include/asm-s390x/module.h deleted file mode 100644 index f61254c6a49d1..0000000000000 --- a/include/asm-s390x/module.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef _ASM_S390_MODULE_H -#define _ASM_S390_MODULE_H -/* - * This file contains the s390 architecture specific module code. - */ - -struct mod_arch_syminfo -{ - unsigned long got_offset; - unsigned long plt_offset; - int got_initialized; - int plt_initialized; -}; - -struct mod_arch_specific -{ - /* Starting offset of got in the module core memory. */ - unsigned long got_offset; - /* Starting offset of plt in the module core memory. */ - unsigned long plt_offset; - /* Size of the got. */ - unsigned long got_size; - /* Size of the plt. */ - unsigned long plt_size; - /* Number of symbols in syminfo. */ - int nsyms; - /* Additional symbol information (got and plt offsets). */ - struct mod_arch_syminfo *syminfo; -}; - -#ifdef CONFIG_ARCH_S390X -#define ElfW(x) Elf64_ ## x -#define ELFW(x) ELF64_ ## x -#else -#define ElfW(x) Elf32_ ## x -#define ELFW(x) ELF64_ ## x -#endif - -#define Elf_Shdr ElfW(Shdr) -#define Elf_Sym ElfW(Sym) -#define Elf_Ehdr ElfW(Ehdr) -#define ELF_R_TYPE ELFW(R_TYPE) -#endif /* _ASM_S390_MODULE_H */ diff --git a/include/asm-s390x/msgbuf.h b/include/asm-s390x/msgbuf.h deleted file mode 100644 index a131dec56e68a..0000000000000 --- a/include/asm-s390x/msgbuf.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef _S390_MSGBUF_H -#define _S390_MSGBUF_H - -/* - * The msqid64_ds structure for S/390 architecture. - * Note extra padding because this structure is passed back and forth - * between kernel and user space. - * - * Pad space is left for: - * - 2 miscellaneous 64-bit values - */ - -struct msqid64_ds { - struct ipc64_perm msg_perm; - __kernel_time_t msg_stime; /* last msgsnd time */ - __kernel_time_t msg_rtime; /* last msgrcv time */ - __kernel_time_t msg_ctime; /* last change time */ - unsigned long msg_cbytes; /* current number of bytes on queue */ - unsigned long msg_qnum; /* number of messages in queue */ - unsigned long msg_qbytes; /* max number of bytes on queue */ - __kernel_pid_t msg_lspid; /* pid of last msgsnd */ - __kernel_pid_t msg_lrpid; /* last receive pid */ - unsigned long __unused1; - unsigned long __unused2; -}; - -#endif /* _S390_MSGBUF_H */ diff --git a/include/asm-s390x/namei.h b/include/asm-s390x/namei.h deleted file mode 100644 index 3e286bdde4b08..0000000000000 --- a/include/asm-s390x/namei.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * include/asm-s390/namei.h - * - * S390 version - * - * Derived from "include/asm-i386/namei.h" - * - * Included from linux/fs/namei.c - */ - -#ifndef __S390_NAMEI_H -#define __S390_NAMEI_H - -/* This dummy routine maybe changed to something useful - * for /usr/gnemul/ emulation stuff. - * Look at asm-sparc/namei.h for details. - */ - -#define __emul_prefix() NULL - -#endif /* __S390_NAMEI_H */ diff --git a/include/asm-s390x/page.h b/include/asm-s390x/page.h deleted file mode 100644 index e075af90adb22..0000000000000 --- a/include/asm-s390x/page.h +++ /dev/null @@ -1,120 +0,0 @@ -/* - * include/asm-s390/page.h - * - * S390 version - * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation - * Author(s): Hartmut Penner (hpenner@de.ibm.com) - */ - -#ifndef _S390_PAGE_H -#define _S390_PAGE_H - -#include - -/* PAGE_SHIFT determines the page size */ -#define PAGE_SHIFT 12 -#define PAGE_SIZE (1UL << PAGE_SHIFT) -#define PAGE_MASK (~(PAGE_SIZE-1)) - -#ifdef __KERNEL__ -#ifndef __ASSEMBLY__ - -static inline void clear_page(void *page) -{ - asm volatile (" lgr 2,%0\n" - " lghi 3,4096\n" - " slgr 1,1\n" - " mvcl 2,0" - : : "a" ((void *) (page)) - : "memory", "cc", "1", "2", "3" ); -} - -static inline void copy_page(void *to, void *from) -{ - if (MACHINE_HAS_MVPG) - asm volatile (" sgr 0,0\n" - " mvpg %0,%1" - : : "a" ((void *)(to)), "a" ((void *)(from)) - : "memory", "cc", "0" ); - else - asm volatile (" mvc 0(256,%0),0(%1)\n" - " mvc 256(256,%0),256(%1)\n" - " mvc 512(256,%0),512(%1)\n" - " mvc 768(256,%0),768(%1)\n" - " mvc 1024(256,%0),1024(%1)\n" - " mvc 1280(256,%0),1280(%1)\n" - " mvc 1536(256,%0),1536(%1)\n" - " mvc 1792(256,%0),1792(%1)\n" - " mvc 2048(256,%0),2048(%1)\n" - " mvc 2304(256,%0),2304(%1)\n" - " mvc 2560(256,%0),2560(%1)\n" - " mvc 2816(256,%0),2816(%1)\n" - " mvc 3072(256,%0),3072(%1)\n" - " mvc 3328(256,%0),3328(%1)\n" - " mvc 3584(256,%0),3584(%1)\n" - " mvc 3840(256,%0),3840(%1)\n" - : : "a"((void *)(to)),"a"((void *)(from)) - : "memory" ); -} - -#define clear_user_page(page, vaddr, pg) clear_page(page) -#define copy_user_page(to, from, vaddr, pg) copy_page(to, from) - -/* Pure 2^n version of get_order */ -extern __inline__ int get_order(unsigned long size) -{ - int order; - - size = (size-1) >> (PAGE_SHIFT-1); - order = -1; - do { - size >>= 1; - order++; - } while (size); - return order; -} - -/* - * These are used to make use of C type-checking.. - */ -typedef struct { unsigned long pte; } pte_t; -typedef struct { - unsigned long pmd0; - unsigned long pmd1; - } pmd_t; -typedef struct { unsigned long pgd; } pgd_t; -typedef struct { unsigned long pgprot; } pgprot_t; - -#define pte_val(x) ((x).pte) -#define pmd_val(x) ((x).pmd0) -#define pmd_val1(x) ((x).pmd1) -#define pgd_val(x) ((x).pgd) -#define pgprot_val(x) ((x).pgprot) - -#define __pte(x) ((pte_t) { (x) } ) -#define __pmd(x) ((pmd_t) { (x) } ) -#define __pgd(x) ((pgd_t) { (x) } ) -#define __pgprot(x) ((pgprot_t) { (x) } ) - -#endif /* !__ASSEMBLY__ */ - -/* to align the pointer to the (next) page boundary */ -#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK) - -#define __PAGE_OFFSET 0x0UL -#define PAGE_OFFSET 0x0UL -#define __pa(x) (unsigned long)(x) -#define __va(x) (void *)(unsigned long)(x) -#define pfn_to_page(pfn) (mem_map + (pfn)) -#define page_to_pfn(page) ((unsigned long)((page) - mem_map)) -#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) - -#define pfn_valid(pfn) ((pfn) < max_mapnr) -#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) - -#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ - VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) - -#endif /* __KERNEL__ */ - -#endif /* _S390_PAGE_H */ diff --git a/include/asm-s390x/param.h b/include/asm-s390x/param.h deleted file mode 100644 index 753b8bdeecba5..0000000000000 --- a/include/asm-s390x/param.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * include/asm-s390/param.h - * - * S390 version - * - * Derived from "include/asm-i386/param.h" - */ - -#ifndef _ASMS390_PARAM_H -#define _ASMS390_PARAM_H - -#ifdef __KERNEL__ -# define HZ 100 /* Internal kernel timer frequency */ -# define USER_HZ 100 /* .. some user interfaces are in "ticks" */ -# define CLOCKS_PER_SEC (USER_HZ) /* like times() */ -#endif - -#ifndef HZ -#define HZ 100 -#endif - -#define EXEC_PAGESIZE 4096 - -#ifndef NGROUPS -#define NGROUPS 32 -#endif - -#ifndef NOGROUP -#define NOGROUP (-1) -#endif - -#define MAXHOSTNAMELEN 64 /* max length of hostname */ - -#endif diff --git a/include/asm-s390x/pci.h b/include/asm-s390x/pci.h deleted file mode 100644 index f8f8b7302b744..0000000000000 --- a/include/asm-s390x/pci.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef __ASM_S390_PCI_H -#define __ASM_S390_PCI_H - -/* S/390 systems don't have a PCI bus. This file is just here because some stupid .c code - * includes it even if CONFIG_PCI is not set. - */ -#define PCI_DMA_BUS_IS_PHYS (1) - -#endif /* __ASM_S390_PCI_H */ - diff --git a/include/asm-s390x/percpu.h b/include/asm-s390x/percpu.h deleted file mode 100644 index 291ec210bcee6..0000000000000 --- a/include/asm-s390x/percpu.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef __ARCH_S390X_PERCPU__ -#define __ARCH_S390X_PERCPU__ - -#include - -#endif /* __ARCH_S390X_PERCPU__ */ diff --git a/include/asm-s390x/pgalloc.h b/include/asm-s390x/pgalloc.h deleted file mode 100644 index 838eb9ff927e8..0000000000000 --- a/include/asm-s390x/pgalloc.h +++ /dev/null @@ -1,154 +0,0 @@ -/* - * include/asm-s390/pgalloc.h - * - * S390 version - * Copyright (C) 1999, 2000 IBM Deutschland Entwicklung GmbH, IBM Corporation - * Author(s): Hartmut Penner (hpenner@de.ibm.com) - * Martin Schwidefsky (schwidefsky@de.ibm.com) - * - * Derived from "include/asm-i386/pgalloc.h" - * Copyright (C) 1994 Linus Torvalds - */ - -#ifndef _S390_PGALLOC_H -#define _S390_PGALLOC_H - -#include -#include -#include -#include -#include - -#define check_pgt_cache() do { } while (0) - -/* - * Allocate and free page tables. The xxx_kernel() versions are - * used to allocate a kernel page table - this turns on ASN bits - * if any. - */ - -static inline pgd_t *pgd_alloc (struct mm_struct *mm) -{ - pgd_t *pgd; - int i; - - pgd = (pgd_t *) __get_free_pages(GFP_KERNEL,2); - if (pgd != NULL) - for (i = 0; i < PTRS_PER_PGD; i++) - pgd_clear(pgd + i); - return pgd; -} - -static inline void pgd_free (pgd_t *pgd) -{ - free_pages((unsigned long) pgd, 2); -} - -static inline void pgd_populate(struct mm_struct *mm, pgd_t *pgd, pmd_t *pmd) -{ - pgd_val(*pgd) = _PGD_ENTRY | __pa(pmd); -} - -/* - * page middle directory allocation/free routines. - */ -static inline pmd_t * pmd_alloc_one(struct mm_struct *mm, unsigned long vmaddr) -{ - pmd_t *pmd; - int i; - - pmd = (pmd_t *) __get_free_pages(GFP_KERNEL, 2); - if (pmd != NULL) { - for (i=0; i < PTRS_PER_PMD; i++) - pmd_clear(pmd+i); - } - return pmd; -} - -static inline void pmd_free (pmd_t *pmd) -{ - free_pages((unsigned long) pmd, 2); -} - -#define __pmd_free_tlb(tlb,pmd) pmd_free(pmd) - -static inline void -pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd, pte_t *pte) -{ - pmd_val(*pmd) = _PMD_ENTRY + __pa(pte); - pmd_val1(*pmd) = _PMD_ENTRY + __pa(pte+256); -} - -static inline void -pmd_populate(struct mm_struct *mm, pmd_t *pmd, struct page *page) -{ - pmd_populate_kernel(mm, pmd, (pte_t *)((page-mem_map) << PAGE_SHIFT)); -} - -/* - * page table entry allocation/free routines. - */ -static inline pte_t * -pte_alloc_one_kernel(struct mm_struct *mm, unsigned long vmaddr) -{ - pte_t *pte; - int count; - int i; - - count = 0; - do { - pte = (pte_t *) __get_free_page(GFP_KERNEL); - if (pte != NULL) { - for (i=0; i < PTRS_PER_PTE; i++) - pte_clear(pte+i); - } else { - current->state = TASK_UNINTERRUPTIBLE; - schedule_timeout(HZ); - } - } while (!pte && (count++ < 10)); - return pte; -} - -static inline struct page * -pte_alloc_one(struct mm_struct *mm, unsigned long addr) -{ - return virt_to_page(pte_alloc_one_kernel(mm, addr)); -} - -static inline void pte_free_kernel(pte_t *pte) -{ - free_page((unsigned long) pte); -} - -static inline void pte_free(struct page *pte) -{ - __free_page(pte); -} - -#define __pte_free_tlb(tlb,pte) tlb_remove_page((tlb),(pte)) - -/* - * This establishes kernel virtual mappings (e.g., as a result of a - * vmalloc call). Since s390-esame uses a separate kernel page table, - * there is nothing to do here... :) - */ -#define set_pgdir(vmaddr, entry) do { } while(0) - -static inline pte_t ptep_invalidate(struct vm_area_struct *vma, - unsigned long address, pte_t *ptep) -{ - pte_t pte = *ptep; - if (!(pte_val(pte) & _PAGE_INVALID)) - __asm__ __volatile__ ("ipte %0,%1" : : "a" (ptep), "a" (address)); - pte_clear(ptep); - return pte; -} - -static inline void ptep_establish(struct vm_area_struct *vma, - unsigned long address, pte_t *ptep, pte_t entry) -{ - ptep_invalidate(vma, address, ptep); - set_pte(ptep, entry); -} - -#endif /* _S390_PGALLOC_H */ diff --git a/include/asm-s390x/pgtable.h b/include/asm-s390x/pgtable.h deleted file mode 100644 index 1bb01e181fab3..0000000000000 --- a/include/asm-s390x/pgtable.h +++ /dev/null @@ -1,550 +0,0 @@ -/* - * include/asm-s390/pgtable.h - * - * S390 64bit version - * Copyright (C) 2000 IBM Deutschland Entwicklung GmbH, IBM Corporation - * Author(s): Hartmut Penner (hp@de.ibm.com) - * Ulrich Weigand (weigand@de.ibm.com) - * Martin Schwidefsky (schwidefsky@de.ibm.com) - * - * Derived from "include/asm-i386/pgtable.h" - */ - -#ifndef _ASM_S390_PGTABLE_H -#define _ASM_S390_PGTABLE_H - -/* - * The Linux memory management assumes a three-level page table setup. On - * the S390, we use that, but "fold" the mid level into the top-level page - * table, so that we physically have the same two-level page table as the - * S390 mmu expects. - * - * This file contains the functions and defines necessary to modify and use - * the S390 page table tree. - */ -#ifndef __ASSEMBLY__ -#include -#include - -extern pgd_t swapper_pg_dir[] __attribute__ ((aligned (4096))); -extern void paging_init(void); - -/* - * The S390 doesn't have any external MMU info: the kernel page - * tables contain all the necessary information. - */ -#define update_mmu_cache(vma, address, pte) do { } while (0) - -/* - * ZERO_PAGE is a global shared page that is always zero: used - * for zero-mapped memory areas etc.. - */ -extern char empty_zero_page[PAGE_SIZE]; -#define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page)) -#endif /* !__ASSEMBLY__ */ - -/* - * PMD_SHIFT determines the size of the area a second-level page - * table can map - */ -#define PMD_SHIFT 21 -#define PMD_SIZE (1UL << PMD_SHIFT) -#define PMD_MASK (~(PMD_SIZE-1)) - -/* PGDIR_SHIFT determines what a third-level page table entry can map */ -#define PGDIR_SHIFT 31 -#define PGDIR_SIZE (1UL << PGDIR_SHIFT) -#define PGDIR_MASK (~(PGDIR_SIZE-1)) - -/* - * entries per page directory level: the S390 is two to five-level, - * currently we use a 3 level lookup - */ -#define PTRS_PER_PTE 512 -#define PTRS_PER_PMD 1024 -#define PTRS_PER_PGD 2048 - -/* - * pgd entries used up by user/kernel: - */ -#define USER_PTRS_PER_PGD 2048 -#define USER_PGD_PTRS 2048 -#define KERNEL_PGD_PTRS 2048 -#define FIRST_USER_PGD_NR 0 - -#define pte_ERROR(e) \ - printk("%s:%d: bad pte %016lx.\n", __FILE__, __LINE__, pte_val(e)) -#define pmd_ERROR(e) \ - printk("%s:%d: bad pmd %016lx.\n", __FILE__, __LINE__, pmd_val(e)) -#define pgd_ERROR(e) \ - printk("%s:%d: bad pgd %016lx.\n", __FILE__, __LINE__, pgd_val(e)) - -#ifndef __ASSEMBLY__ -/* - * Just any arbitrary offset to the start of the vmalloc VM area: the - * current 8MB value just means that there will be a 8MB "hole" after the - * physical memory until the kernel virtual memory starts. That means that - * any out-of-bounds memory accesses will hopefully be caught. - * The vmalloc() routines leaves a hole of 4kB between each vmalloced - * area for the same reason. ;) - */ -#define VMALLOC_OFFSET (8*1024*1024) -#define VMALLOC_START (((unsigned long) high_memory + VMALLOC_OFFSET) \ - & ~(VMALLOC_OFFSET-1)) -#define VMALLOC_VMADDR(x) ((unsigned long)(x)) -#define VMALLOC_END (0x40000000000L) - - -/* - * A pagetable entry of S390 has following format: - * | PFRA |0IP0| OS | - * 0000000000111111111122222222223333333333444444444455555555556666 - * 0123456789012345678901234567890123456789012345678901234567890123 - * - * I Page-Invalid Bit: Page is not available for address-translation - * P Page-Protection Bit: Store access not possible for page - * - * A segmenttable entry of S390 has following format: - * | P-table origin | TT - * 0000000000111111111122222222223333333333444444444455555555556666 - * 0123456789012345678901234567890123456789012345678901234567890123 - * - * I Segment-Invalid Bit: Segment is not available for address-translation - * C Common-Segment Bit: Segment is not private (PoP 3-30) - * P Page-Protection Bit: Store access not possible for page - * TT Type 00 - * - * A region table entry of S390 has following format: - * | S-table origin | TF TTTL - * 0000000000111111111122222222223333333333444444444455555555556666 - * 0123456789012345678901234567890123456789012345678901234567890123 - * - * I Segment-Invalid Bit: Segment is not available for address-translation - * TT Type 01 - * TF - * TL Table lenght - * - * The regiontable origin of S390 has following format: - * | region table origon | DTTL - * 0000000000111111111122222222223333333333444444444455555555556666 - * 0123456789012345678901234567890123456789012345678901234567890123 - * - * X Space-Switch event: - * G Segment-Invalid Bit: - * P Private-Space Bit: - * S Storage-Alteration: - * R Real space - * TL Table-Length: - * - * A storage key has the following format: - * | ACC |F|R|C|0| - * 0 3 4 5 6 7 - * ACC: access key - * F : fetch protection bit - * R : referenced bit - * C : changed bit - */ - -/* Bits in the page table entry */ -#define _PAGE_PRESENT 0x001 /* Software */ -#define _PAGE_MKCLEAN 0x002 /* Software */ -#define _PAGE_ISCLEAN 0x004 /* Software */ -#define _PAGE_RO 0x200 /* HW read-only */ -#define _PAGE_INVALID 0x400 /* HW invalid */ - -/* Bits in the segment table entry */ -#define _PMD_ENTRY_INV 0x20 /* invalid segment table entry */ -#define _PMD_ENTRY 0x00 - -/* Bits in the region third table entry */ -#define _PGD_ENTRY_INV 0x20 /* invalid region table entry */ -#define _PGD_ENTRY 0x07 - -/* - * User and kernel page directory - */ -#define _REGION_THIRD 0x4 -#define _REGION_THIRD_LEN 0x3 -#define _REGION_TABLE (_REGION_THIRD|_REGION_THIRD_LEN|0x40|0x100) -#define _KERN_REGION_TABLE (_REGION_THIRD|_REGION_THIRD_LEN) - -#define USER_STD_MASK 0x0000000000000080UL - -/* Bits in the storage key */ -#define _PAGE_CHANGED 0x02 /* HW changed bit */ -#define _PAGE_REFERENCED 0x04 /* HW referenced bit */ - -/* - * No mapping available - */ -#define PAGE_INVALID __pgprot(_PAGE_INVALID) -#define PAGE_NONE_SHARED __pgprot(_PAGE_PRESENT|_PAGE_INVALID) -#define PAGE_NONE_PRIVATE __pgprot(_PAGE_PRESENT|_PAGE_INVALID|_PAGE_ISCLEAN) -#define PAGE_RO_SHARED __pgprot(_PAGE_PRESENT|_PAGE_RO) -#define PAGE_RO_PRIVATE __pgprot(_PAGE_PRESENT|_PAGE_RO|_PAGE_ISCLEAN) -#define PAGE_COPY __pgprot(_PAGE_PRESENT|_PAGE_RO|_PAGE_ISCLEAN) -#define PAGE_SHARED __pgprot(_PAGE_PRESENT) -#define PAGE_KERNEL __pgprot(_PAGE_PRESENT) - -/* - * The S390 can't do page protection for execute, and considers that the - * same are read. Also, write permissions imply read permissions. This is - * the closest we can get.. - */ -#define __P000 PAGE_NONE_PRIVATE -#define __P001 PAGE_RO_PRIVATE -#define __P010 PAGE_COPY -#define __P011 PAGE_COPY -#define __P100 PAGE_RO_PRIVATE -#define __P101 PAGE_RO_PRIVATE -#define __P110 PAGE_COPY -#define __P111 PAGE_COPY - -#define __S000 PAGE_NONE_SHARED -#define __S001 PAGE_RO_SHARED -#define __S010 PAGE_SHARED -#define __S011 PAGE_SHARED -#define __S100 PAGE_RO_SHARED -#define __S101 PAGE_RO_SHARED -#define __S110 PAGE_SHARED -#define __S111 PAGE_SHARED - -/* - * Certain architectures need to do special things when PTEs - * within a page table are directly modified. Thus, the following - * hook is made available. - */ -extern inline void set_pte(pte_t *pteptr, pte_t pteval) -{ - if ((pte_val(pteval) & (_PAGE_MKCLEAN|_PAGE_INVALID)) - == _PAGE_MKCLEAN) - { - pte_val(pteval) &= ~_PAGE_MKCLEAN; - - asm volatile ("sske %0,%1" - : : "d" (0), "a" (pte_val(pteval))); - } - - *pteptr = pteval; -} - -/* - * pgd/pmd/pte query functions - */ -extern inline int pgd_present(pgd_t pgd) -{ - return (pgd_val(pgd) & ~PAGE_MASK) == _PGD_ENTRY; -} - -extern inline int pgd_none(pgd_t pgd) -{ - return pgd_val(pgd) & _PGD_ENTRY_INV; -} - -extern inline int pgd_bad(pgd_t pgd) -{ - return (pgd_val(pgd) & (~PAGE_MASK & ~_PGD_ENTRY_INV)) != _PGD_ENTRY; -} - -extern inline int pmd_present(pmd_t pmd) -{ - return (pmd_val(pmd) & ~PAGE_MASK) == _PMD_ENTRY; -} - -extern inline int pmd_none(pmd_t pmd) -{ - return pmd_val(pmd) & _PMD_ENTRY_INV; -} - -extern inline int pmd_bad(pmd_t pmd) -{ - return (pmd_val(pmd) & (~PAGE_MASK & ~_PMD_ENTRY_INV)) != _PMD_ENTRY; -} - -extern inline int pte_present(pte_t pte) -{ - return pte_val(pte) & _PAGE_PRESENT; -} - -extern inline int pte_none(pte_t pte) -{ - return ((pte_val(pte) & - (_PAGE_INVALID | _PAGE_RO | _PAGE_PRESENT)) == _PAGE_INVALID); -} - -#define pte_same(a,b) (pte_val(a) == pte_val(b)) - -/* - * query functions pte_write/pte_dirty/pte_young only work if - * pte_present() is true. Undefined behaviour if not.. - */ -extern inline int pte_write(pte_t pte) -{ - return (pte_val(pte) & _PAGE_RO) == 0; -} - -extern inline int pte_dirty(pte_t pte) -{ - int skey; - - if (pte_val(pte) & _PAGE_ISCLEAN) - return 0; - asm volatile ("iske %0,%1" : "=d" (skey) : "a" (pte_val(pte))); - return skey & _PAGE_CHANGED; -} - -extern inline int pte_young(pte_t pte) -{ - int skey; - - asm volatile ("iske %0,%1" : "=d" (skey) : "a" (pte_val(pte))); - return skey & _PAGE_REFERENCED; -} - -/* - * pgd/pmd/pte modification functions - */ -extern inline void pgd_clear(pgd_t * pgdp) -{ - pgd_val(*pgdp) = _PGD_ENTRY_INV | _PGD_ENTRY; -} - -extern inline void pmd_clear(pmd_t * pmdp) -{ - pmd_val(*pmdp) = _PMD_ENTRY_INV | _PMD_ENTRY; - pmd_val1(*pmdp) = _PMD_ENTRY_INV | _PMD_ENTRY; -} - -extern inline void pte_clear(pte_t *ptep) -{ - pte_val(*ptep) = _PAGE_INVALID; -} - -/* - * The following pte_modification functions only work if - * pte_present() is true. Undefined behaviour if not.. - */ -extern inline pte_t pte_modify(pte_t pte, pgprot_t newprot) -{ - pte_val(pte) &= PAGE_MASK | _PAGE_ISCLEAN; - pte_val(pte) |= pgprot_val(newprot) & ~_PAGE_ISCLEAN; - return pte; -} - -extern inline pte_t pte_wrprotect(pte_t pte) -{ - pte_val(pte) |= _PAGE_RO; - return pte; -} - -extern inline pte_t pte_mkwrite(pte_t pte) -{ - pte_val(pte) &= ~(_PAGE_RO | _PAGE_ISCLEAN); - return pte; -} - -extern inline pte_t pte_mkclean(pte_t pte) -{ - /* The only user of pte_mkclean is the fork() code. - We must *not* clear the *physical* page dirty bit - just because fork() wants to clear the dirty bit in - *one* of the page's mappings. So we just do nothing. */ - return pte; -} - -extern inline pte_t pte_mkdirty(pte_t pte) -{ - /* We do not explicitly set the dirty bit because the - * sske instruction is slow. It is faster to let the - * next instruction set the dirty bit. - */ - pte_val(pte) &= ~(_PAGE_MKCLEAN | _PAGE_ISCLEAN); - return pte; -} - -extern inline pte_t pte_mkold(pte_t pte) -{ - asm volatile ("rrbe 0,%0" : : "a" (pte_val(pte)) : "cc" ); - return pte; -} - -extern inline pte_t pte_mkyoung(pte_t pte) -{ - /* To set the referenced bit we read the first word from the real - * page with a special instruction: load using real address (lura). - * Isn't S/390 a nice architecture ?! */ - asm volatile ("lura 0,%0" : : "a" (pte_val(pte) & PAGE_MASK) : "0" ); - return pte; -} - -static inline int ptep_test_and_clear_young(pte_t *ptep) -{ - int ccode; - - asm volatile ("rrbe 0,%1\n\t" - "ipm %0\n\t" - "srl %0,28\n\t" - : "=d" (ccode) : "a" (pte_val(*ptep)) : "cc" ); - return ccode & 2; -} - -static inline int ptep_test_and_clear_dirty(pte_t *ptep) -{ - int skey; - - if (pte_val(*ptep) & _PAGE_ISCLEAN) - return 0; - asm volatile ("iske %0,%1" : "=d" (skey) : "a" (*ptep)); - if ((skey & _PAGE_CHANGED) == 0) - return 0; - /* We can't clear the changed bit atomically. For now we - * clear (!) the page referenced bit. */ - asm volatile ("sske %0,%1" - : : "d" (0), "a" (*ptep)); - return 1; -} - -static inline pte_t ptep_get_and_clear(pte_t *ptep) -{ - pte_t pte = *ptep; - pte_clear(ptep); - return pte; -} - -static inline void ptep_set_wrprotect(pte_t *ptep) -{ - pte_t old_pte = *ptep; - set_pte(ptep, pte_wrprotect(old_pte)); -} - -static inline void ptep_mkdirty(pte_t *ptep) -{ - pte_mkdirty(*ptep); -} - -/* - * Conversion functions: convert a page and protection to a page entry, - * and a page entry and page directory to the page they refer to. - */ -extern inline pte_t mk_pte_phys(unsigned long physpage, pgprot_t pgprot) -{ - pte_t __pte; - pte_val(__pte) = physpage + pgprot_val(pgprot); - return __pte; -} - -#define mk_pte(pg, pgprot) \ -({ \ - struct page *__page = (pg); \ - pgprot_t __pgprot = (pgprot); \ - unsigned long __physpage = __pa((__page-mem_map) << PAGE_SHIFT); \ - pte_t __pte = mk_pte_phys(__physpage, __pgprot); \ - \ - if (!(pgprot_val(__pgprot) & _PAGE_ISCLEAN)) { \ - int __users = !!PagePrivate(__page) + !!__page->mapping; \ - if (__users + page_count(__page) == 1) \ - pte_val(__pte) |= _PAGE_MKCLEAN; \ - } \ - __pte; \ -}) - -#define pfn_pte(pfn, pgprot) \ -({ \ - struct page *__page = mem_map+(pfn); \ - pgprot_t __pgprot = (pgprot); \ - unsigned long __physpage = __pa((pfn) << PAGE_SHIFT); \ - pte_t __pte = mk_pte_phys(__physpage, __pgprot); \ - \ - if (!(pgprot_val(__pgprot) & _PAGE_ISCLEAN)) { \ - int __users = !!PagePrivate(__page) + !!__page->mapping; \ - if (__users + page_count(__page) == 1) \ - pte_val(__pte) |= _PAGE_MKCLEAN; \ - } \ - __pte; \ -}) - -#define pfn_pmd(pfn, pgprot) \ -({ \ - pgprot_t __pgprot = (pgprot); \ - unsigned long __physpage = __pa((pfn) << PAGE_SHIFT); \ - pmd_t __pmd = __pmd(__physpage + pgprot_val(__pgprot)); \ - __pmd; \ -}) - -#define pte_pfn(x) (pte_val(x) >> PAGE_SHIFT) -#define pte_page(x) pfn_to_page(pte_pfn(x)) - -#define pmd_page_kernel(pmd) (pmd_val(pmd) & PAGE_MASK) - -#define pmd_page(pmd) (mem_map+(pmd_val(pmd) >> PAGE_SHIFT)) - -#define pgd_page_kernel(pgd) (pgd_val(pgd) & PAGE_MASK) - -/* to find an entry in a page-table-directory */ -#define pgd_index(address) ((address >> PGDIR_SHIFT) & (PTRS_PER_PGD-1)) -#define pgd_offset(mm, address) ((mm)->pgd + pgd_index(address)) - -/* to find an entry in a kernel page-table-directory */ -#define pgd_offset_k(address) pgd_offset(&init_mm, address) - -/* Find an entry in the second-level page table.. */ -#define pmd_index(address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1)) -#define pmd_offset(dir,addr) \ - ((pmd_t *) pgd_page_kernel(*(dir)) + pmd_index(addr)) - -/* Find an entry in the third-level page table.. */ -#define pte_index(address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE-1)) -#define pte_offset_kernel(pmd, address) \ - ((pte_t *) pmd_page_kernel(*(pmd)) + pte_index(address)) -#define pte_offset_map(pmd, address) pte_offset_kernel(pmd, address) -#define pte_offset_map_nested(pmd, address) pte_offset_kernel(pmd, address) -#define pte_unmap(pte) do { } while (0) -#define pte_unmap_nested(pte) do { } while (0) - -/* - * A page-table entry has some bits we have to treat in a special way. - * Bits 52 and bit 55 have to be zero, otherwise an specification - * exception will occur instead of a page translation exception. The - * specifiation exception has the bad habit not to store necessary - * information in the lowcore. - * Bit 53 and bit 54 are the page invalid bit and the page protection - * bit. We set both to indicate a swapped page. - * Bit 63 is used as the software page present bit. If a page is - * swapped this obviously has to be zero. - * This leaves the bits 0-51 and bits 56-62 to store type and offset. - * We use the 7 bits from 56-62 for the type and the 52 bits from 0-51 - * for the offset. - * | offset |0110|type |0 - * 0000000000111111111122222222223333333333444444444455555555556666 - * 0123456789012345678901234567890123456789012345678901234567890123 - */ -extern inline pte_t mk_swap_pte(unsigned long type, unsigned long offset) -{ - pte_t pte; - pte_val(pte) = (type << 1) | (offset << 12) | _PAGE_INVALID | _PAGE_RO; - pte_val(pte) &= 0xfffffffffffff6fe; /* better to be paranoid */ - return pte; -} - -#define __swp_type(entry) (((entry).val >> 1) & 0x3f) -#define __swp_offset(entry) ((entry).val >> 12) -#define __swp_entry(type,offset) ((swp_entry_t) { pte_val(mk_swap_pte((type),(offset))) }) - -#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) }) -#define __swp_entry_to_pte(x) ((pte_t) { (x).val }) - -typedef pte_t *pte_addr_t; - -#endif /* !__ASSEMBLY__ */ - -#define kern_addr_valid(addr) (1) - -/* - * No page table caches to initialise - */ -#define pgtable_cache_init() do { } while (0) - -#define HAVE_ARCH_UNMAPPED_AREA - -#endif /* _S390_PAGE_H */ - diff --git a/include/asm-s390x/poll.h b/include/asm-s390x/poll.h deleted file mode 100644 index e90a5ca420619..0000000000000 --- a/include/asm-s390x/poll.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * include/asm-s390/poll.h - * - * S390 version - * - * Derived from "include/asm-i386/poll.h" - */ - -#ifndef __S390_POLL_H -#define __S390_POLL_H - -/* These are specified by iBCS2 */ -#define POLLIN 0x0001 -#define POLLPRI 0x0002 -#define POLLOUT 0x0004 -#define POLLERR 0x0008 -#define POLLHUP 0x0010 -#define POLLNVAL 0x0020 - -/* The rest seem to be more-or-less nonstandard. Check them! */ -#define POLLRDNORM 0x0040 -#define POLLRDBAND 0x0080 -#define POLLWRNORM 0x0100 -#define POLLWRBAND 0x0200 -#define POLLMSG 0x0400 -#define POLLREMOVE 0x1000 - -struct pollfd { - int fd; - short events; - short revents; -}; - -#endif diff --git a/include/asm-s390x/posix_types.h b/include/asm-s390x/posix_types.h deleted file mode 100644 index 25562b31f35cb..0000000000000 --- a/include/asm-s390x/posix_types.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * include/asm-s390/posix_types.h - * - * S390 version - * - * Derived from "include/asm-i386/posix_types.h" - */ - -#ifndef __ARCH_S390_POSIX_TYPES_H -#define __ARCH_S390_POSIX_TYPES_H - -/* - * This file is generally used by user-level software, so you need to - * be a little careful about namespace pollution etc. Also, we cannot - * assume GCC is being used. - */ - -typedef unsigned int __kernel_dev_t; -typedef unsigned int __kernel_ino_t; -typedef unsigned int __kernel_mode_t; -typedef unsigned int __kernel_nlink_t; -typedef long __kernel_off_t; -typedef long long __kernel_loff_t; -typedef int __kernel_pid_t; -typedef int __kernel_ipc_pid_t; -typedef unsigned int __kernel_uid_t; -typedef unsigned int __kernel_gid_t; -typedef unsigned long __kernel_size_t; -typedef long __kernel_ssize_t; -typedef long __kernel_ptrdiff_t; -typedef long __kernel_time_t; -typedef long __kernel_suseconds_t; -typedef long __kernel_clock_t; -typedef int __kernel_daddr_t; -typedef char * __kernel_caddr_t; -typedef unsigned long __kernel_sigset_t; /* at least 32 bits */ -typedef unsigned short __kernel_uid16_t; -typedef unsigned short __kernel_gid16_t; - -typedef __kernel_uid_t __kernel_old_uid_t; -typedef __kernel_gid_t __kernel_old_gid_t; -typedef __kernel_uid_t __kernel_uid32_t; -typedef __kernel_gid_t __kernel_gid32_t; - -typedef struct { -#if defined(__KERNEL__) || defined(__USE_ALL) - int val[2]; -#else /* !defined(__KERNEL__) && !defined(__USE_ALL)*/ - int __val[2]; -#endif /* !defined(__KERNEL__) && !defined(__USE_ALL)*/ -} __kernel_fsid_t; - - -#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) - -#ifndef _S390_BITOPS_H -#include -#endif - -#undef __FD_SET -#define __FD_SET(fd,fdsetp) set_bit(fd,fdsetp->fds_bits) - -#undef __FD_CLR -#define __FD_CLR(fd,fdsetp) clear_bit(fd,fdsetp->fds_bits) - -#undef __FD_ISSET -#define __FD_ISSET(fd,fdsetp) test_bit(fd,fdsetp->fds_bits) - -#undef __FD_ZERO -#define __FD_ZERO(fdsetp) (memset (fdsetp, 0, sizeof(*(fd_set *)fdsetp))) - -#endif /* defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)*/ - -#endif diff --git a/include/asm-s390x/processor.h b/include/asm-s390x/processor.h deleted file mode 100644 index 4e4283b8fd0db..0000000000000 --- a/include/asm-s390x/processor.h +++ /dev/null @@ -1,243 +0,0 @@ -/* - * include/asm-s390/processor.h - * - * S390 version - * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation - * Author(s): Hartmut Penner (hp@de.ibm.com), - * Martin Schwidefsky (schwidefsky@de.ibm.com) - * - * Derived from "include/asm-i386/processor.h" - * Copyright (C) 1994, Linus Torvalds - */ - -#ifndef __ASM_S390_PROCESSOR_H -#define __ASM_S390_PROCESSOR_H - -#include -#include - -#ifdef __KERNEL__ -/* - * Default implementation of macro that returns current - * instruction pointer ("program counter"). - */ -#define current_text_addr() ({ void *pc; __asm__("basr %0,0":"=a"(pc)); pc; }) - -/* - * CPU type and hardware bug flags. Kept separately for each CPU. - * Members of this structure are referenced in head.S, so think twice - * before touching them. [mj] - */ - -typedef struct -{ - unsigned int version : 8; - unsigned int ident : 24; - unsigned int machine : 16; - unsigned int unused : 16; -} __attribute__ ((packed)) cpuid_t; - -struct cpuinfo_S390 -{ - cpuid_t cpu_id; - unsigned long loops_per_jiffy; - unsigned long *pgd_quick; - unsigned long *pmd_quick; - unsigned long *pte_quick; - unsigned long pgtable_cache_sz; - __u16 cpu_addr; - __u16 cpu_nr; - __u16 pad[2]; -}; - -extern void print_cpu_info(struct cpuinfo_S390 *); - -/* Lazy FPU handling on uni-processor */ -extern struct task_struct *last_task_used_math; - -/* - * User space process size: 4TB (default). - */ -#define TASK_SIZE (0x20000000000UL) -#define TASK31_SIZE (0x80000000UL) - -/* This decides where the kernel will search for a free chunk of vm - * space during mmap's. - */ -#define TASK_UNMAPPED_BASE \ - (test_thread_flag(TIF_31BIT) ? (TASK31_SIZE / 2) : (TASK_SIZE / 2)) - -#define THREAD_SIZE (4*PAGE_SIZE) - -typedef struct { - __u32 ar4; -} mm_segment_t; - -/* if you change the thread_struct structure, you must - * update the _TSS_* defines in entry.S - */ - -struct thread_struct - { - s390_fp_regs fp_regs; - __u32 ar2; /* kernel access register 2 */ - __u32 ar4; /* kernel access register 4 */ - addr_t ksp; /* kernel stack pointer */ - addr_t user_seg; /* HSTD */ - addr_t prot_addr; /* address of protection-excep. */ - __u32 error_code; /* error-code of last prog-excep. */ - __u32 trap_no; - per_struct per_info;/* Must be aligned on an 4 byte boundary*/ - /* Used to give failing instruction back to user for ieee exceptions */ - addr_t ieee_instruction_pointer; - unsigned long flags; /* various flags */ - /* pfault_wait is used to block the process on a pfault event */ - addr_t pfault_wait; -}; - -typedef struct thread_struct thread_struct; - -#define INIT_THREAD {{0,{{0},{0},{0},{0},{0},{0},{0},{0},{0},{0}, \ - {0},{0},{0},{0},{0},{0}}}, \ - 0, 0, \ - sizeof(init_stack) + (addr_t) &init_stack, \ - (__pa((addr_t) &swapper_pg_dir[0]) + _REGION_TABLE),\ - 0,0,0, \ - (per_struct) {{{{0,}}},0,0,0,0,{{0,}}}, \ - 0, 0, 0 \ -} - -/* need to define ... */ -#define start_thread(regs, new_psw, new_stackp) do { \ - regs->psw.mask = PSW_USER_BITS; \ - regs->psw.addr = new_psw; \ - regs->gprs[15] = new_stackp; \ -} while (0) - -#define start_thread31(regs, new_psw, new_stackp) do { \ - regs->psw.mask = PSW_USER32_BITS; \ - regs->psw.addr = new_psw; \ - regs->gprs[15] = new_stackp; \ -} while (0) - - -/* Forward declaration, a strange C thing */ -struct task_struct; -struct mm_struct; - -/* Free all resources held by a thread. */ -extern void release_thread(struct task_struct *); -extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); - -/* Prepare to copy thread state - unlazy all lazy status */ -#define prepare_to_copy(tsk) do { } while (0) - -/* - * Return saved PC of a blocked thread. - */ -extern inline unsigned long thread_saved_pc(struct task_struct *t); - -/* - * Print register of task into buffer. Used in fs/proc/array.c. - */ -extern char *task_show_regs(struct task_struct *task, char *buffer); - -unsigned long get_wchan(struct task_struct *p); -#define __KSTK_PTREGS(tsk) ((struct pt_regs *) \ - (((addr_t) tsk->thread_info + THREAD_SIZE - sizeof(struct pt_regs)) & -8L)) -#define KSTK_EIP(tsk) (__KSTK_PTREGS(tsk)->psw.addr) -#define KSTK_ESP(tsk) (__KSTK_PTREGS(tsk)->gprs[15]) - -#define cpu_relax() barrier() - -/* - * Set PSW mask to specified value, while leaving the - * PSW addr pointing to the next instruction. - */ - -static inline void __load_psw_mask (unsigned long mask) -{ - unsigned long addr; - - psw_t psw; - psw.mask = mask; - - asm volatile ( - " larl %0,1f\n" - " stg %0,8(%1)\n" - " lpswe 0(%1)\n" - "1:" - : "=&d" (addr) : "a" (&psw) : "memory", "cc" ); -} - -/* - * Function to stop a processor until an interruption occurred - */ -static inline void enabled_wait(void) -{ - unsigned long reg; - psw_t wait_psw; - - wait_psw.mask = PSW_BASE_BITS | PSW_MASK_IO | PSW_MASK_EXT | - PSW_MASK_MCHECK | PSW_MASK_WAIT; - asm volatile ( - " larl %0,0f\n" - " stg %0,8(%1)\n" - " lpswe 0(%1)\n" - "0:" - : "=&a" (reg) : "a" (&wait_psw) : "memory", "cc" ); -} - -/* - * Function to drop a processor into disabled wait state - */ - -static inline void disabled_wait(addr_t code) -{ - char psw_buffer[2*sizeof(psw_t)]; - char ctl_buf[8]; - psw_t *dw_psw = (psw_t *)(((unsigned long) &psw_buffer+sizeof(psw_t)-1) - & -sizeof(psw_t)); - - dw_psw->mask = PSW_BASE_BITS | PSW_MASK_WAIT; - dw_psw->addr = code; - /* - * Store status and then load disabled wait psw, - * the processor is dead afterwards - */ - asm volatile (" stctg 0,0,0(%1)\n" - " ni 4(%1),0xef\n" /* switch off protection */ - " lctlg 0,0,0(%1)\n" - " lghi 1,0x1000\n" - " stpt 0x328(1)\n" /* store timer */ - " stckc 0x330(1)\n" /* store clock comparator */ - " stpx 0x318(1)\n" /* store prefix register */ - " stam 0,15,0x340(1)\n" /* store access registers */ - " stfpc 0x31c(1)\n" /* store fpu control */ - " std 0,0x200(1)\n" /* store f0 */ - " std 1,0x208(1)\n" /* store f1 */ - " std 2,0x210(1)\n" /* store f2 */ - " std 3,0x218(1)\n" /* store f3 */ - " std 4,0x220(1)\n" /* store f4 */ - " std 5,0x228(1)\n" /* store f5 */ - " std 6,0x230(1)\n" /* store f6 */ - " std 7,0x238(1)\n" /* store f7 */ - " std 8,0x240(1)\n" /* store f8 */ - " std 9,0x248(1)\n" /* store f9 */ - " std 10,0x250(1)\n" /* store f10 */ - " std 11,0x258(1)\n" /* store f11 */ - " std 12,0x260(1)\n" /* store f12 */ - " std 13,0x268(1)\n" /* store f13 */ - " std 14,0x270(1)\n" /* store f14 */ - " std 15,0x278(1)\n" /* store f15 */ - " stmg 0,15,0x280(1)\n" /* store general registers */ - " stctg 0,15,0x380(1)\n" /* store control registers */ - " oi 0x384(1),0x10\n" /* fake protection bit */ - " lpswe 0(%0)" - : : "a" (dw_psw), "a" (&ctl_buf) : "cc", "0", "1"); -} - -#endif - -#endif /* __ASM_S390_PROCESSOR_H */ - diff --git a/include/asm-s390x/ptrace.h b/include/asm-s390x/ptrace.h deleted file mode 100644 index c43c1594b0ac4..0000000000000 --- a/include/asm-s390x/ptrace.h +++ /dev/null @@ -1,339 +0,0 @@ -/* - * include/asm-s390/ptrace.h - * - * S390 version - * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation - * Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com) - */ - -#ifndef _S390_PTRACE_H -#define _S390_PTRACE_H - -/* - * Offsets in the user_regs_struct. They are used for the ptrace - * system call and in entry.S - */ -#define PT_PSWMASK 0x00 -#define PT_PSWADDR 0x08 -#define PT_GPR0 0x10 -#define PT_GPR1 0x18 -#define PT_GPR2 0x20 -#define PT_GPR3 0x28 -#define PT_GPR4 0x30 -#define PT_GPR5 0x38 -#define PT_GPR6 0x40 -#define PT_GPR7 0x48 -#define PT_GPR8 0x50 -#define PT_GPR9 0x58 -#define PT_GPR10 0x60 -#define PT_GPR11 0x68 -#define PT_GPR12 0x70 -#define PT_GPR13 0x78 -#define PT_GPR14 0x80 -#define PT_GPR15 0x88 -#define PT_ACR0 0x90 -#define PT_ACR1 0x94 -#define PT_ACR2 0x98 -#define PT_ACR3 0x9C -#define PT_ACR4 0xA0 -#define PT_ACR5 0xA4 -#define PT_ACR6 0xA8 -#define PT_ACR7 0xAC -#define PT_ACR8 0xB0 -#define PT_ACR9 0xB4 -#define PT_ACR10 0xB8 -#define PT_ACR11 0xBC -#define PT_ACR12 0xC0 -#define PT_ACR13 0xC4 -#define PT_ACR14 0xC8 -#define PT_ACR15 0xCC -#define PT_ORIGGPR2 0xD0 -#define PT_FPC 0xD8 -#define PT_FPR0 0xE0 -#define PT_FPR1 0xE8 -#define PT_FPR2 0xF0 -#define PT_FPR3 0xF8 -#define PT_FPR4 0x100 -#define PT_FPR5 0x108 -#define PT_FPR6 0x110 -#define PT_FPR7 0x118 -#define PT_FPR8 0x120 -#define PT_FPR9 0x128 -#define PT_FPR10 0x130 -#define PT_FPR11 0x138 -#define PT_FPR12 0x140 -#define PT_FPR13 0x148 -#define PT_FPR14 0x150 -#define PT_FPR15 0x158 -#define PT_CR_9 0x160 -#define PT_CR_10 0x168 -#define PT_CR_11 0x170 -#define PT_IEEE_IP 0x1A8 -#define PT_LASTOFF PT_IEEE_IP -#define PT_ENDREGS 0x1B0-1 - -#define NUM_GPRS 16 -#define NUM_FPRS 16 -#define NUM_CRS 16 -#define NUM_ACRS 16 -#define GPR_SIZE 8 -#define FPR_SIZE 8 -#define FPC_SIZE 4 -#define FPC_PAD_SIZE 4 /* gcc insists on aligning the fpregs */ -#define CR_SIZE 8 -#define ACR_SIZE 4 - -#define STACK_FRAME_OVERHEAD 160 /* size of minimum stack frame */ - -#define PTRACE_OLDSETOPTIONS 21 - -#ifndef __ASSEMBLY__ -#include -#include -#include - -#include - -/* this typedef defines how a Program Status Word looks like */ -typedef struct -{ - __u64 mask; - __u64 addr; -} __attribute__ ((aligned(8))) psw_t; - -#define PSW_MASK_PER 0x4000000000000000UL -#define PSW_MASK_DAT 0x0400000000000000UL -#define PSW_MASK_IO 0x0200000000000000UL -#define PSW_MASK_EXT 0x0100000000000000UL -#define PSW_MASK_KEY 0x00F0000000000000UL -#define PSW_MASK_MCHECK 0x0004000000000000UL -#define PSW_MASK_WAIT 0x0002000000000000UL -#define PSW_MASK_PSTATE 0x0001000000000000UL -#define PSW_MASK_ASC 0x0000C00000000000UL -#define PSW_MASK_CC 0x0000300000000000UL -#define PSW_MASK_PM 0x00000F0000000000UL - -#define PSW_BASE_BITS 0x0000000180000000UL -#define PSW_BASE32_BITS 0x0000000080000000UL - -#define PSW_ASC_PRIMARY 0x0000000000000000UL -#define PSW_ASC_ACCREG 0x0000400000000000UL -#define PSW_ASC_SECONDARY 0x0000800000000000UL -#define PSW_ASC_HOME 0x0000C00000000000UL - -#define PSW_KERNEL_BITS (PSW_BASE_BITS | PSW_MASK_DAT | PSW_ASC_PRIMARY) -#define PSW_USER_BITS (PSW_BASE_BITS | PSW_MASK_DAT | PSW_ASC_HOME | \ - PSW_MASK_IO | PSW_MASK_EXT | PSW_MASK_MCHECK | \ - PSW_MASK_PSTATE) -#define PSW_USER32_BITS (PSW_BASE32_BITS | PSW_MASK_DAT | PSW_ASC_HOME | \ - PSW_MASK_IO | PSW_MASK_EXT | PSW_MASK_MCHECK | \ - PSW_MASK_PSTATE) - -typedef union -{ - float f; - double d; - __u64 ui; - struct - { - __u32 hi; - __u32 lo; - } fp; -} freg_t; - -typedef struct -{ - __u32 fpc; - freg_t fprs[NUM_FPRS]; -} s390_fp_regs; - -#define FPC_EXCEPTION_MASK 0xF8000000 -#define FPC_FLAGS_MASK 0x00F80000 -#define FPC_DXC_MASK 0x0000FF00 -#define FPC_RM_MASK 0x00000003 -#define FPC_VALID_MASK 0xF8F8FF03 - -/* - * The first entries in pt_regs and user_regs_struct - * are common for the two structures. The s390_regs structure - * covers the common parts. It simplifies copying the common part - * between the three structures. - */ -typedef struct -{ - psw_t psw; - __u64 gprs[NUM_GPRS]; - __u32 acrs[NUM_ACRS]; - __u64 orig_gpr2; -} s390_regs; - -/* - * The pt_regs struct defines the way the registers are stored on - * the stack during a system call. - */ -struct pt_regs -{ - psw_t psw; - __u64 gprs[NUM_GPRS]; - __u32 acrs[NUM_ACRS]; - __u64 orig_gpr2; - __u32 trap; -} __attribute__ ((packed)); - -/* - * Now for the program event recording (trace) definitions. - */ -typedef struct -{ - __u64 cr[3]; -} per_cr_words; - -#define PER_EM_MASK 0x00000000E8000000UL - -typedef struct -{ - unsigned : 32; - unsigned em_branching : 1; - unsigned em_instruction_fetch : 1; - /* - * Switching on storage alteration automatically fixes - * the storage alteration event bit in the users std. - */ - unsigned em_storage_alteration : 1; - unsigned em_gpr_alt_unused : 1; - unsigned em_store_real_address : 1; - unsigned : 3; - unsigned branch_addr_ctl : 1; - unsigned : 1; - unsigned storage_alt_space_ctl : 1; - unsigned : 21; - addr_t starting_addr; - addr_t ending_addr; -} per_cr_bits; - -typedef struct -{ - __u16 perc_atmid; - addr_t address; - __u8 access_id; -} per_lowcore_words; - -typedef struct -{ - unsigned perc_branching : 1; /* 0x096 */ - unsigned perc_instruction_fetch : 1; - unsigned perc_storage_alteration : 1; - unsigned perc_gpr_alt_unused : 1; - unsigned perc_store_real_address : 1; - unsigned : 3; - unsigned atmid_psw_bit_31 : 1; - unsigned atmid_validity_bit : 1; - unsigned atmid_psw_bit_32 : 1; - unsigned atmid_psw_bit_5 : 1; - unsigned atmid_psw_bit_16 : 1; - unsigned atmid_psw_bit_17 : 1; - unsigned si : 2; - addr_t address; /* 0x098 */ - unsigned : 4; /* 0x0a1 */ - unsigned access_id : 4; -} per_lowcore_bits; - -typedef struct -{ - union { - per_cr_words words; - per_cr_bits bits; - } control_regs; - /* - * Use these flags instead of setting em_instruction_fetch - * directly they are used so that single stepping can be - * switched on & off while not affecting other tracing - */ - unsigned single_step : 1; - unsigned instruction_fetch : 1; - unsigned : 30; - /* - * These addresses are copied into cr10 & cr11 if single - * stepping is switched off - */ - addr_t starting_addr; - addr_t ending_addr; - union { - per_lowcore_words words; - per_lowcore_bits bits; - } lowcore; -} per_struct; - -typedef struct -{ - __u32 len; - addr_t kernel_addr; - addr_t process_addr; -} ptrace_area; - -/* - * S/390 specific non posix ptrace requests. I chose unusual values so - * they are unlikely to clash with future ptrace definitions. - */ -#define PTRACE_PEEKUSR_AREA 0x5000 -#define PTRACE_POKEUSR_AREA 0x5001 -#define PTRACE_PEEKTEXT_AREA 0x5002 -#define PTRACE_PEEKDATA_AREA 0x5003 -#define PTRACE_POKETEXT_AREA 0x5004 -#define PTRACE_POKEDATA_AREA 0x5005 -/* - * PT_PROT definition is loosely based on hppa bsd definition in - * gdb/hppab-nat.c - */ -#define PTRACE_PROT 21 - -typedef enum -{ - ptprot_set_access_watchpoint, - ptprot_set_write_watchpoint, - ptprot_disable_watchpoint -} ptprot_flags; - -typedef struct -{ - addr_t lowaddr; - addr_t hiaddr; - ptprot_flags prot; -} ptprot_area; - -/* Sequence of bytes for breakpoint illegal instruction. */ -#define S390_BREAKPOINT {0x0,0x1} -#define S390_BREAKPOINT_U16 ((__u16)0x0001) -#define S390_SYSCALL_OPCODE ((__u16)0x0a00) -#define S390_SYSCALL_SIZE 2 - -/* - * The user_regs_struct defines the way the user registers are - * store on the stack for signal handling. - */ -struct user_regs_struct -{ - psw_t psw; - __u64 gprs[NUM_GPRS]; - __u32 acrs[NUM_ACRS]; - __u64 orig_gpr2; - s390_fp_regs fp_regs; - /* - * These per registers are in here so that gdb can modify them - * itself as there is no "official" ptrace interface for hardware - * watchpoints. This is the way intel does it. - */ - per_struct per_info; - addr_t ieee_instruction_pointer; - /* Used to give failing instruction back to user for ieee exceptions */ -}; - -#ifdef __KERNEL__ -#define user_mode(regs) (((regs)->psw.mask & PSW_MASK_PSTATE) != 0) -#define instruction_pointer(regs) ((regs)->psw.addr) -extern void show_regs(struct pt_regs * regs); -#endif - -#endif /* __ASSEMBLY__ */ - -#endif /* _S390X_PTRACE_H */ diff --git a/include/asm-s390x/qdio.h b/include/asm-s390x/qdio.h deleted file mode 100644 index d327f67573508..0000000000000 --- a/include/asm-s390x/qdio.h +++ /dev/null @@ -1,399 +0,0 @@ -/* - * linux/include/asm/qdio.h - * - * Linux for S/390 QDIO base support, Hipersocket base support - * version 2 - * - * Copyright 2000,2002 IBM Corporation - * Author(s): Utz Bacher - * - */ -#ifndef __QDIO_H__ -#define __QDIO_H__ - -#define VERSION_QDIO_H "$Revision: 1.57 $" - -/* note, that most of the typedef's are from ingo. */ - -#include -#include - -#define QDIO_NAME "qdio " - -#ifndef CONFIG_ARCH_S390X -#define QDIO_32_BIT -#endif /* CONFIG_ARCH_S390X */ - -/**** CONSTANTS, that are relied on without using these symbols *****/ -#define QDIO_MAX_QUEUES_PER_IRQ 32 /* used in width of unsigned int */ -/************************ END of CONSTANTS **************************/ -#define QDIO_MAX_BUFFERS_PER_Q 128 /* must be a power of 2 (%x=&(x-1)*/ -#define QDIO_BUF_ORDER 7 /* 2**this == number of pages used for sbals in 1 q */ -#define QDIO_MAX_ELEMENTS_PER_BUFFER 16 -#define SBAL_SIZE 256 - -#define QDIO_QETH_QFMT 0 -#define QDIO_ZFCP_QFMT 1 -#define QDIO_IQDIO_QFMT 2 - -struct qdio_buffer_element{ - unsigned int flags; - unsigned int length; -#ifdef QDIO_32_BIT - void *reserved; -#endif /* QDIO_32_BIT */ - void *addr; -} __attribute__ ((packed,aligned(16))); - -struct qdio_buffer{ - volatile struct qdio_buffer_element element[16]; -} __attribute__ ((packed,aligned(256))); - - -/* params are: ccw_device, status, qdio_error, siga_error, - queue_number, first element processed, number of elements processed, - int_parm */ -typedef void qdio_handler_t(struct ccw_device *,unsigned int,unsigned int, - unsigned int,unsigned int,int,int,unsigned long); - - -#define QDIO_STATUS_INBOUND_INT 0x01 -#define QDIO_STATUS_OUTBOUND_INT 0x02 -#define QDIO_STATUS_LOOK_FOR_ERROR 0x04 -#define QDIO_STATUS_MORE_THAN_ONE_QDIO_ERROR 0x08 -#define QDIO_STATUS_MORE_THAN_ONE_SIGA_ERROR 0x10 -#define QDIO_STATUS_ACTIVATE_CHECK_CONDITION 0x20 - -#define QDIO_SIGA_ERROR_ACCESS_EXCEPTION 0x10 -#define QDIO_SIGA_ERROR_B_BIT_SET 0x20 - -/* for qdio_initialize */ -#define QDIO_INBOUND_0COPY_SBALS 0x01 -#define QDIO_OUTBOUND_0COPY_SBALS 0x02 -#define QDIO_USE_OUTBOUND_PCIS 0x04 - -/* for qdio_cleanup */ -#define QDIO_FLAG_CLEANUP_USING_CLEAR 0x01 -#define QDIO_FLAG_CLEANUP_USING_HALT 0x02 - -struct qdio_initialize{ - struct ccw_device *cdev; - unsigned char q_format; - unsigned char adapter_name[8]; - unsigned int qib_param_field_format; /*adapter dependent*/ - /* pointer to 128 bytes or NULL, if no param field */ - unsigned char *qib_param_field; /* adapter dependent */ - /* pointer to no_queues*128 words of data or NULL */ - unsigned long *input_slib_elements; - unsigned long *output_slib_elements; - unsigned int min_input_threshold; - unsigned int max_input_threshold; - unsigned int min_output_threshold; - unsigned int max_output_threshold; - unsigned int no_input_qs; - unsigned int no_output_qs; - qdio_handler_t *input_handler; - qdio_handler_t *output_handler; - unsigned long int_parm; - unsigned long flags; - void **input_sbal_addr_array; /* addr of n*128 void ptrs */ - void **output_sbal_addr_array; /* addr of n*128 void ptrs */ -}; -extern int qdio_initialize(struct qdio_initialize *init_data); -extern int qdio_allocate(struct qdio_initialize *init_data); -extern int qdio_establish(struct ccw_device *); - -extern int qdio_activate(struct ccw_device *,int flags); - -#define QDIO_STATE_MUST_USE_OUTB_PCI 0x00000001 -#define QDIO_STATE_INACTIVE 0x00000002 /* after qdio_cleanup */ -#define QDIO_STATE_ESTABLISHED 0x00000004 /* after qdio_initialize */ -#define QDIO_STATE_ACTIVE 0x00000008 /* after qdio_activate */ -#define QDIO_STATE_STOPPED 0x00000010 /* after queues went down */ -extern unsigned long qdio_get_status(int irq); - - -#define QDIO_FLAG_SYNC_INPUT 0x01 -#define QDIO_FLAG_SYNC_OUTPUT 0x02 -#define QDIO_FLAG_UNDER_INTERRUPT 0x04 -#define QDIO_FLAG_NO_INPUT_INTERRUPT_CONTEXT 0x08 /* no effect on - adapter interrupts */ -#define QDIO_FLAG_DONT_SIGA 0x10 - -extern int do_QDIO(struct ccw_device*, unsigned int flags, - unsigned int queue_number, - unsigned int qidx,unsigned int count, - struct qdio_buffer *buffers); - -extern int qdio_synchronize(struct ccw_device*, unsigned int flags, - unsigned int queue_number); - -extern int qdio_cleanup(struct ccw_device*, int how); -extern int qdio_shutdown(struct ccw_device*, int how); -extern int qdio_free(struct ccw_device*); - -unsigned char qdio_get_slsb_state(struct ccw_device*, unsigned int flag, - unsigned int queue_number, - unsigned int qidx); - -extern void qdio_init_scrubber(void); - -struct qdesfmt0 { -#ifdef QDIO_32_BIT - unsigned long res1; /* reserved */ -#endif /* QDIO_32_BIT */ - unsigned long sliba; /* storage-list-information-block - address */ -#ifdef QDIO_32_BIT - unsigned long res2; /* reserved */ -#endif /* QDIO_32_BIT */ - unsigned long sla; /* storage-list address */ -#ifdef QDIO_32_BIT - unsigned long res3; /* reserved */ -#endif /* QDIO_32_BIT */ - unsigned long slsba; /* storage-list-state-block address */ - unsigned int res4; /* reserved */ - unsigned int akey : 4; /* access key for DLIB */ - unsigned int bkey : 4; /* access key for SL */ - unsigned int ckey : 4; /* access key for SBALs */ - unsigned int dkey : 4; /* access key for SLSB */ - unsigned int res5 : 16; /* reserved */ -} __attribute__ ((packed)); - -/* - * Queue-Description record (QDR) - */ -struct qdr { - unsigned int qfmt : 8; /* queue format */ - unsigned int pfmt : 8; /* impl. dep. parameter format */ - unsigned int res1 : 8; /* reserved */ - unsigned int ac : 8; /* adapter characteristics */ - unsigned int res2 : 8; /* reserved */ - unsigned int iqdcnt : 8; /* input-queue-descriptor count */ - unsigned int res3 : 8; /* reserved */ - unsigned int oqdcnt : 8; /* output-queue-descriptor count */ - unsigned int res4 : 8; /* reserved */ - unsigned int iqdsz : 8; /* input-queue-descriptor size */ - unsigned int res5 : 8; /* reserved */ - unsigned int oqdsz : 8; /* output-queue-descriptor size */ - unsigned int res6[9]; /* reserved */ -#ifdef QDIO_32_BIT - unsigned long res7; /* reserved */ -#endif /* QDIO_32_BIT */ - unsigned long qiba; /* queue-information-block address */ - unsigned int res8; /* reserved */ - unsigned int qkey : 4; /* queue-informatio-block key */ - unsigned int res9 : 28; /* reserved */ -/* union _qd {*/ /* why this? */ - struct qdesfmt0 qdf0[126]; -/* } qd;*/ -} __attribute__ ((packed,aligned(4096))); - - -/* - * queue information block (QIB) - */ -#define QIB_AC_INBOUND_PCI_SUPPORTED 0x80 -#define QIB_AC_OUTBOUND_PCI_SUPPORTED 0x40 -struct qib { - unsigned int qfmt : 8; /* queue format */ - unsigned int pfmt : 8; /* impl. dep. parameter format */ - unsigned int res1 : 8; /* reserved */ - unsigned int ac : 8; /* adapter characteristics */ - unsigned int res2; /* reserved */ -#ifdef QDIO_32_BIT - unsigned long res3; /* reserved */ -#endif /* QDIO_32_BIT */ - unsigned long isliba; /* absolute address of 1st - input SLIB */ -#ifdef QDIO_32_BIT - unsigned long res4; /* reserved */ -#endif /* QDIO_32_BIT */ - unsigned long osliba; /* absolute address of 1st - output SLIB */ - unsigned int res5; /* reserved */ - unsigned int res6; /* reserved */ - unsigned char ebcnam[8]; /* adapter identifier in EBCDIC */ - unsigned char res7[88]; /* reserved */ - unsigned char parm[QDIO_MAX_BUFFERS_PER_Q]; - /* implementation dependent - parameters */ -} __attribute__ ((packed,aligned(256))); - - -/* - * storage-list-information block element (SLIBE) - */ -struct slibe { -#ifdef QDIO_32_BIT - unsigned long res; /* reserved */ -#endif /* QDIO_32_BIT */ - unsigned long parms; /* implementation dependent - parameters */ -}; - -/* - * storage-list-information block (SLIB) - */ -struct slib { -#ifdef QDIO_32_BIT - unsigned long res1; /* reserved */ -#endif /* QDIO_32_BIT */ - unsigned long nsliba; /* next SLIB address (if any) */ -#ifdef QDIO_32_BIT - unsigned long res2; /* reserved */ -#endif /* QDIO_32_BIT */ - unsigned long sla; /* SL address */ -#ifdef QDIO_32_BIT - unsigned long res3; /* reserved */ -#endif /* QDIO_32_BIT */ - unsigned long slsba; /* SLSB address */ - unsigned char res4[1000]; /* reserved */ - struct slibe slibe[QDIO_MAX_BUFFERS_PER_Q]; /* SLIB elements */ -} __attribute__ ((packed,aligned(2048))); - -struct sbal_flags { - unsigned char res1 : 1; /* reserved */ - unsigned char last : 1; /* last entry */ - unsigned char cont : 1; /* contiguous storage */ - unsigned char res2 : 1; /* reserved */ - unsigned char frag : 2; /* fragmentation (s.below) */ - unsigned char res3 : 2; /* reserved */ -} __attribute__ ((packed)); - -#define SBAL_FLAGS_FIRST_FRAG 0x04000000UL -#define SBAL_FLAGS_MIDDLE_FRAG 0x08000000UL -#define SBAL_FLAGS_LAST_FRAG 0x0c000000UL -#define SBAL_FLAGS_LAST_ENTRY 0x40000000UL -#define SBAL_FLAGS_CONTIGUOUS 0x20000000UL - -#define SBAL_FLAGS0_DATA_CONTINUATION 0x20UL - -/* Awesome OpenFCP extensions */ -#define SBAL_FLAGS0_TYPE_STATUS 0x00UL -#define SBAL_FLAGS0_TYPE_WRITE 0x08UL -#define SBAL_FLAGS0_TYPE_READ 0x10UL -#define SBAL_FLAGS0_TYPE_WRITE_READ 0x18UL -#define SBAL_FLAGS0_MORE_SBALS 0x04UL -#define SBAL_FLAGS0_COMMAND 0x02UL -#define SBAL_FLAGS0_LAST_SBAL 0x00UL -#define SBAL_FLAGS0_ONLY_SBAL SBAL_FLAGS0_COMMAND -#define SBAL_FLAGS0_MIDDLE_SBAL SBAL_FLAGS0_MORE_SBALS -#define SBAL_FLAGS0_FIRST_SBAL SBAL_FLAGS0_MORE_SBALS | SBAL_FLAGS0_COMMAND -/* Naught of interest beyond this point */ - -#define SBAL_FLAGS0_PCI 0x40 -struct sbal_sbalf_0 { - unsigned char res1 : 1; /* reserved */ - unsigned char pci : 1; /* PCI indicator */ - unsigned char cont : 1; /* data continuation */ - unsigned char sbtype: 2; /* storage-block type (OpenFCP) */ - unsigned char res2 : 3; /* reserved */ -} __attribute__ ((packed)); - -struct sbal_sbalf_1 { - unsigned char res1 : 4; /* reserved */ - unsigned char key : 4; /* storage key */ -} __attribute__ ((packed)); - -struct sbal_sbalf_14 { - unsigned char res1 : 4; /* reserved */ - unsigned char erridx : 4; /* error index */ -} __attribute__ ((packed)); - -struct sbal_sbalf_15 { - unsigned char reason; /* reserved */ -} __attribute__ ((packed)); - -union sbal_sbalf { - struct sbal_sbalf_0 i0; - struct sbal_sbalf_1 i1; - struct sbal_sbalf_14 i14; - struct sbal_sbalf_15 i15; - unsigned char value; -}; - -struct sbal_element { - union { - struct sbal_flags bits; /* flags */ - unsigned char value; - } flags; - unsigned int res1 : 16; /* reserved */ - union sbal_sbalf sbalf; /* SBAL flags */ - unsigned int res2 : 16; /* reserved */ - unsigned int count : 16; /* data count */ -#ifdef QDIO_32_BIT - unsigned long res3; /* reserved */ -#endif /* QDIO_32_BIT */ - unsigned long addr; /* absolute data address */ -} __attribute__ ((packed,aligned(16))); - -/* - * strorage-block access-list (SBAL) - */ -struct sbal { - struct sbal_element element[QDIO_MAX_ELEMENTS_PER_BUFFER]; -} __attribute__ ((packed,aligned(256))); - -/* - * storage-list (SL) - */ -struct sl_element { -#ifdef QDIO_32_BIT - unsigned long res; /* reserved */ -#endif /* QDIO_32_BIT */ - unsigned long sbal; /* absolute SBAL address */ -} __attribute__ ((packed)); - -struct sl { - struct sl_element element[QDIO_MAX_BUFFERS_PER_Q]; -} __attribute__ ((packed,aligned(1024))); - -/* - * storage-list-state block (SLSB) - */ -struct slsb_flags { - unsigned char owner : 2; /* SBAL owner */ - unsigned char type : 1; /* buffer type */ - unsigned char state : 5; /* processing state */ -} __attribute__ ((packed)); - - -struct slsb { - union { - unsigned char val[QDIO_MAX_BUFFERS_PER_Q]; - struct slsb_flags flags[QDIO_MAX_BUFFERS_PER_Q]; - } acc; -} __attribute__ ((packed,aligned(256))); - -/* - * SLSB values - */ -#define SLSB_OWNER_PROG 1 -#define SLSB_OWNER_CU 2 - -#define SLSB_TYPE_INPUT 0 -#define SLSB_TYPE_OUTPUT 1 - -#define SLSB_STATE_NOT_INIT 0 -#define SLSB_STATE_EMPTY 1 -#define SLSB_STATE_PRIMED 2 -#define SLSB_STATE_HALTED 0xe -#define SLSB_STATE_ERROR 0xf - -#define SLSB_P_INPUT_NOT_INIT 0x80 -#define SLSB_P_INPUT_PROCESSING 0x81 -#define SLSB_CU_INPUT_EMPTY 0x41 -#define SLSB_P_INPUT_PRIMED 0x82 -#define SLSB_P_INPUT_HALTED 0x8E -#define SLSB_P_INPUT_ERROR 0x8F - -#define SLSB_P_OUTPUT_NOT_INIT 0xA0 -#define SLSB_P_OUTPUT_EMPTY 0xA1 -#define SLSB_CU_OUTPUT_PRIMED 0x62 -#define SLSB_P_OUTPUT_HALTED 0xAE -#define SLSB_P_OUTPUT_ERROR 0xAF - -#define SLSB_ERROR_DURING_LOOKUP 0xFF - -#endif /* __QDIO_H__ */ diff --git a/include/asm-s390x/queue.h b/include/asm-s390x/queue.h deleted file mode 100644 index 1e78ea8bf58ba..0000000000000 --- a/include/asm-s390x/queue.h +++ /dev/null @@ -1,170 +0,0 @@ -/* - * include/asm-s390/queue.h - * - * S390 version - * Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation - * Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com) - * - * A little set of queue utilies. - */ -#ifndef __ASM_QUEUE_H -#define __ASM_QUEUE_H -#include - -typedef struct queue -{ - struct queue *next; -} queue; - -typedef queue list; - -typedef struct -{ - queue *head; - queue *tail; -} qheader; - -static __inline__ void init_queue(qheader *qhead) -{ - memset(qhead,0,sizeof(*qhead)); -} - -static __inline__ void enqueue_tail(qheader *qhead,queue *member) -{ - if(member) - { - queue *tail=qhead->tail; - - if(tail) - tail->next=member; - else - - qhead->head=member; - qhead->tail=member; - member->next=NULL; - } -} - -static __inline__ queue *dequeue_head(qheader *qhead) -{ - queue *head=qhead->head,*next_head; - - if(head) - { - next_head=head->next; - qhead->head=next_head; - if(!next_head) - qhead->tail=NULL; - } - return(head); -} - -static __inline__ void init_list(list **lhead) -{ - *lhead=NULL; -} - -static __inline__ void add_to_list(list **lhead,list *member) -{ - member->next=*lhead; - *lhead=member; -} - -static __inline__ list *remove_listhead(list **lhead) -{ - list *oldhead=*lhead; - - if(oldhead) - *lhead=(*lhead)->next; - return(oldhead); -} - -static __inline__ void add_to_list_tail(list **lhead,list *member) -{ - list *curr,*prev; - if(*lhead==NULL) - *lhead=member; - else - { - prev=*lhead; - for(curr=(*lhead)->next;curr!=NULL;curr=curr->next) - prev=curr; - prev->next=member; - } -} -static __inline__ void add_to_list_tail_null(list **lhead,list *member) -{ - member->next=NULL; - add_to_list_tail_null(lhead,member); -} - - -static __inline__ int is_in_list(list *lhead,list *member) -{ - list *curr; - - for(curr=lhead;curr!=NULL;curr=curr->next) - if(curr==member) - return(1); - return(0); -} - -static __inline__ int get_prev(list *lhead,list *member,list **prev) -{ - list *curr; - - *prev=NULL; - for(curr=lhead;curr!=NULL;curr=curr->next) - { - if(curr==member) - return(1); - *prev=curr; - } - *prev=NULL; - return(0); -} - - - -static __inline__ int remove_from_list(list **lhead,list *member) -{ - list *prev; - - if(get_prev(*lhead,member,&prev)) - { - - if(prev) - prev->next=member->next; - else - *lhead=member->next; - return(1); - } - return(0); -} - -static __inline__ int remove_from_queue(qheader *qhead,queue *member) -{ - queue *prev; - - if(get_prev(qhead->head,(list *)member,(list **)&prev)) - { - - if(prev) - { - prev->next=member->next; - if(prev->next==NULL) - qhead->tail=prev; - } - else - { - if(qhead->head==qhead->tail) - qhead->tail=NULL; - qhead->head=member->next; - } - return(1); - } - return(0); -} - -#endif /* __ASM_QUEUE_H */ - diff --git a/include/asm-s390x/resource.h b/include/asm-s390x/resource.h deleted file mode 100644 index 4e0f8e7ba7c62..0000000000000 --- a/include/asm-s390x/resource.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * include/asm-s390/resource.h - * - * S390 version - * - * Derived from "include/asm-i386/resources.h" - */ - -#ifndef _S390_RESOURCE_H -#define _S390_RESOURCE_H - -/* - * Resource limits - */ - -#define RLIMIT_CPU 0 /* CPU time in ms */ -#define RLIMIT_FSIZE 1 /* Maximum filesize */ -#define RLIMIT_DATA 2 /* max data size */ -#define RLIMIT_STACK 3 /* max stack size */ -#define RLIMIT_CORE 4 /* max core file size */ -#define RLIMIT_RSS 5 /* max resident set size */ -#define RLIMIT_NPROC 6 /* max number of processes */ -#define RLIMIT_NOFILE 7 /* max number of open files */ -#define RLIMIT_MEMLOCK 8 /* max locked-in-memory address space */ -#define RLIMIT_AS 9 /* address space limit */ -#define RLIMIT_LOCKS 10 /* maximum file locks held */ - -#define RLIM_NLIMITS 11 - -/* - * SuS says limits have to be unsigned. - * Which makes a ton more sense anyway. - */ -#define RLIM_INFINITY (~0UL) - -#ifdef __KERNEL__ - -#define INIT_RLIMITS \ -{ \ - { RLIM_INFINITY, RLIM_INFINITY }, \ - { RLIM_INFINITY, RLIM_INFINITY }, \ - { RLIM_INFINITY, RLIM_INFINITY }, \ - { _STK_LIM, RLIM_INFINITY }, \ - { 0, RLIM_INFINITY }, \ - { RLIM_INFINITY, RLIM_INFINITY }, \ - { 0, 0 }, \ - { INR_OPEN, INR_OPEN }, \ - { RLIM_INFINITY, RLIM_INFINITY }, \ - { RLIM_INFINITY, RLIM_INFINITY }, \ - { RLIM_INFINITY, RLIM_INFINITY }, \ -} - -#endif /* __KERNEL__ */ - -#endif - diff --git a/include/asm-s390x/rmap.h b/include/asm-s390x/rmap.h deleted file mode 100644 index c41a23a18e4dd..0000000000000 --- a/include/asm-s390x/rmap.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef _S390X_RMAP_H -#define _S390X_RMAP_H - -/* nothing to see, move along */ -#include - -#endif diff --git a/include/asm-s390x/rwsem.h b/include/asm-s390x/rwsem.h deleted file mode 100644 index 9ffabfed0afe9..0000000000000 --- a/include/asm-s390x/rwsem.h +++ /dev/null @@ -1,273 +0,0 @@ -#ifndef _S390X_RWSEM_H -#define _S390X_RWSEM_H - -/* - * include/asm-s390x/rwsem.h - * - * S390 version - * Copyright (C) 2002 IBM Deutschland Entwicklung GmbH, IBM Corporation - * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com) - * - * Based on asm-alpha/semaphore.h and asm-i386/rwsem.h - */ - -/* - * - * The MSW of the count is the negated number of active writers and waiting - * lockers, and the LSW is the total number of active locks - * - * The lock count is initialized to 0 (no active and no waiting lockers). - * - * When a writer subtracts WRITE_BIAS, it'll get 0xffff0001 for the case of an - * uncontended lock. This can be determined because XADD returns the old value. - * Readers increment by 1 and see a positive value when uncontended, negative - * if there are writers (and maybe) readers waiting (in which case it goes to - * sleep). - * - * The value of WAITING_BIAS supports up to 32766 waiting processes. This can - * be extended to 65534 by manually checking the whole MSW rather than relying - * on the S flag. - * - * The value of ACTIVE_BIAS supports up to 65535 active processes. - * - * This should be totally fair - if anything is waiting, a process that wants a - * lock will go to the back of the queue. When the currently active lock is - * released, if there's a writer at the front of the queue, then that and only - * that will be woken up; if there's a bunch of consequtive readers at the - * front, then they'll all be woken up, but no other readers will be. - */ - -#ifndef _LINUX_RWSEM_H -#error "please don't include asm/rwsem.h directly, use linux/rwsem.h instead" -#endif - -#ifdef __KERNEL__ - -#include -#include - -struct rwsem_waiter; - -extern struct rw_semaphore *rwsem_down_read_failed(struct rw_semaphore *); -extern struct rw_semaphore *rwsem_down_write_failed(struct rw_semaphore *); -extern struct rw_semaphore *rwsem_wake(struct rw_semaphore *); -extern struct rw_semaphore *rwsem_downgrade_wake(struct rw_semaphore *); -extern struct rw_semaphore *rwsem_downgrade_write(struct rw_semaphore *); - -/* - * the semaphore definition - */ -struct rw_semaphore { - signed long count; - spinlock_t wait_lock; - struct list_head wait_list; -}; - -#define RWSEM_UNLOCKED_VALUE 0x0000000000000000L -#define RWSEM_ACTIVE_BIAS 0x0000000000000001L -#define RWSEM_ACTIVE_MASK 0x00000000ffffffffL -#define RWSEM_WAITING_BIAS (-0x0000000100000000L) -#define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS -#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS) - -/* - * initialisation - */ -#define __RWSEM_INITIALIZER(name) \ -{ RWSEM_UNLOCKED_VALUE, SPIN_LOCK_UNLOCKED, LIST_HEAD_INIT((name).wait_list) } - -#define DECLARE_RWSEM(name) \ - struct rw_semaphore name = __RWSEM_INITIALIZER(name) - -static inline void init_rwsem(struct rw_semaphore *sem) -{ - sem->count = RWSEM_UNLOCKED_VALUE; - spin_lock_init(&sem->wait_lock); - INIT_LIST_HEAD(&sem->wait_list); -} - -/* - * lock for reading - */ -static inline void __down_read(struct rw_semaphore *sem) -{ - signed long old, new; - - __asm__ __volatile__( - " lg %0,0(%2)\n" - "0: lgr %1,%0\n" - " aghi %1,%3\n" - " csg %0,%1,0(%2)\n" - " jl 0b" - : "=&d" (old), "=&d" (new) - : "a" (&sem->count), "i" (RWSEM_ACTIVE_READ_BIAS) - : "cc", "memory" ); - if (old < 0) - rwsem_down_read_failed(sem); -} - -/* - * trylock for reading -- returns 1 if successful, 0 if contention - */ -static inline int __down_read_trylock(struct rw_semaphore *sem) -{ - signed long old, new; - - __asm__ __volatile__( - " lg %0,0(%2)\n" - "0: ltgr %1,%0\n" - " jm 1f\n" - " aghi %1,%3\n" - " csg %0,%1,0(%2)\n" - " jl 0b\n" - "1:" - : "=&d" (old), "=&d" (new) - : "a" (&sem->count), "i" (RWSEM_ACTIVE_READ_BIAS) - : "cc", "memory" ); - return old >= 0 ? 1 : 0; -} - -/* - * lock for writing - */ -static inline void __down_write(struct rw_semaphore *sem) -{ - signed long old, new, tmp; - - tmp = RWSEM_ACTIVE_WRITE_BIAS; - __asm__ __volatile__( - " lg %0,0(%2)\n" - "0: lgr %1,%0\n" - " ag %1,%3\n" - " csg %0,%1,0(%2)\n" - " jl 0b" - : "=&d" (old), "=&d" (new) - : "a" (&sem->count), "m" (tmp) - : "cc", "memory" ); - if (old != 0) - rwsem_down_write_failed(sem); -} - -/* - * trylock for writing -- returns 1 if successful, 0 if contention - */ -static inline int __down_write_trylock(struct rw_semaphore *sem) -{ - signed long old; - - __asm__ __volatile__( - " lg %0,0(%1)\n" - "0: ltgr %0,%0\n" - " jnz 1f\n" - " csg %0,%2,0(%1)\n" - " jl 0b\n" - "1:" - : "=&d" (old) - : "a" (&sem->count), "d" (RWSEM_ACTIVE_WRITE_BIAS) - : "cc", "memory" ); - return (old == RWSEM_UNLOCKED_VALUE) ? 1 : 0; -} - -/* - * unlock after reading - */ -static inline void __up_read(struct rw_semaphore *sem) -{ - signed long old, new; - - __asm__ __volatile__( - " lg %0,0(%2)\n" - "0: lgr %1,%0\n" - " aghi %1,%3\n" - " csg %0,%1,0(%2)\n" - " jl 0b" - : "=&d" (old), "=&d" (new) - : "a" (&sem->count), "i" (-RWSEM_ACTIVE_READ_BIAS) - : "cc", "memory" ); - if (new < 0) - if ((new & RWSEM_ACTIVE_MASK) == 0) - rwsem_wake(sem); -} - -/* - * unlock after writing - */ -static inline void __up_write(struct rw_semaphore *sem) -{ - signed long old, new, tmp; - - tmp = -RWSEM_ACTIVE_WRITE_BIAS; - __asm__ __volatile__( - " lg %0,0(%2)\n" - "0: lgr %1,%0\n" - " ag %1,%3\n" - " csg %0,%1,0(%2)\n" - " jl 0b" - : "=&d" (old), "=&d" (new) - : "a" (&sem->count), "m" (tmp) - : "cc", "memory" ); - if (new < 0) - if ((new & RWSEM_ACTIVE_MASK) == 0) - rwsem_wake(sem); -} - -/* - * downgrade write lock to read lock - */ -static inline void __downgrade_write(struct rw_semaphore *sem) -{ - signed long old, new, tmp; - - tmp = -RWSEM_WAITING_BIAS; - __asm__ __volatile__( - " lg %0,0(%2)\n" - "0: lgr %1,%0\n" - " ag %1,%3\n" - " csg %0,%1,0(%2)\n" - " jl 0b" - : "=&d" (old), "=&d" (new) - : "a" (&sem->count), "m" (tmp) - : "cc", "memory" ); - if (new > 1) - rwsem_downgrade_wake(sem); -} - -/* - * implement atomic add functionality - */ -static inline void rwsem_atomic_add(long delta, struct rw_semaphore *sem) -{ - signed long old, new; - - __asm__ __volatile__( - " lg %0,0(%2)\n" - "0: lgr %1,%0\n" - " agr %1,%3\n" - " csg %0,%1,0(%2)\n" - " jl 0b" - : "=&d" (old), "=&d" (new) - : "a" (&sem->count), "d" (delta) - : "cc", "memory" ); -} - -/* - * implement exchange and add functionality - */ -static inline long rwsem_atomic_update(long delta, struct rw_semaphore *sem) -{ - signed long old, new; - - __asm__ __volatile__( - " lg %0,0(%2)\n" - "0: lgr %1,%0\n" - " agr %1,%3\n" - " csg %0,%1,0(%2)\n" - " jl 0b" - : "=&d" (old), "=&d" (new) - : "a" (&sem->count), "d" (delta) - : "cc", "memory" ); - return new; -} - -#endif /* __KERNEL__ */ -#endif /* _S390X_RWSEM_H */ diff --git a/include/asm-s390x/s390_ext.h b/include/asm-s390x/s390_ext.h deleted file mode 100644 index e9a2862b230d1..0000000000000 --- a/include/asm-s390x/s390_ext.h +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef _S390_EXTINT_H -#define _S390_EXTINT_H - -/* - * include/asm-s390/s390_ext.h - * - * S390 version - * Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation - * Author(s): Holger Smolinski (Holger.Smolinski@de.ibm.com), - * Martin Schwidefsky (schwidefsky@de.ibm.com) - */ - -typedef void (*ext_int_handler_t)(struct pt_regs *regs, __u16 code); - -/* - * Warning: if you change ext_int_info_t you have to change the - * external interrupt handler in entry.S too. - */ -typedef struct ext_int_info_t { - struct ext_int_info_t *next; - ext_int_handler_t handler; - __u16 code; -} __attribute__ ((packed)) ext_int_info_t; - -extern ext_int_info_t *ext_int_hash[]; - -int register_external_interrupt(__u16 code, ext_int_handler_t handler); -int register_early_external_interrupt(__u16 code, ext_int_handler_t handler, - ext_int_info_t *info); -int unregister_external_interrupt(__u16 code, ext_int_handler_t handler); -int unregister_early_external_interrupt(__u16 code, ext_int_handler_t handler, - ext_int_info_t *info); - -#endif diff --git a/include/asm-s390x/scatterlist.h b/include/asm-s390x/scatterlist.h deleted file mode 100644 index 114ceaf5338ff..0000000000000 --- a/include/asm-s390x/scatterlist.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef _ASMS390X_SCATTERLIST_H -#define _ASMS390X_SCATTERLIST_H - -struct scatterlist { - struct page *page; - unsigned int offset; - unsigned int length; -}; - -#define ISA_DMA_THRESHOLD (0xffffffffffffffff) - -#endif /* _ASMS390X_SCATTERLIST_H */ diff --git a/include/asm-s390x/segment.h b/include/asm-s390x/segment.h deleted file mode 100644 index 8bfce3475b1c4..0000000000000 --- a/include/asm-s390x/segment.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef _ASM_SEGMENT_H -#define _ASM_SEGMENT_H - -#endif diff --git a/include/asm-s390x/semaphore.h b/include/asm-s390x/semaphore.h deleted file mode 100644 index 90640a5c8baf8..0000000000000 --- a/include/asm-s390x/semaphore.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - * include/asm-s390x/semaphore.h - * - * S390 version - * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation - * - * Derived from "include/asm-i386/semaphore.h" - * (C) Copyright 1996 Linus Torvalds - */ - -#ifndef _S390_SEMAPHORE_H -#define _S390_SEMAPHORE_H - -#include -#include -#include -#include - -struct semaphore { - atomic_t count; - wait_queue_head_t wait; -}; - -#define __SEMAPHORE_INITIALIZER(name,count) \ - { ATOMIC_INIT(count), __WAIT_QUEUE_HEAD_INITIALIZER((name).wait) } - -#define __MUTEX_INITIALIZER(name) \ - __SEMAPHORE_INITIALIZER(name,1) - -#define __DECLARE_SEMAPHORE_GENERIC(name,count) \ - struct semaphore name = __SEMAPHORE_INITIALIZER(name,count) - -#define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1) -#define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name,0) - -static inline void sema_init (struct semaphore *sem, int val) -{ - *sem = (struct semaphore) __SEMAPHORE_INITIALIZER((*sem),val); -} - -static inline void init_MUTEX (struct semaphore *sem) -{ - sema_init(sem, 1); -} - -static inline void init_MUTEX_LOCKED (struct semaphore *sem) -{ - sema_init(sem, 0); -} - -asmlinkage void __down(struct semaphore * sem); -asmlinkage int __down_interruptible(struct semaphore * sem); -asmlinkage int __down_trylock(struct semaphore * sem); -asmlinkage void __up(struct semaphore * sem); - -static inline void down(struct semaphore * sem) -{ - if (atomic_dec_return(&sem->count) < 0) - __down(sem); -} - -static inline int down_interruptible(struct semaphore * sem) -{ - int ret = 0; - - if (atomic_dec_return(&sem->count) < 0) - ret = __down_interruptible(sem); - return ret; -} - -static inline int down_trylock(struct semaphore * sem) -{ - int old_val, new_val; - - /* - * This inline assembly atomically implements the equivalent - * to the following C code: - * old_val = sem->count.counter; - * if ((new_val = old_val) > 0) - * sem->count.counter = --new_val; - * In the ppc code this is called atomic_dec_if_positive. - */ - __asm__ __volatile__ ( - " l %0,0(%3)\n" - "0: ltr %1,%0\n" - " jle 1f\n" - " ahi %1,-1\n" - " cs %0,%1,0(%3)\n" - " jl 0b\n" - "1:" - : "=&d" (old_val), "=&d" (new_val), - "+m" (sem->count.counter) - : "a" (&sem->count.counter) : "cc" ); - return old_val <= 0; -} - -static inline void up(struct semaphore * sem) -{ - if (atomic_inc_return(&sem->count) <= 0) - __up(sem); -} - -#endif diff --git a/include/asm-s390x/sembuf.h b/include/asm-s390x/sembuf.h deleted file mode 100644 index 13bba13a25d33..0000000000000 --- a/include/asm-s390x/sembuf.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef _S390_SEMBUF_H -#define _S390_SEMBUF_H - -/* - * The semid64_ds structure for S/390 architecture. - * Note extra padding because this structure is passed back and forth - * between kernel and user space. - * - * Pad space is left for: - * - 2 miscellaneous 32-bit values - */ - -struct semid64_ds { - struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ - __kernel_time_t sem_otime; /* last semop time */ - __kernel_time_t sem_ctime; /* last change time */ - unsigned long sem_nsems; /* no. of semaphores in array */ - unsigned long __unused1; - unsigned long __unused2; -}; - -#endif /* _S390_SEMBUF_H */ diff --git a/include/asm-s390x/setup.h b/include/asm-s390x/setup.h deleted file mode 100644 index 91d2fb85c1c51..0000000000000 --- a/include/asm-s390x/setup.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * include/asm-s390/setup.h - * - * S390 version - * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation - */ - -#ifndef _ASM_S390_SETUP_H -#define _ASM_S390_SETUP_H - -#define PARMAREA 0x10400 -#define COMMAND_LINE_SIZE 896 -#define RAMDISK_ORIGIN 0x800000 -#define RAMDISK_SIZE 0x800000 - -#ifndef __ASSEMBLY__ - -#define IPL_DEVICE (*(unsigned long *) (0x10400)) -#define INITRD_START (*(unsigned long *) (0x10408)) -#define INITRD_SIZE (*(unsigned long *) (0x10410)) -#define COMMAND_LINE ((char *) (0x10480)) - -/* - * Machine features detected in head.S - */ -extern unsigned long machine_flags; - -#define MACHINE_IS_VM (machine_flags & 1) -#define MACHINE_IS_P390 (machine_flags & 4) -#define MACHINE_HAS_MVPG (machine_flags & 16) -#define MACHINE_HAS_DIAG44 (machine_flags & 32) - -#define MACHINE_HAS_SCLP (!MACHINE_IS_P390) - -/* - * Console mode. Override with conmode= - */ -extern unsigned int console_mode; -extern unsigned int console_device; -extern unsigned int console_irq; - -#define CONSOLE_IS_UNDEFINED (console_mode == 0) -#define CONSOLE_IS_SCLP (console_mode == 1) -#define CONSOLE_IS_3215 (console_mode == 2) -#define CONSOLE_IS_3270 (console_mode == 3) -#define SET_CONSOLE_SCLP do { console_mode = 1; } while (0) -#define SET_CONSOLE_3215 do { console_mode = 2; } while (0) -#define SET_CONSOLE_3270 do { console_mode = 3; } while (0) - -#else - -#define IPL_DEVICE 0x10400 -#define INITRD_START 0x10408 -#define INITRD_SIZE 0x10410 -#define COMMAND_LINE 0x10480 - -#endif - -#endif diff --git a/include/asm-s390x/shmbuf.h b/include/asm-s390x/shmbuf.h deleted file mode 100644 index 0fbcdef501132..0000000000000 --- a/include/asm-s390x/shmbuf.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef _S390_SHMBUF_H -#define _S390_SHMBUF_H - -/* - * The shmid64_ds structure for S/390 architecture. - * Note extra padding because this structure is passed back and forth - * between kernel and user space. - * - * Pad space is left for: - * - 2 miscellaneous 32-bit values - */ - -struct shmid64_ds { - struct ipc64_perm shm_perm; /* operation perms */ - size_t shm_segsz; /* size of segment (bytes) */ - __kernel_time_t shm_atime; /* last attach time */ - __kernel_time_t shm_dtime; /* last detach time */ - __kernel_time_t shm_ctime; /* last change time */ - __kernel_pid_t shm_cpid; /* pid of creator */ - __kernel_pid_t shm_lpid; /* pid of last operator */ - unsigned long shm_nattch; /* no. of current attaches */ - unsigned long __unused1; - unsigned long __unused2; -}; - -struct shminfo64 { - unsigned long shmmax; - unsigned long shmmin; - unsigned long shmmni; - unsigned long shmseg; - unsigned long shmall; - unsigned long __unused1; - unsigned long __unused2; - unsigned long __unused3; - unsigned long __unused4; -}; - -#endif /* _S390_SHMBUF_H */ diff --git a/include/asm-s390x/shmparam.h b/include/asm-s390x/shmparam.h deleted file mode 100644 index c2e0c0508e73e..0000000000000 --- a/include/asm-s390x/shmparam.h +++ /dev/null @@ -1,13 +0,0 @@ -/* - * include/asm-s390/shmparam.h - * - * S390 version - * - * Derived from "include/asm-i386/shmparam.h" - */ -#ifndef _ASM_S390_SHMPARAM_H -#define _ASM_S390_SHMPARAM_H - -#define SHMLBA PAGE_SIZE /* attach addr a multiple of this */ - -#endif /* _ASM_S390_SHMPARAM_H */ diff --git a/include/asm-s390x/sigcontext.h b/include/asm-s390x/sigcontext.h deleted file mode 100644 index 6799affcec85e..0000000000000 --- a/include/asm-s390x/sigcontext.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * include/asm-s390/sigcontext.h - * - * S390 version - * Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation - */ - -#ifndef _ASM_S390_SIGCONTEXT_H -#define _ASM_S390_SIGCONTEXT_H - -#define __NUM_GPRS 16 -#define __NUM_FPRS 16 -#define __NUM_ACRS 16 - -/* Has to be at least _NSIG_WORDS from asm/signal.h */ -#define _SIGCONTEXT_NSIG 64 -#define _SIGCONTEXT_NSIG_BPW 64 -/* Size of stack frame allocated when calling signal handler. */ -#define __SIGNAL_FRAMESIZE 160 -#define _SIGCONTEXT_NSIG_WORDS (_SIGCONTEXT_NSIG / _SIGCONTEXT_NSIG_BPW) -#define _SIGMASK_COPY_SIZE (sizeof(unsigned long)*_SIGCONTEXT_NSIG_WORDS) - -typedef struct -{ - unsigned long mask; - unsigned long addr; -} __attribute__ ((aligned(8))) _psw_t; - -typedef struct -{ - _psw_t psw; - unsigned long gprs[__NUM_GPRS]; - unsigned int acrs[__NUM_ACRS]; -} _s390_regs_common; - -typedef struct -{ - unsigned int fpc; - double fprs[__NUM_FPRS]; -} _s390_fp_regs; - -typedef struct -{ - _s390_regs_common regs; - _s390_fp_regs fpregs; -} _sigregs; - -struct sigcontext -{ - unsigned long oldmask[_SIGCONTEXT_NSIG_WORDS]; - _sigregs *sregs; -}; - - -#endif - diff --git a/include/asm-s390x/siginfo.h b/include/asm-s390x/siginfo.h deleted file mode 100644 index 87bcae4498629..0000000000000 --- a/include/asm-s390x/siginfo.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * include/asm-s390/siginfo.h - * - * S390 version - * - * Derived from "include/asm-i386/siginfo.h" - */ - -#ifndef _S390_SIGINFO_H -#define _S390_SIGINFO_H - -#define HAVE_ARCH_SI_CODES - -#include - -/* - * SIGILL si_codes - */ -#define ILL_ILLOPC (__SI_FAULT|1) /* illegal opcode */ -#define ILL_ILLOPN (__SI_FAULT|2) /* illegal operand */ -#define ILL_ILLADR (__SI_FAULT|3) /* illegal addressing mode */ -#define ILL_ILLTRP (__SI_FAULT|4) /* illegal trap */ -#define ILL_PRVOPC (__SI_FAULT|5) /* privileged opcode */ -#define ILL_PRVREG (__SI_FAULT|6) /* privileged register */ -#define ILL_COPROC (__SI_FAULT|7) /* coprocessor error */ -#define ILL_BADSTK (__SI_FAULT|8) /* internal stack error */ -#define NSIGILL 8 - -/* - * SIGFPE si_codes - */ -#define FPE_INTDIV (__SI_FAULT|1) /* integer divide by zero */ -#define FPE_INTOVF (__SI_FAULT|2) /* integer overflow */ -#define FPE_FLTDIV (__SI_FAULT|3) /* floating point divide by zero */ -#define FPE_FLTOVF (__SI_FAULT|4) /* floating point overflow */ -#define FPE_FLTUND (__SI_FAULT|5) /* floating point underflow */ -#define FPE_FLTRES (__SI_FAULT|6) /* floating point inexact result */ -#define FPE_FLTINV (__SI_FAULT|7) /* floating point invalid operation */ -#define FPE_FLTSUB (__SI_FAULT|8) /* subscript out of range */ -#define NSIGFPE 8 - -/* - * SIGSEGV si_codes - */ -#define SEGV_MAPERR (__SI_FAULT|1) /* address not mapped to object */ -#define SEGV_ACCERR (__SI_FAULT|2) /* invalid permissions for mapped object */ -#define NSIGSEGV 2 - -/* - * SIGBUS si_codes - */ -#define BUS_ADRALN (__SI_FAULT|1) /* invalid address alignment */ -#define BUS_ADRERR (__SI_FAULT|2) /* non-existant physical address */ -#define BUS_OBJERR (__SI_FAULT|3) /* object specific hardware error */ -#define NSIGBUS 3 - -/* - * SIGTRAP si_codes - */ -#define TRAP_BRKPT (__SI_FAULT|1) /* process breakpoint */ -#define TRAP_TRACE (__SI_FAULT|2) /* process trace trap */ -#define NSIGTRAP 2 - -/* - * SIGCHLD si_codes - */ -#define CLD_EXITED (__SI_CHLD|1) /* child has exited */ -#define CLD_KILLED (__SI_CHLD|2) /* child was killed */ -#define CLD_DUMPED (__SI_CHLD|3) /* child terminated abnormally */ -#define CLD_TRAPPED (__SI_CHLD|4) /* traced child has trapped */ -#define CLD_STOPPED (__SI_CHLD|5) /* child has stopped */ -#define CLD_CONTINUED (__SI_CHLD|6) /* stopped child has continued */ -#define NSIGCHLD 6 - -/* - * SIGPOLL si_codes - */ -#define POLL_IN (__SI_POLL|1) /* data input available */ -#define POLL_OUT (__SI_POLL|2) /* output buffers available */ -#define POLL_MSG (__SI_POLL|3) /* input message available */ -#define POLL_ERR (__SI_POLL|4) /* i/o error */ -#define POLL_PRI (__SI_POLL|5) /* high priority input available */ -#define POLL_HUP (__SI_POLL|6) /* device disconnected */ -#define NSIGPOLL 6 - -#endif diff --git a/include/asm-s390x/signal.h b/include/asm-s390x/signal.h deleted file mode 100644 index 75504a248135b..0000000000000 --- a/include/asm-s390x/signal.h +++ /dev/null @@ -1,190 +0,0 @@ -/* - * include/asm-s390/signal.h - * - * S390 version - * - * Derived from "include/asm-i386/signal.h" - */ - -#ifndef _ASMS390_SIGNAL_H -#define _ASMS390_SIGNAL_H - -#include - -/* Avoid too many header ordering problems. */ -struct siginfo; -struct pt_regs; - -#ifdef __KERNEL__ -/* Most things should be clean enough to redefine this at will, if care - is taken to make libc match. */ -#include -#define _NSIG _SIGCONTEXT_NSIG -#define _NSIG_BPW _SIGCONTEXT_NSIG_BPW -#define _NSIG_WORDS _SIGCONTEXT_NSIG_WORDS - -typedef unsigned long old_sigset_t; /* at least 32 bits */ - -typedef struct { - unsigned long sig[_NSIG_WORDS]; -} sigset_t; - -#else -/* Here we must cater to libcs that poke about in kernel headers. */ - -#define NSIG 32 -typedef unsigned long sigset_t; - -#endif /* __KERNEL__ */ - -#define SIGHUP 1 -#define SIGINT 2 -#define SIGQUIT 3 -#define SIGILL 4 -#define SIGTRAP 5 -#define SIGABRT 6 -#define SIGIOT 6 -#define SIGBUS 7 -#define SIGFPE 8 -#define SIGKILL 9 -#define SIGUSR1 10 -#define SIGSEGV 11 -#define SIGUSR2 12 -#define SIGPIPE 13 -#define SIGALRM 14 -#define SIGTERM 15 -#define SIGSTKFLT 16 -#define SIGCHLD 17 -#define SIGCONT 18 -#define SIGSTOP 19 -#define SIGTSTP 20 -#define SIGTTIN 21 -#define SIGTTOU 22 -#define SIGURG 23 -#define SIGXCPU 24 -#define SIGXFSZ 25 -#define SIGVTALRM 26 -#define SIGPROF 27 -#define SIGWINCH 28 -#define SIGIO 29 -#define SIGPOLL SIGIO -/* -#define SIGLOST 29 -*/ -#define SIGPWR 30 -#define SIGSYS 31 -#define SIGUNUSED 31 - -/* These should not be considered constants from userland. */ -#define SIGRTMIN 32 -#define SIGRTMAX (_NSIG-1) - -/* - * SA_FLAGS values: - * - * SA_ONSTACK indicates that a registered stack_t will be used. - * SA_INTERRUPT is a no-op, but left due to historical reasons. Use the - * SA_RESTART flag to get restarting signals (which were the default long ago) - * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop. - * SA_RESETHAND clears the handler when the signal is delivered. - * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies. - * SA_NODEFER prevents the current signal from being masked in the handler. - * - * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single - * Unix names RESETHAND and NODEFER respectively. - */ -#define SA_NOCLDSTOP 0x00000001 -#define SA_NOCLDWAIT 0x00000002 -#define SA_SIGINFO 0x00000004 -#define SA_ONSTACK 0x08000000 -#define SA_RESTART 0x10000000 -#define SA_NODEFER 0x40000000 -#define SA_RESETHAND 0x80000000 - -#define SA_NOMASK SA_NODEFER -#define SA_ONESHOT SA_RESETHAND -#define SA_INTERRUPT 0x20000000 /* dummy -- ignored */ - -#define SA_RESTORER 0x04000000 - -/* - * sigaltstack controls - */ -#define SS_ONSTACK 1 -#define SS_DISABLE 2 - -#define MINSIGSTKSZ 2048 -#define SIGSTKSZ 8192 - -#ifdef __KERNEL__ - -/* - * These values of sa_flags are used only by the kernel as part of the - * irq handling routines. - * - * SA_INTERRUPT is also used by the irq handling routines. - * SA_SHIRQ is for shared interrupt support on PCI and EISA. - */ -#define SA_PROBE SA_ONESHOT -#define SA_SAMPLE_RANDOM SA_RESTART -#define SA_SHIRQ 0x04000000 -#endif - -#define SIG_BLOCK 0 /* for blocking signals */ -#define SIG_UNBLOCK 1 /* for unblocking signals */ -#define SIG_SETMASK 2 /* for setting the signal mask */ - -/* Type of a signal handler. */ -typedef void (*__sighandler_t)(int); - -#define SIG_DFL ((__sighandler_t)0) /* default signal handling */ -#define SIG_IGN ((__sighandler_t)1) /* ignore signal */ -#define SIG_ERR ((__sighandler_t)-1) /* error return from signal */ - -#ifdef __KERNEL__ -struct old_sigaction { - __sighandler_t sa_handler; - old_sigset_t sa_mask; - unsigned long sa_flags; - void (*sa_restorer)(void); -}; - -struct sigaction { - __sighandler_t sa_handler; - unsigned long sa_flags; - void (*sa_restorer)(void); - sigset_t sa_mask; /* mask last for extensibility */ -}; - -struct k_sigaction { - struct sigaction sa; -}; - -#define ptrace_signal_deliver(regs, cookie) do { } while (0) - -#else -/* Here we must cater to libcs that poke about in kernel headers. */ - -struct sigaction { - union { - __sighandler_t _sa_handler; - void (*_sa_sigaction)(int, struct siginfo *, void *); - } _u; - unsigned long sa_flags; - void (*sa_restorer)(void); - sigset_t sa_mask; -}; - -#define sa_handler _u._sa_handler -#define sa_sigaction _u._sa_sigaction - -#endif /* __KERNEL__ */ - -typedef struct sigaltstack { - void *ss_sp; - int ss_flags; - size_t ss_size; -} stack_t; - - -#endif diff --git a/include/asm-s390x/sigp.h b/include/asm-s390x/sigp.h deleted file mode 100644 index 38198659b82d7..0000000000000 --- a/include/asm-s390x/sigp.h +++ /dev/null @@ -1,132 +0,0 @@ -/* - * include/asm-s390/sigp.h - * - * S390 version - * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation - * Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com), - * Martin Schwidefsky (schwidefsky@de.ibm.com) - * - * sigp.h by D.J. Barrow (c) IBM 1999 - * contains routines / structures for signalling other S/390 processors in an - * SMP configuration. - */ - -#ifndef __SIGP__ -#define __SIGP__ - -#include -#include - -/* get real cpu address from logical cpu number */ -extern volatile int __cpu_logical_map[]; - -typedef enum -{ - sigp_unassigned=0x0, - sigp_sense, - sigp_external_call, - sigp_emergency_signal, - sigp_start, - sigp_stop, - sigp_restart, - sigp_unassigned1, - sigp_unassigned2, - sigp_stop_and_store_status, - sigp_unassigned3, - sigp_initial_cpu_reset, - sigp_cpu_reset, - sigp_set_prefix, - sigp_store_status_at_address, - sigp_store_extended_status_at_address -} sigp_order_code; - -typedef __u32 sigp_status_word; - -typedef enum -{ - sigp_order_code_accepted=0, - sigp_status_stored, - sigp_busy, - sigp_not_operational -} sigp_ccode; - - -/* - * Definitions for the external call - */ - -/* 'Bit' signals, asynchronous */ -typedef enum -{ - ec_schedule=0, - ec_call_function, - ec_bit_last -} ec_bit_sig; - - -/* - * Signal processor - */ -extern __inline__ sigp_ccode -signal_processor(__u16 cpu_addr, sigp_order_code order_code) -{ - sigp_ccode ccode; - - __asm__ __volatile__( - " sgr 1,1\n" /* parameter=0 in gpr 1 */ - " sigp 1,%1,0(%2)\n" - " ipm %0\n" - " srl %0,28" - : "=d" (ccode) - : "d" (__cpu_logical_map[cpu_addr]), "a" (order_code) - : "cc" , "memory", "1" ); - return ccode; -} - -/* - * Signal processor with parameter - */ -extern __inline__ sigp_ccode -signal_processor_p(__u64 parameter,__u16 cpu_addr,sigp_order_code order_code) -{ - sigp_ccode ccode; - - __asm__ __volatile__( - " lgr 1,%1\n" /* parameter in gpr 1 */ - " sigp 1,%2,0(%3)\n" - " ipm %0\n" - " srl %0,28\n" - : "=d" (ccode) - : "d" (parameter), "d" (__cpu_logical_map[cpu_addr]), - "a" (order_code) - : "cc" , "memory", "1" ); - return ccode; -} - -/* - * Signal processor with parameter and return status - */ -extern __inline__ sigp_ccode -signal_processor_ps(__u32 *statusptr, __u64 parameter, - __u16 cpu_addr, sigp_order_code order_code) -{ - sigp_ccode ccode; - - __asm__ __volatile__( - " sgr 2,2\n" /* clear status so it doesn't contain rubbish if not saved. */ - " lgr 3,%2\n" /* parameter in gpr 3 */ - " sigp 2,%3,0(%4)\n" - " stg 2,%1\n" - " ipm %0\n" - " srl %0,28\n" - : "=d" (ccode), "=m" (*statusptr) - : "d" (parameter), "d" (__cpu_logical_map[cpu_addr]), - "a" (order_code) - : "cc" , "memory", "2" , "3" - ); - return ccode; -} - -#endif /* __SIGP__ */ - - diff --git a/include/asm-s390x/smp.h b/include/asm-s390x/smp.h deleted file mode 100644 index 28e1fd23b426c..0000000000000 --- a/include/asm-s390x/smp.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * include/asm-s390/smp.h - * - * S390 version - * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation - * Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com), - * Martin Schwidefsky (schwidefsky@de.ibm.com) - */ -#ifndef __ASM_SMP_H -#define __ASM_SMP_H - -#include -#include -#include - -#if defined(__KERNEL__) && defined(CONFIG_SMP) && !defined(__ASSEMBLY__) - -#include - -/* - s390 specific smp.c headers - */ -typedef struct -{ - int intresting; - sigp_ccode ccode; - __u32 status; - __u16 cpu; -} sigp_info; - -extern volatile unsigned long cpu_online_map; -extern volatile unsigned long cpu_possible_map; - -#define NO_PROC_ID 0xFF /* No processor magic marker */ - -/* - * This magic constant controls our willingness to transfer - * a process across CPUs. Such a transfer incurs misses on the L1 - * cache, and on a P6 or P5 with multiple L2 caches L2 hits. My - * gut feeling is this will vary by board in value. For a board - * with separate L2 cache it probably depends also on the RSS, and - * for a board with shared L2 cache it ought to decay fast as other - * processes are run. - */ - -#define PROC_CHANGE_PENALTY 20 /* Schedule penalty */ - -#define smp_processor_id() (current_thread_info()->cpu) - -#define cpu_online(cpu) (cpu_online_map & (1<<(cpu))) -#define cpu_possible(cpu) (cpu_possible_map & (1<<(cpu))) - -extern inline unsigned int num_online_cpus(void) -{ - return hweight64(cpu_online_map); -} - -extern inline int any_online_cpu(unsigned int mask) -{ - if (mask & cpu_online_map) - return __ffs(mask & cpu_online_map); - - return -1; -} - -extern __inline__ __u16 hard_smp_processor_id(void) -{ - __u16 cpu_address; - - __asm__ ("stap %0\n" : "=m" (cpu_address)); - return cpu_address; -} - -#define cpu_logical_map(cpu) (cpu) - -#endif -#endif diff --git a/include/asm-s390x/socket.h b/include/asm-s390x/socket.h deleted file mode 100644 index 873992418889d..0000000000000 --- a/include/asm-s390x/socket.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * include/asm-s390/socket.h - * - * S390 version - * - * Derived from "include/asm-i386/socket.h" - */ - -#ifndef _ASM_SOCKET_H -#define _ASM_SOCKET_H - -#include - -/* For setsockoptions(2) */ -#define SOL_SOCKET 1 - -#define SO_DEBUG 1 -#define SO_REUSEADDR 2 -#define SO_TYPE 3 -#define SO_ERROR 4 -#define SO_DONTROUTE 5 -#define SO_BROADCAST 6 -#define SO_SNDBUF 7 -#define SO_RCVBUF 8 -#define SO_KEEPALIVE 9 -#define SO_OOBINLINE 10 -#define SO_NO_CHECK 11 -#define SO_PRIORITY 12 -#define SO_LINGER 13 -#define SO_BSDCOMPAT 14 -/* To add :#define SO_REUSEPORT 15 */ -#define SO_PASSCRED 16 -#define SO_PEERCRED 17 -#define SO_RCVLOWAT 18 -#define SO_SNDLOWAT 19 -#define SO_RCVTIMEO 20 -#define SO_SNDTIMEO 21 - -/* Security levels - as per NRL IPv6 - don't actually do anything */ -#define SO_SECURITY_AUTHENTICATION 22 -#define SO_SECURITY_ENCRYPTION_TRANSPORT 23 -#define SO_SECURITY_ENCRYPTION_NETWORK 24 - -#define SO_BINDTODEVICE 25 - -/* Socket filtering */ -#define SO_ATTACH_FILTER 26 -#define SO_DETACH_FILTER 27 - -#define SO_PEERNAME 28 -#define SO_TIMESTAMP 29 -#define SCM_TIMESTAMP SO_TIMESTAMP -#define SO_ACCEPTCONN 30 - -/* Nast libc5 fixup - bletch */ -#if defined(__KERNEL__) -/* Socket types. */ -#define SOCK_STREAM 1 /* stream (connection) socket */ -#define SOCK_DGRAM 2 /* datagram (conn.less) socket */ -#define SOCK_RAW 3 /* raw socket */ -#define SOCK_RDM 4 /* reliably-delivered message */ -#define SOCK_SEQPACKET 5 /* sequential packet socket */ -#define SOCK_PACKET 10 /* linux specific way of */ - /* getting packets at the dev */ - /* level. For writing rarp and */ - /* other similar things on the */ - /* user level. */ -#define SOCK_MAX (SOCK_PACKET+1) -#endif - -#endif /* _ASM_SOCKET_H */ diff --git a/include/asm-s390x/sockios.h b/include/asm-s390x/sockios.h deleted file mode 100644 index 412aeb4dd6cea..0000000000000 --- a/include/asm-s390x/sockios.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * include/asm-s390/sockios.h - * - * S390 version - * - * Derived from "include/asm-i386/sockios.h" - */ - -#ifndef __ARCH_S390_SOCKIOS__ -#define __ARCH_S390_SOCKIOS__ - -/* Socket-level I/O control calls. */ -#define FIOSETOWN 0x8901 -#define SIOCSPGRP 0x8902 -#define FIOGETOWN 0x8903 -#define SIOCGPGRP 0x8904 -#define SIOCATMARK 0x8905 -#define SIOCGSTAMP 0x8906 /* Get stamp */ - -#endif diff --git a/include/asm-s390x/spinlock.h b/include/asm-s390x/spinlock.h deleted file mode 100644 index ac7a1b9a43d9a..0000000000000 --- a/include/asm-s390x/spinlock.h +++ /dev/null @@ -1,155 +0,0 @@ -/* - * include/asm-s390/spinlock.h - * - * S390 version - * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation - * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com) - * - * Derived from "include/asm-i386/spinlock.h" - */ - -#ifndef __ASM_SPINLOCK_H -#define __ASM_SPINLOCK_H - -/* - * Grmph, take care of %&#! user space programs that include - * asm/spinlock.h. The diagnose is only available in kernel - * context. - */ -#ifdef __KERNEL__ -#include -#define __DIAG44_INSN "ex" -#define __DIAG44_OPERAND __LC_DIAG44_OPCODE -#else -#define __DIAG44_INSN "#" -#define __DIAG44_OPERAND 0 -#endif - -/* - * Simple spin lock operations. There are two variants, one clears IRQ's - * on the local processor, one does not. - * - * We make no fairness assumptions. They have a cost. - */ - -typedef struct { - volatile unsigned int lock; -} __attribute__ ((aligned (4))) spinlock_t; - -#define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 } -#define spin_lock_init(lp) do { (lp)->lock = 0; } while(0) -#define spin_unlock_wait(lp) do { barrier(); } while(((volatile spinlock_t *)(lp))->lock) -#define spin_is_locked(x) ((x)->lock != 0) - -extern inline void _raw_spin_lock(spinlock_t *lp) -{ - unsigned long reg1, reg2; - __asm__ __volatile(" bras %1,1f\n" - "0: " __DIAG44_INSN " 0,%4\n" - "1: slr %0,%0\n" - " cs %0,%1,0(%3)\n" - " jl 0b\n" - : "=&d" (reg1), "=&d" (reg2), "+m" (lp->lock) - : "a" (&lp->lock), "i" (__DIAG44_OPERAND) - : "cc" ); -} - -extern inline int _raw_spin_trylock(spinlock_t *lp) -{ - unsigned int result, reg; - __asm__ __volatile(" slr %0,%0\n" - " basr %1,0\n" - "0: cs %0,%1,0(%3)" - : "=&d" (result), "=&d" (reg), "+m" (lp->lock) - : "a" (&lp->lock) : "cc" ); - return !result; -} - -extern inline void _raw_spin_unlock(spinlock_t *lp) -{ - __asm__ __volatile(" xc 0(4,%1),0(%1)\n" - " bcr 15,0" - : "+m" (lp->lock) : "a" (&lp->lock) : "cc" ); -} - -/* - * Read-write spinlocks, allowing multiple readers - * but only one writer. - * - * NOTE! it is quite common to have readers in interrupts - * but no interrupt writers. For those circumstances we - * can "mix" irq-safe locks - any writer needs to get a - * irq-safe write-lock, but readers can get non-irqsafe - * read-locks. - */ -typedef struct { - volatile unsigned long lock; - volatile unsigned long owner_pc; -} rwlock_t; - -#define RW_LOCK_UNLOCKED (rwlock_t) { 0, 0 } - -#define rwlock_init(x) do { *(x) = RW_LOCK_UNLOCKED; } while(0) - -#define rwlock_is_locked(x) ((x)->lock != 0) - -#define _raw_read_lock(rw) \ - asm volatile(" lg 2,0(%1)\n" \ - " j 1f\n" \ - "0: " __DIAG44_INSN " 0,%2\n" \ - "1: nihh 2,0x7fff\n" /* clear high (=write) bit */ \ - " la 3,1(2)\n" /* one more reader */ \ - " csg 2,3,0(%1)\n" /* try to write new value */ \ - " jl 0b" \ - : "+m" ((rw)->lock) \ - : "a" (&(rw)->lock), "i" (__DIAG44_OPERAND) \ - : "2", "3", "cc" ) - -#define _raw_read_unlock(rw) \ - asm volatile(" lg 2,0(%1)\n" \ - " j 1f\n" \ - "0: " __DIAG44_INSN " 0,%2\n" \ - "1: lgr 3,2\n" \ - " bctgr 3,0\n" /* one less reader */ \ - " csg 2,3,0(%1)\n" \ - " jl 0b" \ - : "+m" ((rw)->lock) \ - : "a" (&(rw)->lock), "i" (__DIAG44_OPERAND) \ - : "2", "3", "cc" ) - -#define _raw_write_lock(rw) \ - asm volatile(" llihh 3,0x8000\n" /* new lock value = 0x80...0 */ \ - " j 1f\n" \ - "0: " __DIAG44_INSN " 0,%2\n" \ - "1: slgr 2,2\n" /* old lock value must be 0 */ \ - " csg 2,3,0(%1)\n" \ - " jl 0b" \ - : "+m" ((rw)->lock) \ - : "a" (&(rw)->lock), "i" (__DIAG44_OPERAND) \ - : "2", "3", "cc" ) - -#define _raw_write_unlock(rw) \ - asm volatile(" slgr 3,3\n" /* new lock value = 0 */ \ - " j 1f\n" \ - "0: " __DIAG44_INSN " 0,%2\n" \ - "1: llihh 2,0x8000\n" /* old lock value must be 0x8..0 */\ - " csg 2,3,0(%1)\n" \ - " jl 0b" \ - : "+m" ((rw)->lock) \ - : "a" (&(rw)->lock), "i" (__DIAG44_OPERAND) \ - : "2", "3", "cc" ) - -extern inline int _raw_write_trylock(rwlock_t *rw) -{ - unsigned int result, reg; - - __asm__ __volatile__(" llihh %0,0x8000\n" - " basr %1,0\n" - "0: csg %0,%1,0(%3)\n" - : "=&d" (result), "=&d" (reg), "+m" (rw->lock) - : "a" (&rw->lock) : "cc" ); - return !result; -} - -#endif /* __ASM_SPINLOCK_H */ - diff --git a/include/asm-s390x/stat.h b/include/asm-s390x/stat.h deleted file mode 100644 index 0b53429ae25b3..0000000000000 --- a/include/asm-s390x/stat.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * include/asm-s390x/stat.h - * - * S390 version - * - * Derived from "include/asm-i386/stat.h" - */ - -#ifndef _S390_STAT_H -#define _S390_STAT_H - -struct stat { - unsigned long st_dev; - unsigned long st_ino; - unsigned long st_nlink; - unsigned int st_mode; - unsigned int st_uid; - unsigned int st_gid; - unsigned int __pad1; - unsigned long st_rdev; - unsigned long st_size; - unsigned long st_atime; - unsigned long st_atime_nsec; - unsigned long st_mtime; - unsigned long st_mtime_nsec; - unsigned long st_ctime; - unsigned long st_ctime_nsec; - unsigned long st_blksize; - long st_blocks; - unsigned long __unused[3]; -}; - -#define STAT_HAVE_NSEC 1 - -#endif diff --git a/include/asm-s390x/statfs.h b/include/asm-s390x/statfs.h deleted file mode 100644 index 900d00e54bb3f..0000000000000 --- a/include/asm-s390x/statfs.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * include/asm-s390/statfs.h - * - * S390 version - * - * Derived from "include/asm-i386/statfs.h" - */ - -#ifndef _S390_STATFS_H -#define _S390_STATFS_H - -#ifndef __KERNEL_STRICT_NAMES - -#include - -typedef __kernel_fsid_t fsid_t; - -#endif - -struct statfs { - int f_type; - int f_bsize; - long f_blocks; - long f_bfree; - long f_bavail; - long f_files; - long f_ffree; - __kernel_fsid_t f_fsid; - int f_namelen; - int f_spare[6]; -}; - -#endif diff --git a/include/asm-s390x/string.h b/include/asm-s390x/string.h deleted file mode 100644 index 9da6bed1181e6..0000000000000 --- a/include/asm-s390x/string.h +++ /dev/null @@ -1,112 +0,0 @@ -/* - * include/asm-s390/string.h - * - * S390 version - * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation - * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com), - */ - -#ifndef _S390_STRING_H_ -#define _S390_STRING_H_ - -#ifdef __KERNEL__ - -#ifndef _LINUX_TYPES_H -#include -#endif - -#define __HAVE_ARCH_MEMCHR -#define __HAVE_ARCH_MEMCPY -#define __HAVE_ARCH_MEMSET -#define __HAVE_ARCH_STRCAT -#define __HAVE_ARCH_STRCMP -#define __HAVE_ARCH_STRCPY -#define __HAVE_ARCH_STRLEN -#define __HAVE_ARCH_STRNCPY - -#undef __HAVE_ARCH_MEMMOVE -#undef __HAVE_ARCH_STRNICMP -#undef __HAVE_ARCH_STRNCAT -#undef __HAVE_ARCH_STRNCMP -#undef __HAVE_ARCH_STRCHR -#undef __HAVE_ARCH_STRRCHR -#undef __HAVE_ARCH_STRNLEN -#undef __HAVE_ARCH_STRSPN -#undef __HAVE_ARCH_STRPBRK -#undef __HAVE_ARCH_STRTOK -#undef __HAVE_ARCH_BCOPY -#undef __HAVE_ARCH_MEMCMP -#undef __HAVE_ARCH_MEMSCAN -#undef __HAVE_ARCH_STRSTR - -extern void *memset(void *, int, size_t); -extern void *memcpy(void *, const void *, size_t); -extern void *memmove(void *, const void *, size_t); -extern char *strncpy(char *, const char *, size_t); -extern int strcmp(const char *,const char *); - -static inline void * memchr(const void * cs,int c,size_t count) -{ - void *ptr; - - __asm__ __volatile__ (" lgr 0,%2\n" - " lgr 1,%1\n" - " la %0,0(%3,%1)\n" - "0: srst %0,1\n" - " jo 0b\n" - " brc 13,1f\n" - " slgr %0,%0\n" - "1:" - : "=&a" (ptr) : "a" (cs), "d" (c), "d" (count) - : "cc", "0", "1" ); - return ptr; -} - -static __inline__ char *strcpy(char *dest, const char *src) -{ - char *tmp = dest; - - __asm__ __volatile__ (" slgr 0,0\n" - "0: mvst %0,%1\n" - " jo 0b" - : "+&a" (dest), "+&a" (src) : - : "cc", "memory", "0" ); - return tmp; -} - -static __inline__ size_t strlen(const char *s) -{ - size_t len; - - __asm__ __volatile__ (" slgr 0,0\n" - " lgr %0,%1\n" - "0: srst 0,%0\n" - " jo 0b\n" - " lgr %0,0\n" - " sgr %0,%1" - : "=&a" (len) : "a" (s) - : "cc", "0" ); - return len; -} - -static __inline__ char *strcat(char *dest, const char *src) -{ - char *tmp = dest; - - __asm__ __volatile__ (" slgr 0,0\n" - "0: srst 0,%0\n" - " jo 0b\n" - " lgr %0,0\n" - " slgr 0,0\n" - "1: mvst %0,%1\n" - " jo 1b" - : "+&a" (dest), "+&a" (src) : - : "cc", "memory", "0" ); - return tmp; -} - -extern void *alloca(size_t); -#endif /* __KERNEL__ */ - -#endif /* __S390_STRING_H_ */ - diff --git a/include/asm-s390x/suspend.h b/include/asm-s390x/suspend.h deleted file mode 100644 index d38e027e16ed5..0000000000000 --- a/include/asm-s390x/suspend.h +++ /dev/null @@ -1,5 +0,0 @@ -#ifndef __ASM_S390X_SUSPEND_H -#define __ASM_S390X_SUSPEND_H - -#endif - diff --git a/include/asm-s390x/system.h b/include/asm-s390x/system.h deleted file mode 100644 index 824589e8da3a9..0000000000000 --- a/include/asm-s390x/system.h +++ /dev/null @@ -1,360 +0,0 @@ -/* - * include/asm-s390/system.h - * - * S390 version - * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation - * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com), - * - * Derived from "include/asm-i386/system.h" - */ - -#ifndef __ASM_SYSTEM_H -#define __ASM_SYSTEM_H - -#include -#include -#include -#include -#include - -#ifdef __KERNEL__ - -struct task_struct; - -extern struct task_struct *resume(void *, void *); - -static inline void save_fp_regs(s390_fp_regs *fpregs) -{ - asm volatile ( - " stfpc 0(%0)\n" - " std 0,8(%0)\n" - " std 1,16(%0)\n" - " std 2,24(%0)\n" - " std 3,32(%0)\n" - " std 4,40(%0)\n" - " std 5,48(%0)\n" - " std 6,56(%0)\n" - " std 7,64(%0)\n" - " std 8,72(%0)\n" - " std 9,80(%0)\n" - " std 10,88(%0)\n" - " std 11,96(%0)\n" - " std 12,104(%0)\n" - " std 13,112(%0)\n" - " std 14,120(%0)\n" - " std 15,128(%0)\n" - : : "a" (fpregs) : "memory" ); -} - -static inline void restore_fp_regs(s390_fp_regs *fpregs) -{ - asm volatile ( - " lfpc 0(%0)\n" - " ld 0,8(%0)\n" - " ld 1,16(%0)\n" - " ld 2,24(%0)\n" - " ld 3,32(%0)\n" - " ld 4,40(%0)\n" - " ld 5,48(%0)\n" - " ld 6,56(%0)\n" - " ld 7,64(%0)\n" - " ld 8,72(%0)\n" - " ld 9,80(%0)\n" - " ld 10,88(%0)\n" - " ld 11,96(%0)\n" - " ld 12,104(%0)\n" - " ld 13,112(%0)\n" - " ld 14,120(%0)\n" - " ld 15,128(%0)\n" - : : "a" (fpregs)); -} - -#define switch_to(prev,next,last) do { \ - if (prev == next) \ - break; \ - save_fp_regs(&prev->thread.fp_regs); \ - restore_fp_regs(&next->thread.fp_regs); \ - resume(prev,next); \ -} while (0) - -#define nop() __asm__ __volatile__ ("nop") - -#define xchg(ptr,x) \ - ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(void *)(ptr),sizeof(*(ptr)))) - -extern void __misaligned_u16(void); -extern void __misaligned_u32(void); -extern void __misaligned_u64(void); - -static inline unsigned long __xchg(unsigned long x, void * ptr, int size) -{ - unsigned long addr, old; - int shift; - - switch (size) { - case 1: - addr = (unsigned long) ptr; - shift = (3 ^ (addr & 3)) << 3; - addr ^= addr & 3; - asm volatile( - " l %0,0(%3)\n" - "0: lr 0,%0\n" - " nr 0,%2\n" - " or 0,%1\n" - " cs %0,0,0(%3)\n" - " jl 0b\n" - : "=&d" (old) - : "d" (x << shift), "d" (~(255 << shift)), "a" (addr) - : "memory", "cc", "0" ); - x = old >> shift; - break; - case 2: - addr = (unsigned long) ptr; - shift = (2 ^ (addr & 2)) << 3; - addr ^= addr & 2; - asm volatile( - " l %0,0(%3)\n" - "0: lr 0,%0\n" - " nr 0,%2\n" - " or 0,%1\n" - " cs %0,0,0(%3)\n" - " jl 0b\n" - : "=&d" (old) - : "d" (x << shift), "d" (~(65535 << shift)), "a" (addr) - : "memory", "cc", "0" ); - x = old >> shift; - break; - case 4: - asm volatile ( - " l %0,0(%2)\n" - "0: cs %0,%1,0(%2)\n" - " jl 0b\n" - : "=&d" (old) : "d" (x), "a" (ptr) - : "memory", "cc", "0" ); - x = old; - break; - case 8: - asm volatile ( - " lg %0,0(%2)\n" - "0: csg %0,%1,0(%2)\n" - " jl 0b\n" - : "=&d" (old) : "d" (x), "a" (ptr) - : "memory", "cc", "0" ); - x = old; - break; - } - return x; -} - -/* - * Atomic compare and exchange. Compare OLD with MEM, if identical, - * store NEW in MEM. Return the initial value in MEM. Success is - * indicated by comparing RETURN with OLD. - */ - -#define __HAVE_ARCH_CMPXCHG 1 - -#define cmpxchg(ptr,o,n)\ - ((__typeof__(*(ptr)))__cmpxchg((ptr),(unsigned long)(o),\ - (unsigned long)(n),sizeof(*(ptr)))) - -static inline unsigned long -__cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size) -{ - unsigned long addr, prev, tmp; - int shift; - - switch (size) { - case 1: - addr = (unsigned long) ptr; - shift = (3 ^ (addr & 3)) << 3; - addr ^= addr & 3; - asm volatile( - " l %0,0(%4)\n" - "0: nr %0,%5\n" - " lr %1,%0\n" - " or %0,%2\n" - " or %1,%3\n" - " cs %0,%1,0(%4)\n" - " jnl 1f\n" - " xr %1,%0\n" - " nr %1,%5\n" - " jnz 0b\n" - "1:" - : "=&d" (prev), "=&d" (tmp) - : "d" (old << shift), "d" (new << shift), "a" (ptr), - "d" (~(255 << shift)) - : "memory", "cc" ); - return prev >> shift; - case 2: - addr = (unsigned long) ptr; - shift = (2 ^ (addr & 2)) << 3; - addr ^= addr & 2; - asm volatile( - " l %0,0(%4)\n" - "0: nr %0,%5\n" - " lr %1,%0\n" - " or %0,%2\n" - " or %1,%3\n" - " cs %0,%1,0(%4)\n" - " jnl 1f\n" - " xr %1,%0\n" - " nr %1,%5\n" - " jnz 0b\n" - "1:" - : "=&d" (prev), "=&d" (tmp) - : "d" (old << shift), "d" (new << shift), "a" (ptr), - "d" (~(65535 << shift)) - : "memory", "cc" ); - return prev >> shift; - case 4: - asm volatile ( - " cs %0,%2,0(%3)\n" - : "=&d" (prev) : "0" (old), "d" (new), "a" (ptr) - : "memory", "cc" ); - return prev; - case 8: - asm volatile ( - " csg %0,%2,0(%3)\n" - : "=&d" (prev) : "0" (old), "d" (new), "a" (ptr) - : "memory", "cc" ); - return prev; - } - return old; -} - -/* - * Force strict CPU ordering. - * And yes, this is required on UP too when we're talking - * to devices. - * - * This is very similar to the ppc eieio/sync instruction in that is - * does a checkpoint syncronisation & makes sure that - * all memory ops have completed wrt other CPU's ( see 7-15 POP DJB ). - */ - -#define eieio() __asm__ __volatile__ ( "bcr 15,0" : : : "memory" ) -# define SYNC_OTHER_CORES(x) eieio() -#define mb() eieio() -#define rmb() eieio() -#define wmb() eieio() -#define read_barrier_depends() do { } while(0) -#define smp_mb() mb() -#define smp_rmb() rmb() -#define smp_wmb() wmb() -#define smp_read_barrier_depends() read_barrier_depends() -#define smp_mb__before_clear_bit() smp_mb() -#define smp_mb__after_clear_bit() smp_mb() - -#define set_mb(var, value) do { var = value; mb(); } while (0) -#define set_wmb(var, value) do { var = value; wmb(); } while (0) - -/* interrupt control.. */ -#define local_irq_enable() ({ \ - unsigned long __dummy; \ - __asm__ __volatile__ ( \ - "stosm 0(%1),0x03" : "=m" (__dummy) : "a" (&__dummy) ); \ - }) - -#define local_irq_disable() ({ \ - unsigned long __flags; \ - __asm__ __volatile__ ( \ - "stnsm 0(%1),0xfc" : "=m" (__flags) : "a" (&__flags) ); \ - __flags; \ - }) - -#define local_save_flags(x) \ - __asm__ __volatile__("stosm 0(%1),0" : "=m" (x) : "a" (&x) ) - -#define local_irq_restore(x) \ - __asm__ __volatile__("ssm 0(%0)" : : "a" (&x) ) - -#define irqs_disabled() \ -({ \ - unsigned long flags; \ - local_save_flags(flags); \ - !((flags >> 56) & 3); \ -}) - -#define __load_psw(psw) \ - __asm__ __volatile__("lpswe 0(%0)" : : "a" (&psw) : "cc" ); - -#define __ctl_load(array, low, high) ({ \ - __asm__ __volatile__ ( \ - " la 1,%0\n" \ - " bras 2,0f\n" \ - " lctlg 0,0,0(1)\n" \ - "0: ex %1,0(2)" \ - : : "m" (array), "a" (((low)<<4)+(high)) : "1", "2" ); \ - }) - -#define __ctl_store(array, low, high) ({ \ - __asm__ __volatile__ ( \ - " la 1,%0\n" \ - " bras 2,0f\n" \ - " stctg 0,0,0(1)\n" \ - "0: ex %1,0(2)" \ - : "=m" (array) : "a" (((low)<<4)+(high)): "1", "2" ); \ - }) - -#define __ctl_set_bit(cr, bit) ({ \ - __u8 __dummy[24]; \ - __asm__ __volatile__ ( \ - " la 1,%0\n" /* align to 8 byte */ \ - " aghi 1,7\n" \ - " nill 1,0xfff8\n" \ - " bras 2,0f\n" /* skip indirect insns */ \ - " stctg 0,0,0(1)\n" \ - " lctlg 0,0,0(1)\n" \ - "0: ex %1,0(2)\n" /* execute stctl */ \ - " lg 0,0(1)\n" \ - " ogr 0,%2\n" /* set the bit */ \ - " stg 0,0(1)\n" \ - "1: ex %1,6(2)" /* execute lctl */ \ - : "=m" (__dummy) : "a" (cr*17), "a" (1L<<(bit)) \ - : "cc", "0", "1", "2"); \ - }) - -#define __ctl_clear_bit(cr, bit) ({ \ - __u8 __dummy[24]; \ - __asm__ __volatile__ ( \ - " la 1,%0\n" /* align to 8 byte */ \ - " aghi 1,7\n" \ - " nill 1,0xfff8\n" \ - " bras 2,0f\n" /* skip indirect insns */ \ - " stctg 0,0,0(1)\n" \ - " lctlg 0,0,0(1)\n" \ - "0: ex %1,0(2)\n" /* execute stctl */ \ - " lg 0,0(1)\n" \ - " ngr 0,%2\n" /* set the bit */ \ - " stg 0,0(1)\n" \ - "1: ex %1,6(2)" /* execute lctl */ \ - : "=m" (__dummy) : "a" (cr*17), "a" (~(1L<<(bit))) \ - : "cc", "0", "1", "2"); \ - }) - -/* For spinlocks etc */ -#define local_irq_save(x) ((x) = local_irq_disable()) - -#ifdef CONFIG_SMP - -extern void smp_ctl_set_bit(int cr, int bit); -extern void smp_ctl_clear_bit(int cr, int bit); -#define ctl_set_bit(cr, bit) smp_ctl_set_bit(cr, bit) -#define ctl_clear_bit(cr, bit) smp_ctl_clear_bit(cr, bit) - -#else - -#define ctl_set_bit(cr, bit) __ctl_set_bit(cr, bit) -#define ctl_clear_bit(cr, bit) __ctl_clear_bit(cr, bit) - -#endif /* CONFIG_SMP */ - -extern void (*_machine_restart)(char *command); -extern void (*_machine_halt)(void); -extern void (*_machine_power_off)(void); - -#endif /* __KERNEL __ */ - -#endif - diff --git a/include/asm-s390x/tape390.h b/include/asm-s390x/tape390.h deleted file mode 100644 index f1d66ba0deef4..0000000000000 --- a/include/asm-s390x/tape390.h +++ /dev/null @@ -1,39 +0,0 @@ -/************************************************************************* - * - * tape390.h - * enables user programs to display messages on the tape device - * - * S390 and zSeries version - * Copyright (C) 2001 IBM Corporation - * Author(s): Despina Papadopoulou - * - *************************************************************************/ - -#ifndef _TAPE390_H -#define _TAPE390_H - -#define TAPE390_DISPLAY _IOW('d', 1, struct display_struct) - -/* - * The TAPE390_DISPLAY ioctl calls the Load Display command - * which transfers 17 bytes of data from the channel to the subsystem: - * - 1 format control byte, and - * - two 8-byte messages - * - * Format control byte: - * 0-2: New Message Overlay - * 3: Alternate Messages - * 4: Blink Message - * 5: Display Low/High Message - * 6: Reserved - * 7: Automatic Load Request - * - */ - -typedef struct display_struct { - char cntrl; - char message1[8]; - char message2[8]; -} display_struct; - -#endif diff --git a/include/asm-s390x/termbits.h b/include/asm-s390x/termbits.h deleted file mode 100644 index cfbe7a36a8e27..0000000000000 --- a/include/asm-s390x/termbits.h +++ /dev/null @@ -1,180 +0,0 @@ -/* - * include/asm-s390/termbits.h - * - * S390 version - * - * Derived from "include/asm-i386/termbits.h" - */ - -#ifndef __ARCH_S390_TERMBITS_H__ -#define __ARCH_S390_TERMBITS_H__ - -#include - -typedef unsigned char cc_t; -typedef unsigned int speed_t; -typedef unsigned int tcflag_t; - -#define NCCS 19 -struct termios { - tcflag_t c_iflag; /* input mode flags */ - tcflag_t c_oflag; /* output mode flags */ - tcflag_t c_cflag; /* control mode flags */ - tcflag_t c_lflag; /* local mode flags */ - cc_t c_line; /* line discipline */ - cc_t c_cc[NCCS]; /* control characters */ -}; - -/* c_cc characters */ -#define VINTR 0 -#define VQUIT 1 -#define VERASE 2 -#define VKILL 3 -#define VEOF 4 -#define VTIME 5 -#define VMIN 6 -#define VSWTC 7 -#define VSTART 8 -#define VSTOP 9 -#define VSUSP 10 -#define VEOL 11 -#define VREPRINT 12 -#define VDISCARD 13 -#define VWERASE 14 -#define VLNEXT 15 -#define VEOL2 16 - -/* c_iflag bits */ -#define IGNBRK 0000001 -#define BRKINT 0000002 -#define IGNPAR 0000004 -#define PARMRK 0000010 -#define INPCK 0000020 -#define ISTRIP 0000040 -#define INLCR 0000100 -#define IGNCR 0000200 -#define ICRNL 0000400 -#define IUCLC 0001000 -#define IXON 0002000 -#define IXANY 0004000 -#define IXOFF 0010000 -#define IMAXBEL 0020000 - -/* c_oflag bits */ -#define OPOST 0000001 -#define OLCUC 0000002 -#define ONLCR 0000004 -#define OCRNL 0000010 -#define ONOCR 0000020 -#define ONLRET 0000040 -#define OFILL 0000100 -#define OFDEL 0000200 -#define NLDLY 0000400 -#define NL0 0000000 -#define NL1 0000400 -#define CRDLY 0003000 -#define CR0 0000000 -#define CR1 0001000 -#define CR2 0002000 -#define CR3 0003000 -#define TABDLY 0014000 -#define TAB0 0000000 -#define TAB1 0004000 -#define TAB2 0010000 -#define TAB3 0014000 -#define XTABS 0014000 -#define BSDLY 0020000 -#define BS0 0000000 -#define BS1 0020000 -#define VTDLY 0040000 -#define VT0 0000000 -#define VT1 0040000 -#define FFDLY 0100000 -#define FF0 0000000 -#define FF1 0100000 - -/* c_cflag bit meaning */ -#define CBAUD 0010017 -#define B0 0000000 /* hang up */ -#define B50 0000001 -#define B75 0000002 -#define B110 0000003 -#define B134 0000004 -#define B150 0000005 -#define B200 0000006 -#define B300 0000007 -#define B600 0000010 -#define B1200 0000011 -#define B1800 0000012 -#define B2400 0000013 -#define B4800 0000014 -#define B9600 0000015 -#define B19200 0000016 -#define B38400 0000017 -#define EXTA B19200 -#define EXTB B38400 -#define CSIZE 0000060 -#define CS5 0000000 -#define CS6 0000020 -#define CS7 0000040 -#define CS8 0000060 -#define CSTOPB 0000100 -#define CREAD 0000200 -#define PARENB 0000400 -#define PARODD 0001000 -#define HUPCL 0002000 -#define CLOCAL 0004000 -#define CBAUDEX 0010000 -#define B57600 0010001 -#define B115200 0010002 -#define B230400 0010003 -#define B460800 0010004 -#define B500000 0010005 -#define B576000 0010006 -#define B921600 0010007 -#define B1000000 0010010 -#define B1152000 0010011 -#define B1500000 0010012 -#define B2000000 0010013 -#define B2500000 0010014 -#define B3000000 0010015 -#define B3500000 0010016 -#define B4000000 0010017 -#define CIBAUD 002003600000 /* input baud rate (not used) */ -#define CMSPAR 010000000000 /* mark or space (stick) parity */ -#define CRTSCTS 020000000000 /* flow control */ - -/* c_lflag bits */ -#define ISIG 0000001 -#define ICANON 0000002 -#define XCASE 0000004 -#define ECHO 0000010 -#define ECHOE 0000020 -#define ECHOK 0000040 -#define ECHONL 0000100 -#define NOFLSH 0000200 -#define TOSTOP 0000400 -#define ECHOCTL 0001000 -#define ECHOPRT 0002000 -#define ECHOKE 0004000 -#define FLUSHO 0010000 -#define PENDIN 0040000 -#define IEXTEN 0100000 - -/* tcflow() and TCXONC use these */ -#define TCOOFF 0 -#define TCOON 1 -#define TCIOFF 2 -#define TCION 3 - -/* tcflush() and TCFLSH use these */ -#define TCIFLUSH 0 -#define TCOFLUSH 1 -#define TCIOFLUSH 2 - -/* tcsetattr uses these */ -#define TCSANOW 0 -#define TCSADRAIN 1 -#define TCSAFLUSH 2 - -#endif diff --git a/include/asm-s390x/termios.h b/include/asm-s390x/termios.h deleted file mode 100644 index a5da5be9e1a75..0000000000000 --- a/include/asm-s390x/termios.h +++ /dev/null @@ -1,115 +0,0 @@ -/* - * include/asm-s390/termios.h - * - * S390 version - * - * Derived from "include/asm-i386/termios.h" - */ - -#ifndef _S390_TERMIOS_H -#define _S390_TERMIOS_H - -#include -#include - - -struct winsize { - unsigned short ws_row; - unsigned short ws_col; - unsigned short ws_xpixel; - unsigned short ws_ypixel; -}; - -#define NCC 8 -struct termio { - unsigned short c_iflag; /* input mode flags */ - unsigned short c_oflag; /* output mode flags */ - unsigned short c_cflag; /* control mode flags */ - unsigned short c_lflag; /* local mode flags */ - unsigned char c_line; /* line discipline */ - unsigned char c_cc[NCC]; /* control characters */ -}; - -/* modem lines */ -#define TIOCM_LE 0x001 -#define TIOCM_DTR 0x002 -#define TIOCM_RTS 0x004 -#define TIOCM_ST 0x008 -#define TIOCM_SR 0x010 -#define TIOCM_CTS 0x020 -#define TIOCM_CAR 0x040 -#define TIOCM_RNG 0x080 -#define TIOCM_DSR 0x100 -#define TIOCM_CD TIOCM_CAR -#define TIOCM_RI TIOCM_RNG -#define TIOCM_OUT1 0x2000 -#define TIOCM_OUT2 0x4000 -#define TIOCM_LOOP 0x8000 - -/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ - -/* line disciplines */ -#define N_TTY 0 -#define N_SLIP 1 -#define N_MOUSE 2 -#define N_PPP 3 -#define N_STRIP 4 -#define N_AX25 5 -#define N_X25 6 /* X.25 async */ -#define N_6PACK 7 -#define N_MASC 8 /* Reserved for Mobitex module */ -#define N_R3964 9 /* Reserved for Simatic R3964 module */ -#define N_PROFIBUS_FDL 10 /* Reserved for Profibus */ -#define N_IRDA 11 /* Linux IR - http://irda.sourceforge.net/ */ -#define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards about SMS messages */ -#define N_HDLC 13 /* synchronous HDLC */ -#define N_HCI 15 /* Bluetooth HCI UART */ - -#ifdef __KERNEL__ - -/* intr=^C quit=^\ erase=del kill=^U - eof=^D vtime=\0 vmin=\1 sxtc=\0 - start=^Q stop=^S susp=^Z eol=\0 - reprint=^R discard=^U werase=^W lnext=^V - eol2=\0 -*/ -#define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0" - -/* - * Translate a "termio" structure into a "termios". Ugh. - */ - -#define user_termio_to_kernel_termios(termios, termio) \ -({ \ - unsigned short tmp; \ - get_user(tmp, &(termio)->c_iflag); \ - (termios)->c_iflag = (0xffff0000 & ((termios)->c_iflag)) | tmp; \ - get_user(tmp, &(termio)->c_oflag); \ - (termios)->c_oflag = (0xffff0000 & ((termios)->c_oflag)) | tmp; \ - get_user(tmp, &(termio)->c_cflag); \ - (termios)->c_cflag = (0xffff0000 & ((termios)->c_cflag)) | tmp; \ - get_user(tmp, &(termio)->c_lflag); \ - (termios)->c_lflag = (0xffff0000 & ((termios)->c_lflag)) | tmp; \ - get_user((termios)->c_line, &(termio)->c_line); \ - copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \ -}) - -/* - * Translate a "termios" structure into a "termio". Ugh. - */ -#define kernel_termios_to_user_termio(termio, termios) \ -({ \ - put_user((termios)->c_iflag, &(termio)->c_iflag); \ - put_user((termios)->c_oflag, &(termio)->c_oflag); \ - put_user((termios)->c_cflag, &(termio)->c_cflag); \ - put_user((termios)->c_lflag, &(termio)->c_lflag); \ - put_user((termios)->c_line, &(termio)->c_line); \ - copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \ -}) - -#define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios)) -#define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios)) - -#endif /* __KERNEL__ */ - -#endif /* _S390_TERMIOS_H */ diff --git a/include/asm-s390x/thread_info.h b/include/asm-s390x/thread_info.h deleted file mode 100644 index a84effda06c9f..0000000000000 --- a/include/asm-s390x/thread_info.h +++ /dev/null @@ -1,95 +0,0 @@ -/* - * include/asm-s390/thread_info.h - * - * S390 version - * Copyright (C) 2002 IBM Deutschland Entwicklung GmbH, IBM Corporation - * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com) - */ - -#ifndef _ASM_THREAD_INFO_H -#define _ASM_THREAD_INFO_H - -#ifdef __KERNEL__ - -#ifndef __ASSEMBLY__ -#include - -/* - * low level task data that entry.S needs immediate access to - * - this struct should fit entirely inside of one cache line - * - this struct shares the supervisor stack pages - * - if the contents of this structure are changed, the assembly constants must also be changed - */ -struct thread_info { - struct task_struct *task; /* main task structure */ - struct exec_domain *exec_domain; /* execution domain */ - unsigned long flags; /* low level flags */ - unsigned int cpu; /* current CPU */ - unsigned int preempt_count; /* 0 => preemptable */ - struct restart_block restart_block; -}; - -/* - * macros/functions for gaining access to the thread information structure - */ -#define INIT_THREAD_INFO(tsk) \ -{ \ - .task = &tsk, \ - .exec_domain = &default_exec_domain, \ - .flags = 0, \ - .cpu = 0, \ - .restart_block = { \ - .fn = do_no_restart_syscall, \ - }, \ -} - -#define init_thread_info (init_thread_union.thread_info) -#define init_stack (init_thread_union.stack) - -/* how to get the thread information struct from C */ -static inline struct thread_info *current_thread_info(void) -{ - return (struct thread_info *)((*(unsigned long *) 0xd40)-16384); -} - -/* thread information allocation */ -#define alloc_thread_info() ((struct thread_info *) \ - __get_free_pages(GFP_KERNEL,2)) -#define free_thread_info(ti) free_pages((unsigned long) (ti), 2) -#define get_thread_info(ti) get_task_struct((ti)->task) -#define put_thread_info(ti) put_task_struct((ti)->task) - -#endif - -/* - * Size of kernel stack for each process - */ -#define THREAD_SIZE (4*PAGE_SIZE) - -/* - * thread information flags bit numbers - */ -#define TIF_SYSCALL_TRACE 0 /* syscall trace active */ -#define TIF_NOTIFY_RESUME 1 /* resumption notification requested */ -#define TIF_SIGPENDING 2 /* signal pending */ -#define TIF_NEED_RESCHED 3 /* rescheduling necessary */ -#define TIF_RESTART_SVC 4 /* restart svc with new svc number */ -#define TIF_USEDFPU 16 /* FPU was used by this task this quantum (SMP) */ -#define TIF_POLLING_NRFLAG 17 /* true if poll_idle() is polling - TIF_NEED_RESCHED */ -#define TIF_31BIT 18 /* 32bit process */ - -#define _TIF_SYSCALL_TRACE (1<> 2; -} - -static inline unsigned long long get_clock (void) -{ - unsigned long long clock; - - __asm__("stck 0(%0)" : : "a" (&(clock)) : "memory", "cc"); - return clock; -} - -#endif diff --git a/include/asm-s390x/tlb.h b/include/asm-s390x/tlb.h deleted file mode 100644 index d90e9b8ecbf25..0000000000000 --- a/include/asm-s390x/tlb.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef _S390X_TLB_H -#define _S390X_TLB_H - -/* - * s390x doesn't need any special per-pte or - * per-vma handling.. - */ -#define tlb_start_vma(tlb, vma) do { } while (0) -#define tlb_end_vma(tlb, vma) do { } while (0) -#define __tlb_remove_tlb_entry(tlb, ptep, address) do { } while (0) - -/* - * .. because we flush the whole mm when it - * fills up. - */ -#define tlb_flush(tlb) flush_tlb_mm((tlb)->mm) - -#include - -#endif diff --git a/include/asm-s390x/tlbflush.h b/include/asm-s390x/tlbflush.h deleted file mode 100644 index ad41122701e27..0000000000000 --- a/include/asm-s390x/tlbflush.h +++ /dev/null @@ -1,138 +0,0 @@ -#ifndef _S390X_TLBFLUSH_H -#define _S390X_TLBFLUSH_H - -#include -#include -#include - -/* - * TLB flushing: - * - * - flush_tlb() flushes the current mm struct TLBs - * - flush_tlb_all() flushes all processes TLBs - * - flush_tlb_mm(mm) flushes the specified mm context TLB's - * - flush_tlb_page(vma, vmaddr) flushes one page - * - flush_tlb_range(vma, start, end) flushes a range of pages - * - flush_tlb_kernel_range(start, end) flushes a range of kernel pages - * - flush_tlb_pgtables(mm, start, end) flushes a range of page tables - */ - -/* - * S/390 has three ways of flushing TLBs - * 'ptlb' does a flush of the local processor - * 'csp' flushes the TLBs on all PUs of a SMP - * 'ipte' invalidates a pte in a page table and flushes that out of - * the TLBs of all PUs of a SMP - */ - -#define local_flush_tlb() \ -do { __asm__ __volatile__("ptlb": : :"memory"); } while (0) - -#ifndef CONFIG_SMP - -/* - * We always need to flush, since s390 does not flush tlb - * on each context switch - */ - -static inline void flush_tlb(void) -{ - local_flush_tlb(); -} -static inline void flush_tlb_all(void) -{ - local_flush_tlb(); -} -static inline void flush_tlb_mm(struct mm_struct *mm) -{ - local_flush_tlb(); -} -static inline void flush_tlb_page(struct vm_area_struct *vma, - unsigned long addr) -{ - local_flush_tlb(); -} -static inline void flush_tlb_range(struct vm_area_struct *vma, - unsigned long start, unsigned long end) -{ - local_flush_tlb(); -} - -#define flush_tlb_kernel_range(start, end) \ - local_flush_tlb(); - -#else - -#include - -extern void smp_ptlb_all(void); - -static inline void global_flush_tlb(void) -{ - long dummy = 0; - - __asm__ __volatile__ ( - " la 4,1(%0)\n" - " slr 2,2\n" - " slr 3,3\n" - " csp 2,4" - : : "a" (&dummy) : "cc", "2", "3", "4" ); -} - -/* - * We only have to do global flush of tlb if process run since last - * flush on any other pu than current. - * If we have threads (mm->count > 1) we always do a global flush, - * since the process runs on more than one processor at the same time. - */ - -static inline void __flush_tlb_mm(struct mm_struct * mm) -{ - preempt_disable(); - if (mm->cpu_vm_mask != (1UL << smp_processor_id())) { - /* mm was active on more than one cpu. */ - if (mm == current->active_mm && - atomic_read(&mm->mm_users) == 1) - /* this cpu is the only one using the mm. */ - mm->cpu_vm_mask = 1UL << smp_processor_id(); - global_flush_tlb(); - } else - local_flush_tlb(); - preempt_enable(); -} - -static inline void flush_tlb(void) -{ - __flush_tlb_mm(current->mm); -} -static inline void flush_tlb_all(void) -{ - global_flush_tlb(); -} -static inline void flush_tlb_mm(struct mm_struct *mm) -{ - __flush_tlb_mm(mm); -} -static inline void flush_tlb_page(struct vm_area_struct *vma, - unsigned long addr) -{ - __flush_tlb_mm(vma->vm_mm); -} -static inline void flush_tlb_range(struct vm_area_struct *vma, - unsigned long start, unsigned long end) -{ - __flush_tlb_mm(vma->vm_mm); -} - -#define flush_tlb_kernel_range(start, end) \ - __flush_tlb_mm(&init_mm) - -#endif - -static inline void flush_tlb_pgtables(struct mm_struct *mm, - unsigned long start, unsigned long end) -{ - /* S/390 does not keep any page table caches in TLB */ -} - -#endif /* _S390X_TLBFLUSH_H */ diff --git a/include/asm-s390x/todclk.h b/include/asm-s390x/todclk.h deleted file mode 100644 index c7f62055488ae..0000000000000 --- a/include/asm-s390x/todclk.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - * File...........: linux/include/asm/todclk.h - * Author(s)......: Holger Smolinski - * Bugreports.to..: - * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999,2000 - * - * History of changes (starts July 2000) - */ - -#ifndef __ASM_TODCLK_H -#define __ASM_TODCLK_H - -#ifdef __KERNEL__ - -#define TOD_uSEC (0x1000ULL) -#define TOD_mSEC (1000 * TOD_uSEC) -#define TOD_SEC (1000 * TOD_mSEC) -#define TOD_MIN (60 * TOD_SEC) -#define TOD_HOUR (60 * TOD_MIN) - -#endif - -#endif diff --git a/include/asm-s390x/topology.h b/include/asm-s390x/topology.h deleted file mode 100644 index 32cfa163930c8..0000000000000 --- a/include/asm-s390x/topology.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef _ASM_S390X_TOPOLOGY_H -#define _ASM_S390X_TOPOLOGY_H - -#include - -#endif /* _ASM_S390X_TOPOLOGY_H */ diff --git a/include/asm-s390x/types.h b/include/asm-s390x/types.h deleted file mode 100644 index 1163af6aec8d7..0000000000000 --- a/include/asm-s390x/types.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * include/asm-s390/types.h - * - * S390 version - * - * Derived from "include/asm-i386/types.h" - */ - -#ifndef _S390_TYPES_H -#define _S390_TYPES_H - -#ifndef __ASSEMBLY__ - -typedef unsigned short umode_t; - -/* - * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the - * header files exported to user space - */ - -typedef __signed__ char __s8; -typedef unsigned char __u8; - -typedef __signed__ short __s16; -typedef unsigned short __u16; - -typedef __signed__ int __s32; -typedef unsigned int __u32; - -typedef __signed__ long __s64; -typedef unsigned long __u64; - -/* - * A address type so that arithmetic can be done on it & it can be upgraded to - * 64 bit when necessary - */ - -typedef unsigned long addr_t; -typedef signed long saddr_t; - -#endif /* __ASSEMBLY__ */ - -/* - * These aren't exported outside the kernel to avoid name space clashes - */ -#ifdef __KERNEL__ - -#define BITS_PER_LONG 64 - -#ifndef __ASSEMBLY__ - -typedef signed char s8; -typedef unsigned char u8; - -typedef signed short s16; -typedef unsigned short u16; - -typedef signed int s32; -typedef unsigned int u32; - -typedef signed long s64; -typedef unsigned long u64; - -typedef u32 dma_addr_t; - -#endif /* __ASSEMBLY__ */ - -#endif /* __KERNEL__ */ -#endif diff --git a/include/asm-s390x/uaccess.h b/include/asm-s390x/uaccess.h deleted file mode 100644 index 9369d23ad85fb..0000000000000 --- a/include/asm-s390x/uaccess.h +++ /dev/null @@ -1,481 +0,0 @@ -/* - * include/asm-s390/uaccess.h - * - * S390 version - * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation - * Author(s): Hartmut Penner (hpenner@de.ibm.com), - * Martin Schwidefsky (schwidefsky@de.ibm.com) - * - * Derived from "include/asm-i386/uaccess.h" - */ -#ifndef __S390_UACCESS_H -#define __S390_UACCESS_H - -/* - * User space memory access functions - */ -#include -#include - -#define VERIFY_READ 0 -#define VERIFY_WRITE 1 - - -/* - * The fs value determines whether argument validity checking should be - * performed or not. If get_fs() == USER_DS, checking is performed, with - * get_fs() == KERNEL_DS, checking is bypassed. - * - * For historical reasons, these macros are grossly misnamed. - */ - -#define MAKE_MM_SEG(s) ((mm_segment_t) { (s) }) - - -#define KERNEL_DS MAKE_MM_SEG(0) -#define USER_DS MAKE_MM_SEG(1) - -#define get_ds() (KERNEL_DS) -#define get_fs() ({ mm_segment_t __x; \ - asm volatile("ear %0,4":"=a" (__x)); \ - __x;}) -#define set_fs(x) ({asm volatile("sar 4,%0"::"a" ((x).ar4));}) - -#define segment_eq(a,b) ((a).ar4 == (b).ar4) - - -#define __access_ok(addr,size) (1) - -#define access_ok(type,addr,size) __access_ok(addr,size) - -extern inline int verify_area(int type, const void * addr, unsigned long size) -{ - return access_ok(type,addr,size)?0:-EFAULT; -} - -/* - * The exception table consists of pairs of addresses: the first is the - * address of an instruction that is allowed to fault, and the second is - * the address at which the program should continue. No registers are - * modified, so it is entirely up to the continuation code to figure out - * what to do. - * - * All the routines below use bits of fixup code that are out of line - * with the main instruction path. This means when everything is well, - * we don't even have to jump over them. Further, they do not intrude - * on our cache or tlb entries. - */ - -struct exception_table_entry -{ - unsigned long insn, fixup; -}; - -/* - * These are the main single-value transfer routines. They automatically - * use the right size if we just have the right pointer type. - */ - -extern inline int __put_user_asm_8(__u64 x, void *ptr) -{ - int err; - - __asm__ __volatile__ ( " sr %0,%0\n" - " la 4,%1\n" - " sacf 512\n" - "0: stg %2,0(4)\n" - "1: sacf 0\n" - ".section .fixup,\"ax\"\n" - "2: lhi %0,%h3\n" - " jg 1b\n" - ".previous\n" - ".section __ex_table,\"a\"\n" - " .align 8\n" - " .quad 0b,2b\n" - ".previous" - : "=&d" (err) - : "m" (*((__u64*) ptr)), "d" (x), "K" (-EFAULT) - : "cc", "4" ); - return err; -} -extern inline int __put_user_asm_4(__u32 x, void *ptr) -{ - int err; - - __asm__ __volatile__ ( " sr %0,%0\n" - " la 4,%1\n" - " sacf 512\n" - "0: st %2,0(4)\n" - "1: sacf 0\n" - ".section .fixup,\"ax\"\n" - "2: lhi %0,%h3\n" - " jg 1b\n" - ".previous\n" - ".section __ex_table,\"a\"\n" - " .align 8\n" - " .quad 0b,2b\n" - ".previous" - : "=&d" (err) - : "m" (*((__u32*) ptr)), "d" (x), "K" (-EFAULT) - : "cc", "4" ); - return err; -} - -extern inline int __put_user_asm_2(__u16 x, void *ptr) -{ - int err; - - __asm__ __volatile__ ( " sr %0,%0\n" - " la 4,%1\n" - " sacf 512\n" - "0: sth %2,0(4)\n" - "1: sacf 0\n" - ".section .fixup,\"ax\"\n" - "2: lhi %0,%h3\n" - " jg 1b\n" - ".previous\n" - ".section __ex_table,\"a\"\n" - " .align 8\n" - " .quad 0b,2b\n" - ".previous" - : "=&d" (err) - : "m" (*((__u16*) ptr)), "d" (x), "K" (-EFAULT) - : "cc", "4" ); - return err; -} - -extern inline int __put_user_asm_1(__u8 x, void *ptr) -{ - int err; - - __asm__ __volatile__ ( " sr %0,%0\n" - " la 4,%1\n" - " sacf 512\n" - "0: stc %2,0(4)\n" - "1: sacf 0\n" - ".section .fixup,\"ax\"\n" - "2: lhi %0,%h3\n" - " jg 1b\n" - ".previous\n" - ".section __ex_table,\"a\"\n" - " .align 8\n" - " .quad 0b,2b\n" - ".previous" - : "=&d" (err) - : "m" (*((__u8*) ptr)), "d" (x), "K" (-EFAULT) - : "cc", "4" ); - return err; -} - -/* - * (u?)(u64) ... autsch, but that the only way we can suppress the - * warnings when compiling binfmt_elf.c - */ -#define __put_user(x, ptr) \ -({ \ - __typeof__(*(ptr)) __x = (x); \ - int __pu_err; \ - switch (sizeof (*(ptr))) { \ - case 1: \ - __pu_err = __put_user_asm_1((__u8)(__u64)(__x), \ - ptr); \ - break; \ - case 2: \ - __pu_err = __put_user_asm_2((__u16)(__u64)(__x),\ - ptr); \ - break; \ - case 4: \ - __pu_err = __put_user_asm_4((__u32)(__u64)(__x),\ - ptr); \ - break; \ - case 8: \ - __pu_err = __put_user_asm_8((__u64)(__x), \ - ptr); \ - break; \ - default: \ - __pu_err = __put_user_bad(); \ - break; \ - } \ - __pu_err; \ -}) - -#define put_user(x, ptr) __put_user(x, ptr) - -extern int __put_user_bad(void); - -#define __get_user_asm_8(x, ptr, err) \ -({ \ - __asm__ __volatile__ ( " sr %1,%1\n" \ - " la 4,%2\n" \ - " sacf 512\n" \ - "0: lg %0,0(4)\n" \ - "1: sacf 0\n" \ - ".section .fixup,\"ax\"\n" \ - "2: lhi %1,%h3\n" \ - " jg 1b\n" \ - ".previous\n" \ - ".section __ex_table,\"a\"\n" \ - " .align 8\n" \ - " .quad 0b,2b\n" \ - ".previous" \ - : "=d" (x) , "=&d" (err) \ - : "m" (*(const __u64*)(ptr)),"K" (-EFAULT) \ - : "cc", "4" ); \ -}) -#define __get_user_asm_4(x, ptr, err) \ -({ \ - __asm__ __volatile__ ( " sr %1,%1\n" \ - " la 4,%2\n" \ - " sacf 512\n" \ - "0: l %0,0(4)\n" \ - "1: sacf 0\n" \ - ".section .fixup,\"ax\"\n" \ - "2: lhi %1,%h3\n" \ - " jg 1b\n" \ - ".previous\n" \ - ".section __ex_table,\"a\"\n" \ - " .align 8\n" \ - " .quad 0b,2b\n" \ - ".previous" \ - : "=d" (x) , "=&d" (err) \ - : "m" (*(const __u32*)(ptr)),"K" (-EFAULT) \ - : "cc", "4" ); \ -}) - -#define __get_user_asm_2(x, ptr, err) \ -({ \ - __asm__ __volatile__ ( " sr %1,%1\n" \ - " la 4,%2\n" \ - " sacf 512\n" \ - "0: lh %0,0(4)\n" \ - "1: sacf 0\n" \ - ".section .fixup,\"ax\"\n" \ - "2: lhi %1,%h3\n" \ - " jg 1b\n" \ - ".previous\n" \ - ".section __ex_table,\"a\"\n" \ - " .align 8\n" \ - " .quad 0b,2b\n" \ - ".previous" \ - : "=d" (x) , "=&d" (err) \ - : "m" (*(const __u16*)(ptr)),"K" (-EFAULT) \ - : "cc", "4" ); \ -}) - -#define __get_user_asm_1(x, ptr, err) \ -({ \ - __asm__ __volatile__ ( " sr %1,%1\n" \ - " la 4,%2\n" \ - " sr %0,%0\n" \ - " sacf 512\n" \ - "0: ic %0,0(4)\n" \ - "1: sacf 0\n" \ - ".section .fixup,\"ax\"\n" \ - "2: lhi %1,%h3\n" \ - " jg 1b\n" \ - ".previous\n" \ - ".section __ex_table,\"a\"\n" \ - " .align 8\n" \ - " .quad 0b,2b\n" \ - ".previous" \ - : "=d" (x) , "=&d" (err) \ - : "m" (*(const __u8*)(ptr)),"K" (-EFAULT) \ - : "cc", "4" ); \ -}) - -#define __get_user(x, ptr) \ -({ \ - __typeof__(*(ptr)) __x; \ - int __gu_err; \ - switch (sizeof(*(ptr))) { \ - case 1: \ - __get_user_asm_1(__x,ptr,__gu_err); \ - break; \ - case 2: \ - __get_user_asm_2(__x,ptr,__gu_err); \ - break; \ - case 4: \ - __get_user_asm_4(__x,ptr,__gu_err); \ - break; \ - case 8: \ - __get_user_asm_8(__x,ptr,__gu_err); \ - break; \ - default: \ - __x = 0; \ - __gu_err = __get_user_bad(); \ - break; \ - } \ - (x) = __x; \ - __gu_err; \ -}) - -#define get_user(x, ptr) __get_user(x, ptr) - -extern int __get_user_bad(void); - -/* - * access register are set up, that 4 points to secondary (user) , 2 to primary (kernel) - */ - -extern long __copy_to_user_asm(const void *from, long n, void *to); - -#define __copy_to_user(to, from, n) \ -({ \ - __copy_to_user_asm(from, n, to); \ -}) - -#define copy_to_user(to, from, n) \ -({ \ - long err = 0; \ - __typeof__(n) __n = (n); \ - if (__access_ok(to,__n)) { \ - err = __copy_to_user_asm(from, __n, to); \ - } \ - else \ - err = __n; \ - err; \ -}) - -extern long __copy_from_user_asm(void *to, long n, const void *from); - -#define __copy_from_user(to, from, n) \ -({ \ - __copy_from_user_asm(to, n, from); \ -}) - -#define copy_from_user(to, from, n) \ -({ \ - long err = 0; \ - __typeof__(n) __n = (n); \ - if (__access_ok(from,__n)) { \ - err = __copy_from_user_asm(to, __n, from); \ - } \ - else \ - err = __n; \ - err; \ -}) - -/* - * Copy a null terminated string from userspace. - */ - -static inline long -__strncpy_from_user(char *dst, const char *src, long count) -{ - long len; - __asm__ __volatile__ ( " slgr %0,%0\n" - " lgr 2,%1\n" - " lgr 4,%2\n" - " slr 3,3\n" - " sacf 512\n" - "0: ic 3,0(%0,4)\n" - "1: stc 3,0(%0,2)\n" - " ltr 3,3\n" - " jz 2f\n" - " aghi %0,1\n" - " cgr %0,%3\n" - " jl 0b\n" - "2: sacf 0\n" - ".section .fixup,\"ax\"\n" - "3: lghi %0,%h4\n" - " jg 2b\n" - ".previous\n" - ".section __ex_table,\"a\"\n" - " .align 8\n" - " .quad 0b,3b\n" - " .quad 1b,3b\n" - ".previous" - : "=&a" (len) - : "a" (dst), "d" (src), "d" (count), - "K" (-EFAULT) - : "cc", "2" ,"3", "4" ); - return len; -} - -static inline long -strncpy_from_user(char *dst, const char *src, long count) -{ - long res = -EFAULT; - if (access_ok(VERIFY_READ, src, 1)) - res = __strncpy_from_user(dst, src, count); - return res; -} - -/* - * Return the size of a string (including the ending 0) - * - * Return 0 for error - */ -static inline unsigned long -strnlen_user(const char * src, unsigned long n) -{ -#if 0 - __asm__ __volatile__ (" algr %0,%1\n" - " slgr 0,0\n" - " lgr 4,%1\n" - " sacf 512\n" - "0: srst %0,4\n" - " jo 0b\n" - " slgr %0,%1\n" - " aghi %0,1\n" - "1: sacf 0\n" - ".section .fixup,\"ax\"\n" - "2: slgr %0,%0\n" - " jg 1b\n" - ".previous\n" - ".section __ex_table,\"a\"\n" - " .align 8\n" - " .quad 0b,2b\n" - ".previous" - : "+&a" (n) : "d" (src) - : "cc", "0", "4" ); -#else - __asm__ __volatile__ (" lgr 4,%1\n" - " sacf 512\n" - "0: cli 0(4),0x00\n" - " la 4,1(4)\n" - " je 1f\n" - " brctg %0,0b\n" - "1: lgr %0,4\n" - " slgr %0,%1\n" - "2: sacf 0\n" - ".section .fixup,\"ax\"\n" - "3: slgr %0,%0\n" - " jg 2b\n" - ".previous\n" - ".section __ex_table,\"a\"\n" - " .align 8\n" - " .quad 0b,3b\n" - ".previous" - : "+&a" (n) : "d" (src) - : "cc", "4" ); -#endif - return n; -} -#define strlen_user(str) strnlen_user(str, ~0UL) - -/* - * Zero Userspace - */ - -extern long __clear_user_asm(void *to, long n); - -#define __clear_user(to, n) \ -({ \ - __clear_user_asm(to, n); \ -}) - -static inline unsigned long -clear_user(void *to, unsigned long n) -{ - if (access_ok(VERIFY_WRITE, to, n)) - n = __clear_user(to, n); - return n; -} - -#endif /* _S390_UACCESS_H */ - - - - - diff --git a/include/asm-s390x/ucontext.h b/include/asm-s390x/ucontext.h deleted file mode 100644 index d69bec0b03f58..0000000000000 --- a/include/asm-s390x/ucontext.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * include/asm-s390/ucontext.h - * - * S390 version - * - * Derived from "include/asm-i386/ucontext.h" - */ - -#ifndef _ASM_S390_UCONTEXT_H -#define _ASM_S390_UCONTEXT_H - -struct ucontext { - unsigned long uc_flags; - struct ucontext *uc_link; - stack_t uc_stack; - _sigregs uc_mcontext; - sigset_t uc_sigmask; /* mask last for extensibility */ -}; - -#endif /* !_ASM_S390_UCONTEXT_H */ diff --git a/include/asm-s390x/unaligned.h b/include/asm-s390x/unaligned.h deleted file mode 100644 index 8ee86dbedd1fe..0000000000000 --- a/include/asm-s390x/unaligned.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * include/asm-s390/unaligned.h - * - * S390 version - * - * Derived from "include/asm-i386/unaligned.h" - */ - -#ifndef __S390_UNALIGNED_H -#define __S390_UNALIGNED_H - -/* - * The S390 can do unaligned accesses itself. - * - * The strange macros are there to make sure these can't - * be misused in a way that makes them not work on other - * architectures where unaligned accesses aren't as simple. - */ - -#define get_unaligned(ptr) (*(ptr)) - -#define put_unaligned(val, ptr) ((void)( *(ptr) = (val) )) - -#endif diff --git a/include/asm-s390x/unistd.h b/include/asm-s390x/unistd.h deleted file mode 100644 index 7d082721a1a22..0000000000000 --- a/include/asm-s390x/unistd.h +++ /dev/null @@ -1,390 +0,0 @@ -/* - * include/asm-s390/unistd.h - * - * S390 version - * - * Derived from "include/asm-i386/unistd.h" - */ - -#ifndef _ASM_S390_UNISTD_H_ -#define _ASM_S390_UNISTD_H_ - -/* - * This file contains the system call numbers. - */ - -#define __NR_exit 1 -#define __NR_fork 2 -#define __NR_read 3 -#define __NR_write 4 -#define __NR_open 5 -#define __NR_close 6 -#define __NR_restart_syscall 7 -#define __NR_creat 8 -#define __NR_link 9 -#define __NR_unlink 10 -#define __NR_execve 11 -#define __NR_chdir 12 -#define __NR_mknod 14 -#define __NR_chmod 15 -#define __NR_lseek 19 -#define __NR_getpid 20 -#define __NR_mount 21 -#define __NR_umount 22 -#define __NR_ptrace 26 -#define __NR_alarm 27 -#define __NR_pause 29 -#define __NR_utime 30 -#define __NR_access 33 -#define __NR_nice 34 -#define __NR_sync 36 -#define __NR_kill 37 -#define __NR_rename 38 -#define __NR_mkdir 39 -#define __NR_rmdir 40 -#define __NR_dup 41 -#define __NR_pipe 42 -#define __NR_times 43 -#define __NR_brk 45 -#define __NR_signal 48 -#define __NR_acct 51 -#define __NR_umount2 52 -#define __NR_ioctl 54 -#define __NR_fcntl 55 -#define __NR_setpgid 57 -#define __NR_umask 60 -#define __NR_chroot 61 -#define __NR_ustat 62 -#define __NR_dup2 63 -#define __NR_getppid 64 -#define __NR_getpgrp 65 -#define __NR_setsid 66 -#define __NR_sigaction 67 -#define __NR_sigsuspend 72 -#define __NR_sigpending 73 -#define __NR_sethostname 74 -#define __NR_setrlimit 75 -#define __NR_getrusage 77 -#define __NR_gettimeofday 78 -#define __NR_settimeofday 79 -#define __NR_symlink 83 -#define __NR_readlink 85 -#define __NR_uselib 86 -#define __NR_swapon 87 -#define __NR_reboot 88 -#define __NR_readdir 89 -#define __NR_mmap 90 -#define __NR_munmap 91 -#define __NR_truncate 92 -#define __NR_ftruncate 93 -#define __NR_fchmod 94 -#define __NR_getpriority 96 -#define __NR_setpriority 97 -#define __NR_statfs 99 -#define __NR_fstatfs 100 -#define __NR_socketcall 102 -#define __NR_syslog 103 -#define __NR_setitimer 104 -#define __NR_getitimer 105 -#define __NR_stat 106 -#define __NR_lstat 107 -#define __NR_fstat 108 -#define __NR_vhangup 111 -#define __NR_idle 112 -#define __NR_wait4 114 -#define __NR_swapoff 115 -#define __NR_sysinfo 116 -#define __NR_ipc 117 -#define __NR_fsync 118 -#define __NR_sigreturn 119 -#define __NR_clone 120 -#define __NR_setdomainname 121 -#define __NR_uname 122 -#define __NR_adjtimex 124 -#define __NR_mprotect 125 -#define __NR_sigprocmask 126 -#define __NR_create_module 127 -#define __NR_init_module 128 -#define __NR_delete_module 129 -#define __NR_get_kernel_syms 130 -#define __NR_quotactl 131 -#define __NR_getpgid 132 -#define __NR_fchdir 133 -#define __NR_bdflush 134 -#define __NR_sysfs 135 -#define __NR_personality 136 -#define __NR_afs_syscall 137 /* Syscall for Andrew File System */ -#define __NR_getdents 141 -#define __NR_select 142 -#define __NR_flock 143 -#define __NR_msync 144 -#define __NR_readv 145 -#define __NR_writev 146 -#define __NR_getsid 147 -#define __NR_fdatasync 148 -#define __NR__sysctl 149 -#define __NR_mlock 150 -#define __NR_munlock 151 -#define __NR_mlockall 152 -#define __NR_munlockall 153 -#define __NR_sched_setparam 154 -#define __NR_sched_getparam 155 -#define __NR_sched_setscheduler 156 -#define __NR_sched_getscheduler 157 -#define __NR_sched_yield 158 -#define __NR_sched_get_priority_max 159 -#define __NR_sched_get_priority_min 160 -#define __NR_sched_rr_get_interval 161 -#define __NR_nanosleep 162 -#define __NR_mremap 163 -#define __NR_query_module 167 -#define __NR_poll 168 -#define __NR_nfsservctl 169 -#define __NR_prctl 172 -#define __NR_rt_sigreturn 173 -#define __NR_rt_sigaction 174 -#define __NR_rt_sigprocmask 175 -#define __NR_rt_sigpending 176 -#define __NR_rt_sigtimedwait 177 -#define __NR_rt_sigqueueinfo 178 -#define __NR_rt_sigsuspend 179 -#define __NR_pread64 180 -#define __NR_pwrite64 181 -#define __NR_getcwd 183 -#define __NR_capget 184 -#define __NR_capset 185 -#define __NR_sigaltstack 186 -#define __NR_sendfile 187 -#define __NR_getpmsg 188 -#define __NR_putpmsg 189 -#define __NR_vfork 190 -#define __NR_getrlimit 191 /* SuS compliant getrlimit */ -#define __NR_lchown 198 -#define __NR_getuid 199 -#define __NR_getgid 200 -#define __NR_geteuid 201 -#define __NR_getegid 202 -#define __NR_setreuid 203 -#define __NR_setregid 204 -#define __NR_getgroups 205 -#define __NR_setgroups 206 -#define __NR_fchown 207 -#define __NR_setresuid 208 -#define __NR_getresuid 209 -#define __NR_setresgid 210 -#define __NR_getresgid 211 -#define __NR_chown 212 -#define __NR_setuid 213 -#define __NR_setgid 214 -#define __NR_setfsuid 215 -#define __NR_setfsgid 216 -#define __NR_pivot_root 217 -#define __NR_mincore 218 -#define __NR_madvise 219 -#define __NR_readahead 222 -#define __NR_setxattr 224 -#define __NR_lsetxattr 225 -#define __NR_fsetxattr 226 -#define __NR_getxattr 227 -#define __NR_lgetxattr 228 -#define __NR_fgetxattr 229 -#define __NR_listxattr 230 -#define __NR_llistxattr 231 -#define __NR_flistxattr 232 -#define __NR_removexattr 233 -#define __NR_lremovexattr 234 -#define __NR_fremovexattr 235 -#define __NR_gettid 236 -#define __NR_tkill 237 -#define __NR_futex 238 -#define __NR_sched_setaffinity 239 -#define __NR_sched_getaffinity 240 -/* - * Number 241 is currently unused - */ -/* - * Number 242 is reserved for tux - */ -#define __NR_io_setup 243 -#define __NR_io_destroy 244 -#define __NR_io_getevents 245 -#define __NR_io_submit 246 -#define __NR_io_cancel 247 -#define __NR_exit_group 248 -#define __NR_epoll_create 249 -#define __NR_epoll_ctl 250 -#define __NR_epoll_wait 251 -#define __NR_set_tid_address 252 -#define __NR_fadvise64 253 - - -/* user-visible error numbers are in the range -1 - -122: see */ - -#define __syscall_return(type, res) \ -do { \ - if ((unsigned long)(res) >= (unsigned long)(-125)) { \ - errno = -(res); \ - res = -1; \ - } \ - return (type) (res); \ -} while (0) - -#define _svc_clobber "cc", "memory" - -#define _syscall0(type,name) \ -type name(void) { \ - register long __svcres asm("2"); \ - long __res; \ - __asm__ __volatile__ ( \ - " svc %b1\n" \ - : "=d" (__svcres) \ - : "i" (__NR_##name) \ - : _svc_clobber ); \ - __res = __svcres; \ - __syscall_return(type,__res); \ -} - -#define _syscall1(type,name,type1,arg1) \ -type name(type1 arg1) { \ - register type1 __arg1 asm("2") = arg1; \ - register long __svcres asm("2"); \ - long __res; \ - __asm__ __volatile__ ( \ - " svc %b1\n" \ - : "=d" (__svcres) \ - : "i" (__NR_##name), \ - "0" (__arg1) \ - : _svc_clobber ); \ - __res = __svcres; \ - __syscall_return(type,__res); \ -} - -#define _syscall2(type,name,type1,arg1,type2,arg2) \ -type name(type1 arg1, type2 arg2) { \ - register type1 __arg1 asm("2") = arg1; \ - register type2 __arg2 asm("3") = arg2; \ - register long __svcres asm("2"); \ - long __res; \ - __asm__ __volatile__ ( \ - " svc %b1\n" \ - : "=d" (__svcres) \ - : "i" (__NR_##name), \ - "0" (__arg1), \ - "d" (__arg2) \ - : _svc_clobber ); \ - __res = __svcres; \ - __syscall_return(type,__res); \ -} - -#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3)\ -type name(type1 arg1, type2 arg2, type3 arg3) { \ - register type1 __arg1 asm("2") = arg1; \ - register type2 __arg2 asm("3") = arg2; \ - register type3 __arg3 asm("4") = arg3; \ - register long __svcres asm("2"); \ - long __res; \ - __asm__ __volatile__ ( \ - " svc %b1\n" \ - : "=d" (__svcres) \ - : "i" (__NR_##name), \ - "0" (__arg1), \ - "d" (__arg2), \ - "d" (__arg3) \ - : _svc_clobber ); \ - __res = __svcres; \ - __syscall_return(type,__res); \ -} - -#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,\ - type4,name4) \ -type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4) { \ - register type1 __arg1 asm("2") = arg1; \ - register type2 __arg2 asm("3") = arg2; \ - register type3 __arg3 asm("4") = arg3; \ - register type4 __arg4 asm("5") = arg4; \ - register long __svcres asm("2"); \ - long __res; \ - __asm__ __volatile__ ( \ - " svc %b1\n" \ - : "=d" (__svcres) \ - : "i" (__NR_##name), \ - "0" (__arg1), \ - "d" (__arg2), \ - "d" (__arg3), \ - "d" (__arg4) \ - : _svc_clobber ); \ - __res = __svcres; \ - __syscall_return(type,__res); \ -} - -#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,\ - type4,name4,type5,name5) \ -type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, \ - type5 arg5) { \ - register type1 __arg1 asm("2") = arg1; \ - register type2 __arg2 asm("3") = arg2; \ - register type3 __arg3 asm("4") = arg3; \ - register type4 __arg4 asm("5") = arg4; \ - register type5 __arg5 asm("6") = arg5; \ - register long __svcres asm("2"); \ - long __res; \ - __asm__ __volatile__ ( \ - " svc %b1\n" \ - : "=d" (__svcres) \ - : "i" (__NR_##name), \ - "0" (__arg1), \ - "d" (__arg2), \ - "d" (__arg3), \ - "d" (__arg4), \ - "d" (__arg5) \ - : _svc_clobber ); \ - __res = __svcres; \ - __syscall_return(type,__res); \ -} - -#ifdef __KERNEL_SYSCALLS__ - -#include - -/* - * we need this inline - forking from kernel space will result - * in NO COPY ON WRITE (!!!), until an execve is executed. This - * is no problem, but for the stack. This is handled by not letting - * main() use the stack at all after fork(). Thus, no function - * calls - which means inline code for fork too, as otherwise we - * would use the stack upon exit from 'fork()'. - * - * Actually only pause and fork are needed inline, so that there - * won't be any messing with the stack from main(), but we define - * some others too. - */ -#define __NR__exit __NR_exit -static inline _syscall0(pid_t,setsid) -static inline _syscall3(int,write,int,fd,const char *,buf,off_t,count) -static inline _syscall3(int,read,int,fd,char *,buf,off_t,count) -static inline _syscall3(off_t,lseek,int,fd,off_t,offset,int,count) -static inline _syscall1(int,dup,int,fd) -static inline _syscall3(int,execve,const char *,file,char **,argv,char **,envp) -static inline _syscall3(int,open,const char *,file,int,flag,int,mode) -static inline _syscall1(int,close,int,fd) -static inline _syscall1(int,_exit,int,exitcode) -static inline _syscall2(long,stat,char *,filename,struct stat *,statbuf) - -struct rusage; -extern long sys_wait4(pid_t, unsigned int *, int, struct rusage *); -static inline pid_t waitpid(int pid, int *wait_stat, int flags) -{ - return sys_wait4(pid, wait_stat, flags, NULL); -} - -#endif - -/* - * "Conditional" syscalls - * - * What we want is __attribute__((weak,alias("sys_ni_syscall"))), - * but it doesn't work on all toolchains, so we just do it by hand - */ -#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall"); - -#endif /* _ASM_S390_UNISTD_H_ */ diff --git a/include/asm-s390x/user.h b/include/asm-s390x/user.h deleted file mode 100644 index 2e91b881b7332..0000000000000 --- a/include/asm-s390x/user.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * include/asm-s390/user.h - * - * S390 version - * - * Derived from "include/asm-i386/usr.h" - */ - -#ifndef _S390_USER_H -#define _S390_USER_H - -#include -#include -/* Core file format: The core file is written in such a way that gdb - can understand it and provide useful information to the user (under - linux we use the 'trad-core' bfd). There are quite a number of - obstacles to being able to view the contents of the floating point - registers, and until these are solved you will not be able to view the - contents of them. Actually, you can read in the core file and look at - the contents of the user struct to find out what the floating point - registers contain. - The actual file contents are as follows: - UPAGE: 1 page consisting of a user struct that tells gdb what is present - in the file. Directly after this is a copy of the task_struct, which - is currently not used by gdb, but it may come in useful at some point. - All of the registers are stored as part of the upage. The upage should - always be only one page. - DATA: The data area is stored. We use current->end_text to - current->brk to pick up all of the user variables, plus any memory - that may have been malloced. No attempt is made to determine if a page - is demand-zero or if a page is totally unused, we just cover the entire - range. All of the addresses are rounded in such a way that an integral - number of pages is written. - STACK: We need the stack information in order to get a meaningful - backtrace. We need to write the data from (esp) to - current->start_stack, so we round each of these off in order to be able - to write an integer number of pages. - The minimum core file size is 3 pages, or 12288 bytes. -*/ - - -/* - * This is the old layout of "struct pt_regs", and - * is still the layout used by user mode (the new - * pt_regs doesn't have all registers as the kernel - * doesn't use the extra segment registers) - */ - -/* When the kernel dumps core, it starts by dumping the user struct - - this will be used by gdb to figure out where the data and stack segments - are within the file, and what virtual addresses to use. */ -struct user { -/* We start with the registers, to mimic the way that "memory" is returned - from the ptrace(3,...) function. */ - struct user_regs_struct regs; /* Where the registers are actually stored */ -/* The rest of this junk is to help gdb figure out what goes where */ - size_t u_tsize; /* Text segment size (pages). */ - size_t u_dsize; /* Data segment size (pages). */ - size_t u_ssize; /* Stack segment size (pages). */ - unsigned long start_code; /* Starting virtual address of text. */ - unsigned long start_stack; /* Starting virtual address of stack area. - This is actually the bottom of the stack, - the top of the stack is always found in the - gprs[15] register. */ - long int signal; /* Signal that caused the core dump. */ - struct user_regs_struct *u_ar0; - /* Used by gdb to help find the values for */ - /* the registers. */ - unsigned long magic; /* To uniquely identify a core file */ - char u_comm[32]; /* User command that was responsible */ -}; -#define NBPG PAGE_SIZE -#define UPAGES 1 -#define HOST_TEXT_START_ADDR (u.start_code) -#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG) - -#endif /* _S390_USER_H */ diff --git a/include/asm-s390x/vtoc.h b/include/asm-s390x/vtoc.h deleted file mode 100644 index f805a0b46697f..0000000000000 --- a/include/asm-s390x/vtoc.h +++ /dev/null @@ -1,373 +0,0 @@ -#ifndef __KERNEL__ -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#endif - - -#define LINE_LENGTH 80 -#define VTOC_START_CC 0x0 -#define VTOC_START_HH 0x1 -#define FIRST_USABLE_CYL 1 -#define FIRST_USABLE_TRK 2 - -#define DASD_3380_TYPE 13148 -#define DASD_3390_TYPE 13200 -#define DASD_9345_TYPE 37701 - -#define DASD_3380_VALUE 0xbb60 -#define DASD_3390_VALUE 0xe5a2 -#define DASD_9345_VALUE 0xbc98 - -#define VOLSER_LENGTH 6 -#define BIG_DISK_SIZE 0x10000 - -#define VTOC_ERROR "VTOC error:" - - -typedef struct ttr -{ - __u16 tt; - __u8 r; -} __attribute__ ((packed)) ttr_t; - -typedef struct cchhb -{ - __u16 cc; - __u16 hh; - __u8 b; -} __attribute__ ((packed)) cchhb_t; - -typedef struct cchh -{ - __u16 cc; - __u16 hh; -} __attribute__ ((packed)) cchh_t; - -typedef struct labeldate -{ - __u8 year; - __u16 day; -} __attribute__ ((packed)) labeldate_t; - - -typedef struct volume_label -{ - char volkey[4]; /* volume key = volume label */ - char vollbl[4]; /* volume label */ - char volid[6]; /* volume identifier */ - __u8 security; /* security byte */ - cchhb_t vtoc; /* VTOC address */ - char res1[5]; /* reserved */ - char cisize[4]; /* CI-size for FBA,... */ - /* ...blanks for CKD */ - char blkperci[4]; /* no of blocks per CI (FBA), blanks for CKD */ - char labperci[4]; /* no of labels per CI (FBA), blanks for CKD */ - char res2[4]; /* reserved */ - char lvtoc[14]; /* owner code for LVTOC */ - char res3[29]; /* reserved */ -} __attribute__ ((packed)) volume_label_t; - - -typedef struct extent -{ - __u8 typeind; /* extent type indicator */ - __u8 seqno; /* extent sequence number */ - cchh_t llimit; /* starting point of this extent */ - cchh_t ulimit; /* ending point of this extent */ -} __attribute__ ((packed)) extent_t; - - -typedef struct dev_const -{ - __u16 DS4DSCYL; /* number of logical cyls */ - __u16 DS4DSTRK; /* number of tracks in a logical cylinder */ - __u16 DS4DEVTK; /* device track length */ - __u8 DS4DEVI; /* non-last keyed record overhead */ - __u8 DS4DEVL; /* last keyed record overhead */ - __u8 DS4DEVK; /* non-keyed record overhead differential */ - __u8 DS4DEVFG; /* flag byte */ - __u16 DS4DEVTL; /* device tolerance */ - __u8 DS4DEVDT; /* number of DSCB's per track */ - __u8 DS4DEVDB; /* number of directory blocks per track */ -} __attribute__ ((packed)) dev_const_t; - - -typedef struct format1_label -{ - char DS1DSNAM[44]; /* data set name */ - __u8 DS1FMTID; /* format identifier */ - char DS1DSSN[6]; /* data set serial number */ - __u16 DS1VOLSQ; /* volume sequence number */ - labeldate_t DS1CREDT; /* creation date: ydd */ - labeldate_t DS1EXPDT; /* expiration date */ - __u8 DS1NOEPV; /* number of extents on volume */ - __u8 DS1NOBDB; /* no. of bytes used in last direction blk */ - __u8 DS1FLAG1; /* flag 1 */ - char DS1SYSCD[13]; /* system code */ - labeldate_t DS1REFD; /* date last referenced */ - __u8 DS1SMSFG; /* system managed storage indicators */ - __u8 DS1SCXTF; /* sec. space extension flag byte */ - __u16 DS1SCXTV; /* secondary space extension value */ - __u8 DS1DSRG1; /* data set organisation byte 1 */ - __u8 DS1DSRG2; /* data set organisation byte 2 */ - __u8 DS1RECFM; /* record format */ - __u8 DS1OPTCD; /* option code */ - __u16 DS1BLKL; /* block length */ - __u16 DS1LRECL; /* record length */ - __u8 DS1KEYL; /* key length */ - __u16 DS1RKP; /* relative key position */ - __u8 DS1DSIND; /* data set indicators */ - __u8 DS1SCAL1; /* secondary allocation flag byte */ - char DS1SCAL3[3]; /* secondary allocation quantity */ - ttr_t DS1LSTAR; /* last used track and block on track */ - __u16 DS1TRBAL; /* space remaining on last used track */ - __u16 res1; /* reserved */ - extent_t DS1EXT1; /* first extent description */ - extent_t DS1EXT2; /* second extent description */ - extent_t DS1EXT3; /* third extent description */ - cchhb_t DS1PTRDS; /* possible pointer to f2 or f3 DSCB */ -} __attribute__ ((packed)) format1_label_t; - - -typedef struct format4_label -{ - char DS4KEYCD[44]; /* key code for VTOC labels: 44 times 0x04 */ - __u8 DS4IDFMT; /* format identifier */ - cchhb_t DS4HPCHR; /* highest address of a format 1 DSCB */ - __u16 DS4DSREC; /* number of available DSCB's */ - cchh_t DS4HCCHH; /* CCHH of next available alternate track */ - __u16 DS4NOATK; /* number of remaining alternate tracks */ - __u8 DS4VTOCI; /* VTOC indicators */ - __u8 DS4NOEXT; /* number of extents in VTOC */ - __u8 DS4SMSFG; /* system managed storage indicators */ - __u8 DS4DEVAC; /* number of alternate cylinders. - Subtract from first two bytes of - DS4DEVSZ to get number of usable - cylinders. can be zero. valid - only if DS4DEVAV on. */ - dev_const_t DS4DEVCT; /* device constants */ - char DS4AMTIM[8]; /* VSAM time stamp */ - char DS4AMCAT[3]; /* VSAM catalog indicator */ - char DS4R2TIM[8]; /* VSAM volume/catalog match time stamp */ - char res1[5]; /* reserved */ - char DS4F6PTR[5]; /* pointer to first format 6 DSCB */ - extent_t DS4VTOCE; /* VTOC extent description */ - char res2[10]; /* reserved */ - __u8 DS4EFLVL; /* extended free-space management level */ - cchhb_t DS4EFPTR; /* pointer to extended free-space info */ - char res3[9]; /* reserved */ -} __attribute__ ((packed)) format4_label_t; - - -typedef struct ds5ext -{ - __u16 t; /* RTA of the first track of free extent */ - __u16 fc; /* number of whole cylinders in free ext. */ - __u8 ft; /* number of remaining free tracks */ -} __attribute__ ((packed)) ds5ext_t; - - -typedef struct format5_label -{ - char DS5KEYID[4]; /* key identifier */ - ds5ext_t DS5AVEXT; /* first available (free-space) extent. */ - ds5ext_t DS5EXTAV[7]; /* seven available extents */ - __u8 DS5FMTID; /* format identifier */ - ds5ext_t DS5MAVET[18]; /* eighteen available extents */ - cchhb_t DS5PTRDS; /* pointer to next format5 DSCB */ -} __attribute__ ((packed)) format5_label_t; - - -typedef struct ds7ext -{ - __u32 a; /* starting RTA value */ - __u32 b; /* ending RTA value + 1 */ -} __attribute__ ((packed)) ds7ext_t; - - -typedef struct format7_label -{ - char DS7KEYID[4]; /* key identifier */ - ds7ext_t DS7EXTNT[5]; /* space for 5 extent descriptions */ - __u8 DS7FMTID; /* format identifier */ - ds7ext_t DS7ADEXT[11]; /* space for 11 extent descriptions */ - char res1[2]; /* reserved */ - cchhb_t DS7PTRDS; /* pointer to next FMT7 DSCB */ -} __attribute__ ((packed)) format7_label_t; - - -char * vtoc_ebcdic_enc ( - unsigned char source[LINE_LENGTH], - unsigned char target[LINE_LENGTH], - int l); -char * vtoc_ebcdic_dec ( - unsigned char source[LINE_LENGTH], - unsigned char target[LINE_LENGTH], - int l); -void vtoc_set_extent ( - extent_t * ext, - __u8 typeind, - __u8 seqno, - cchh_t * lower, - cchh_t * upper); -void vtoc_set_cchh ( - cchh_t * addr, - __u16 cc, - __u16 hh); -void vtoc_set_cchhb ( - cchhb_t * addr, - __u16 cc, - __u16 hh, - __u8 b); -void vtoc_set_date ( - labeldate_t * d, - __u8 year, - __u16 day); - -void vtoc_volume_label_init ( - volume_label_t *vlabel); - -int vtoc_read_volume_label ( - char * device, - unsigned long vlabel_start, - volume_label_t * vlabel); - -int vtoc_write_volume_label ( - char *device, - unsigned long vlabel_start, - volume_label_t *vlabel); - -void vtoc_volume_label_set_volser ( - volume_label_t *vlabel, - char *volser); - -char *vtoc_volume_label_get_volser ( - volume_label_t *vlabel, - char *volser); - -void vtoc_volume_label_set_key ( - volume_label_t *vlabel, - char *key); - -void vtoc_volume_label_set_label ( - volume_label_t *vlabel, - char *lbl); - -char *vtoc_volume_label_get_label ( - volume_label_t *vlabel, - char *lbl); - -void vtoc_read_label ( - char *device, - unsigned long position, - format1_label_t *f1, - format4_label_t *f4, - format5_label_t *f5, - format7_label_t *f7); - -void vtoc_write_label ( - char *device, - unsigned long position, - format1_label_t *f1, - format4_label_t *f4, - format5_label_t *f5, - format7_label_t *f7); - - -void vtoc_init_format1_label ( - char *volid, - unsigned int blksize, - extent_t *part_extent, - format1_label_t *f1); - - -void vtoc_init_format4_label ( - format4_label_t *f4lbl, - unsigned int usable_partitions, - unsigned int cylinders, - unsigned int tracks, - unsigned int blocks, - unsigned int blksize, - __u16 dev_type); - -void vtoc_update_format4_label ( - format4_label_t *f4, - cchhb_t *highest_f1, - __u16 unused_update); - - -void vtoc_init_format5_label ( - format5_label_t *f5); - -void vtoc_update_format5_label_add ( - format5_label_t *f5, - int verbose, - int cyl, - int trk, - __u16 a, - __u16 b, - __u8 c); - -void vtoc_update_format5_label_del ( - format5_label_t *f5, - int verbose, - int cyl, - int trk, - __u16 a, - __u16 b, - __u8 c); - - -void vtoc_init_format7_label ( - format7_label_t *f7); - -void vtoc_update_format7_label_add ( - format7_label_t *f7, - int verbose, - __u32 a, - __u32 b); - -void vtoc_update_format7_label_del ( - format7_label_t *f7, - int verbose, - __u32 a, - __u32 b); - - -void vtoc_set_freespace( - format4_label_t *f4, - format5_label_t *f5, - format7_label_t *f7, - char ch, - int verbose, - __u32 start, - __u32 stop, - int cyl, - int trk); - - - - - - - - - - - - diff --git a/include/asm-s390x/xor.h b/include/asm-s390x/xor.h deleted file mode 100644 index c82eb12a5b181..0000000000000 --- a/include/asm-s390x/xor.h +++ /dev/null @@ -1 +0,0 @@ -#include -- 2.53.0