diff options
63 files changed, 1656 insertions, 3445 deletions
diff --git a/MAINTAINERS b/MAINTAINERS index a6c9b599fd8f..0597c5b3c4ee 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -6881,7 +6881,7 @@ F: drivers/scsi/nsp32* NIOS2 ARCHITECTURE M: Ley Foon Tan <lftan@altera.com> L: nios2-dev@lists.rocketboards.org (moderated for non-subscribers) -T: git git://git.rocketboards.org/linux-socfpga.git +T: git git://git.rocketboards.org/linux-socfpga-next.git S: Maintained F: arch/nios2/ diff --git a/arch/nios2/Kconfig b/arch/nios2/Kconfig index 2361acf6d2b1..437555424bda 100644 --- a/arch/nios2/Kconfig +++ b/arch/nios2/Kconfig @@ -8,6 +8,7 @@ config NIOS2 select GENERIC_IRQ_PROBE select GENERIC_IRQ_SHOW select HAVE_ARCH_TRACEHOOK + select HAVE_ARCH_KGDB select IRQ_DOMAIN select MODULES_USE_ELF_RELA select OF @@ -134,6 +135,14 @@ config NIOS2_PASS_CMDLINE will override "Default kernel command string". Say N if you are unsure. +config NIOS2_BOOT_LINK_OFFSET + hex "Link address offset for booting" + default "0x00500000" + help + This option allows you to set the link address offset of the zImage. + This can be useful if you are on a board which has a small amount of + memory. + endmenu menu "Advanced setup" diff --git a/arch/nios2/Kconfig.debug b/arch/nios2/Kconfig.debug index 8d4e6bacd997..2fd08cbfdddb 100644 --- a/arch/nios2/Kconfig.debug +++ b/arch/nios2/Kconfig.debug @@ -14,4 +14,15 @@ config DEBUG_STACK_USAGE This option will slow down process creation somewhat. +config EARLY_PRINTK + bool "Activate early kernel debugging" + default y + select SERIAL_CORE_CONSOLE + depends on SERIAL_ALTERA_JTAGUART_CONSOLE || SERIAL_ALTERA_UART_CONSOLE + help + Enable early printk on console + This is useful for kernel debugging when your machine crashes very + early before the console code is initialized. + You should normally say N here, unless you want to debug such a crash. + endmenu diff --git a/arch/nios2/boot/Makefile b/arch/nios2/boot/Makefile index 59392dc0bdcb..c899876320df 100644 --- a/arch/nios2/boot/Makefile +++ b/arch/nios2/boot/Makefile @@ -24,6 +24,13 @@ $(obj)/vmImage: $(obj)/vmlinux.gz $(call if_changed,uimage) @$(kecho) 'Kernel: $@ is ready' +$(obj)/zImage: $(obj)/compressed/vmlinux FORCE + $(call if_changed,objcopy) + @$(kecho) 'Kernel: $@ is ready' + +$(obj)/compressed/vmlinux: $(obj)/vmlinux.gz FORCE + $(Q)$(MAKE) $(build)=$(obj)/compressed $@ + # Rule to build device tree blobs DTB_SRC := $(patsubst "%",%,$(CONFIG_NIOS2_DTB_SOURCE)) diff --git a/arch/nios2/boot/compressed/Makefile b/arch/nios2/boot/compressed/Makefile new file mode 100644 index 000000000000..5b0fb346d888 --- /dev/null +++ b/arch/nios2/boot/compressed/Makefile @@ -0,0 +1,19 @@ +# +# create a compressed vmlinux image from the original vmlinux +# + +targets := vmlinux head.o misc.o piggy.o vmlinux.lds +asflags-y := + +OBJECTS = $(obj)/head.o $(obj)/misc.o + +LDFLAGS_vmlinux := -T + +$(obj)/vmlinux: $(obj)/vmlinux.lds $(OBJECTS) $(obj)/piggy.o FORCE + $(call if_changed,ld) + @: + +LDFLAGS_piggy.o := -r --format binary --oformat elf32-littlenios2 -T + +$(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/../vmlinux.gz FORCE + $(call if_changed,ld) diff --git a/arch/nios2/boot/compressed/console.c b/arch/nios2/boot/compressed/console.c new file mode 100644 index 000000000000..2675e879b85a --- /dev/null +++ b/arch/nios2/boot/compressed/console.c @@ -0,0 +1,125 @@ +/* + * Copyright (C) 2008-2010 Thomas Chou <thomas@wytron.com.tw> + * + * 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, see <http://www.gnu.org/licenses/>. + * + */ + +#include <linux/io.h> + +#if (defined(CONFIG_SERIAL_ALTERA_JTAGUART_CONSOLE) && defined(JTAG_UART_BASE))\ + || (defined(CONFIG_SERIAL_ALTERA_UART_CONSOLE) && defined(UART0_BASE)) +static void *my_ioremap(unsigned long physaddr) +{ + return (void *)(physaddr | CONFIG_NIOS2_IO_REGION_BASE); +} +#endif + +#if defined(CONFIG_SERIAL_ALTERA_JTAGUART_CONSOLE) && defined(JTAG_UART_BASE) + +#define ALTERA_JTAGUART_SIZE 8 +#define ALTERA_JTAGUART_DATA_REG 0 +#define ALTERA_JTAGUART_CONTROL_REG 4 +#define ALTERA_JTAGUART_CONTROL_AC_MSK (0x00000400) +#define ALTERA_JTAGUART_CONTROL_WSPACE_MSK (0xFFFF0000) +static void *uartbase; + +#if defined(CONFIG_SERIAL_ALTERA_JTAGUART_CONSOLE_BYPASS) +static void jtag_putc(int ch) +{ + if (readl(uartbase + ALTERA_JTAGUART_CONTROL_REG) & + ALTERA_JTAGUART_CONTROL_WSPACE_MSK) + writeb(ch, uartbase + ALTERA_JTAGUART_DATA_REG); +} +#else +static void jtag_putc(int ch) +{ + while ((readl(uartbase + ALTERA_JTAGUART_CONTROL_REG) & + ALTERA_JTAGUART_CONTROL_WSPACE_MSK) == 0) + ; + writeb(ch, uartbase + ALTERA_JTAGUART_DATA_REG); +} +#endif + +static int putchar(int ch) +{ + jtag_putc(ch); + return ch; +} + +static void console_init(void) +{ + uartbase = my_ioremap((unsigned long) JTAG_UART_BASE); + writel(ALTERA_JTAGUART_CONTROL_AC_MSK, + uartbase + ALTERA_JTAGUART_CONTROL_REG); +} + +#elif defined(CONFIG_SERIAL_ALTERA_UART_CONSOLE) && defined(UART0_BASE) + +#define ALTERA_UART_SIZE 32 +#define ALTERA_UART_TXDATA_REG 4 +#define ALTERA_UART_STATUS_REG 8 +#define ALTERA_UART_DIVISOR_REG 16 +#define ALTERA_UART_STATUS_TRDY_MSK (0x40) +static unsigned uartbase; + +static void uart_putc(int ch) +{ + int i; + + for (i = 0; (i < 0x10000); i++) { + if (readw(uartbase + ALTERA_UART_STATUS_REG) & + ALTERA_UART_STATUS_TRDY_MSK) + break; + } + writeb(ch, uartbase + ALTERA_UART_TXDATA_REG); +} + +static int putchar(int ch) +{ + uart_putc(ch); + if (ch == '\n') + uart_putc('\r'); + return ch; +} + +static void console_init(void) +{ + unsigned int baud, baudclk; + + uartbase = (unsigned long) my_ioremap((unsigned long) UART0_BASE); + baud = CONFIG_SERIAL_ALTERA_UART_BAUDRATE; + baudclk = UART0_FREQ / baud; + writew(baudclk, uartbase + ALTERA_UART_DIVISOR_REG); +} + +#else + +static int putchar(int ch) +{ + return ch; +} + +static void console_init(void) +{ +} + +#endif + +static int puts(const char *s) +{ + while (*s) + putchar(*s++); + return 0; +} diff --git a/arch/nios2/boot/compressed/head.S b/arch/nios2/boot/compressed/head.S new file mode 100644 index 000000000000..15c6c48dd909 --- /dev/null +++ b/arch/nios2/boot/compressed/head.S @@ -0,0 +1,117 @@ +/* + * Copyright (C) 2009 Thomas Chou <thomas@wytron.com.tw> + * + * Based on arch/nios2/kernel/head.S + * + * 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. + * + */ + +/* + * This code can be loaded anywhere, eg FLASH ROM as reset vector, + * as long as output does not overlap it. + */ + +#include <linux/linkage.h> +#include <asm/cache.h> + + .text + .set noat +ENTRY(_start) + wrctl status, r0 /* disable interrupt */ + /* invalidate all instruction cache */ + movia r1, NIOS2_ICACHE_SIZE + movui r2, NIOS2_ICACHE_LINE_SIZE +1: initi r1 + sub r1, r1, r2 + bgt r1, r0, 1b + /* invalidate all data cache */ + movia r1, NIOS2_DCACHE_SIZE + movui r2, NIOS2_DCACHE_LINE_SIZE +1: initd 0(r1) + sub r1, r1, r2 + bgt r1, r0, 1b + + nextpc r1 /* Find out where we are */ +chkadr: + movia r2, chkadr + beq r1, r2, finish_move /* We are running in correct address, + done */ + /* move code, r1: src, r2: dest, r3: last dest */ + addi r1, r1, (_start - chkadr) /* Source */ + movia r2, _start /* Destination */ + movia r3, __bss_start /* End of copy */ +1: ldw r8, 0(r1) /* load a word from [r1] */ + stw r8, 0(r2) /* stort a word to dest [r2] */ + addi r1, r1, 4 /* inc the src addr */ + addi r2, r2, 4 /* inc the dest addr */ + blt r2, r3, 1b + /* flush the data cache after moving */ + movia r1, NIOS2_DCACHE_SIZE + movui r2, NIOS2_DCACHE_LINE_SIZE +1: flushd 0(r1) + sub r1, r1, r2 + bgt r1, r0, 1b + movia r1, finish_move + jmp r1 /* jmp to linked address */ + +finish_move: + /* zero out the .bss segment (uninitialized common data) */ + movia r2, __bss_start /* presume nothing is between */ + movia r1, _end /* the .bss and _end. */ +1: stb r0, 0(r2) + addi r2, r2, 1 + bne r1, r2, 1b + /* + * set up the stack pointer, some where higher than _end. + * The stack space must be greater than 32K for decompress. + */ + movia sp, 0x10000 + add sp, sp, r1 + /* save args passed from u-boot, maybe */ + addi sp, sp, -16 + stw r4, 0(sp) + stw r5, 4(sp) + stw r6, 8(sp) + stw r7, 12(sp) + /* decompress the kernel */ + call decompress_kernel + /* pass saved args to kernel */ + ldw r4, 0(sp) + ldw r5, 4(sp) + ldw r6, 8(sp) + ldw r7, 12(sp) + + /* flush all data cache after decompressing */ + movia r1, NIOS2_DCACHE_SIZE + movui r2, NIOS2_DCACHE_LINE_SIZE +1: flushd 0(r1) + sub r1, r1, r2 + bgt r1, r0, 1b + /* flush all instruction cache */ + movia r1, NIOS2_ICACHE_SIZE + movui r2, NIOS2_ICACHE_LINE_SIZE +1: flushi r1 + sub r1, r1, r2 + bgt r1, r0, 1b + flushp + /* jump to start real kernel */ + movia r1, (CONFIG_NIOS2_MEM_BASE | CONFIG_NIOS2_KERNEL_REGION_BASE) + jmp r1 + + .balign 512 +fake_headers_as_bzImage: + .short 0 + .ascii "HdrS" + .short 0x0202 + .short 0 + .short 0 + .byte 0x00, 0x10 + .short 0 + .byte 0 + .byte 1 + .byte 0x00, 0x80 + .long 0 + .long 0 diff --git a/arch/nios2/boot/compressed/misc.c b/arch/nios2/boot/compressed/misc.c new file mode 100644 index 000000000000..84377825ef1a --- /dev/null +++ b/arch/nios2/boot/compressed/misc.c @@ -0,0 +1,187 @@ +/* + * Copyright (C) 2009 Thomas Chou <thomas@wytron.com.tw> + * + * This is a collection of several routines from gzip-1.0.3 + * adapted for Linux. + * + * malloc by Hannu Savolainen 1993 and Matthias Urlichs 1994 + * + * Adapted for SH by Stuart Menefy, Aug 1999 + * + * Modified to use standard LinuxSH BIOS by Greg Banks 7Jul2000 + * + * Based on arch/sh/boot/compressed/misc.c + * + * 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, see <http://www.gnu.org/licenses/>. + * + */ + +#include <linux/string.h> + +/* + * gzip declarations + */ +#define OF(args) args +#define STATIC static + +#undef memset +#undef memcpy +#define memzero(s, n) memset((s), 0, (n)) + +typedef unsigned char uch; +typedef unsigned short ush; +typedef unsigned long ulg; +#define WSIZE 0x8000 /* Window size must be at least 32k, */ + /* and a power of two */ + +static uch *inbuf; /* input buffer */ +static uch window[WSIZE]; /* Sliding window buffer */ + +static unsigned insize; /* valid bytes in inbuf */ +static unsigned inptr; /* index of next byte to be processed in inbuf */ +static unsigned outcnt; /* bytes in output buffer */ + +/* gzip flag byte */ +#define ASCII_FLAG 0x01 /* bit 0 set: file probably ASCII text */ +#define CONTINUATION 0x02 /* bit 1 set: continuation of multi-part gzip + file */ +#define EXTRA_FIELD 0x04 /* bit 2 set: extra field present */ +#define ORIG_NAME 0x08 /* bit 3 set: original file name present */ +#define COMMENT 0x10 /* bit 4 set: file comment present */ +#define ENCRYPTED 0x20 /* bit 5 set: file is encrypted */ +#define RESERVED 0xC0 /* bit 6,7: reserved */ + +#define get_byte() (inptr < insize ? inbuf[inptr++] : fill_inbuf()) + +#ifdef DEBUG +# define Assert(cond, msg) {if (!(cond)) error(msg); } +# define Trace(x) fprintf x +# define Tracev(x) {if (verbose) fprintf x ; } +# define Tracevv(x) {if (verbose > 1) fprintf x ; } +# define Tracec(c, x) {if (verbose && (c)) fprintf x ; } +# define Tracecv(c, x) {if (verbose > 1 && (c)) fprintf x ; } +#else +# define Assert(cond, msg) +# define Trace(x) +# define Tracev(x) +# define Tracevv(x) +# define Tracec(c, x) +# define Tracecv(c, x) +#endif +static int fill_inbuf(void); +static void flush_window(void); +static void error(char *m); + +extern char input_data[]; +extern int input_len; + +static long bytes_out; +static uch *output_data; +static unsigned long output_ptr; + +#include "console.c" + +static void error(char *m); + +int puts(const char *); + +extern int _end; +static unsigned long free_mem_ptr; +static unsigned long free_mem_end_ptr; + +#define HEAP_SIZE 0x10000 + +#include "../../../../lib/inflate.c" + +void *memset(void *s, int c, size_t n) +{ + int i; + char *ss = (char *)s; + + for (i = 0; i < n; i++) + ss[i] = c; + return s; +} + +void *memcpy(void *__dest, __const void *__src, size_t __n) +{ + int i; + char *d = (char *)__dest, *s = (char *)__src; + + for (i = 0; i < __n; i++) + d[i] = s[i]; + return __dest; +} + +/* + * Fill the input buffer. This is called only when the buffer is empty + * and at least one byte is really needed. + */ +static int fill_inbuf(void) +{ + if (insize != 0) + error("ran out of input data"); + + inbuf = input_data; + insize = input_len; + inptr = 1; + return inbuf[0]; +} + +/* + * Write the output window window[0..outcnt-1] and update crc and bytes_out. + * (Used for the decompressed data only.) + */ +static void flush_window(void) +{ + ulg c = crc; /* temporary variable */ + unsigned n; + uch *in, *out, ch; + + in = window; + out = &output_data[output_ptr]; + for (n = 0; n < outcnt; n++) { + ch = *out++ = *in++; + c = crc_32_tab[((int)c ^ ch) & 0xff] ^ (c >> 8); + } + crc = c; + bytes_out += (ulg)outcnt; + output_ptr += (ulg)outcnt; + outcnt = 0; +} + +static void error(char *x) +{ + puts("\nERROR\n"); + puts(x); + puts("\n\n -- System halted"); + + while (1) /* Halt */ + ; +} + +void decompress_kernel(void) +{ + output_data = (void *) (CONFIG_NIOS2_MEM_BASE | + CONFIG_NIOS2_KERNEL_REGION_BASE); + output_ptr = 0; + free_mem_ptr = (unsigned long)&_end; + free_mem_end_ptr = free_mem_ptr + HEAP_SIZE; + + console_init(); + makecrc(); + puts("Uncompressing Linux... "); + gunzip(); + puts("Ok, booting the kernel.\n"); +} diff --git a/arch/nios2/boot/compressed/vmlinux.lds.S b/arch/nios2/boot/compressed/vmlinux.lds.S new file mode 100644 index 000000000000..e867b3756059 --- /dev/null +++ b/arch/nios2/boot/compressed/vmlinux.lds.S @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2009 Thomas Chou <thomas@wytron.com.tw> + * + * 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, see <http://www.gnu.org/licenses/>. + * + */ + +#include <asm-generic/vmlinux.lds.h> + +OUTPUT_FORMAT("elf32-littlenios2", "elf32-littlenios2", "elf32-littlenios2") + +OUTPUT_ARCH(nios) +ENTRY(_start) /* Defined in head.S */ + +SECTIONS +{ + . = (CONFIG_NIOS2_MEM_BASE + CONFIG_NIOS2_BOOT_LINK_OFFSET) | \ + CONFIG_NIOS2_KERNEL_REGION_BASE; + + _text = .; + .text : { *(.text) } = 0 + .rodata : { *(.rodata) *(.rodata.*) } + _etext = .; + + . = ALIGN(32 / 8); + .data : { *(.data) } + . = ALIGN(32 / 8); + _got = .; + .got : { + *(.got.plt) + *(.igot.plt) + *(.got) + *(.igot) + } + _egot = .; + _edata = .; + + . = ALIGN(32 / 8); + __bss_start = .; + .bss : { *(.bss) *(.sbss) } + . = ALIGN(32 / 8); + _ebss = .; + end = . ; + _end = . ; + + got_len = (_egot - _got); +} diff --git a/arch/nios2/boot/compressed/vmlinux.scr b/arch/nios2/boot/compressed/vmlinux.scr new file mode 100644 index 000000000000..28c42f1d127e --- /dev/null +++ b/arch/nios2/boot/compressed/vmlinux.scr @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2009 Thomas Chou <thomas@wytron.com.tw> + * + * 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, see <http://www.gnu.org/licenses/>. + * + */ + +SECTIONS +{ + .data : { + input_len = .; + LONG(input_data_end - input_data) input_data = .; + *(.data) + . = ALIGN(4); + input_data_end = .; + } +} diff --git a/arch/nios2/configs/3c120_defconfig b/arch/nios2/configs/3c120_defconfig index 87541f0a5d6e..9451940678a0 100644 --- a/arch/nios2/configs/3c120_defconfig +++ b/arch/nios2/configs/3c120_defconfig @@ -22,6 +22,7 @@ CONFIG_NIOS2_DCACHE_SIZE=0x8000 CONFIG_NIOS2_ICACHE_SIZE=0x8000 # CONFIG_NIOS2_CMDLINE_IGNORE_DTB is not set CONFIG_NIOS2_PASS_CMDLINE=y +CONFIG_NIOS2_BOOT_LINK_OFFSET=0x00800000 CONFIG_NET=y CONFIG_PACKET=y CONFIG_UNIX=y diff --git a/arch/nios2/include/asm/kgdb.h b/arch/nios2/include/asm/kgdb.h new file mode 100644 index 000000000000..8fd5e3b66c57 --- /dev/null +++ b/arch/nios2/include/asm/kgdb.h @@ -0,0 +1,93 @@ +/* + * Copyright (C) 2015 Altera Corporation + * Copyright (C) 2011 Tobias Klauser <tklauser@distanz.ch> + * + * Based on the code posted by Kazuyasu on the Altera Forum at: + * http://www.alteraforum.com/forum/showpost.php?p=77003&postcount=20 + * + * 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, see <http://www.gnu.org/licenses/>. + * + */ + +#ifndef _ASM_NIOS2_KGDB_H +#define _ASM_NIOS2_KGDB_H + +#define CACHE_FLUSH_IS_SAFE 1 +#define BUFMAX 2048 + +enum regnames { + GDB_R0 = 0, + GDB_AT, + GDB_R2, + GDB_R3, + GDB_R4, + GDB_R5, + GDB_R6, + GDB_R7, + GDB_R8, + GDB_R9, + GDB_R10, + GDB_R11, + GDB_R12, + GDB_R13, + GDB_R14, + GDB_R15, + GDB_R16, + GDB_R17, + GDB_R18, + GDB_R19, + GDB_R20, + GDB_R21, + GDB_R22, + GDB_R23, + GDB_ET, + GDB_BT, + GDB_GP, + GDB_SP, + GDB_FP, + GDB_EA, + GDB_BA, + GDB_RA, + GDB_PC, + GDB_STATUS, + GDB_ESTATUS, + GDB_BSTATUS, + GDB_IENABLE, + GDB_IPENDING, + GDB_CPUID, + GDB_CTL6, + GDB_EXCEPTION, + GDB_PTEADDR, + GDB_TLBACC, + GDB_TLBMISC, + GDB_ECCINJ, + GDB_BADADDR, + GDB_CONFIG, + GDB_MPUBASE, + GDB_MPUACC, + /* do not change the last entry or anything below! */ + GDB_NUMREGBYTES /* number of registers */ +}; + +#define GDB_SIZEOF_REG sizeof(u32) +#define DBG_MAX_REG_NUM (49) +#define NUMREGBYTES (DBG_MAX_REG_NUM * sizeof(GDB_SIZEOF_REG)) + +#define BREAK_INSTR_SIZE 4 +static inline void arch_kgdb_breakpoint(void) +{ + __asm__ __volatile__("trap 30\n"); +} + +#endif /* _ASM_NIOS2_KGDB_H */ diff --git a/arch/nios2/include/asm/processor.h b/arch/nios2/include/asm/processor.h index 3bd349473b06..c2ba45c159c7 100644 --- a/arch/nios2/include/asm/processor.h +++ b/arch/nios2/include/asm/processor.h @@ -85,9 +85,6 @@ static inline void exit_thread(void) extern unsigned long get_wchan(struct task_struct *p); -/* Prepare to copy thread state - unlazy all lazy status */ -#define prepare_to_copy(tsk) do { } while (0) - #define task_pt_regs(p) \ ((struct pt_regs *)(THREAD_SIZE + task_stack_page(p)) - 1) diff --git a/arch/nios2/include/asm/prom.h b/arch/nios2/include/asm/prom.h new file mode 100644 index 000000000000..75fffb42cfa5 --- /dev/null +++ b/arch/nios2/include/asm/prom.h @@ -0,0 +1,22 @@ +/* + * Copyright Altera Corporation (C) <2015>. All rights reserved + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope 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, see <http://www.gnu.org/licenses/>. + */ + +#ifndef __ASM_NIOS2_PROM_H__ +#define __ASM_NIOS2_PROM_H__ + +extern unsigned long __init of_early_console(void); + +#endif diff --git a/arch/nios2/kernel/Makefile b/arch/nios2/kernel/Makefile index 8ae76823ff93..1aae25703657 100644 --- a/arch/nios2/kernel/Makefile +++ b/arch/nios2/kernel/Makefile @@ -20,5 +20,7 @@ obj-y += syscall_table.o obj-y += time.o obj-y += traps.o +obj-$(CONFIG_EARLY_PRINTK) += early_printk.o +obj-$(CONFIG_KGDB) += kgdb.o obj-$(CONFIG_MODULES) += module.o obj-$(CONFIG_NIOS2_ALIGNMENT_TRAP) += misaligned.o diff --git a/arch/nios2/kernel/early_printk.c b/arch/nios2/kernel/early_printk.c new file mode 100644 index 000000000000..c08e4c1486fc --- /dev/null +++ b/arch/nios2/kernel/early_printk.c @@ -0,0 +1,118 @@ +/* + * Early printk for Nios2. + * + * Copyright (C) 2015, Altera Corporation + * Copyright (C) 2010, Tobias Klauser <tklauser@distanz.ch> + * Copyright (C) 2009, Wind River Systems Inc + * Implemented by fredrik.markstrom@gmail.com and ivarholmqvist@gmail.com + * + * 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. + */ + +#include <linux/console.h> +#include <linux/init.h> +#include <linux/kernel.h> +#include <linux/io.h> + +#include <asm/prom.h> + +static unsigned long base_addr; + +#if defined(CONFIG_SERIAL_ALTERA_JTAGUART_CONSOLE) + +#define ALTERA_JTAGUART_DATA_REG 0 +#define ALTERA_JTAGUART_CONTROL_REG 4 +#define ALTERA_JTAGUART_CONTROL_WSPACE_MSK 0xFFFF0000 +#define ALTERA_JTAGUART_CONTROL_AC_MSK 0x00000400 + +#define JUART_GET_CR() \ + __builtin_ldwio((void *)(base_addr + ALTERA_JTAGUART_CONTROL_REG)) +#define JUART_SET_CR(v) \ + __builtin_stwio((void *)(base_addr + ALTERA_JTAGUART_CONTROL_REG), v) +#define JUART_SET_TX(v) \ + __builtin_stwio((void *)(base_addr + ALTERA_JTAGUART_DATA_REG), v) + +static void early_console_write(struct console *con, const char *s, unsigned n) +{ + unsigned long status; + + while (n-- && *s) { + while (((status = JUART_GET_CR()) + & ALTERA_JTAGUART_CONTROL_WSPACE_MSK) == 0) { +#if defined(CONFIG_SERIAL_ALTERA_JTAGUART_CONSOLE_BYPASS) + if ((status & ALTERA_JTAGUART_CONTROL_AC_MSK) == 0) + return; /* no connection activity */ +#endif + } + JUART_SET_TX(*s); + s++; + } +} + +#elif defined(CONFIG_SERIAL_ALTERA_UART_CONSOLE) + +#define ALTERA_UART_TXDATA_REG 4 +#define ALTERA_UART_STATUS_REG 8 +#define ALTERA_UART_STATUS_TRDY 0x0040 + +#define UART_GET_SR() \ + __builtin_ldwio((void *)(base_addr + ALTERA_UART_STATUS_REG)) +#define UART_SET_TX(v) \ + __builtin_stwio((void *)(base_addr + ALTERA_UART_TXDATA_REG), v) + +static void early_console_putc(char c) +{ + while (!(UART_GET_SR() & ALTERA_UART_STATUS_TRDY)) + ; + + UART_SET_TX(c); +} + +static void early_console_write(struct console *con, const char *s, unsigned n) +{ + while (n-- && *s) { + early_console_putc(*s); + if (*s == '\n') + early_console_putc('\r'); + s++; + } +} + +#else +# error Neither SERIAL_ALTERA_JTAGUART_CONSOLE nor SERIAL_ALTERA_UART_CONSOLE \ +selected +#endif + +static struct console early_console_prom = { + .name = "early", + .write = early_console_write, + .flags = CON_PRINTBUFFER | CON_BOOT, + .index = -1 +}; + +void __init setup_early_printk(void) +{ +#if defined(CONFIG_SERIAL_ALTERA_JTAGUART_CONSOLE) || \ + defined(CONFIG_SERIAL_ALTERA_UART_CONSOLE) + base_addr = of_early_console(); +#else + base_addr = 0; +#endif + + if (!base_addr) + return; + +#if defined(CONFIG_SERIAL_ALTERA_JTAGUART_CONSOLE_BYPASS) + /* Clear activity bit so BYPASS doesn't stall if we've used JTAG for + * downloading the kernel. This might cause early data to be lost even + * if the JTAG terminal is running. + */ + JUART_SET_CR(JUART_GET_CR() | ALTERA_JTAGUART_CONTROL_AC_MSK); +#endif + + early_console = &early_console_prom; + register_console(early_console); + pr_info("early_console initialized at 0x%08lx\n", base_addr); +} diff --git a/arch/nios2/kernel/entry.S b/arch/nios2/kernel/entry.S index 0bdfd13ff98b..7729bd3f2e79 100644 --- a/arch/nios2/kernel/entry.S +++ b/arch/nios2/kernel/entry.S @@ -121,7 +121,11 @@ trap_table: .word instruction_trap /* 27 */ .word instruction_trap /* 28 */ .word instruction_trap /* 29 */ - .word instruction_trap /* 30 */ +#ifdef CONFIG_KGDB + .word handle_kgdb_breakpoint /* 30 KGDB breakpoint */ +#else + .word instruction_trap /* 30 */ +#endif .word handle_breakpoint /* 31 */ .text @@ -445,6 +449,12 @@ handle_diverror: call handle_diverror_c br ret_from_exception +#ifdef CONFIG_KGDB +handle_kgdb_breakpoint: + call kgdb_breakpoint_c + br ret_from_exception +#endif + /* * Beware - when entering resume, prev (the current task) is * in r4, next (the new task) is in r5, don't change these diff --git a/arch/nios2/kernel/kgdb.c b/arch/nios2/kernel/kgdb.c new file mode 100644 index 000000000000..117859122d1c --- /dev/null +++ b/arch/nios2/kernel/kgdb.c @@ -0,0 +1,171 @@ +/* + * Nios2 KGDB support + * + * Copyright (C) 2015 Altera Corporation + * Copyright (C) 2011 Tobias Klauser <tklauser@distanz.ch> + * + * Based on the code posted by Kazuyasu on the Altera Forum at: + * http://www.alteraforum.com/forum/showpost.php?p=77003&postcount=20 + * + * 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, see <http://www.gnu.org/licenses/>. + * + */ +#include <linux/ptrace.h> +#include <linux/kgdb.h> +#include <linux/kdebug.h> +#include <linux/io.h> + +static int wait_for_remote_debugger; + +struct dbg_reg_def_t dbg_reg_def[DBG_MAX_REG_NUM] = +{ + { "zero", GDB_SIZEOF_REG, -1 }, + { "at", GDB_SIZEOF_REG, offsetof(struct pt_regs, r1) }, + { "r2", GDB_SIZEOF_REG, offsetof(struct pt_regs, r2) }, + { "r3", GDB_SIZEOF_REG, offsetof(struct pt_regs, r3) }, + { "r4", GDB_SIZEOF_REG, offsetof(struct pt_regs, r4) }, + { "r5", GDB_SIZEOF_REG, offsetof(struct pt_regs, r5) }, + { "r6", GDB_SIZEOF_REG, offsetof(struct pt_regs, r6) }, + { "r7", GDB_SIZEOF_REG, offsetof(struct pt_regs, r7) }, + { "r8", GDB_SIZEOF_REG, offsetof(struct pt_regs, r8) }, + { "r9", GDB_SIZEOF_REG, offsetof(struct pt_regs, r9) }, + { "r10", GDB_SIZEOF_REG, offsetof(struct pt_regs, r10) }, + { "r11", GDB_SIZEOF_REG, offsetof(struct pt_regs, r11) }, + { "r12", GDB_SIZEOF_REG, offsetof(struct pt_regs, r12) }, + { "r13", GDB_SIZEOF_REG, offsetof(struct pt_regs, r13) }, + { "r14", GDB_SIZEOF_REG, offsetof(struct pt_regs, r14) }, + { "r15", GDB_SIZEOF_REG, offsetof(struct pt_regs, r15) }, + { "r16", GDB_SIZEOF_REG, -1 }, + { "r17", GDB_SIZEOF_REG, -1 }, + { "r18", GDB_SIZEOF_REG, -1 }, + { "r19", GDB_SIZEOF_REG, -1 }, + { "r20", GDB_SIZEOF_REG, -1 }, + { "r21", GDB_SIZEOF_REG, -1 }, + { "r22", GDB_SIZEOF_REG, -1 }, + { "r23", GDB_SIZEOF_REG, -1 }, + { "et", GDB_SIZEOF_REG, -1 }, + { "bt", GDB_SIZEOF_REG, -1 }, + { "gp", GDB_SIZEOF_REG, offsetof(struct pt_regs, gp) }, + { "sp", GDB_SIZEOF_REG, offsetof(struct pt_regs, sp) }, + { "fp", GDB_SIZEOF_REG, offsetof(struct pt_regs, fp) }, + { "ea", GDB_SIZEOF_REG, -1 }, + { "ba", GDB_SIZEOF_REG, -1 }, + { "ra", GDB_SIZEOF_REG, offsetof(struct pt_regs, ra) }, + { "pc", GDB_SIZEOF_REG, offsetof(struct pt_regs, ea) }, + { "status", GDB_SIZEOF_REG, -1 }, + { "estatus", GDB_SIZEOF_REG, offsetof(struct pt_regs, estatus) }, + { "bstatus", GDB_SIZEOF_REG, -1 }, + { "ienable", GDB_SIZEOF_REG, -1 }, + { "ipending", GDB_SIZEOF_REG, -1}, + { "cpuid", GDB_SIZEOF_REG, -1 }, + { "ctl6", GDB_SIZEOF_REG, -1 }, + { "exception", GDB_SIZEOF_REG, -1 }, + { "pteaddr", GDB_SIZEOF_REG, -1 }, + { "tlbacc", GDB_SIZEOF_REG, -1 }, + { "tlbmisc", GDB_SIZEOF_REG, -1 }, + { "eccinj", GDB_SIZEOF_REG, -1 }, + { "badaddr", GDB_SIZEOF_REG, -1 }, + { "config", GDB_SIZEOF_REG, -1 }, + { "mpubase", GDB_SIZEOF_REG, -1 }, + { "mpuacc", GDB_SIZEOF_REG, -1 }, +}; + +char *dbg_get_reg(int regno, void *mem, struct pt_regs *regs) +{ + if (regno >= DBG_MAX_REG_NUM || regno < 0) + return NULL; + + if (dbg_reg_def[regno].offset != -1) + memcpy(mem, (void *)regs + dbg_reg_def[regno].offset, + dbg_reg_def[regno].size); + else + memset(mem, 0, dbg_reg_def[regno].size); + + return dbg_reg_def[regno].name; +} + +int dbg_set_reg(int regno, void *mem, struct pt_regs *regs) +{ + if (regno >= DBG_MAX_REG_NUM || regno < 0) + return -EINVAL; + + if (dbg_reg_def[regno].offset != -1) + memcpy((void *)regs + dbg_reg_def[regno].offset, mem, + dbg_reg_def[regno].size); + + return 0; +} + +void sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *p) +{ + memset((char *)gdb_regs, 0, NUMREGBYTES); + gdb_regs[GDB_SP] = p->thread.kregs->sp; + gdb_regs[GDB_PC] = p->thread.kregs->ea; +} + +void kgdb_arch_set_pc(struct pt_regs *regs, unsigned long pc) +{ + regs->ea = pc; +} + +int kgdb_arch_handle_exception(int vector, int signo, int err_code, + char *remcom_in_buffer, char *remcom_out_buffer, + struct pt_regs *regs) +{ + char *ptr; + unsigned long addr; + + switch (remcom_in_buffer[0]) { + case 's': + case 'c': + /* handle the optional parameters */ + ptr = &remcom_in_buffer[1]; + if (kgdb_hex2long(&ptr, &addr)) + regs->ea = addr; + + return 0; + } + + return -1; /* this means that we do not want to exit from the handler */ +} + +asmlinkage void kgdb_breakpoint_c(struct pt_regs *regs) +{ + /* + * The breakpoint entry code has moved the PC on by 4 bytes, so we must + * move it back. This could be done on the host but we do it here + */ + if (!wait_for_remote_debugger) + regs->ea -= 4; + else /* pass the first trap 30 code */ + wait_for_remote_debugger = 0; + + kgdb_handle_exception(30, SIGTRAP, 0, regs); +} + +int kgdb_arch_init(void) +{ + wait_for_remote_debugger = 1; + return 0; +} + +void kgdb_arch_exit(void) +{ + /* Nothing to do */ +} + +struct kgdb_arch arch_kgdb_ops = { + /* Breakpoint instruction: trap 30 */ + .gdb_bpt_instr = { 0xba, 0x6f, 0x3b, 0x00 }, +}; diff --git a/arch/nios2/kernel/prom.c b/arch/nios2/kernel/prom.c index 0522d3378e3f..718dd197909f 100644 --- a/arch/nios2/kernel/prom.c +++ b/arch/nios2/kernel/prom.c @@ -1,7 +1,7 @@ /* * Device tree support * - * Copyright (C) 2013 Altera Corporation + * Copyright (C) 2013, 2015 Altera Corporation * Copyright (C) 2010 Thomas Chou <thomas@wytron.com.tw> * * Based on MIPS support for CONFIG_OF device tree support @@ -30,6 +30,7 @@ #include <linux/of_fdt.h> #include <linux/io.h> +#include <asm/prom.h> #include <asm/sections.h> void __init early_init_dt_add_memory_arch(u64 base, u64 size) @@ -63,3 +64,52 @@ void __init early_init_devtree(void *params) early_init_dt_scan(params); } + +#ifdef CONFIG_EARLY_PRINTK +static int __init early_init_dt_scan_serial(unsigned long node, + const char *uname, int depth, void *data) +{ + u64 *addr64 = (u64 *) data; + const char *p; + + /* only consider serial nodes */ + if (strncmp(uname, "serial", 6) != 0) + return 0; + + p = of_get_flat_dt_prop(node, "compatible", NULL); + if (!p) + return 0; + + /* + * We found an altera_jtaguart but it wasn't configured for console, so + * skip it. + */ +#ifndef CONFIG_SERIAL_ALTERA_JTAGUART_CONSOLE + if (strncmp(p, "altr,juart", 10) == 0) + return 0; +#endif + + /* + * Same for altera_uart. + */ +#ifndef CONFIG_SERIAL_ALTERA_UART_CONSOLE + if (strncmp(p, "altr,uart", 9) == 0) + return 0; +#endif + + *addr64 = fdt_translate_address((const void *)initial_boot_params, + node); + + return *addr64 == OF_BAD_ADDR ? 0 : 1; +} + +unsigned long __init of_early_console(void) +{ + u64 base = 0; + + if (of_scan_flat_dt(early_init_dt_scan_serial, &base)) + return (u32)ioremap(base, 32); + else + return 0; +} +#endif /* CONFIG_EARLY_PRINTK */ diff --git a/arch/nios2/kernel/setup.c b/arch/nios2/kernel/setup.c index cb3121f975d4..b101a43d3c5a 100644 --- a/arch/nios2/kernel/setup.c +++ b/arch/nios2/kernel/setup.c @@ -139,6 +139,10 @@ void __init setup_arch(char **cmdline_p) console_verbose(); +#ifdef CONFIG_EARLY_PRINTK + setup_early_printk(); +#endif + memory_start = PAGE_ALIGN((unsigned long)__pa(_end)); memory_end = (unsigned long) CONFIG_NIOS2_MEM_BASE + memory_size; diff --git a/arch/nios2/mm/fault.c b/arch/nios2/mm/fault.c index d194c0427b26..0d231adfe576 100644 --- a/arch/nios2/mm/fault.c +++ b/arch/nios2/mm/fault.c @@ -47,7 +47,7 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long cause, struct mm_struct *mm = tsk->mm; int code = SEGV_MAPERR; int fault; - unsigned int flags = 0; + unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE; cause >>= 2; @@ -86,6 +86,7 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long cause, if (!down_read_trylock(&mm->mmap_sem)) { if (!user_mode(regs) && !search_exception_tables(regs->ea)) goto bad_area_nosemaphore; +retry: down_read(&mm->mmap_sem); } @@ -132,6 +133,10 @@ survive: * the fault. */ fault = handle_mm_fault(mm, vma, address, flags); + + if ((fault & VM_FAULT_RETRY) && fatal_signal_pending(current)) + return; + if (unlikely(fault & VM_FAULT_ERROR)) { if (fault & VM_FAULT_OOM) goto out_of_memory; @@ -141,10 +146,32 @@ survive: goto do_sigbus; BUG(); } - if (fault & VM_FAULT_MAJOR) - tsk->maj_flt++; - else - tsk->min_flt++; + + /* + * Major/minor page fault accounting is only done on the + * initial attempt. If we go through a retry, it is extremely + * likely that the page will be found in page cache at that point. + */ + if (flags & FAULT_FLAG_ALLOW_RETRY) { + if (fault & VM_FAULT_MAJOR) + current->maj_flt++; + else + current->min_flt++; + if (fault & VM_FAULT_RETRY) { + /* Clear FAULT_FLAG_ALLOW_RETRY to avoid any risk + * of starvation. */ + flags &= ~FAULT_FLAG_ALLOW_RETRY; + flags |= FAULT_FLAG_TRIED; + + /* + * No need to up_read(&mm->mmap_sem) as we would + * have already released it in __lock_page_or_retry + * in mm/filemap.c. + */ + + goto retry; + } + } up_read(&mm->mmap_sem); return; diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig index 1554a6f2a5bb..8014727a2743 100644 --- a/arch/parisc/Kconfig +++ b/arch/parisc/Kconfig @@ -291,10 +291,6 @@ config SYSVIPC_COMPAT config AUDIT_ARCH def_bool y -config HPUX - bool "Support for HP-UX binaries" - depends on !64BIT - config NR_CPUS int "Maximum number of CPUs (2-32)" range 2 32 diff --git a/arch/parisc/Makefile b/arch/parisc/Makefile index 5db8882f732c..91fbb6ee702c 100644 --- a/arch/parisc/Makefile +++ b/arch/parisc/Makefile @@ -84,7 +84,6 @@ head-y := arch/parisc/kernel/head.o KBUILD_CFLAGS += $(cflags-y) kernel-y := mm/ kernel/ math-emu/ -kernel-$(CONFIG_HPUX) += hpux/ core-y += $(addprefix arch/parisc/, $(kernel-y)) libs-y += arch/parisc/lib/ $(LIBGCC) diff --git a/arch/parisc/hpux/Makefile b/arch/parisc/hpux/Makefile deleted file mode 100644 index 1048fb69f06d..000000000000 --- a/arch/parisc/hpux/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -# -# Makefile for HPUX emulation -# - -obj-y := entry_hpux.o gate.o wrappers.o fs.o ioctl.o sys_hpux.o diff --git a/arch/parisc/hpux/entry_hpux.S b/arch/parisc/hpux/entry_hpux.S deleted file mode 100644 index d15a413572f0..000000000000 --- a/arch/parisc/hpux/entry_hpux.S +++ /dev/null @@ -1,546 +0,0 @@ -/* syscall table for HPUX specific syscalls - * - * Linux/PA-RISC Project (http://www.parisc-linux.org/) - * Copyright (C) 1999 Matthew Wilcox <willy at debian . org> - * - * 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 <asm/unistd.h> -#include <asm/assembly.h> -#include <linux/sys.h> -#include <linux/linkage.h> - -#define ENTRY_NAME(_name_) ASM_ULONG_INSN _name_ - - .section .rodata,"a" - .import hpux_unimplemented_wrapper -ENTRY(hpux_call_table) - ENTRY_NAME(sys_ni_syscall) /* 0 */ - ENTRY_NAME(sys_exit) - ENTRY_NAME(hpux_fork_wrapper) - ENTRY_NAME(sys_read) - ENTRY_NAME(sys_write) - ENTRY_NAME(sys_open) /* 5 */ - ENTRY_NAME(sys_close) - ENTRY_NAME(hpux_wait) - ENTRY_NAME(sys_creat) - ENTRY_NAME(sys_link) - ENTRY_NAME(sys_unlink) /* 10 */ - ENTRY_NAME(hpux_execv_wrapper) - ENTRY_NAME(sys_chdir) - ENTRY_NAME(sys_time) - ENTRY_NAME(sys_mknod) - ENTRY_NAME(sys_chmod) /* 15 */ - ENTRY_NAME(sys_chown) - ENTRY_NAME(hpux_brk) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(sys_lseek) - ENTRY_NAME(sys_getpid) /* 20 */ - ENTRY_NAME(hpux_mount) - ENTRY_NAME(sys_oldumount) - ENTRY_NAME(sys_setuid) - ENTRY_NAME(sys_getuid) - ENTRY_NAME(sys_stime) /* 25 */ - ENTRY_NAME(hpux_ptrace) - ENTRY_NAME(sys_alarm) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(sys_pause) - ENTRY_NAME(sys_utime) /* 30 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(sys_access) - ENTRY_NAME(hpux_nice) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 35 */ - ENTRY_NAME(sys_sync) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(sys_newstat) - ENTRY_NAME(hpux_setpgrp3) - ENTRY_NAME(sys_newlstat) /* 40 */ - ENTRY_NAME(sys_dup) - ENTRY_NAME(hpux_pipe_wrapper) - ENTRY_NAME(sys_times) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 45 */ - ENTRY_NAME(sys_setgid) - ENTRY_NAME(sys_getgid) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 50 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_ioctl) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 55 */ - ENTRY_NAME(sys_symlink) - ENTRY_NAME(hpux_utssys) - ENTRY_NAME(sys_readlink) - ENTRY_NAME(hpux_execve_wrapper) - ENTRY_NAME(sys_umask) /* 60 */ - ENTRY_NAME(sys_chroot) - ENTRY_NAME(sys_fcntl) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 65 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_sbrk) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 70 */ - ENTRY_NAME(sys_mmap) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 75 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 80 */ - ENTRY_NAME(sys_getpgid) - ENTRY_NAME(sys_setpgid) - ENTRY_NAME(sys_setitimer) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 85 */ - ENTRY_NAME(sys_getitimer) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(sys_dup2) /* 90 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(sys_newfstat) - ENTRY_NAME(sys_select) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 95 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 100 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 105 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 110 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 115 */ - ENTRY_NAME(sys_gettimeofday) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 120 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(sys_fchown) - ENTRY_NAME(sys_fchmod) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 125 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(sys_rename) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 130 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_sysconf) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 135 */ - ENTRY_NAME(sys_mkdir) - ENTRY_NAME(sys_rmdir) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 140 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(sys_getrlimit) - ENTRY_NAME(sys_setrlimit) /* 145 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 150 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_lockf) /* 155 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 160 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 165 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 170 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 175 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 180 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(sys_sigprocmask) /* 185 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 190 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_getdomainname) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 195 */ - ENTRY_NAME(hpux_statfs) - ENTRY_NAME(hpux_fstatfs) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(sys_waitpid) /* 200 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 205 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 210 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 215 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 220 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 225 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 230 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 235 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 240 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 245 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 250 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 255 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 260 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 265 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 270 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(sys_fchdir) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(sys_accept) /* 275 */ - ENTRY_NAME(sys_bind) - ENTRY_NAME(sys_connect) - ENTRY_NAME(sys_getpeername) - ENTRY_NAME(sys_getsockname) - ENTRY_NAME(sys_getsockopt) /* 280 */ - ENTRY_NAME(sys_listen) - ENTRY_NAME(sys_recv) - ENTRY_NAME(sys_recvfrom) - ENTRY_NAME(sys_recvmsg) - ENTRY_NAME(sys_send) /* 285 */ - ENTRY_NAME(sys_sendmsg) - ENTRY_NAME(sys_sendto) - ENTRY_NAME(sys_setsockopt) - ENTRY_NAME(sys_shutdown) - ENTRY_NAME(sys_socket) /* 290 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 295 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 300 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 305 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 310 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 315 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 320 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 325 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 330 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(sys_lchown) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_sysfs) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 335 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 340 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 345 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 350 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(sys_nanosleep) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 355 */ - ENTRY_NAME(hpux_getdents) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 360 */ - ENTRY_NAME(hpux_fstat64) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 365 */ - ENTRY_NAME(hpux_lstat64) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_stat64) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 370 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 375 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 380 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_setpgrp) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 385 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 390 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 395 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 400 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 405 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 410 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 415 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 420 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 425 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 430 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 435 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 440 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 445 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 450 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 455 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 460 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 465 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 470 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 475 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 480 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 485 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 490 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 495 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 500 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 505 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) /* 510 */ - ENTRY_NAME(hpux_unimplemented_wrapper) - ENTRY_NAME(hpux_unimplemented_wrapper) -END(hpux_call_table) -.end - diff --git a/arch/parisc/hpux/fs.c b/arch/parisc/hpux/fs.c deleted file mode 100644 index 97a7bf8df348..000000000000 --- a/arch/parisc/hpux/fs.c +++ /dev/null @@ -1,192 +0,0 @@ -/* - * Implements HPUX syscalls. - * - * Copyright (C) 1999 Matthew Wilcox <willy with parisc-linux.org> - * Copyright (C) 2000 Michael Ang <mang with subcarrier.org> - * Copyright (C) 2000 John Marvin <jsm with parisc-linux.org> - * Copyright (C) 2000 Philipp Rumpf - * - * 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 <linux/kernel.h> -#include <linux/mm.h> -#include <linux/fs.h> -#include <linux/sched.h> -#include <linux/file.h> -#include <linux/ptrace.h> -#include <linux/slab.h> -#include <asm/errno.h> -#include <asm/uaccess.h> - -int hpux_execve(struct pt_regs *regs) -{ - return do_execve(getname((const char __user *) regs->gr[26]), - (const char __user *const __user *) regs->gr[25], - (const char __user *const __user *) regs->gr[24]); -} - -struct hpux_dirent { - loff_t d_off; - ino_t d_ino; - short d_reclen; - short d_namlen; - char d_name[1]; -}; - -struct getdents_callback { - struct dir_context ctx; - struct hpux_dirent __user *current_dir; - struct hpux_dirent __user *previous; - int count; - int error; -}; - -#define NAME_OFFSET(de) ((int) ((de)->d_name - (char __user *) (de))) - -static int filldir(struct dir_context *ctx, const char *name, int namlen, - loff_t offset, u64 ino, unsigned d_type) -{ - struct hpux_dirent __user * dirent; - struct getdents_callback *buf = - container_of(ctx, struct getdents_callback, ctx); - ino_t d_ino; - int reclen = ALIGN(NAME_OFFSET(dirent) + namlen + 1, sizeof(long)); - - buf->error = -EINVAL; /* only used if we fail.. */ - if (reclen > buf->count) - return -EINVAL; - d_ino = ino; - if (sizeof(d_ino) < sizeof(ino) && d_ino != ino) { - buf->error = -EOVERFLOW; - return -EOVERFLOW; - } - dirent = buf->previous; - if (dirent) - if (put_user(offset, &dirent->d_off)) - goto Efault; - dirent = buf->current_dir; - if (put_user(d_ino, &dirent->d_ino) || - put_user(reclen, &dirent->d_reclen) || - put_user(namlen, &dirent->d_namlen) || - copy_to_user(dirent->d_name, name, namlen) || - put_user(0, dirent->d_name + namlen)) - goto Efault; - buf->previous = dirent; - buf->current_dir = (void __user *)dirent + reclen; - buf->count -= reclen; - return 0; -Efault: - buf->error = -EFAULT; - return -EFAULT; -} - -#undef NAME_OFFSET - -int hpux_getdents(unsigned int fd, struct hpux_dirent __user *dirent, unsigned int count) -{ - struct fd arg; - struct hpux_dirent __user * lastdirent; - struct getdents_callback buf = { - .ctx.actor = filldir, - .current_dir = dirent, - .count = count - }; - int error; - - arg = fdget(fd); - if (!arg.file) - return -EBADF; - - error = iterate_dir(arg.file, &buf.ctx); - if (error >= 0) - error = buf.error; - lastdirent = buf.previous; - if (lastdirent) { - if (put_user(buf.ctx.pos, &lastdirent->d_off)) - error = -EFAULT; - else - error = count - buf.count; - } - - fdput(arg); - return error; -} - -int hpux_mount(const char *fs, const char *path, int mflag, - const char *fstype, const char *dataptr, int datalen) -{ - return -ENOSYS; -} - -static int cp_hpux_stat(struct kstat *stat, struct hpux_stat64 __user *statbuf) -{ - struct hpux_stat64 tmp; - - /* we probably want a different split here - is hpux 12:20? */ - - if (!new_valid_dev(stat->dev) || !new_valid_dev(stat->rdev)) - return -EOVERFLOW; - - memset(&tmp, 0, sizeof(tmp)); - tmp.st_dev = new_encode_dev(stat->dev); - tmp.st_ino = stat->ino; - tmp.st_mode = stat->mode; - tmp.st_nlink = stat->nlink; - tmp.st_uid = from_kuid_munged(current_user_ns(), stat->uid); - tmp.st_gid = from_kgid_munged(current_user_ns(), stat->gid); - tmp.st_rdev = new_encode_dev(stat->rdev); - tmp.st_size = stat->size; - tmp.st_atime = stat->atime.tv_sec; - tmp.st_mtime = stat->mtime.tv_sec; - tmp.st_ctime = stat->ctime.tv_sec; - tmp.st_blocks = stat->blocks; - tmp.st_blksize = stat->blksize; - return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0; -} - -long hpux_stat64(const char __user *filename, struct hpux_stat64 __user *statbuf) -{ - struct kstat stat; - int error = vfs_stat(filename, &stat); - - if (!error) - error = cp_hpux_stat(&stat, statbuf); - - return error; -} - -long hpux_fstat64(unsigned int fd, struct hpux_stat64 __user *statbuf) -{ - struct kstat stat; - int error = vfs_fstat(fd, &stat); - - if (!error) - error = cp_hpux_stat(&stat, statbuf); - - return error; -} - -long hpux_lstat64(const char __user *filename, - struct hpux_stat64 __user *statbuf) -{ - struct kstat stat; - int error = vfs_lstat(filename, &stat); - - if (!error) - error = cp_hpux_stat(&stat, statbuf); - - return error; -} diff --git a/arch/parisc/hpux/gate.S b/arch/parisc/hpux/gate.S deleted file mode 100644 index 011468857e98..000000000000 --- a/arch/parisc/hpux/gate.S +++ /dev/null @@ -1,107 +0,0 @@ -/* - * - * Linux/PARISC Project (http://www.parisc-linux.org/) - * - * System call entry code Copyright (c) Matthew Wilcox 1999 <willy@bofh.ai> - * Licensed under the GNU GPL. - * thanks to Philipp Rumpf, Mike Shaver and various others - * sorry about the wall, puffin.. - */ - -#include <asm/assembly.h> -#include <asm/asm-offsets.h> -#include <asm/unistd.h> -#include <asm/errno.h> -#include <linux/linkage.h> - - .level LEVEL - .text - - .import hpux_call_table - .import hpux_syscall_exit,code - - .align PAGE_SIZE -ENTRY(hpux_gateway_page) - nop -#ifdef CONFIG_64BIT -#warning NEEDS WORK for 64-bit -#endif - ldw -64(%r30), %r29 ;! 8th argument - ldw -60(%r30), %r19 ;! 7th argument - ldw -56(%r30), %r20 ;! 6th argument - ldw -52(%r30), %r21 ;! 5th argument - gate .+8, %r0 /* become privileged */ - mtsp %r0,%sr4 /* get kernel space into sr4 */ - mtsp %r0,%sr5 /* get kernel space into sr5 */ - mtsp %r0,%sr6 /* get kernel space into sr6 */ - mfsp %sr7,%r1 /* save user sr7 */ - mtsp %r1,%sr3 /* and store it in sr3 */ - - mtctl %r30,%cr28 - mfctl %cr30,%r1 - xor %r1,%r30,%r30 /* ye olde xor trick */ - xor %r1,%r30,%r1 - xor %r1,%r30,%r30 - ldo TASK_SZ_ALGN+FRAME_SIZE(%r30),%r30 /* set up kernel stack */ - - /* N.B.: It is critical that we don't set sr7 to 0 until r30 - * contains a valid kernel stack pointer. It is also - * critical that we don't start using the kernel stack - * until after sr7 has been set to 0. - */ - - mtsp %r0,%sr7 /* get kernel space into sr7 */ - STREG %r1,TASK_PT_GR30-TASK_SZ_ALGN-FRAME_SIZE(%r30) /* save usp */ - ldo -TASK_SZ_ALGN-FRAME_SIZE(%r30),%r1 /* get task ptr in %r1 */ - - /* Save some registers for sigcontext and potential task - switch (see entry.S for the details of which ones are - saved/restored). TASK_PT_PSW is zeroed so we can see whether - a process is on a syscall or not. For an interrupt the real - PSW value is stored. This is needed for gdb and sys_ptrace. */ - STREG %r0, TASK_PT_PSW(%r1) - STREG %r2, TASK_PT_GR2(%r1) /* preserve rp */ - STREG %r19, TASK_PT_GR19(%r1) /* 7th argument */ - STREG %r20, TASK_PT_GR20(%r1) /* 6th argument */ - STREG %r21, TASK_PT_GR21(%r1) /* 5th argument */ - STREG %r22, TASK_PT_GR22(%r1) /* syscall # */ - STREG %r23, TASK_PT_GR23(%r1) /* 4th argument */ - STREG %r24, TASK_PT_GR24(%r1) /* 3rd argument */ - STREG %r25, TASK_PT_GR25(%r1) /* 2nd argument */ - STREG %r26, TASK_PT_GR26(%r1) /* 1st argument */ - STREG %r27, TASK_PT_GR27(%r1) /* user dp */ - STREG %r28, TASK_PT_GR28(%r1) /* return value 0 */ - STREG %r0, TASK_PT_ORIG_R28(%r1) /* don't prohibit restarts */ - STREG %r29, TASK_PT_GR29(%r1) /* 8th argument */ - STREG %r31, TASK_PT_GR31(%r1) /* preserve syscall return ptr */ - - ldo TASK_PT_FR0(%r1), %r27 /* save fpregs from the kernel */ - save_fp %r27 /* or potential task switch */ - - mfctl %cr11, %r27 /* i.e. SAR */ - STREG %r27, TASK_PT_SAR(%r1) - - loadgp - - stw %r21, -52(%r30) ;! 5th argument - stw %r20, -56(%r30) ;! 6th argument - stw %r19, -60(%r30) ;! 7th argument - stw %r29, -64(%r30) ;! 8th argument - - ldil L%hpux_call_table, %r21 - ldo R%hpux_call_table(%r21), %r21 - comiclr,>>= __NR_HPUX_syscalls, %r22, %r0 - b,n syscall_nosys - LDREGX %r22(%r21), %r21 - ldil L%hpux_syscall_exit,%r2 - be 0(%sr7,%r21) - ldo R%hpux_syscall_exit(%r2),%r2 - -syscall_nosys: - ldil L%hpux_syscall_exit,%r1 - be R%hpux_syscall_exit(%sr7,%r1) - ldo -ENOSYS(%r0),%r28 -ENDPROC(hpux_gateway_page) - - .align PAGE_SIZE -ENTRY(end_hpux_gateway_page) diff --git a/arch/parisc/hpux/ioctl.c b/arch/parisc/hpux/ioctl.c deleted file mode 100644 index dede4765852e..000000000000 --- a/arch/parisc/hpux/ioctl.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Implements some necessary HPUX ioctls. - * - * Copyright (C) 1999-2002 Matthew Wilcox <willy with parisc-linux.org> - * - * 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 - */ - -/* - * Supported ioctls: - * TCGETA - * TCSETA - * TCSETAW - * TCSETAF - * TCSBRK - * TCXONC - * TCFLSH - * TIOCGWINSZ - * TIOCSWINSZ - * TIOCGPGRP - * TIOCSPGRP - */ - -#include <linux/sched.h> -#include <linux/syscalls.h> -#include <asm/errno.h> -#include <asm/ioctl.h> -#include <asm/termios.h> -#include <asm/uaccess.h> - -static int hpux_ioctl_t(int fd, unsigned long cmd, unsigned long arg) -{ - int result = -EOPNOTSUPP; - int nr = _IOC_NR(cmd); - switch (nr) { - case 106: - result = sys_ioctl(fd, TIOCSWINSZ, arg); - break; - case 107: - result = sys_ioctl(fd, TIOCGWINSZ, arg); - break; - } - return result; -} - -int hpux_ioctl(int fd, unsigned long cmd, unsigned long arg) -{ - int result = -EOPNOTSUPP; - int type = _IOC_TYPE(cmd); - switch (type) { - case 'T': - /* Our structures are now compatible with HPUX's */ - result = sys_ioctl(fd, cmd, arg); - break; - case 't': - result = hpux_ioctl_t(fd, cmd, arg); - break; - } - return result; -} diff --git a/arch/parisc/hpux/sys_hpux.c b/arch/parisc/hpux/sys_hpux.c deleted file mode 100644 index e5c4da035810..000000000000 --- a/arch/parisc/hpux/sys_hpux.c +++ /dev/null @@ -1,963 +0,0 @@ -/* - * Implements HPUX syscalls. - * - * Copyright (C) 1999 Matthew Wilcox <willy with parisc-linux.org> - * Copyright (C) 2000 Philipp Rumpf - * Copyright (C) 2000 John Marvin <jsm with parisc-linux.org> - * Copyright (C) 2000 Michael Ang <mang with subcarrier.org> - * Copyright (C) 2001 Nathan Neulinger <nneul at umr.edu> - * - * 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 <linux/capability.h> -#include <linux/file.h> -#include <linux/fs.h> -#include <linux/namei.h> -#include <linux/sched.h> -#include <linux/slab.h> -#include <linux/syscalls.h> -#include <linux/utsname.h> -#include <linux/vfs.h> -#include <linux/vmalloc.h> - -#include <asm/errno.h> -#include <asm/pgalloc.h> -#include <asm/uaccess.h> - -unsigned long hpux_brk(unsigned long addr) -{ - /* Sigh. Looks like HP/UX libc relies on kernel bugs. */ - return sys_brk(addr + PAGE_SIZE); -} - -int hpux_sbrk(void) -{ - return -ENOSYS; -} - -/* Random other syscalls */ - -int hpux_nice(int priority_change) -{ - return -ENOSYS; -} - -int hpux_ptrace(void) -{ - return -ENOSYS; -} - -int hpux_wait(int __user *stat_loc) -{ - return sys_waitpid(-1, stat_loc, 0); -} - -int hpux_setpgrp(void) -{ - return sys_setpgid(0,0); -} - -int hpux_setpgrp3(void) -{ - return hpux_setpgrp(); -} - -#define _SC_CPU_VERSION 10001 -#define _SC_OPEN_MAX 4 -#define CPU_PA_RISC1_1 0x210 - -int hpux_sysconf(int which) -{ - switch (which) { - case _SC_CPU_VERSION: - return CPU_PA_RISC1_1; - case _SC_OPEN_MAX: - return INT_MAX; - default: - return -EINVAL; - } -} - -/*****************************************************************************/ - -#define HPUX_UTSLEN 9 -#define HPUX_SNLEN 15 - -struct hpux_utsname { - char sysname[HPUX_UTSLEN]; - char nodename[HPUX_UTSLEN]; - char release[HPUX_UTSLEN]; - char version[HPUX_UTSLEN]; - char machine[HPUX_UTSLEN]; - char idnumber[HPUX_SNLEN]; -} ; - -struct hpux_ustat { - int32_t f_tfree; /* total free (daddr_t) */ - u_int32_t f_tinode; /* total inodes free (ino_t) */ - char f_fname[6]; /* filsys name */ - char f_fpack[6]; /* filsys pack name */ - u_int32_t f_blksize; /* filsys block size (int) */ -}; - -/* - * HPUX's utssys() call. It's a collection of miscellaneous functions, - * alas, so there's no nice way of splitting them up. - */ - -/* This function is called from hpux_utssys(); HP-UX implements - * ustat() as an option to utssys(). - * - * Now, struct ustat on HP-UX is exactly the same as on Linux, except - * that it contains one addition field on the end, int32_t f_blksize. - * So, we could have written this function to just call the Linux - * sys_ustat(), (defined in linux/fs/super.c), and then just - * added this additional field to the user's structure. But I figure - * if we're gonna be digging through filesystem structures to get - * this, we might as well just do the whole enchilada all in one go. - * - * So, most of this function is almost identical to sys_ustat(). - * I have placed comments at the few lines changed or added, to - * aid in porting forward if and when sys_ustat() is changed from - * its form in kernel 2.2.5. - */ -static int hpux_ustat(dev_t dev, struct hpux_ustat __user *ubuf) -{ - struct hpux_ustat tmp; /* Changed to hpux_ustat */ - struct kstatfs sbuf; - int err = vfs_ustat(dev, &sbuf); - if (err) - goto out; - - memset(&tmp,0,sizeof(tmp)); - - tmp.f_tfree = (int32_t)sbuf.f_bfree; - tmp.f_tinode = (u_int32_t)sbuf.f_ffree; - tmp.f_blksize = (u_int32_t)sbuf.f_bsize; /* Added this line */ - - err = copy_to_user(ubuf, &tmp, sizeof(tmp)) ? -EFAULT : 0; -out: - return err; -} - -/* - * Wrapper for hpux statfs call. At the moment, just calls the linux native one - * and ignores the extra fields at the end of the hpux statfs struct. - * - */ - -typedef int32_t hpux_fsid_t[2]; /* file system ID type */ -typedef uint16_t hpux_site_t; - -struct hpux_statfs { - int32_t f_type; /* type of info, zero for now */ - int32_t f_bsize; /* fundamental file system block size */ - int32_t f_blocks; /* total blocks in file system */ - int32_t f_bfree; /* free block in fs */ - int32_t f_bavail; /* free blocks avail to non-superuser */ - int32_t f_files; /* total file nodes in file system */ - int32_t f_ffree; /* free file nodes in fs */ - hpux_fsid_t f_fsid; /* file system ID */ - int32_t f_magic; /* file system magic number */ - int32_t f_featurebits; /* file system features */ - int32_t f_spare[4]; /* spare for later */ - hpux_site_t f_cnode; /* cluster node where mounted */ - int16_t f_pad; -}; - -static int do_statfs_hpux(struct kstatfs *st, struct hpux_statfs __user *p) -{ - struct hpux_statfs buf; - memset(&buf, 0, sizeof(buf)); - buf.f_type = st->f_type; - buf.f_bsize = st->f_bsize; - buf.f_blocks = st->f_blocks; - buf.f_bfree = st->f_bfree; - buf.f_bavail = st->f_bavail; - buf.f_files = st->f_files; - buf.f_ffree = st->f_ffree; - buf.f_fsid[0] = st->f_fsid.val[0]; - buf.f_fsid[1] = st->f_fsid.val[1]; - if (copy_to_user(p, &buf, sizeof(buf))) - return -EFAULT; - return 0; -} - -/* hpux statfs */ -asmlinkage long hpux_statfs(const char __user *pathname, - struct hpux_statfs __user *buf) -{ - struct kstatfs st; - int error = user_statfs(pathname, &st); - if (!error) - error = do_statfs_hpux(&st, buf); - return error; -} - -asmlinkage long hpux_fstatfs(unsigned int fd, struct hpux_statfs __user * buf) -{ - struct kstatfs st; - int error = fd_statfs(fd, &st); - if (!error) - error = do_statfs_hpux(&st, buf); - return error; -} - - -/* This function is called from hpux_utssys(); HP-UX implements - * uname() as an option to utssys(). - * - * The form of this function is pretty much copied from sys_olduname(), - * defined in linux/arch/i386/kernel/sys_i386.c. - */ -/* TODO: Are these put_user calls OK? Should they pass an int? - * (I copied it from sys_i386.c like this.) - */ -static int hpux_uname(struct hpux_utsname __user *name) -{ - int error; - - if (!name) - return -EFAULT; - if (!access_ok(VERIFY_WRITE,name,sizeof(struct hpux_utsname))) - return -EFAULT; - - down_read(&uts_sem); - - error = __copy_to_user(&name->sysname, &utsname()->sysname, - HPUX_UTSLEN - 1); - error |= __put_user(0, name->sysname + HPUX_UTSLEN - 1); - error |= __copy_to_user(&name->nodename, &utsname()->nodename, - HPUX_UTSLEN - 1); - error |= __put_user(0, name->nodename + HPUX_UTSLEN - 1); - error |= __copy_to_user(&name->release, &utsname()->release, - HPUX_UTSLEN - 1); - error |= __put_user(0, name->release + HPUX_UTSLEN - 1); - error |= __copy_to_user(&name->version, &utsname()->version, - HPUX_UTSLEN - 1); - error |= __put_user(0, name->version + HPUX_UTSLEN - 1); - error |= __copy_to_user(&name->machine, &utsname()->machine, - HPUX_UTSLEN - 1); - error |= __put_user(0, name->machine + HPUX_UTSLEN - 1); - - up_read(&uts_sem); - - /* HP-UX utsname has no domainname field. */ - - /* TODO: Implement idnumber!!! */ -#if 0 - error |= __put_user(0,name->idnumber); - error |= __put_user(0,name->idnumber+HPUX_SNLEN-1); -#endif - - error = error ? -EFAULT : 0; - - return error; -} - -/* Note: HP-UX just uses the old suser() function to check perms - * in this system call. We'll use capable(CAP_SYS_ADMIN). - */ -int hpux_utssys(char __user *ubuf, int n, int type) -{ - int len; - int error; - switch( type ) { - case 0: - /* uname(): */ - return hpux_uname((struct hpux_utsname __user *)ubuf); - break ; - case 1: - /* Obsolete (used to be umask().) */ - return -EFAULT ; - break ; - case 2: - /* ustat(): */ - return hpux_ustat(new_decode_dev(n), - (struct hpux_ustat __user *)ubuf); - break; - case 3: - /* setuname(): - * - * On linux (unlike HP-UX), utsname.nodename - * is the same as the hostname. - * - * sys_sethostname() is defined in linux/kernel/sys.c. - */ - if (!capable(CAP_SYS_ADMIN)) - return -EPERM; - /* Unlike Linux, HP-UX returns an error if n==0: */ - if ( n <= 0 ) - return -EINVAL ; - /* Unlike Linux, HP-UX truncates it if n is too big: */ - len = (n <= __NEW_UTS_LEN) ? n : __NEW_UTS_LEN ; - return sys_sethostname(ubuf, len); - break ; - case 4: - /* sethostname(): - * - * sys_sethostname() is defined in linux/kernel/sys.c. - */ - if (!capable(CAP_SYS_ADMIN)) - return -EPERM; - /* Unlike Linux, HP-UX returns an error if n==0: */ - if ( n <= 0 ) - return -EINVAL ; - /* Unlike Linux, HP-UX truncates it if n is too big: */ - len = (n <= __NEW_UTS_LEN) ? n : __NEW_UTS_LEN ; - return sys_sethostname(ubuf, len); - break ; - case 5: - /* gethostname(): - * - * sys_gethostname() is defined in linux/kernel/sys.c. - */ - /* Unlike Linux, HP-UX returns an error if n==0: */ - if ( n <= 0 ) - return -EINVAL ; - return sys_gethostname(ubuf, n); - break ; - case 6: - /* Supposedly called from setuname() in libc. - * TODO: When and why is this called? - * Is it ever even called? - * - * This code should look a lot like sys_sethostname(), - * defined in linux/kernel/sys.c. If that gets updated, - * update this code similarly. - */ - if (!capable(CAP_SYS_ADMIN)) - return -EPERM; - /* Unlike Linux, HP-UX returns an error if n==0: */ - if ( n <= 0 ) - return -EINVAL ; - /* Unlike Linux, HP-UX truncates it if n is too big: */ - len = (n <= __NEW_UTS_LEN) ? n : __NEW_UTS_LEN ; - /**/ - /* TODO: print a warning about using this? */ - down_write(&uts_sem); - error = -EFAULT; - if (!copy_from_user(utsname()->sysname, ubuf, len)) { - utsname()->sysname[len] = 0; - error = 0; - } - up_write(&uts_sem); - return error; - break ; - case 7: - /* Sets utsname.release, if you're allowed. - * Undocumented. Used by swinstall to change the - * OS version, during OS updates. Yuck!!! - * - * This code should look a lot like sys_sethostname() - * in linux/kernel/sys.c. If that gets updated, update - * this code similarly. - */ - if (!capable(CAP_SYS_ADMIN)) - return -EPERM; - /* Unlike Linux, HP-UX returns an error if n==0: */ - if ( n <= 0 ) - return -EINVAL ; - /* Unlike Linux, HP-UX truncates it if n is too big: */ - len = (n <= __NEW_UTS_LEN) ? n : __NEW_UTS_LEN ; - /**/ - /* TODO: print a warning about this? */ - down_write(&uts_sem); - error = -EFAULT; - if (!copy_from_user(utsname()->release, ubuf, len)) { - utsname()->release[len] = 0; - error = 0; - } - up_write(&uts_sem); - return error; - break ; - default: - /* This system call returns -EFAULT if given an unknown type. - * Why not -EINVAL? I don't know, it's just not what they did. - */ - return -EFAULT ; - } -} - -int hpux_getdomainname(char __user *name, int len) -{ - int nlen; - int err = -EFAULT; - - down_read(&uts_sem); - - nlen = strlen(utsname()->domainname) + 1; - - if (nlen < len) - len = nlen; - if(len > __NEW_UTS_LEN) - goto done; - if(copy_to_user(name, utsname()->domainname, len)) - goto done; - err = 0; -done: - up_read(&uts_sem); - return err; - -} - -int hpux_pipe(int *kstack_fildes) -{ - return do_pipe_flags(kstack_fildes, 0); -} - -/* lies - says it works, but it really didn't lock anything */ -int hpux_lockf(int fildes, int function, off_t size) -{ - return 0; -} - -int hpux_sysfs(int opcode, unsigned long arg1, unsigned long arg2) -{ - char *fsname = NULL; - int len = 0; - int fstype; - -/*Unimplemented HP-UX syscall emulation. Syscall #334 (sysfs) - Args: 1 80057bf4 0 400179f0 0 0 0 */ - printk(KERN_DEBUG "in hpux_sysfs\n"); - printk(KERN_DEBUG "hpux_sysfs called with opcode = %d\n", opcode); - printk(KERN_DEBUG "hpux_sysfs called with arg1='%lx'\n", arg1); - - if ( opcode == 1 ) { /* GETFSIND */ - char __user *user_fsname = (char __user *)arg1; - len = strlen_user(user_fsname); - printk(KERN_DEBUG "len of arg1 = %d\n", len); - if (len == 0) - return 0; - fsname = kmalloc(len, GFP_KERNEL); - if (!fsname) { - printk(KERN_DEBUG "failed to kmalloc fsname\n"); - return 0; - } - - if (copy_from_user(fsname, user_fsname, len)) { - printk(KERN_DEBUG "failed to copy_from_user fsname\n"); - kfree(fsname); - return 0; - } - - /* String could be altered by userspace after strlen_user() */ - fsname[len - 1] = '\0'; - - printk(KERN_DEBUG "that is '%s' as (char *)\n", fsname); - if ( !strcmp(fsname, "hfs") ) { - fstype = 0; - } else { - fstype = 0; - } - - kfree(fsname); - - printk(KERN_DEBUG "returning fstype=%d\n", fstype); - return fstype; /* something other than default */ - } - - - return 0; -} - - -/* Table of syscall names and handle for unimplemented routines */ -static const char * const syscall_names[] = { - "nosys", /* 0 */ - "exit", - "fork", - "read", - "write", - "open", /* 5 */ - "close", - "wait", - "creat", - "link", - "unlink", /* 10 */ - "execv", - "chdir", - "time", - "mknod", - "chmod", /* 15 */ - "chown", - "brk", - "lchmod", - "lseek", - "getpid", /* 20 */ - "mount", - "umount", - "setuid", - "getuid", - "stime", /* 25 */ - "ptrace", - "alarm", - NULL, - "pause", - "utime", /* 30 */ - "stty", - "gtty", - "access", - "nice", - "ftime", /* 35 */ - "sync", - "kill", - "stat", - "setpgrp3", - "lstat", /* 40 */ - "dup", - "pipe", - "times", - "profil", - "ki_call", /* 45 */ - "setgid", - "getgid", - NULL, - NULL, - NULL, /* 50 */ - "acct", - "set_userthreadid", - NULL, - "ioctl", - "reboot", /* 55 */ - "symlink", - "utssys", - "readlink", - "execve", - "umask", /* 60 */ - "chroot", - "fcntl", - "ulimit", - NULL, - NULL, /* 65 */ - "vfork", - NULL, - NULL, - NULL, - NULL, /* 70 */ - "mmap", - NULL, - "munmap", - "mprotect", - "madvise", /* 75 */ - "vhangup", - "swapoff", - NULL, - "getgroups", - "setgroups", /* 80 */ - "getpgrp2", - "setpgid/setpgrp2", - "setitimer", - "wait3", - "swapon", /* 85 */ - "getitimer", - NULL, - NULL, - NULL, - "dup2", /* 90 */ - NULL, - "fstat", - "select", - NULL, - "fsync", /* 95 */ - "setpriority", - NULL, - NULL, - NULL, - "getpriority", /* 100 */ - NULL, - NULL, - NULL, - NULL, - NULL, /* 105 */ - NULL, - NULL, - "sigvector", - "sigblock", - "sigsetmask", /* 110 */ - "sigpause", - "sigstack", - NULL, - NULL, - NULL, /* 115 */ - "gettimeofday", - "getrusage", - NULL, - NULL, - "readv", /* 120 */ - "writev", - "settimeofday", - "fchown", - "fchmod", - NULL, /* 125 */ - "setresuid", - "setresgid", - "rename", - "truncate", - "ftruncate", /* 130 */ - NULL, - "sysconf", - NULL, - NULL, - NULL, /* 135 */ - "mkdir", - "rmdir", - NULL, - "sigcleanup", - "setcore", /* 140 */ - NULL, - "gethostid", - "sethostid", - "getrlimit", - "setrlimit", /* 145 */ - NULL, - NULL, - "quotactl", - "get_sysinfo", - NULL, /* 150 */ - "privgrp", - "rtprio", - "plock", - NULL, - "lockf", /* 155 */ - "semget", - NULL, - "semop", - "msgget", - NULL, /* 160 */ - "msgsnd", - "msgrcv", - "shmget", - NULL, - "shmat", /* 165 */ - "shmdt", - NULL, - "csp/nsp_init", - "cluster", - "mkrnod", /* 170 */ - "test", - "unsp_open", - NULL, - "getcontext", - "osetcontext", /* 175 */ - "bigio", - "pipenode", - "lsync", - "getmachineid", - "cnodeid/mysite", /* 180 */ - "cnodes/sitels", - "swapclients", - "rmtprocess", - "dskless_stats", - "sigprocmask", /* 185 */ - "sigpending", - "sigsuspend", - "sigaction", - NULL, - "nfssvc", /* 190 */ - "getfh", - "getdomainname", - "setdomainname", - "async_daemon", - "getdirentries", /* 195 */ - NULL, - NULL, - "vfsmount", - NULL, - "waitpid", /* 200 */ - NULL, - NULL, - NULL, - NULL, - NULL, /* 205 */ - NULL, - NULL, - NULL, - NULL, - NULL, /* 210 */ - NULL, - NULL, - NULL, - NULL, - NULL, /* 215 */ - NULL, - NULL, - NULL, - NULL, - NULL, /* 220 */ - NULL, - NULL, - NULL, - "sigsetreturn", - "sigsetstatemask", /* 225 */ - "bfactl", - "cs", - "cds", - NULL, - "pathconf", /* 230 */ - "fpathconf", - NULL, - NULL, - "nfs_fcntl", - "ogetacl", /* 235 */ - "ofgetacl", - "osetacl", - "ofsetacl", - "pstat", - "getaudid", /* 240 */ - "setaudid", - "getaudproc", - "setaudproc", - "getevent", - "setevent", /* 245 */ - "audwrite", - "audswitch", - "audctl", - "ogetaccess", - "fsctl", /* 250 */ - "ulconnect", - "ulcontrol", - "ulcreate", - "uldest", - "ulrecv", /* 255 */ - "ulrecvcn", - "ulsend", - "ulshutdown", - "swapfs", - "fss", /* 260 */ - NULL, - NULL, - NULL, - NULL, - NULL, /* 265 */ - NULL, - "tsync", - "getnumfds", - "poll", - "getmsg", /* 270 */ - "putmsg", - "fchdir", - "getmount_cnt", - "getmount_entry", - "accept", /* 275 */ - "bind", - "connect", - "getpeername", - "getsockname", - "getsockopt", /* 280 */ - "listen", - "recv", - "recvfrom", - "recvmsg", - "send", /* 285 */ - "sendmsg", - "sendto", - "setsockopt", - "shutdown", - "socket", /* 290 */ - "socketpair", - "proc_open", - "proc_close", - "proc_send", - "proc_recv", /* 295 */ - "proc_sendrecv", - "proc_syscall", - "ipccreate", - "ipcname", - "ipcnamerase", /* 300 */ - "ipclookup", - "ipcselect", - "ipcconnect", - "ipcrecvcn", - "ipcsend", /* 305 */ - "ipcrecv", - "ipcgetnodename", - "ipcsetnodename", - "ipccontrol", - "ipcshutdown", /* 310 */ - "ipcdest", - "semctl", - "msgctl", - "shmctl", - "mpctl", /* 315 */ - "exportfs", - "getpmsg", - "putpmsg", - "strioctl", - "msync", /* 320 */ - "msleep", - "mwakeup", - "msem_init", - "msem_remove", - "adjtime", /* 325 */ - "kload", - "fattach", - "fdetach", - "serialize", - "statvfs", /* 330 */ - "fstatvfs", - "lchown", - "getsid", - "sysfs", - NULL, /* 335 */ - NULL, - "sched_setparam", - "sched_getparam", - "sched_setscheduler", - "sched_getscheduler", /* 340 */ - "sched_yield", - "sched_get_priority_max", - "sched_get_priority_min", - "sched_rr_get_interval", - "clock_settime", /* 345 */ - "clock_gettime", - "clock_getres", - "timer_create", - "timer_delete", - "timer_settime", /* 350 */ - "timer_gettime", - "timer_getoverrun", - "nanosleep", - "toolbox", - NULL, /* 355 */ - "getdents", - "getcontext", - "sysinfo", - "fcntl64", - "ftruncate64", /* 360 */ - "fstat64", - "getdirentries64", - "getrlimit64", - "lockf64", - "lseek64", /* 365 */ - "lstat64", - "mmap64", - "setrlimit64", - "stat64", - "truncate64", /* 370 */ - "ulimit64", - NULL, - NULL, - NULL, - NULL, /* 375 */ - NULL, - NULL, - NULL, - NULL, - "setcontext", /* 380 */ - "sigaltstack", - "waitid", - "setpgrp", - "recvmsg2", - "sendmsg2", /* 385 */ - "socket2", - "socketpair2", - "setregid", - "lwp_create", - "lwp_terminate", /* 390 */ - "lwp_wait", - "lwp_suspend", - "lwp_resume", - "lwp_self", - "lwp_abort_syscall", /* 395 */ - "lwp_info", - "lwp_kill", - "ksleep", - "kwakeup", - "ksleep_abort", /* 400 */ - "lwp_proc_info", - "lwp_exit", - "lwp_continue", - "getacl", - "fgetacl", /* 405 */ - "setacl", - "fsetacl", - "getaccess", - "lwp_mutex_init", - "lwp_mutex_lock_sys", /* 410 */ - "lwp_mutex_unlock", - "lwp_cond_init", - "lwp_cond_signal", - "lwp_cond_broadcast", - "lwp_cond_wait_sys", /* 415 */ - "lwp_getscheduler", - "lwp_setscheduler", - "lwp_getprivate", - "lwp_setprivate", - "lwp_detach", /* 420 */ - "mlock", - "munlock", - "mlockall", - "munlockall", - "shm_open", /* 425 */ - "shm_unlink", - "sigqueue", - "sigwaitinfo", - "sigtimedwait", - "sigwait", /* 430 */ - "aio_read", - "aio_write", - "lio_listio", - "aio_error", - "aio_return", /* 435 */ - "aio_cancel", - "aio_suspend", - "aio_fsync", - "mq_open", - "mq_unlink", /* 440 */ - "mq_send", - "mq_receive", - "mq_notify", - "mq_setattr", - "mq_getattr", /* 445 */ - "ksem_open", - "ksem_unlink", - "ksem_close", - "ksem_destroy", - "lw_sem_incr", /* 450 */ - "lw_sem_decr", - "lw_sem_read", - "mq_close", -}; -static const int syscall_names_max = 453; - -int -hpux_unimplemented(unsigned long arg1,unsigned long arg2,unsigned long arg3, - unsigned long arg4,unsigned long arg5,unsigned long arg6, - unsigned long arg7,unsigned long sc_num) -{ - /* NOTE: sc_num trashes arg8 for the few syscalls that actually - * have a valid 8th argument. - */ - const char *name = NULL; - if ( sc_num <= syscall_names_max && sc_num >= 0 ) { - name = syscall_names[sc_num]; - } - - if ( name ) { - printk(KERN_DEBUG "Unimplemented HP-UX syscall emulation. Syscall #%lu (%s)\n", - sc_num, name); - } else { - printk(KERN_DEBUG "Unimplemented unknown HP-UX syscall emulation. Syscall #%lu\n", - sc_num); - } - - printk(KERN_DEBUG " Args: %lx %lx %lx %lx %lx %lx %lx\n", - arg1, arg2, arg3, arg4, arg5, arg6, arg7); - - return -ENOSYS; -} diff --git a/arch/parisc/hpux/wrappers.S b/arch/parisc/hpux/wrappers.S deleted file mode 100644 index 58c53c879c02..000000000000 --- a/arch/parisc/hpux/wrappers.S +++ /dev/null @@ -1,250 +0,0 @@ -/* - * Linux/PARISC Project (http://www.parisc-linux.org/) - * - * HP-UX System Call Wrapper routines and System Call Return Path - * - * Copyright (C) 2000 Hewlett-Packard (John Marvin) - * - * 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, 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., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifdef CONFIG_64BIT -#warning PA64 support needs more work...did first cut -#endif - -#include <asm/asm-offsets.h> -#include <asm/assembly.h> -#include <asm/signal.h> -#include <linux/linkage.h> - - .level LEVEL - .text - - /* These should probably go in a header file somewhere. - * They are duplicated in kernel/wrappers.S - * Possibly we should consider consolidating these - * register save/restore macros. - */ - .macro reg_save regs -#ifdef CONFIG_64BIT -#warning NEEDS WORK for 64-bit -#endif - STREG %r3, PT_GR3(\regs) - STREG %r4, PT_GR4(\regs) - STREG %r5, PT_GR5(\regs) - STREG %r6, PT_GR6(\regs) - STREG %r7, PT_GR7(\regs) - STREG %r8, PT_GR8(\regs) - STREG %r9, PT_GR9(\regs) - STREG %r10,PT_GR10(\regs) - STREG %r11,PT_GR11(\regs) - STREG %r12,PT_GR12(\regs) - STREG %r13,PT_GR13(\regs) - STREG %r14,PT_GR14(\regs) - STREG %r15,PT_GR15(\regs) - STREG %r16,PT_GR16(\regs) - STREG %r17,PT_GR17(\regs) - STREG %r18,PT_GR18(\regs) - .endm - - .macro reg_restore regs - LDREG PT_GR3(\regs), %r3 - LDREG PT_GR4(\regs), %r4 - LDREG PT_GR5(\regs), %r5 - LDREG PT_GR6(\regs), %r6 - LDREG PT_GR7(\regs), %r7 - LDREG PT_GR8(\regs), %r8 - LDREG PT_GR9(\regs), %r9 - LDREG PT_GR10(\regs),%r10 - LDREG PT_GR11(\regs),%r11 - LDREG PT_GR12(\regs),%r12 - LDREG PT_GR13(\regs),%r13 - LDREG PT_GR14(\regs),%r14 - LDREG PT_GR15(\regs),%r15 - LDREG PT_GR16(\regs),%r16 - LDREG PT_GR17(\regs),%r17 - LDREG PT_GR18(\regs),%r18 - .endm - - - .import sys_fork - -ENTRY(hpux_fork_wrapper) - ldo TASK_REGS-TASK_SZ_ALGN-64(%r30),%r1 ;! get pt regs - ;! pointer in task - reg_save %r1 - - STREG %r2,-20(%r30) - ldo 64(%r30),%r30 - STREG %r2,PT_GR19(%r1) ;! save for child - STREG %r30,PT_GR21(%r1) ;! save for child - - LDREG PT_GR30(%r1),%r25 - mtctl %r25,%cr29 - copy %r1,%r24 - bl sys_clone,%r2 - ldi SIGCHLD,%r26 - - LDREG -84(%r30),%r2 -fork_return: - ldo -64(%r30),%r30 - ldo TASK_REGS-TASK_SZ_ALGN-64(%r30),%r1 ;! get pt regs - - reg_restore %r1 - - /* - * HP-UX wants pid (child gets parent pid, parent gets child pid) - * in r28 and a flag in r29 (r29 == 1 for child, 0 for parent). - * Linux fork returns 0 for child, pid for parent. Since HP-UX - * libc stub throws away parent pid and returns 0 for child, - * we'll just return 0 for parent pid now. Only applications - * that jump directly to the gateway page (not supported) will - * know the difference. We can fix this later if necessary. - */ - - ldo -1024(%r0),%r1 - comb,>>=,n %r28,%r1,fork_exit /* just let the syscall exit handle it */ - or,= %r28,%r0,%r0 - or,tr %r0,%r0,%r29 /* r28 <> 0, we are parent, set r29 to 0 */ - ldo 1(%r0),%r29 /* r28 == 0, we are child, set r29 to 1 */ - -fork_exit: - bv %r0(%r2) - nop -ENDPROC(hpux_fork_wrapper) - - /* Set the return value for the child */ - -ENTRY(hpux_child_return) -#if defined(CONFIG_SMP) || defined(CONFIG_PREEMPT) - bl,n schedule_tail, %r2 -#endif - - LDREG TASK_PT_GR19-TASK_SZ_ALGN-128(%r30),%r2 - b fork_return - copy %r0,%r28 -ENDPROC(hpux_child_return) - - .import hpux_execve - -ENTRY(hpux_execv_wrapper) - copy %r0,%r24 /* NULL environment */ - -ENTRY(hpux_execve_wrapper) - - ldo TASK_REGS-TASK_SZ_ALGN-64(%r30),%r1 ;! get pt regs - - /* - * Do we need to save/restore r3-r18 here? - * I don't think so. why would new thread need old - * threads registers? - */ - - /* Store arg0, arg1 and arg2 so that hpux_execve will find them */ - - STREG %r26,PT_GR26(%r1) - STREG %r25,PT_GR25(%r1) - STREG %r24,PT_GR24(%r1) - - STREG %r2,-20(%r30) - ldo 64(%r30),%r30 - bl hpux_execve,%r2 - copy %r1,%arg0 - - ldo -64(%r30),%r30 - LDREG -20(%r30),%r2 - - /* If exec succeeded we need to load the args */ - - ldo -1024(%r0),%r1 - comb,>>= %r28,%r1,exec_error - copy %r2,%r19 - ldo -TASK_SZ_ALGN-64(%r30),%r1 ;! get task ptr - LDREG TASK_PT_GR26(%r1),%r26 - LDREG TASK_PT_GR25(%r1),%r25 - LDREG TASK_PT_GR24(%r1),%r24 - LDREG TASK_PT_GR23(%r1),%r23 - copy %r0,%r2 /* Flag to syscall_exit not to clear args */ - -exec_error: - bv %r0(%r19) - nop -ENDPROC(hpux_execv_wrapper) - - .import hpux_pipe - - /* HP-UX expects pipefd's returned in r28 & r29 */ - -ENTRY(hpux_pipe_wrapper) - STREG %r2,-20(%r30) - ldo 64(%r30),%r30 - bl hpux_pipe,%r2 - ldo -56(%r30),%r26 /* pass local array to hpux_pipe */ - - - ldo -1024(%r0),%r1 - comb,>>= %r28,%r1,pipe_exit /* let syscall exit handle it */ - LDREG -84(%r30),%r2 - - /* if success, load fd's from stack array */ - - LDREG -56(%r30),%r28 - LDREG -52(%r30),%r29 - -pipe_exit: - bv %r0(%r2) - ldo -64(%r30),%r30 -ENDPROC(hpux_pipe_wrapper) - - .import syscall_exit - -ENTRY(hpux_syscall_exit) - /* - * - * HP-UX call return conventions: - * - * if error: - * r22 = 1 - * r28 = errno value - * r29 = secondary return value - * else - * r22 = 0 - * r28 = return value - * r29 = secondary return value - * - * For now, we'll just check to see if r28 is < (unsigned long)-1024 - * (to handle addresses > 2 Gb) and if so set r22 to zero. If not, - * we'll complement r28 and set r22 to 1. Wrappers will be - * needed for syscalls that care about the secondary return value. - * The wrapper may also need a way of avoiding the following code, - * but we'll deal with that when it becomes necessary. - */ - - ldo -1024(%r0),%r1 - comb,<< %r28,%r1,no_error - copy %r0,%r22 - subi 0,%r28,%r28 - ldo 1(%r0),%r22 - -no_error: - b,n syscall_exit -ENDPROC(hpux_syscall_exit) - - .import hpux_unimplemented - -ENTRY(hpux_unimplemented_wrapper) - b hpux_unimplemented - STREG %r22,-64(%r30) /* overwrite arg8 with syscall number */ -ENDPROC(hpux_unimplemented_wrapper) diff --git a/arch/parisc/include/asm/processor.h b/arch/parisc/include/asm/processor.h index 689a8ade3606..54adb60c0a42 100644 --- a/arch/parisc/include/asm/processor.h +++ b/arch/parisc/include/asm/processor.h @@ -330,8 +330,6 @@ struct mm_struct; /* Free all resources held by a thread. */ extern void release_thread(struct task_struct *); -extern void map_hpux_gateway_page(struct task_struct *tsk, struct mm_struct *mm); - extern unsigned long get_wchan(struct task_struct *p); #define KSTK_EIP(tsk) ((tsk)->thread.regs.iaoq[0]) diff --git a/arch/parisc/include/asm/uaccess.h b/arch/parisc/include/asm/uaccess.h index a5cb070b54bf..0abdd4c607ed 100644 --- a/arch/parisc/include/asm/uaccess.h +++ b/arch/parisc/include/asm/uaccess.h @@ -17,7 +17,7 @@ #define KERNEL_DS ((mm_segment_t){0}) #define USER_DS ((mm_segment_t){1}) -#define segment_eq(a,b) ((a).seg == (b).seg) +#define segment_eq(a, b) ((a).seg == (b).seg) #define get_ds() (KERNEL_DS) #define get_fs() (current_thread_info()->addr_limit) @@ -42,14 +42,14 @@ static inline long access_ok(int type, const void __user * addr, #if !defined(CONFIG_64BIT) #define LDD_KERNEL(ptr) BUILD_BUG() #define LDD_USER(ptr) BUILD_BUG() -#define STD_KERNEL(x, ptr) __put_kernel_asm64(x,ptr) -#define STD_USER(x, ptr) __put_user_asm64(x,ptr) +#define STD_KERNEL(x, ptr) __put_kernel_asm64(x, ptr) +#define STD_USER(x, ptr) __put_user_asm64(x, ptr) #define ASM_WORD_INSN ".word\t" #else -#define LDD_KERNEL(ptr) __get_kernel_asm("ldd",ptr) -#define LDD_USER(ptr) __get_user_asm("ldd",ptr) -#define STD_KERNEL(x, ptr) __put_kernel_asm("std",x,ptr) -#define STD_USER(x, ptr) __put_user_asm("std",x,ptr) +#define LDD_KERNEL(ptr) __get_kernel_asm("ldd", ptr) +#define LDD_USER(ptr) __get_user_asm("ldd", ptr) +#define STD_KERNEL(x, ptr) __put_kernel_asm("std", x, ptr) +#define STD_USER(x, ptr) __put_user_asm("std", x, ptr) #define ASM_WORD_INSN ".dword\t" #endif @@ -80,68 +80,68 @@ struct exception_data { unsigned long fault_addr; }; -#define __get_user(x,ptr) \ -({ \ - register long __gu_err __asm__ ("r8") = 0; \ - register long __gu_val __asm__ ("r9") = 0; \ - \ - if (segment_eq(get_fs(),KERNEL_DS)) { \ - switch (sizeof(*(ptr))) { \ - case 1: __get_kernel_asm("ldb",ptr); break; \ - case 2: __get_kernel_asm("ldh",ptr); break; \ - case 4: __get_kernel_asm("ldw",ptr); break; \ - case 8: LDD_KERNEL(ptr); break; \ - default: BUILD_BUG(); break; \ - } \ - } \ - else { \ - switch (sizeof(*(ptr))) { \ - case 1: __get_user_asm("ldb",ptr); break; \ - case 2: __get_user_asm("ldh",ptr); break; \ - case 4: __get_user_asm("ldw",ptr); break; \ - case 8: LDD_USER(ptr); break; \ - default: BUILD_BUG(); break; \ - } \ - } \ - \ - (x) = (__typeof__(*(ptr))) __gu_val; \ - __gu_err; \ +#define __get_user(x, ptr) \ +({ \ + register long __gu_err __asm__ ("r8") = 0; \ + register long __gu_val __asm__ ("r9") = 0; \ + \ + if (segment_eq(get_fs(), KERNEL_DS)) { \ + switch (sizeof(*(ptr))) { \ + case 1: __get_kernel_asm("ldb", ptr); break; \ + case 2: __get_kernel_asm("ldh", ptr); break; \ + case 4: __get_kernel_asm("ldw", ptr); break; \ + case 8: LDD_KERNEL(ptr); break; \ + default: BUILD_BUG(); break; \ + } \ + } \ + else { \ + switch (sizeof(*(ptr))) { \ + case 1: __get_user_asm("ldb", ptr); break; \ + case 2: __get_user_asm("ldh", ptr); break; \ + case 4: __get_user_asm("ldw", ptr); break; \ + case 8: LDD_USER(ptr); break; \ + default: BUILD_BUG(); break; \ + } \ + } \ + \ + (x) = (__force __typeof__(*(ptr))) __gu_val; \ + __gu_err; \ }) -#define __get_kernel_asm(ldx,ptr) \ +#define __get_kernel_asm(ldx, ptr) \ __asm__("\n1:\t" ldx "\t0(%2),%0\n\t" \ ASM_EXCEPTIONTABLE_ENTRY(1b, fixup_get_user_skip_1)\ : "=r"(__gu_val), "=r"(__gu_err) \ : "r"(ptr), "1"(__gu_err) \ : "r1"); -#define __get_user_asm(ldx,ptr) \ +#define __get_user_asm(ldx, ptr) \ __asm__("\n1:\t" ldx "\t0(%%sr3,%2),%0\n\t" \ - ASM_EXCEPTIONTABLE_ENTRY(1b,fixup_get_user_skip_1)\ + ASM_EXCEPTIONTABLE_ENTRY(1b, fixup_get_user_skip_1)\ : "=r"(__gu_val), "=r"(__gu_err) \ : "r"(ptr), "1"(__gu_err) \ : "r1"); -#define __put_user(x,ptr) \ +#define __put_user(x, ptr) \ ({ \ register long __pu_err __asm__ ("r8") = 0; \ __typeof__(*(ptr)) __x = (__typeof__(*(ptr)))(x); \ \ - if (segment_eq(get_fs(),KERNEL_DS)) { \ + if (segment_eq(get_fs(), KERNEL_DS)) { \ switch (sizeof(*(ptr))) { \ - case 1: __put_kernel_asm("stb",__x,ptr); break; \ - case 2: __put_kernel_asm("sth",__x,ptr); break; \ - case 4: __put_kernel_asm("stw",__x,ptr); break; \ - case 8: STD_KERNEL(__x,ptr); break; \ + case 1: __put_kernel_asm("stb", __x, ptr); break; \ + case 2: __put_kernel_asm("sth", __x, ptr); break; \ + case 4: __put_kernel_asm("stw", __x, ptr); break; \ + case 8: STD_KERNEL(__x, ptr); break; \ default: BUILD_BUG(); break; \ } \ } \ else { \ switch (sizeof(*(ptr))) { \ - case 1: __put_user_asm("stb",__x,ptr); break; \ - case 2: __put_user_asm("sth",__x,ptr); break; \ - case 4: __put_user_asm("stw",__x,ptr); break; \ - case 8: STD_USER(__x,ptr); break; \ + case 1: __put_user_asm("stb", __x, ptr); break; \ + case 2: __put_user_asm("sth", __x, ptr); break; \ + case 4: __put_user_asm("stw", __x, ptr); break; \ + case 8: STD_USER(__x, ptr); break; \ default: BUILD_BUG(); break; \ } \ } \ @@ -159,18 +159,18 @@ struct exception_data { * r8/r9 are already listed as err/val. */ -#define __put_kernel_asm(stx,x,ptr) \ +#define __put_kernel_asm(stx, x, ptr) \ __asm__ __volatile__ ( \ "\n1:\t" stx "\t%2,0(%1)\n\t" \ - ASM_EXCEPTIONTABLE_ENTRY(1b,fixup_put_user_skip_1)\ + ASM_EXCEPTIONTABLE_ENTRY(1b, fixup_put_user_skip_1)\ : "=r"(__pu_err) \ : "r"(ptr), "r"(x), "0"(__pu_err) \ : "r1") -#define __put_user_asm(stx,x,ptr) \ +#define __put_user_asm(stx, x, ptr) \ __asm__ __volatile__ ( \ "\n1:\t" stx "\t%2,0(%%sr3,%1)\n\t" \ - ASM_EXCEPTIONTABLE_ENTRY(1b,fixup_put_user_skip_1)\ + ASM_EXCEPTIONTABLE_ENTRY(1b, fixup_put_user_skip_1)\ : "=r"(__pu_err) \ : "r"(ptr), "r"(x), "0"(__pu_err) \ : "r1") @@ -178,23 +178,23 @@ struct exception_data { #if !defined(CONFIG_64BIT) -#define __put_kernel_asm64(__val,ptr) do { \ +#define __put_kernel_asm64(__val, ptr) do { \ __asm__ __volatile__ ( \ "\n1:\tstw %2,0(%1)" \ "\n2:\tstw %R2,4(%1)\n\t" \ - ASM_EXCEPTIONTABLE_ENTRY(1b,fixup_put_user_skip_2)\ - ASM_EXCEPTIONTABLE_ENTRY(2b,fixup_put_user_skip_1)\ + ASM_EXCEPTIONTABLE_ENTRY(1b, fixup_put_user_skip_2)\ + ASM_EXCEPTIONTABLE_ENTRY(2b, fixup_put_user_skip_1)\ : "=r"(__pu_err) \ : "r"(ptr), "r"(__val), "0"(__pu_err) \ : "r1"); \ } while (0) -#define __put_user_asm64(__val,ptr) do { \ +#define __put_user_asm64(__val, ptr) do { \ __asm__ __volatile__ ( \ "\n1:\tstw %2,0(%%sr3,%1)" \ "\n2:\tstw %R2,4(%%sr3,%1)\n\t" \ - ASM_EXCEPTIONTABLE_ENTRY(1b,fixup_put_user_skip_2)\ - ASM_EXCEPTIONTABLE_ENTRY(2b,fixup_put_user_skip_1)\ + ASM_EXCEPTIONTABLE_ENTRY(1b, fixup_put_user_skip_2)\ + ASM_EXCEPTIONTABLE_ENTRY(2b, fixup_put_user_skip_1)\ : "=r"(__pu_err) \ : "r"(ptr), "r"(__val), "0"(__pu_err) \ : "r1"); \ @@ -211,8 +211,8 @@ extern unsigned long lcopy_to_user(void __user *, const void *, unsigned long); extern unsigned long lcopy_from_user(void *, const void __user *, unsigned long); extern unsigned long lcopy_in_user(void __user *, const void __user *, unsigned long); extern long strncpy_from_user(char *, const char __user *, long); -extern unsigned lclear_user(void __user *,unsigned long); -extern long lstrnlen_user(const char __user *,long); +extern unsigned lclear_user(void __user *, unsigned long); +extern long lstrnlen_user(const char __user *, long); /* * Complex access routines -- macros */ diff --git a/arch/parisc/include/uapi/asm/unistd.h b/arch/parisc/include/uapi/asm/unistd.h index 5f5c0373de63..2e639d7604f6 100644 --- a/arch/parisc/include/uapi/asm/unistd.h +++ b/arch/parisc/include/uapi/asm/unistd.h @@ -2,480 +2,6 @@ #define _UAPI_ASM_PARISC_UNISTD_H_ /* - * This file contains the system call numbers. - */ - -/* - * HP-UX system calls get their native numbers for binary compatibility. - */ - -#define __NR_HPUX_exit 1 -#define __NR_HPUX_fork 2 -#define __NR_HPUX_read 3 -#define __NR_HPUX_write 4 -#define __NR_HPUX_open 5 -#define __NR_HPUX_close 6 -#define __NR_HPUX_wait 7 -#define __NR_HPUX_creat 8 -#define __NR_HPUX_link 9 -#define __NR_HPUX_unlink 10 -#define __NR_HPUX_execv 11 -#define __NR_HPUX_chdir 12 -#define __NR_HPUX_time 13 -#define __NR_HPUX_mknod 14 -#define __NR_HPUX_chmod 15 -#define __NR_HPUX_chown 16 -#define __NR_HPUX_break 17 -#define __NR_HPUX_lchmod 18 -#define __NR_HPUX_lseek 19 -#define __NR_HPUX_getpid 20 -#define __NR_HPUX_mount 21 -#define __NR_HPUX_umount 22 -#define __NR_HPUX_setuid 23 -#define __NR_HPUX_getuid 24 -#define __NR_HPUX_stime 25 -#define __NR_HPUX_ptrace 26 -#define __NR_HPUX_alarm 27 -#define __NR_HPUX_oldfstat 28 -#define __NR_HPUX_pause 29 -#define __NR_HPUX_utime 30 -#define __NR_HPUX_stty 31 -#define __NR_HPUX_gtty 32 -#define __NR_HPUX_access 33 -#define __NR_HPUX_nice 34 -#define __NR_HPUX_ftime 35 -#define __NR_HPUX_sync 36 -#define __NR_HPUX_kill 37 -#define __NR_HPUX_stat 38 -#define __NR_HPUX_setpgrp3 39 -#define __NR_HPUX_lstat 40 -#define __NR_HPUX_dup 41 -#define __NR_HPUX_pipe 42 -#define __NR_HPUX_times 43 -#define __NR_HPUX_profil 44 -#define __NR_HPUX_ki_call 45 -#define __NR_HPUX_setgid 46 -#define __NR_HPUX_getgid 47 -#define __NR_HPUX_sigsys 48 -#define __NR_HPUX_reserved1 49 -#define __NR_HPUX_reserved2 50 -#define __NR_HPUX_acct 51 -#define __NR_HPUX_set_userthreadid 52 -#define __NR_HPUX_oldlock 53 -#define __NR_HPUX_ioctl 54 -#define __NR_HPUX_reboot 55 -#define __NR_HPUX_symlink 56 -#define __NR_HPUX_utssys 57 -#define __NR_HPUX_readlink 58 -#define __NR_HPUX_execve 59 -#define __NR_HPUX_umask 60 -#define __NR_HPUX_chroot 61 -#define __NR_HPUX_fcntl 62 -#define __NR_HPUX_ulimit 63 -#define __NR_HPUX_getpagesize 64 -#define __NR_HPUX_mremap 65 -#define __NR_HPUX_vfork 66 -#define __NR_HPUX_vread 67 -#define __NR_HPUX_vwrite 68 -#define __NR_HPUX_sbrk 69 -#define __NR_HPUX_sstk 70 -#define __NR_HPUX_mmap 71 -#define __NR_HPUX_vadvise 72 -#define __NR_HPUX_munmap 73 -#define __NR_HPUX_mprotect 74 -#define __NR_HPUX_madvise 75 -#define __NR_HPUX_vhangup 76 -#define __NR_HPUX_swapoff 77 -#define __NR_HPUX_mincore 78 -#define __NR_HPUX_getgroups 79 -#define __NR_HPUX_setgroups 80 -#define __NR_HPUX_getpgrp2 81 -#define __NR_HPUX_setpgrp2 82 -#define __NR_HPUX_setitimer 83 -#define __NR_HPUX_wait3 84 -#define __NR_HPUX_swapon 85 -#define __NR_HPUX_getitimer 86 -#define __NR_HPUX_gethostname42 87 -#define __NR_HPUX_sethostname42 88 -#define __NR_HPUX_getdtablesize 89 -#define __NR_HPUX_dup2 90 -#define __NR_HPUX_getdopt 91 -#define __NR_HPUX_fstat 92 -#define __NR_HPUX_select 93 -#define __NR_HPUX_setdopt 94 -#define __NR_HPUX_fsync 95 -#define __NR_HPUX_setpriority 96 -#define __NR_HPUX_socket_old 97 -#define __NR_HPUX_connect_old 98 -#define __NR_HPUX_accept_old 99 -#define __NR_HPUX_getpriority 100 -#define __NR_HPUX_send_old 101 -#define __NR_HPUX_recv_old 102 -#define __NR_HPUX_socketaddr_old 103 -#define __NR_HPUX_bind_old 104 -#define __NR_HPUX_setsockopt_old 105 -#define __NR_HPUX_listen_old 106 -#define __NR_HPUX_vtimes_old 107 -#define __NR_HPUX_sigvector 108 -#define __NR_HPUX_sigblock 109 -#define __NR_HPUX_siggetmask 110 -#define __NR_HPUX_sigpause 111 -#define __NR_HPUX_sigstack 112 -#define __NR_HPUX_recvmsg_old 113 -#define __NR_HPUX_sendmsg_old 114 -#define __NR_HPUX_vtrace_old 115 -#define __NR_HPUX_gettimeofday 116 -#define __NR_HPUX_getrusage 117 -#define __NR_HPUX_getsockopt_old 118 -#define __NR_HPUX_resuba_old 119 -#define __NR_HPUX_readv 120 -#define __NR_HPUX_writev 121 -#define __NR_HPUX_settimeofday 122 -#define __NR_HPUX_fchown 123 -#define __NR_HPUX_fchmod 124 -#define __NR_HPUX_recvfrom_old 125 -#define __NR_HPUX_setresuid 126 -#define __NR_HPUX_setresgid 127 -#define __NR_HPUX_rename 128 -#define __NR_HPUX_truncate 129 -#define __NR_HPUX_ftruncate 130 -#define __NR_HPUX_flock_old 131 -#define __NR_HPUX_sysconf 132 -#define __NR_HPUX_sendto_old 133 -#define __NR_HPUX_shutdown_old 134 -#define __NR_HPUX_socketpair_old 135 -#define __NR_HPUX_mkdir 136 -#define __NR_HPUX_rmdir 137 -#define __NR_HPUX_utimes_old 138 -#define __NR_HPUX_sigcleanup_old 139 -#define __NR_HPUX_setcore 140 -#define __NR_HPUX_getpeername_old 141 -#define __NR_HPUX_gethostid 142 -#define __NR_HPUX_sethostid 143 -#define __NR_HPUX_getrlimit 144 -#define __NR_HPUX_setrlimit 145 -#define __NR_HPUX_killpg_old 146 -#define __NR_HPUX_cachectl 147 -#define __NR_HPUX_quotactl 148 -#define __NR_HPUX_get_sysinfo 149 -#define __NR_HPUX_getsockname_old 150 -#define __NR_HPUX_privgrp 151 -#define __NR_HPUX_rtprio 152 -#define __NR_HPUX_plock 153 -#define __NR_HPUX_reserved3 154 -#define __NR_HPUX_lockf 155 -#define __NR_HPUX_semget 156 -#define __NR_HPUX_osemctl 157 -#define __NR_HPUX_semop 158 -#define __NR_HPUX_msgget 159 -#define __NR_HPUX_omsgctl 160 -#define __NR_HPUX_msgsnd 161 -#define __NR_HPUX_msgrecv 162 -#define __NR_HPUX_shmget 163 -#define __NR_HPUX_oshmctl 164 -#define __NR_HPUX_shmat 165 -#define __NR_HPUX_shmdt 166 -#define __NR_HPUX_m68020_advise 167 -/* [168,189] are for Discless/DUX */ -#define __NR_HPUX_csp 168 -#define __NR_HPUX_cluster 169 -#define __NR_HPUX_mkrnod 170 -#define __NR_HPUX_test 171 -#define __NR_HPUX_unsp_open 172 -#define __NR_HPUX_reserved4 173 -#define __NR_HPUX_getcontext_old 174 -#define __NR_HPUX_osetcontext 175 -#define __NR_HPUX_bigio 176 -#define __NR_HPUX_pipenode 177 -#define __NR_HPUX_lsync 178 -#define __NR_HPUX_getmachineid 179 -#define __NR_HPUX_cnodeid 180 -#define __NR_HPUX_cnodes 181 -#define __NR_HPUX_swapclients 182 -#define __NR_HPUX_rmt_process 183 -#define __NR_HPUX_dskless_stats 184 -#define __NR_HPUX_sigprocmask 185 -#define __NR_HPUX_sigpending 186 -#define __NR_HPUX_sigsuspend 187 -#define __NR_HPUX_sigaction 188 -#define __NR_HPUX_reserved5 189 -#define __NR_HPUX_nfssvc 190 -#define __NR_HPUX_getfh 191 -#define __NR_HPUX_getdomainname 192 -#define __NR_HPUX_setdomainname 193 -#define __NR_HPUX_async_daemon 194 -#define __NR_HPUX_getdirentries 195 -#define __NR_HPUX_statfs 196 -#define __NR_HPUX_fstatfs 197 -#define __NR_HPUX_vfsmount 198 -#define __NR_HPUX_reserved6 199 -#define __NR_HPUX_waitpid 200 -/* 201 - 223 missing */ -#define __NR_HPUX_sigsetreturn 224 -#define __NR_HPUX_sigsetstatemask 225 -/* 226 missing */ -#define __NR_HPUX_cs 227 -#define __NR_HPUX_cds 228 -#define __NR_HPUX_set_no_trunc 229 -#define __NR_HPUX_pathconf 230 -#define __NR_HPUX_fpathconf 231 -/* 232, 233 missing */ -#define __NR_HPUX_nfs_fcntl 234 -#define __NR_HPUX_ogetacl 235 -#define __NR_HPUX_ofgetacl 236 -#define __NR_HPUX_osetacl 237 -#define __NR_HPUX_ofsetacl 238 -#define __NR_HPUX_pstat 239 -#define __NR_HPUX_getaudid 240 -#define __NR_HPUX_setaudid 241 -#define __NR_HPUX_getaudproc 242 -#define __NR_HPUX_setaudproc 243 -#define __NR_HPUX_getevent 244 -#define __NR_HPUX_setevent 245 -#define __NR_HPUX_audwrite 246 -#define __NR_HPUX_audswitch 247 -#define __NR_HPUX_audctl 248 -#define __NR_HPUX_ogetaccess 249 -#define __NR_HPUX_fsctl 250 -/* 251 - 258 missing */ -#define __NR_HPUX_swapfs 259 -#define __NR_HPUX_fss 260 -/* 261 - 266 missing */ -#define __NR_HPUX_tsync 267 -#define __NR_HPUX_getnumfds 268 -#define __NR_HPUX_poll 269 -#define __NR_HPUX_getmsg 270 -#define __NR_HPUX_putmsg 271 -#define __NR_HPUX_fchdir 272 -#define __NR_HPUX_getmount_cnt 273 -#define __NR_HPUX_getmount_entry 274 -#define __NR_HPUX_accept 275 -#define __NR_HPUX_bind 276 -#define __NR_HPUX_connect 277 -#define __NR_HPUX_getpeername 278 -#define __NR_HPUX_getsockname 279 -#define __NR_HPUX_getsockopt 280 -#define __NR_HPUX_listen 281 -#define __NR_HPUX_recv 282 -#define __NR_HPUX_recvfrom 283 -#define __NR_HPUX_recvmsg 284 -#define __NR_HPUX_send 285 -#define __NR_HPUX_sendmsg 286 -#define __NR_HPUX_sendto 287 -#define __NR_HPUX_setsockopt 288 -#define __NR_HPUX_shutdown 289 -#define __NR_HPUX_socket 290 -#define __NR_HPUX_socketpair 291 -#define __NR_HPUX_proc_open 292 -#define __NR_HPUX_proc_close 293 -#define __NR_HPUX_proc_send 294 -#define __NR_HPUX_proc_recv 295 -#define __NR_HPUX_proc_sendrecv 296 -#define __NR_HPUX_proc_syscall 297 -/* 298 - 311 missing */ -#define __NR_HPUX_semctl 312 -#define __NR_HPUX_msgctl 313 -#define __NR_HPUX_shmctl 314 -#define __NR_HPUX_mpctl 315 -#define __NR_HPUX_exportfs 316 -#define __NR_HPUX_getpmsg 317 -#define __NR_HPUX_putpmsg 318 -/* 319 missing */ -#define __NR_HPUX_msync 320 -#define __NR_HPUX_msleep 321 -#define __NR_HPUX_mwakeup 322 -#define __NR_HPUX_msem_init 323 -#define __NR_HPUX_msem_remove 324 -#define __NR_HPUX_adjtime 325 -#define __NR_HPUX_kload 326 -#define __NR_HPUX_fattach 327 -#define __NR_HPUX_fdetach 328 -#define __NR_HPUX_serialize 329 -#define __NR_HPUX_statvfs 330 -#define __NR_HPUX_fstatvfs 331 -#define __NR_HPUX_lchown 332 -#define __NR_HPUX_getsid 333 -#define __NR_HPUX_sysfs 334 -/* 335, 336 missing */ -#define __NR_HPUX_sched_setparam 337 -#define __NR_HPUX_sched_getparam 338 -#define __NR_HPUX_sched_setscheduler 339 -#define __NR_HPUX_sched_getscheduler 340 -#define __NR_HPUX_sched_yield 341 -#define __NR_HPUX_sched_get_priority_max 342 -#define __NR_HPUX_sched_get_priority_min 343 -#define __NR_HPUX_sched_rr_get_interval 344 -#define __NR_HPUX_clock_settime 345 -#define __NR_HPUX_clock_gettime 346 -#define __NR_HPUX_clock_getres 347 -#define __NR_HPUX_timer_create 348 -#define __NR_HPUX_timer_delete 349 -#define __NR_HPUX_timer_settime 350 -#define __NR_HPUX_timer_gettime 351 -#define __NR_HPUX_timer_getoverrun 352 -#define __NR_HPUX_nanosleep 353 -#define __NR_HPUX_toolbox 354 -/* 355 missing */ -#define __NR_HPUX_getdents 356 -#define __NR_HPUX_getcontext 357 -#define __NR_HPUX_sysinfo 358 -#define __NR_HPUX_fcntl64 359 -#define __NR_HPUX_ftruncate64 360 -#define __NR_HPUX_fstat64 361 -#define __NR_HPUX_getdirentries64 362 -#define __NR_HPUX_getrlimit64 363 -#define __NR_HPUX_lockf64 364 -#define __NR_HPUX_lseek64 365 -#define __NR_HPUX_lstat64 366 -#define __NR_HPUX_mmap64 367 -#define __NR_HPUX_setrlimit64 368 -#define __NR_HPUX_stat64 369 -#define __NR_HPUX_truncate64 370 -#define __NR_HPUX_ulimit64 371 -#define __NR_HPUX_pread 372 -#define __NR_HPUX_preadv 373 -#define __NR_HPUX_pwrite 374 -#define __NR_HPUX_pwritev 375 -#define __NR_HPUX_pread64 376 -#define __NR_HPUX_preadv64 377 -#define __NR_HPUX_pwrite64 378 -#define __NR_HPUX_pwritev64 379 -#define __NR_HPUX_setcontext 380 -#define __NR_HPUX_sigaltstack 381 -#define __NR_HPUX_waitid 382 -#define __NR_HPUX_setpgrp 383 -#define __NR_HPUX_recvmsg2 384 -#define __NR_HPUX_sendmsg2 385 -#define __NR_HPUX_socket2 386 -#define __NR_HPUX_socketpair2 387 -#define __NR_HPUX_setregid 388 -#define __NR_HPUX_lwp_create 389 -#define __NR_HPUX_lwp_terminate 390 -#define __NR_HPUX_lwp_wait 391 -#define __NR_HPUX_lwp_suspend 392 -#define __NR_HPUX_lwp_resume 393 -/* 394 missing */ -#define __NR_HPUX_lwp_abort_syscall 395 -#define __NR_HPUX_lwp_info 396 -#define __NR_HPUX_lwp_kill 397 -#define __NR_HPUX_ksleep 398 -#define __NR_HPUX_kwakeup 399 -/* 400 missing */ -#define __NR_HPUX_pstat_getlwp 401 -#define __NR_HPUX_lwp_exit 402 -#define __NR_HPUX_lwp_continue 403 -#define __NR_HPUX_getacl 404 -#define __NR_HPUX_fgetacl 405 -#define __NR_HPUX_setacl 406 -#define __NR_HPUX_fsetacl 407 -#define __NR_HPUX_getaccess 408 -#define __NR_HPUX_lwp_mutex_init 409 -#define __NR_HPUX_lwp_mutex_lock_sys 410 -#define __NR_HPUX_lwp_mutex_unlock 411 -#define __NR_HPUX_lwp_cond_init 412 -#define __NR_HPUX_lwp_cond_signal 413 -#define __NR_HPUX_lwp_cond_broadcast 414 -#define __NR_HPUX_lwp_cond_wait_sys 415 -#define __NR_HPUX_lwp_getscheduler 416 -#define __NR_HPUX_lwp_setscheduler 417 -#define __NR_HPUX_lwp_getstate 418 -#define __NR_HPUX_lwp_setstate 419 -#define __NR_HPUX_lwp_detach 420 -#define __NR_HPUX_mlock 421 -#define __NR_HPUX_munlock 422 -#define __NR_HPUX_mlockall 423 -#define __NR_HPUX_munlockall 424 -#define __NR_HPUX_shm_open 425 -#define __NR_HPUX_shm_unlink 426 -#define __NR_HPUX_sigqueue 427 -#define __NR_HPUX_sigwaitinfo 428 -#define __NR_HPUX_sigtimedwait 429 -#define __NR_HPUX_sigwait 430 -#define __NR_HPUX_aio_read 431 -#define __NR_HPUX_aio_write 432 -#define __NR_HPUX_lio_listio 433 -#define __NR_HPUX_aio_error 434 -#define __NR_HPUX_aio_return 435 -#define __NR_HPUX_aio_cancel 436 -#define __NR_HPUX_aio_suspend 437 -#define __NR_HPUX_aio_fsync 438 -#define __NR_HPUX_mq_open 439 -#define __NR_HPUX_mq_close 440 -#define __NR_HPUX_mq_unlink 441 -#define __NR_HPUX_mq_send 442 -#define __NR_HPUX_mq_receive 443 -#define __NR_HPUX_mq_notify 444 -#define __NR_HPUX_mq_setattr 445 -#define __NR_HPUX_mq_getattr 446 -#define __NR_HPUX_ksem_open 447 -#define __NR_HPUX_ksem_unlink 448 -#define __NR_HPUX_ksem_close 449 -#define __NR_HPUX_ksem_post 450 -#define __NR_HPUX_ksem_wait 451 -#define __NR_HPUX_ksem_read 452 -#define __NR_HPUX_ksem_trywait 453 -#define __NR_HPUX_lwp_rwlock_init 454 -#define __NR_HPUX_lwp_rwlock_destroy 455 -#define __NR_HPUX_lwp_rwlock_rdlock_sys 456 -#define __NR_HPUX_lwp_rwlock_wrlock_sys 457 -#define __NR_HPUX_lwp_rwlock_tryrdlock 458 -#define __NR_HPUX_lwp_rwlock_trywrlock 459 -#define __NR_HPUX_lwp_rwlock_unlock 460 -#define __NR_HPUX_ttrace 461 -#define __NR_HPUX_ttrace_wait 462 -#define __NR_HPUX_lf_wire_mem 463 -#define __NR_HPUX_lf_unwire_mem 464 -#define __NR_HPUX_lf_send_pin_map 465 -#define __NR_HPUX_lf_free_buf 466 -#define __NR_HPUX_lf_wait_nq 467 -#define __NR_HPUX_lf_wakeup_conn_q 468 -#define __NR_HPUX_lf_unused 469 -#define __NR_HPUX_lwp_sema_init 470 -#define __NR_HPUX_lwp_sema_post 471 -#define __NR_HPUX_lwp_sema_wait 472 -#define __NR_HPUX_lwp_sema_trywait 473 -#define __NR_HPUX_lwp_sema_destroy 474 -#define __NR_HPUX_statvfs64 475 -#define __NR_HPUX_fstatvfs64 476 -#define __NR_HPUX_msh_register 477 -#define __NR_HPUX_ptrace64 478 -#define __NR_HPUX_sendfile 479 -#define __NR_HPUX_sendpath 480 -#define __NR_HPUX_sendfile64 481 -#define __NR_HPUX_sendpath64 482 -#define __NR_HPUX_modload 483 -#define __NR_HPUX_moduload 484 -#define __NR_HPUX_modpath 485 -#define __NR_HPUX_getksym 486 -#define __NR_HPUX_modadm 487 -#define __NR_HPUX_modstat 488 -#define __NR_HPUX_lwp_detached_exit 489 -#define __NR_HPUX_crashconf 490 -#define __NR_HPUX_siginhibit 491 -#define __NR_HPUX_sigenable 492 -#define __NR_HPUX_spuctl 493 -#define __NR_HPUX_zerokernelsum 494 -#define __NR_HPUX_nfs_kstat 495 -#define __NR_HPUX_aio_read64 496 -#define __NR_HPUX_aio_write64 497 -#define __NR_HPUX_aio_error64 498 -#define __NR_HPUX_aio_return64 499 -#define __NR_HPUX_aio_cancel64 500 -#define __NR_HPUX_aio_suspend64 501 -#define __NR_HPUX_aio_fsync64 502 -#define __NR_HPUX_lio_listio64 503 -#define __NR_HPUX_recv2 504 -#define __NR_HPUX_recvfrom2 505 -#define __NR_HPUX_send2 506 -#define __NR_HPUX_sendto2 507 -#define __NR_HPUX_acl 508 -#define __NR_HPUX___cnx_p2p_ctl 509 -#define __NR_HPUX___cnx_gsched_ctl 510 -#define __NR_HPUX___cnx_pmon_ctl 511 - -#define __NR_HPUX_syscalls 512 - -/* * Linux system call numbers. * * Cary Coutant says that we should just use another syscall gateway @@ -484,9 +10,6 @@ * very least. If we decide to change it later, we can ``just'' tweak * the LINUX_GATEWAY_ADDR define at the bottom and make __NR_Linux be * 1024 or something. Oh, and recompile libc. =) - * - * 64-bit HPUX binaries get the syscall gateway address passed in a register - * from the kernel at startup, which seems a sane strategy. */ #define __NR_Linux 0 @@ -834,15 +357,15 @@ #define __NR_getrandom (__NR_Linux + 339) #define __NR_memfd_create (__NR_Linux + 340) #define __NR_bpf (__NR_Linux + 341) +#define __NR_execveat (__NR_Linux + 342) -#define __NR_Linux_syscalls (__NR_bpf + 1) +#define __NR_Linux_syscalls (__NR_execveat + 1) #define __IGNORE_select /* newselect */ #define __IGNORE_fadvise64 /* fadvise64_64 */ -#define HPUX_GATEWAY_ADDR 0xC0000004 #define LINUX_GATEWAY_ADDR 0x100 #endif /* _UAPI_ASM_PARISC_UNISTD_H_ */ diff --git a/arch/parisc/kernel/entry.S b/arch/parisc/kernel/entry.S index e8f07dd28401..2ab16bb160a8 100644 --- a/arch/parisc/kernel/entry.S +++ b/arch/parisc/kernel/entry.S @@ -1774,10 +1774,6 @@ ENTRY(sys_rt_sigreturn_wrapper) ENDPROC(sys_rt_sigreturn_wrapper) ENTRY(syscall_exit) - /* NOTE: HP-UX syscalls also come through here - * after hpux_syscall_exit fixes up return - * values. */ - /* NOTE: Not all syscalls exit this way. rt_sigreturn will exit * via syscall_exit_rfi if the signal was received while the process * was running. @@ -1789,22 +1785,6 @@ ENTRY(syscall_exit) LDREG TI_TASK(%r1),%r1 STREG %r28,TASK_PT_GR28(%r1) -#ifdef CONFIG_HPUX -/* <linux/personality.h> cannot be easily included */ -#define PER_HPUX 0x10 - ldw TASK_PERSONALITY(%r1),%r19 - - /* We can't use "CMPIB<> PER_HPUX" since "im5" field is sign extended */ - ldo -PER_HPUX(%r19), %r19 - cmpib,COND(<>),n 0,%r19,1f - - /* Save other hpux returns if personality is PER_HPUX */ - STREG %r22,TASK_PT_GR22(%r1) - STREG %r29,TASK_PT_GR29(%r1) -1: - -#endif /* CONFIG_HPUX */ - /* Seems to me that dp could be wrong here, if the syscall involved * calling a module, and nothing got round to restoring dp on return. */ diff --git a/arch/parisc/kernel/process.c b/arch/parisc/kernel/process.c index 0bbbf0d3f608..8a488c22a99f 100644 --- a/arch/parisc/kernel/process.c +++ b/arch/parisc/kernel/process.c @@ -193,9 +193,7 @@ copy_thread(unsigned long clone_flags, unsigned long usp, * Make them const so the compiler knows they live in .text */ extern void * const ret_from_kernel_thread; extern void * const child_return; -#ifdef CONFIG_HPUX - extern void * const hpux_child_return; -#endif + if (unlikely(p->flags & PF_KTHREAD)) { memset(cregs, 0, sizeof(struct pt_regs)); if (!usp) /* idle thread */ @@ -229,15 +227,8 @@ copy_thread(unsigned long clone_flags, unsigned long usp, cregs->gr[30] = usp; } cregs->ksp = (unsigned long)stack + THREAD_SZ_ALGN + FRAME_SIZE; - if (personality(p->personality) == PER_HPUX) { -#ifdef CONFIG_HPUX - cregs->kpc = (unsigned long) &hpux_child_return; -#else - BUG(); -#endif - } else { - cregs->kpc = (unsigned long) &child_return; - } + cregs->kpc = (unsigned long) &child_return; + /* Setup thread TLS area from the 4th parameter in clone */ if (clone_flags & CLONE_SETTLS) cregs->cr27 = cregs->gr[23]; diff --git a/arch/parisc/kernel/signal.c b/arch/parisc/kernel/signal.c index 9b910a0251b8..dc1ea796fd60 100644 --- a/arch/parisc/kernel/signal.c +++ b/arch/parisc/kernel/signal.c @@ -9,8 +9,7 @@ * * Like the IA-64, we are a recent enough port (we are *starting* * with glibc2.2) that we do not need to support the old non-realtime - * Linux signals. Therefore we don't. HP/UX signals will go in - * arch/parisc/hpux/signal.c when we figure out how to do them. + * Linux signals. Therefore we don't. */ #include <linux/sched.h> @@ -476,6 +475,9 @@ insert_restart_trampoline(struct pt_regs *regs) case -ERESTART_RESTARTBLOCK: { /* Restart the system call - no handlers present */ unsigned int *usp = (unsigned int *)regs->gr[30]; + unsigned long start = (unsigned long) &usp[2]; + unsigned long end = (unsigned long) &usp[5]; + long err = 0; /* Setup a trampoline to restart the syscall * with __NR_restart_syscall @@ -487,23 +489,21 @@ insert_restart_trampoline(struct pt_regs *regs) * 16: ldi __NR_restart_syscall, %r20 */ #ifdef CONFIG_64BIT - put_user(regs->gr[31] >> 32, &usp[0]); - put_user(regs->gr[31] & 0xffffffff, &usp[1]); - put_user(0x0fc010df, &usp[2]); + err |= put_user(regs->gr[31] >> 32, &usp[0]); + err |= put_user(regs->gr[31] & 0xffffffff, &usp[1]); + err |= put_user(0x0fc010df, &usp[2]); #else - put_user(regs->gr[31], &usp[0]); - put_user(0x0fc0109f, &usp[2]); + err |= put_user(regs->gr[31], &usp[0]); + err |= put_user(0x0fc0109f, &usp[2]); #endif - put_user(0xe0008200, &usp[3]); - put_user(0x34140000, &usp[4]); + err |= put_user(0xe0008200, &usp[3]); + err |= put_user(0x34140000, &usp[4]); - /* Stack is 64-byte aligned, and we only need - * to flush 1 cache line. - * Flushing one cacheline is cheap. - * "sync" on bigger (> 4 way) boxes is not. - */ - flush_user_dcache_range(regs->gr[30], regs->gr[30] + 4); - flush_user_icache_range(regs->gr[30], regs->gr[30] + 4); + WARN_ON(err); + + /* flush data/instruction cache for new insns */ + flush_user_dcache_range(start, end); + flush_user_icache_range(start, end); regs->gr[31] = regs->gr[30] + 8; return; diff --git a/arch/parisc/kernel/smp.c b/arch/parisc/kernel/smp.c index ceda229ea6c2..52e85973a283 100644 --- a/arch/parisc/kernel/smp.c +++ b/arch/parisc/kernel/smp.c @@ -230,9 +230,6 @@ send_IPI_allbutself(enum ipi_message_type op) inline void smp_send_stop(void) { send_IPI_allbutself(IPI_CPU_STOP); } -static inline void -smp_send_start(void) { send_IPI_allbutself(IPI_CPU_START); } - void smp_send_reschedule(int cpu) { send_IPI_single(cpu, IPI_RESCHEDULE); } diff --git a/arch/parisc/kernel/syscall_table.S b/arch/parisc/kernel/syscall_table.S index fe4f0b89bf8f..5a8997d63899 100644 --- a/arch/parisc/kernel/syscall_table.S +++ b/arch/parisc/kernel/syscall_table.S @@ -437,6 +437,7 @@ ENTRY_SAME(getrandom) ENTRY_SAME(memfd_create) /* 340 */ ENTRY_SAME(bpf) + ENTRY_COMP(execveat) /* Nothing yet */ diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c index 0bef864264c0..15dbe81cf5f3 100644 --- a/arch/parisc/mm/init.c +++ b/arch/parisc/mm/init.c @@ -750,78 +750,6 @@ static void __init gateway_init(void) PAGE_SIZE, PAGE_GATEWAY, 1); } -#ifdef CONFIG_HPUX -void -map_hpux_gateway_page(struct task_struct *tsk, struct mm_struct *mm) -{ - pgd_t *pg_dir; - pmd_t *pmd; - pte_t *pg_table; - unsigned long start_pmd; - unsigned long start_pte; - unsigned long address; - unsigned long hpux_gw_page_addr; - /* FIXME: This is 'const' in order to trick the compiler - into not treating it as DP-relative data. */ - extern void * const hpux_gateway_page; - - hpux_gw_page_addr = HPUX_GATEWAY_ADDR & PAGE_MASK; - - /* - * Setup HP-UX Gateway page. - * - * The HP-UX gateway page resides in the user address space, - * so it needs to be aliased into each process. - */ - - pg_dir = pgd_offset(mm,hpux_gw_page_addr); - -#if PTRS_PER_PMD == 1 - start_pmd = 0; -#else - start_pmd = ((hpux_gw_page_addr >> PMD_SHIFT) & (PTRS_PER_PMD - 1)); -#endif - start_pte = ((hpux_gw_page_addr >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)); - - address = __pa(&hpux_gateway_page); -#if PTRS_PER_PMD == 1 - pmd = (pmd_t *)__pa(pg_dir); -#else - pmd = (pmd_t *) pgd_address(*pg_dir); - - /* - * pmd is physical at this point - */ - - if (!pmd) { - pmd = (pmd_t *) get_zeroed_page(GFP_KERNEL); - pmd = (pmd_t *) __pa(pmd); - } - - __pgd_val_set(*pg_dir, PxD_FLAG_PRESENT | PxD_FLAG_VALID | (unsigned long) pmd); -#endif - /* now change pmd to kernel virtual addresses */ - - pmd = (pmd_t *)__va(pmd) + start_pmd; - - /* - * pg_table is physical at this point - */ - - pg_table = (pte_t *) pmd_address(*pmd); - if (!pg_table) - pg_table = (pte_t *) __pa(get_zeroed_page(GFP_KERNEL)); - - __pmd_val_set(*pmd, PxD_FLAG_PRESENT | PxD_FLAG_VALID | (unsigned long) pg_table); - - /* now change pg_table to kernel virtual addresses */ - - pg_table = (pte_t *) __va(pg_table) + start_pte; - set_pte(pg_table, __mk_pte(address, PAGE_GATEWAY)); -} -EXPORT_SYMBOL(map_hpux_gateway_page); -#endif - void __init paging_init(void) { int i; diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index c256bd7fbd78..c6bb9f1257c9 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c @@ -732,9 +732,8 @@ static int acpi_idle_play_dead(struct cpuidle_device *dev, int index) static bool acpi_idle_fallback_to_c1(struct acpi_processor *pr) { - return IS_ENABLED(CONFIG_HOTPLUG_CPU) && num_online_cpus() > 1 && - !(acpi_gbl_FADT.flags & ACPI_FADT_C2_MP_SUPPORTED) && - !pr->flags.has_cst; + return IS_ENABLED(CONFIG_HOTPLUG_CPU) && !pr->flags.has_cst && + !(acpi_gbl_FADT.flags & ACPI_FADT_C2_MP_SUPPORTED); } static int c3_cpu_count; @@ -744,9 +743,10 @@ static DEFINE_RAW_SPINLOCK(c3_lock); * acpi_idle_enter_bm - enters C3 with proper BM handling * @pr: Target processor * @cx: Target state context + * @timer_bc: Whether or not to change timer mode to broadcast */ static void acpi_idle_enter_bm(struct acpi_processor *pr, - struct acpi_processor_cx *cx) + struct acpi_processor_cx *cx, bool timer_bc) { acpi_unlazy_tlb(smp_processor_id()); @@ -754,7 +754,8 @@ static void acpi_idle_enter_bm(struct acpi_processor *pr, * Must be done before busmaster disable as we might need to * access HPET ! */ - lapic_timer_state_broadcast(pr, cx, 1); + if (timer_bc) + lapic_timer_state_broadcast(pr, cx, 1); /* * disable bus master @@ -784,7 +785,8 @@ static void acpi_idle_enter_bm(struct acpi_processor *pr, raw_spin_unlock(&c3_lock); } - lapic_timer_state_broadcast(pr, cx, 0); + if (timer_bc) + lapic_timer_state_broadcast(pr, cx, 0); } static int acpi_idle_enter(struct cpuidle_device *dev, @@ -798,12 +800,12 @@ static int acpi_idle_enter(struct cpuidle_device *dev, return -EINVAL; if (cx->type != ACPI_STATE_C1) { - if (acpi_idle_fallback_to_c1(pr)) { + if (acpi_idle_fallback_to_c1(pr) && num_online_cpus() > 1) { index = CPUIDLE_DRIVER_STATE_START; cx = per_cpu(acpi_cstate[index], dev->cpu); } else if (cx->type == ACPI_STATE_C3 && pr->flags.bm_check) { if (cx->bm_sts_skip || !acpi_idle_bm_check()) { - acpi_idle_enter_bm(pr, cx); + acpi_idle_enter_bm(pr, cx, true); return index; } else if (drv->safe_state_index >= 0) { index = drv->safe_state_index; @@ -827,6 +829,27 @@ static int acpi_idle_enter(struct cpuidle_device *dev, return index; } +static void acpi_idle_enter_freeze(struct cpuidle_device *dev, + struct cpuidle_driver *drv, int index) +{ + struct acpi_processor_cx *cx = per_cpu(acpi_cstate[index], dev->cpu); + + if (cx->type == ACPI_STATE_C3) { + struct acpi_processor *pr = __this_cpu_read(processors); + + if (unlikely(!pr)) + return; + + if (pr->flags.bm_check) { + acpi_idle_enter_bm(pr, cx, false); + return; + } else { + ACPI_FLUSH_CPU_CACHE(); + } + } + acpi_idle_do_entry(cx); +} + struct cpuidle_driver acpi_idle_driver = { .name = "acpi_idle", .owner = THIS_MODULE, @@ -925,6 +948,15 @@ static int acpi_processor_setup_cpuidle_states(struct acpi_processor *pr) state->enter_dead = acpi_idle_play_dead; drv->safe_state_index = count; } + /* + * Halt-induced C1 is not good for ->enter_freeze, because it + * re-enables interrupts on exit. Moreover, C1 is generally not + * particularly interesting from the suspend-to-idle angle, so + * avoid C1 and the situations in which we may need to fall back + * to it altogether. + */ + if (cx->type != ACPI_STATE_C1 && !acpi_idle_fallback_to_c1(pr)) + state->enter_freeze = acpi_idle_enter_freeze; count++; if (count == CPUIDLE_STATE_MAX) diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c index bf53a3771da5..e85d3416d899 100644 --- a/drivers/char/tpm/tpm-interface.c +++ b/drivers/char/tpm/tpm-interface.c @@ -901,8 +901,10 @@ int tpm_pm_suspend(struct device *dev) if (chip == NULL) return -ENODEV; - if (chip->flags & TPM_CHIP_FLAG_TPM2) - return tpm2_shutdown(chip, TPM2_SU_CLEAR); + if (chip->flags & TPM_CHIP_FLAG_TPM2) { + tpm2_shutdown(chip, TPM2_SU_STATE); + return 0; + } /* for buggy tpm, flush pcrs with extend to selected dummy */ if (tpm_suspend_pcr) { diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h index 7b0727c5e803..f8319a0860fd 100644 --- a/drivers/char/tpm/tpm.h +++ b/drivers/char/tpm/tpm.h @@ -432,7 +432,8 @@ ssize_t tpm2_get_tpm_pt(struct tpm_chip *chip, u32 property_id, u32 *value, const char *desc); extern int tpm2_startup(struct tpm_chip *chip, u16 startup_type); -extern int tpm2_shutdown(struct tpm_chip *chip, u16 shutdown_type); +extern void tpm2_shutdown(struct tpm_chip *chip, u16 shutdown_type); extern unsigned long tpm2_calc_ordinal_duration(struct tpm_chip *, u32); extern int tpm2_do_selftest(struct tpm_chip *chip); -extern int tpm2_gen_interrupt(struct tpm_chip *chip, bool quiet); +extern int tpm2_gen_interrupt(struct tpm_chip *chip); +extern int tpm2_probe(struct tpm_chip *chip); diff --git a/drivers/char/tpm/tpm2-cmd.c b/drivers/char/tpm/tpm2-cmd.c index 1abe6502219f..011909a9be96 100644 --- a/drivers/char/tpm/tpm2-cmd.c +++ b/drivers/char/tpm/tpm2-cmd.c @@ -456,20 +456,23 @@ static const struct tpm_input_header tpm2_shutdown_header = { * @chip: TPM chip to use. * @shutdown_type shutdown type. The value is either * TPM_SU_CLEAR or TPM_SU_STATE. - * - * 0 is returned when the operation is successful. If a negative number is - * returned it remarks a POSIX error code. If a positive number is returned - * it remarks a TPM error. */ -int tpm2_shutdown(struct tpm_chip *chip, u16 shutdown_type) +void tpm2_shutdown(struct tpm_chip *chip, u16 shutdown_type) { struct tpm2_cmd cmd; + int rc; cmd.header.in = tpm2_shutdown_header; - cmd.params.startup_in.startup_type = cpu_to_be16(shutdown_type); - return tpm_transmit_cmd(chip, &cmd, sizeof(cmd), - "stopping the TPM"); + + rc = tpm_transmit_cmd(chip, &cmd, sizeof(cmd), "stopping the TPM"); + + /* In places where shutdown command is sent there's no much we can do + * except print the error code on a system failure. + */ + if (rc < 0) + dev_warn(chip->pdev, "transmit returned %d while stopping the TPM", + rc); } EXPORT_SYMBOL_GPL(tpm2_shutdown); @@ -598,20 +601,46 @@ EXPORT_SYMBOL_GPL(tpm2_do_selftest); /** * tpm2_gen_interrupt() - generate an interrupt * @chip: TPM chip to use - * @quiet: surpress the error message * * 0 is returned when the operation is successful. If a negative number is * returned it remarks a POSIX error code. If a positive number is returned * it remarks a TPM error. */ -int tpm2_gen_interrupt(struct tpm_chip *chip, bool quiet) +int tpm2_gen_interrupt(struct tpm_chip *chip) { - const char *desc = NULL; u32 dummy; - if (!quiet) - desc = "attempting to generate an interrupt"; - - return tpm2_get_tpm_pt(chip, TPM2_CAP_TPM_PROPERTIES, &dummy, desc); + return tpm2_get_tpm_pt(chip, 0x100, &dummy, + "attempting to generate an interrupt"); } EXPORT_SYMBOL_GPL(tpm2_gen_interrupt); + +/** + * tpm2_probe() - probe TPM 2.0 + * @chip: TPM chip to use + * + * Send idempotent TPM 2.0 command and see whether TPM 2.0 chip replied based on + * the reply tag. + */ +int tpm2_probe(struct tpm_chip *chip) +{ + struct tpm2_cmd cmd; + int rc; + + cmd.header.in = tpm2_get_tpm_pt_header; + cmd.params.get_tpm_pt_in.cap_id = cpu_to_be32(TPM2_CAP_TPM_PROPERTIES); + cmd.params.get_tpm_pt_in.property_id = cpu_to_be32(0x100); + cmd.params.get_tpm_pt_in.property_cnt = cpu_to_be32(1); + + rc = tpm_transmit(chip, (const char *) &cmd, sizeof(cmd)); + if (rc < 0) + return rc; + else if (rc < TPM_HEADER_SIZE) + return -EFAULT; + + if (be16_to_cpu(cmd.header.out.tag) == TPM2_ST_NO_SESSIONS) + chip->flags |= TPM_CHIP_FLAG_TPM2; + + return 0; +} +EXPORT_SYMBOL_GPL(tpm2_probe); diff --git a/drivers/char/tpm/tpm_crb.c b/drivers/char/tpm/tpm_crb.c index 3dd23cfae4fe..b26ceee3585e 100644 --- a/drivers/char/tpm/tpm_crb.c +++ b/drivers/char/tpm/tpm_crb.c @@ -95,21 +95,7 @@ struct crb_priv { u8 __iomem *rsp; }; -#ifdef CONFIG_PM_SLEEP -static int crb_resume(struct device *dev) -{ - int rc; - struct tpm_chip *chip = dev_get_drvdata(dev); - - rc = tpm2_shutdown(chip, TPM2_SU_STATE); - if (!rc) - rc = tpm2_do_selftest(chip); - - return rc; -} -#endif - -static SIMPLE_DEV_PM_OPS(crb_pm, tpm_pm_suspend, crb_resume); +static SIMPLE_DEV_PM_OPS(crb_pm, tpm_pm_suspend, tpm_pm_resume); static u8 crb_status(struct tpm_chip *chip) { @@ -326,6 +312,10 @@ static int crb_acpi_remove(struct acpi_device *device) struct tpm_chip *chip = dev_get_drvdata(dev); tpm_chip_unregister(chip); + + if (chip->flags & TPM_CHIP_FLAG_TPM2) + tpm2_shutdown(chip, TPM2_SU_CLEAR); + return 0; } diff --git a/drivers/char/tpm/tpm_ibmvtpm.c b/drivers/char/tpm/tpm_ibmvtpm.c index 0840347e251c..b1e53e3aece5 100644 --- a/drivers/char/tpm/tpm_ibmvtpm.c +++ b/drivers/char/tpm/tpm_ibmvtpm.c @@ -148,7 +148,8 @@ static int tpm_ibmvtpm_send(struct tpm_chip *chip, u8 *buf, size_t count) crq.len = (u16)count; crq.data = ibmvtpm->rtce_dma_handle; - rc = ibmvtpm_send_crq(ibmvtpm->vdev, word[0], word[1]); + rc = ibmvtpm_send_crq(ibmvtpm->vdev, cpu_to_be64(word[0]), + cpu_to_be64(word[1])); if (rc != H_SUCCESS) { dev_err(ibmvtpm->dev, "tpm_ibmvtpm_send failed rc=%d\n", rc); rc = 0; @@ -186,7 +187,8 @@ static int ibmvtpm_crq_get_rtce_size(struct ibmvtpm_dev *ibmvtpm) crq.valid = (u8)IBMVTPM_VALID_CMD; crq.msg = (u8)VTPM_GET_RTCE_BUFFER_SIZE; - rc = ibmvtpm_send_crq(ibmvtpm->vdev, buf[0], buf[1]); + rc = ibmvtpm_send_crq(ibmvtpm->vdev, cpu_to_be64(buf[0]), + cpu_to_be64(buf[1])); if (rc != H_SUCCESS) dev_err(ibmvtpm->dev, "ibmvtpm_crq_get_rtce_size failed rc=%d\n", rc); @@ -212,7 +214,8 @@ static int ibmvtpm_crq_get_version(struct ibmvtpm_dev *ibmvtpm) crq.valid = (u8)IBMVTPM_VALID_CMD; crq.msg = (u8)VTPM_GET_VERSION; - rc = ibmvtpm_send_crq(ibmvtpm->vdev, buf[0], buf[1]); + rc = ibmvtpm_send_crq(ibmvtpm->vdev, cpu_to_be64(buf[0]), + cpu_to_be64(buf[1])); if (rc != H_SUCCESS) dev_err(ibmvtpm->dev, "ibmvtpm_crq_get_version failed rc=%d\n", rc); @@ -336,7 +339,8 @@ static int tpm_ibmvtpm_suspend(struct device *dev) crq.valid = (u8)IBMVTPM_VALID_CMD; crq.msg = (u8)VTPM_PREPARE_TO_SUSPEND; - rc = ibmvtpm_send_crq(ibmvtpm->vdev, buf[0], buf[1]); + rc = ibmvtpm_send_crq(ibmvtpm->vdev, cpu_to_be64(buf[0]), + cpu_to_be64(buf[1])); if (rc != H_SUCCESS) dev_err(ibmvtpm->dev, "tpm_ibmvtpm_suspend failed rc=%d\n", rc); @@ -481,11 +485,11 @@ static void ibmvtpm_crq_process(struct ibmvtpm_crq *crq, case IBMVTPM_VALID_CMD: switch (crq->msg) { case VTPM_GET_RTCE_BUFFER_SIZE_RES: - if (crq->len <= 0) { + if (be16_to_cpu(crq->len) <= 0) { dev_err(ibmvtpm->dev, "Invalid rtce size\n"); return; } - ibmvtpm->rtce_size = crq->len; + ibmvtpm->rtce_size = be16_to_cpu(crq->len); ibmvtpm->rtce_buf = kmalloc(ibmvtpm->rtce_size, GFP_KERNEL); if (!ibmvtpm->rtce_buf) { @@ -506,11 +510,11 @@ static void ibmvtpm_crq_process(struct ibmvtpm_crq *crq, return; case VTPM_GET_VERSION_RES: - ibmvtpm->vtpm_version = crq->data; + ibmvtpm->vtpm_version = be32_to_cpu(crq->data); return; case VTPM_TPM_COMMAND_RES: /* len of the data in rtce buffer */ - ibmvtpm->res_len = crq->len; + ibmvtpm->res_len = be16_to_cpu(crq->len); wake_up_interruptible(&ibmvtpm->wq); return; default: diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c index 6725bef7cb96..f2dffa770b8e 100644 --- a/drivers/char/tpm/tpm_tis.c +++ b/drivers/char/tpm/tpm_tis.c @@ -588,6 +588,9 @@ MODULE_PARM_DESC(interrupts, "Enable interrupts"); static void tpm_tis_remove(struct tpm_chip *chip) { + if (chip->flags & TPM_CHIP_FLAG_TPM2) + tpm2_shutdown(chip, TPM2_SU_CLEAR); + iowrite32(~TPM_GLOBAL_INT_ENABLE & ioread32(chip->vendor.iobase + TPM_INT_ENABLE(chip->vendor. @@ -639,12 +642,9 @@ static int tpm_tis_init(struct device *dev, acpi_handle acpi_dev_handle, goto out_err; } - /* Every TPM 2.x command has a higher ordinal than TPM 1.x commands. - * Therefore, we can use an idempotent TPM 2.x command to probe TPM 2.x. - */ - rc = tpm2_gen_interrupt(chip, true); - if (rc == 0 || rc == TPM2_RC_INITIALIZE) - chip->flags |= TPM_CHIP_FLAG_TPM2; + rc = tpm2_probe(chip); + if (rc) + goto out_err; vendor = ioread32(chip->vendor.iobase + TPM_DID_VID(0)); chip->vendor.manufacturer_id = vendor; @@ -747,7 +747,7 @@ static int tpm_tis_init(struct device *dev, acpi_handle acpi_dev_handle, /* Generate Interrupts */ if (chip->flags & TPM_CHIP_FLAG_TPM2) - tpm2_gen_interrupt(chip, false); + tpm2_gen_interrupt(chip); else tpm_gen_interrupt(chip); @@ -865,25 +865,22 @@ static void tpm_tis_reenable_interrupts(struct tpm_chip *chip) static int tpm_tis_resume(struct device *dev) { struct tpm_chip *chip = dev_get_drvdata(dev); - int ret = 0; + int ret; if (chip->vendor.irq) tpm_tis_reenable_interrupts(chip); - if (chip->flags & TPM_CHIP_FLAG_TPM2) { - /* NOP if firmware properly does this. */ - tpm2_startup(chip, TPM2_SU_STATE); + ret = tpm_pm_resume(dev); + if (ret) + return ret; - ret = tpm2_shutdown(chip, TPM2_SU_STATE); - if (!ret) - ret = tpm2_do_selftest(chip); - } else { - ret = tpm_pm_resume(dev); - if (!ret) - tpm_do_selftest(chip); - } + /* TPM 1.2 requires self-test on resume. This function actually returns + * an error code but for unknown reason it isn't handled. + */ + if (!(chip->flags & TPM_CHIP_FLAG_TPM2)) + tpm_do_selftest(chip); - return ret; + return 0; } #endif diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c index 125150dc6e81..4d534582514e 100644 --- a/drivers/cpuidle/cpuidle.c +++ b/drivers/cpuidle/cpuidle.c @@ -19,6 +19,8 @@ #include <linux/ktime.h> #include <linux/hrtimer.h> #include <linux/module.h> +#include <linux/suspend.h> +#include <linux/tick.h> #include <trace/events/power.h> #include "cpuidle.h" @@ -32,7 +34,6 @@ LIST_HEAD(cpuidle_detected_devices); static int enabled_devices; static int off __read_mostly; static int initialized __read_mostly; -static bool use_deepest_state __read_mostly; int cpuidle_disabled(void) { @@ -66,36 +67,23 @@ int cpuidle_play_dead(void) } /** - * cpuidle_use_deepest_state - Enable/disable the "deepest idle" mode. - * @enable: Whether enable or disable the feature. - * - * If the "deepest idle" mode is enabled, cpuidle will ignore the governor and - * always use the state with the greatest exit latency (out of the states that - * are not disabled). - * - * This function can only be called after cpuidle_pause() to avoid races. - */ -void cpuidle_use_deepest_state(bool enable) -{ - use_deepest_state = enable; -} - -/** - * cpuidle_find_deepest_state - Find the state of the greatest exit latency. - * @drv: cpuidle driver for a given CPU. - * @dev: cpuidle device for a given CPU. + * cpuidle_find_deepest_state - Find deepest state meeting specific conditions. + * @drv: cpuidle driver for the given CPU. + * @dev: cpuidle device for the given CPU. + * @freeze: Whether or not the state should be suitable for suspend-to-idle. */ static int cpuidle_find_deepest_state(struct cpuidle_driver *drv, - struct cpuidle_device *dev) + struct cpuidle_device *dev, bool freeze) { unsigned int latency_req = 0; - int i, ret = CPUIDLE_DRIVER_STATE_START - 1; + int i, ret = freeze ? -1 : CPUIDLE_DRIVER_STATE_START - 1; for (i = CPUIDLE_DRIVER_STATE_START; i < drv->state_count; i++) { struct cpuidle_state *s = &drv->states[i]; struct cpuidle_state_usage *su = &dev->states_usage[i]; - if (s->disabled || su->disable || s->exit_latency <= latency_req) + if (s->disabled || su->disable || s->exit_latency <= latency_req + || (freeze && !s->enter_freeze)) continue; latency_req = s->exit_latency; @@ -104,6 +92,63 @@ static int cpuidle_find_deepest_state(struct cpuidle_driver *drv, return ret; } +static void enter_freeze_proper(struct cpuidle_driver *drv, + struct cpuidle_device *dev, int index) +{ + tick_freeze(); + /* + * The state used here cannot be a "coupled" one, because the "coupled" + * cpuidle mechanism enables interrupts and doing that with timekeeping + * suspended is generally unsafe. + */ + drv->states[index].enter_freeze(dev, drv, index); + WARN_ON(!irqs_disabled()); + /* + * timekeeping_resume() that will be called by tick_unfreeze() for the + * last CPU executing it calls functions containing RCU read-side + * critical sections, so tell RCU about that. + */ + RCU_NONIDLE(tick_unfreeze()); +} + +/** + * cpuidle_enter_freeze - Enter an idle state suitable for suspend-to-idle. + * + * If there are states with the ->enter_freeze callback, find the deepest of + * them and enter it with frozen tick. Otherwise, find the deepest state + * available and enter it normally. + */ +void cpuidle_enter_freeze(void) +{ + struct cpuidle_device *dev = __this_cpu_read(cpuidle_devices); + struct cpuidle_driver *drv = cpuidle_get_cpu_driver(dev); + int index; + + /* + * Find the deepest state with ->enter_freeze present, which guarantees + * that interrupts won't be enabled when it exits and allows the tick to + * be frozen safely. + */ + index = cpuidle_find_deepest_state(drv, dev, true); + if (index >= 0) { + enter_freeze_proper(drv, dev, index); + return; + } + + /* + * It is not safe to freeze the tick, find the deepest state available + * at all and try to enter it normally. + */ + index = cpuidle_find_deepest_state(drv, dev, false); + if (index >= 0) + cpuidle_enter(drv, dev, index); + else + arch_cpu_idle(); + + /* Interrupts are enabled again here. */ + local_irq_disable(); +} + /** * cpuidle_enter_state - enter the state and update stats * @dev: cpuidle device for this cpu @@ -166,9 +211,6 @@ int cpuidle_select(struct cpuidle_driver *drv, struct cpuidle_device *dev) if (!drv || !dev || !dev->enabled) return -EBUSY; - if (unlikely(use_deepest_state)) - return cpuidle_find_deepest_state(drv, dev); - return cpuidle_curr_governor->select(drv, dev); } @@ -200,7 +242,7 @@ int cpuidle_enter(struct cpuidle_driver *drv, struct cpuidle_device *dev, */ void cpuidle_reflect(struct cpuidle_device *dev, int index) { - if (cpuidle_curr_governor->reflect && !unlikely(use_deepest_state)) + if (cpuidle_curr_governor->reflect) cpuidle_curr_governor->reflect(dev, index); } diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c index 1bc0c170f12a..b0e58522780d 100644 --- a/drivers/idle/intel_idle.c +++ b/drivers/idle/intel_idle.c @@ -97,6 +97,8 @@ static const struct idle_cpu *icpu; static struct cpuidle_device __percpu *intel_idle_cpuidle_devices; static int intel_idle(struct cpuidle_device *dev, struct cpuidle_driver *drv, int index); +static void intel_idle_freeze(struct cpuidle_device *dev, + struct cpuidle_driver *drv, int index); static int intel_idle_cpu_init(int cpu); static struct cpuidle_state *cpuidle_state_table; @@ -131,28 +133,32 @@ static struct cpuidle_state nehalem_cstates[] = { .flags = MWAIT2flg(0x00), .exit_latency = 3, .target_residency = 6, - .enter = &intel_idle }, + .enter = &intel_idle, + .enter_freeze = intel_idle_freeze, }, { .name = "C1E-NHM", .desc = "MWAIT 0x01", .flags = MWAIT2flg(0x01), .exit_latency = 10, .target_residency = 20, - .enter = &intel_idle }, + .enter = &intel_idle, + .enter_freeze = intel_idle_freeze, }, { .name = "C3-NHM", .desc = "MWAIT 0x10", .flags = MWAIT2flg(0x10) | CPUIDLE_FLAG_TLB_FLUSHED, .exit_latency = 20, .target_residency = 80, - .enter = &intel_idle }, + .enter = &intel_idle, + .enter_freeze = intel_idle_freeze, }, { .name = "C6-NHM", .desc = "MWAIT 0x20", .flags = MWAIT2flg(0x20) | CPUIDLE_FLAG_TLB_FLUSHED, .exit_latency = 200, .target_residency = 800, - .enter = &intel_idle }, + .enter = &intel_idle, + .enter_freeze = intel_idle_freeze, }, { .enter = NULL } }; @@ -164,35 +170,40 @@ static struct cpuidle_state snb_cstates[] = { .flags = MWAIT2flg(0x00), .exit_latency = 2, .target_residency = 2, - .enter = &intel_idle }, + .enter = &intel_idle, + .enter_freeze = intel_idle_freeze, }, { .name = "C1E-SNB", .desc = "MWAIT 0x01", .flags = MWAIT2flg(0x01), .exit_latency = 10, .target_residency = 20, - .enter = &intel_idle }, + .enter = &intel_idle, + .enter_freeze = intel_idle_freeze, }, { .name = "C3-SNB", .desc = "MWAIT 0x10", .flags = MWAIT2flg(0x10) | CPUIDLE_FLAG_TLB_FLUSHED, .exit_latency = 80, .target_residency = 211, - .enter = &intel_idle }, + .enter = &intel_idle, + .enter_freeze = intel_idle_freeze, }, { .name = "C6-SNB", .desc = "MWAIT 0x20", .flags = MWAIT2flg(0x20) | CPUIDLE_FLAG_TLB_FLUSHED, .exit_latency = 104, .target_residency = 345, - .enter = &intel_idle }, + .enter = &intel_idle, + .enter_freeze = intel_idle_freeze, }, { .name = "C7-SNB", .desc = "MWAIT 0x30", .flags = MWAIT2flg(0x30) | CPUIDLE_FLAG_TLB_FLUSHED, .exit_latency = 109, .target_residency = 345, - .enter = &intel_idle }, + .enter = &intel_idle, + .enter_freeze = intel_idle_freeze, }, { .enter = NULL } }; @@ -204,42 +215,48 @@ static struct cpuidle_state byt_cstates[] = { .flags = MWAIT2flg(0x00), .exit_latency = 1, .target_residency = 1, - .enter = &intel_idle }, + .enter = &intel_idle, + .enter_freeze = intel_idle_freeze, }, { .name = "C1E-BYT", .desc = "MWAIT 0x01", .flags = MWAIT2flg(0x01), .exit_latency = 15, .target_residency = 30, - .enter = &intel_idle }, + .enter = &intel_idle, + .enter_freeze = intel_idle_freeze, }, { .name = "C6N-BYT", .desc = "MWAIT 0x58", .flags = MWAIT2flg(0x58) | CPUIDLE_FLAG_TLB_FLUSHED, .exit_latency = 40, .target_residency = 275, - .enter = &intel_idle }, + .enter = &intel_idle, + .enter_freeze = intel_idle_freeze, }, { .name = "C6S-BYT", .desc = "MWAIT 0x52", .flags = MWAIT2flg(0x52) | CPUIDLE_FLAG_TLB_FLUSHED, .exit_latency = 140, .target_residency = 560, - .enter = &intel_idle }, + .enter = &intel_idle, + .enter_freeze = intel_idle_freeze, }, { .name = "C7-BYT", .desc = "MWAIT 0x60", .flags = MWAIT2flg(0x60) | CPUIDLE_FLAG_TLB_FLUSHED, .exit_latency = 1200, .target_residency = 1500, - .enter = &intel_idle }, + .enter = &intel_idle, + .enter_freeze = intel_idle_freeze, }, { .name = "C7S-BYT", .desc = "MWAIT 0x64", .flags = MWAIT2flg(0x64) | CPUIDLE_FLAG_TLB_FLUSHED, .exit_latency = 10000, .target_residency = 20000, - .enter = &intel_idle }, + .enter = &intel_idle, + .enter_freeze = intel_idle_freeze, }, { .enter = NULL } }; @@ -251,35 +268,40 @@ static struct cpuidle_state ivb_cstates[] = { .flags = MWAIT2flg(0x00), .exit_latency = 1, .target_residency = 1, - .enter = &intel_idle }, + .enter = &intel_idle, + .enter_freeze = intel_idle_freeze, }, { .name = "C1E-IVB", .desc = "MWAIT 0x01", .flags = MWAIT2flg(0x01), .exit_latency = 10, .target_residency = 20, - .enter = &intel_idle }, + .enter = &intel_idle, + .enter_freeze = intel_idle_freeze, }, { .name = "C3-IVB", .desc = "MWAIT 0x10", .flags = MWAIT2flg(0x10) | CPUIDLE_FLAG_TLB_FLUSHED, .exit_latency = 59, .target_residency = 156, - .enter = &intel_idle }, + .enter = &intel_idle, + .enter_freeze = intel_idle_freeze, }, { .name = "C6-IVB", .desc = "MWAIT 0x20", .flags = MWAIT2flg(0x20) | CPUIDLE_FLAG_TLB_FLUSHED, .exit_latency = 80, .target_residency = 300, - .enter = &intel_idle }, + .enter = &intel_idle, + .enter_freeze = intel_idle_freeze, }, { .name = "C7-IVB", .desc = "MWAIT 0x30", .flags = MWAIT2flg(0x30) | CPUIDLE_FLAG_TLB_FLUSHED, .exit_latency = 87, .target_residency = 300, - .enter = &intel_idle }, + .enter = &intel_idle, + .enter_freeze = intel_idle_freeze, }, { .enter = NULL } }; @@ -291,28 +313,32 @@ static struct cpuidle_state ivt_cstates[] = { .flags = MWAIT2flg(0x00), .exit_latency = 1, .target_residency = 1, - .enter = &intel_idle }, + .enter = &intel_idle, + .enter_freeze = intel_idle_freeze, }, { .name = "C1E-IVT", .desc = "MWAIT 0x01", .flags = MWAIT2flg(0x01), .exit_latency = 10, .target_residency = 80, - .enter = &intel_idle }, + .enter = &intel_idle, + .enter_freeze = intel_idle_freeze, }, { .name = "C3-IVT", .desc = "MWAIT 0x10", .flags = MWAIT2flg(0x10) | CPUIDLE_FLAG_TLB_FLUSHED, .exit_latency = 59, .target_residency = 156, - .enter = &intel_idle }, + .enter = &intel_idle, + .enter_freeze = intel_idle_freeze, }, { .name = "C6-IVT", .desc = "MWAIT 0x20", .flags = MWAIT2flg(0x20) | CPUIDLE_FLAG_TLB_FLUSHED, .exit_latency = 82, .target_residency = 300, - .enter = &intel_idle }, + .enter = &intel_idle, + .enter_freeze = intel_idle_freeze, }, { .enter = NULL } }; @@ -324,28 +350,32 @@ static struct cpuidle_state ivt_cstates_4s[] = { .flags = MWAIT2flg(0x00), .exit_latency = 1, .target_residency = 1, - .enter = &intel_idle }, + .enter = &intel_idle, + .enter_freeze = intel_idle_freeze, }, { .name = "C1E-IVT-4S", .desc = "MWAIT 0x01", .flags = MWAIT2flg(0x01), .exit_latency = 10, .target_residency = 250, - .enter = &intel_idle }, + .enter = &intel_idle, + .enter_freeze = intel_idle_freeze, }, { .name = "C3-IVT-4S", .desc = "MWAIT 0x10", .flags = MWAIT2flg(0x10) | CPUIDLE_FLAG_TLB_FLUSHED, .exit_latency = 59, .target_residency = 300, - .enter = &intel_idle }, + .enter = &intel_idle, + .enter_freeze = intel_idle_freeze, }, { .name = "C6-IVT-4S", .desc = "MWAIT 0x20", .flags = MWAIT2flg(0x20) | CPUIDLE_FLAG_TLB_FLUSHED, .exit_latency = 84, .target_residency = 400, - .enter = &intel_idle }, + .enter = &intel_idle, + .enter_freeze = intel_idle_freeze, }, { .enter = NULL } }; @@ -357,28 +387,32 @@ static struct cpuidle_state ivt_cstates_8s[] = { .flags = MWAIT2flg(0x00), .exit_latency = 1, .target_residency = 1, - .enter = &intel_idle }, + .enter = &intel_idle, + .enter_freeze = intel_idle_freeze, }, { .name = "C1E-IVT-8S", .desc = "MWAIT 0x01", .flags = MWAIT2flg(0x01), .exit_latency = 10, .target_residency = 500, - .enter = &intel_idle }, + .enter = &intel_idle, + .enter_freeze = intel_idle_freeze, }, { .name = "C3-IVT-8S", .desc = "MWAIT 0x10", .flags = MWAIT2flg(0x10) | CPUIDLE_FLAG_TLB_FLUSHED, .exit_latency = 59, .target_residency = 600, - .enter = &intel_idle }, + .enter = &intel_idle, + .enter_freeze = intel_idle_freeze, }, { .name = "C6-IVT-8S", .desc = "MWAIT 0x20", .flags = MWAIT2flg(0x20) | CPUIDLE_FLAG_TLB_FLUSHED, .exit_latency = 88, .target_residency = 700, - .enter = &intel_idle }, + .enter = &intel_idle, + .enter_freeze = intel_idle_freeze, }, { .enter = NULL } }; @@ -390,56 +424,64 @@ static struct cpuidle_state hsw_cstates[] = { .flags = MWAIT2flg(0x00), .exit_latency = 2, .target_residency = 2, - .enter = &intel_idle }, + .enter = &intel_idle, + .enter_freeze = intel_idle_freeze, }, { .name = "C1E-HSW", .desc = "MWAIT 0x01", .flags = MWAIT2flg(0x01), .exit_latency = 10, .target_residency = 20, - .enter = &intel_idle }, + .enter = &intel_idle, + .enter_freeze = intel_idle_freeze, }, { .name = "C3-HSW", .desc = "MWAIT 0x10", .flags = MWAIT2flg(0x10) | CPUIDLE_FLAG_TLB_FLUSHED, .exit_latency = 33, .target_residency = 100, - .enter = &intel_idle }, + .enter = &intel_idle, + .enter_freeze = intel_idle_freeze, }, { .name = "C6-HSW", .desc = "MWAIT 0x20", .flags = MWAIT2flg(0x20) | CPUIDLE_FLAG_TLB_FLUSHED, .exit_latency = 133, .target_residency = 400, - .enter = &intel_idle }, + .enter = &intel_idle, + .enter_freeze = intel_idle_freeze, }, { .name = "C7s-HSW", .desc = "MWAIT 0x32", .flags = MWAIT2flg(0x32) | CPUIDLE_FLAG_TLB_FLUSHED, .exit_latency = 166, .target_residency = 500, - .enter = &intel_idle }, + .enter = &intel_idle, + .enter_freeze = intel_idle_freeze, }, { .name = "C8-HSW", .desc = "MWAIT 0x40", .flags = MWAIT2flg(0x40) | CPUIDLE_FLAG_TLB_FLUSHED, .exit_latency = 300, .target_residency = 900, - .enter = &intel_idle }, + .enter = &intel_idle, + .enter_freeze = intel_idle_freeze, }, { .name = "C9-HSW", .desc = "MWAIT 0x50", .flags = MWAIT2flg(0x50) | CPUIDLE_FLAG_TLB_FLUSHED, .exit_latency = 600, .target_residency = 1800, - .enter = &intel_idle }, + .enter = &intel_idle, + .enter_freeze = intel_idle_freeze, }, { .name = "C10-HSW", .desc = "MWAIT 0x60", .flags = MWAIT2flg(0x60) | CPUIDLE_FLAG_TLB_FLUSHED, .exit_latency = 2600, .target_residency = 7700, - .enter = &intel_idle }, + .enter = &intel_idle, + .enter_freeze = intel_idle_freeze, }, { .enter = NULL } }; @@ -450,56 +492,64 @@ static struct cpuidle_state bdw_cstates[] = { .flags = MWAIT2flg(0x00), .exit_latency = 2, .target_residency = 2, - .enter = &intel_idle }, + .enter = &intel_idle, + .enter_freeze = intel_idle_freeze, }, { .name = "C1E-BDW", .desc = "MWAIT 0x01", .flags = MWAIT2flg(0x01), .exit_latency = 10, .target_residency = 20, - .enter = &intel_idle }, + .enter = &intel_idle, + .enter_freeze = intel_idle_freeze, }, { .name = "C3-BDW", .desc = "MWAIT 0x10", .flags = MWAIT2flg(0x10) | CPUIDLE_FLAG_TLB_FLUSHED, .exit_latency = 40, .target_residency = 100, - .enter = &intel_idle }, + .enter = &intel_idle, + .enter_freeze = intel_idle_freeze, }, { .name = "C6-BDW", .desc = "MWAIT 0x20", .flags = MWAIT2flg(0x20) | CPUIDLE_FLAG_TLB_FLUSHED, .exit_latency = 133, .target_residency = 400, - .enter = &intel_idle }, + .enter = &intel_idle, + .enter_freeze = intel_idle_freeze, }, { .name = "C7s-BDW", .desc = "MWAIT 0x32", .flags = MWAIT2flg(0x32) | CPUIDLE_FLAG_TLB_FLUSHED, .exit_latency = 166, .target_residency = 500, - .enter = &intel_idle }, + .enter = &intel_idle, + .enter_freeze = intel_idle_freeze, }, { .name = "C8-BDW", .desc = "MWAIT 0x40", .flags = MWAIT2flg(0x40) | CPUIDLE_FLAG_TLB_FLUSHED, .exit_latency = 300, .target_residency = 900, - .enter = &intel_idle }, + .enter = &intel_idle, + .enter_freeze = intel_idle_freeze, }, { .name = "C9-BDW", .desc = "MWAIT 0x50", .flags = MWAIT2flg(0x50) | CPUIDLE_FLAG_TLB_FLUSHED, .exit_latency = 600, .target_residency = 1800, - .enter = &intel_idle }, + .enter = &intel_idle, + .enter_freeze = intel_idle_freeze, }, { .name = "C10-BDW", .desc = "MWAIT 0x60", .flags = MWAIT2flg(0x60) | CPUIDLE_FLAG_TLB_FLUSHED, .exit_latency = 2600, .target_residency = 7700, - .enter = &intel_idle }, + .enter = &intel_idle, + .enter_freeze = intel_idle_freeze, }, { .enter = NULL } }; @@ -511,28 +561,32 @@ static struct cpuidle_state atom_cstates[] = { .flags = MWAIT2flg(0x00), .exit_latency = 10, .target_residency = 20, - .enter = &intel_idle }, + .enter = &intel_idle, + .enter_freeze = intel_idle_freeze, }, { .name = "C2-ATM", .desc = "MWAIT 0x10", .flags = MWAIT2flg(0x10), .exit_latency = 20, .target_residency = 80, - .enter = &intel_idle }, + .enter = &intel_idle, + .enter_freeze = intel_idle_freeze, }, { .name = "C4-ATM", .desc = "MWAIT 0x30", .flags = MWAIT2flg(0x30) | CPUIDLE_FLAG_TLB_FLUSHED, .exit_latency = 100, .target_residency = 400, - .enter = &intel_idle }, + .enter = &intel_idle, + .enter_freeze = intel_idle_freeze, }, { .name = "C6-ATM", .desc = "MWAIT 0x52", .flags = MWAIT2flg(0x52) | CPUIDLE_FLAG_TLB_FLUSHED, .exit_latency = 140, .target_residency = 560, - .enter = &intel_idle }, + .enter = &intel_idle, + .enter_freeze = intel_idle_freeze, }, { .enter = NULL } }; @@ -543,14 +597,16 @@ static struct cpuidle_state avn_cstates[] = { .flags = MWAIT2flg(0x00), .exit_latency = 2, .target_residency = 2, - .enter = &intel_idle }, + .enter = &intel_idle, + .enter_freeze = intel_idle_freeze, }, { .name = "C6-AVN", .desc = "MWAIT 0x51", .flags = MWAIT2flg(0x51) | CPUIDLE_FLAG_TLB_FLUSHED, .exit_latency = 15, .target_residency = 45, - .enter = &intel_idle }, + .enter = &intel_idle, + .enter_freeze = intel_idle_freeze, }, { .enter = NULL } }; @@ -592,6 +648,21 @@ static int intel_idle(struct cpuidle_device *dev, return index; } +/** + * intel_idle_freeze - simplified "enter" callback routine for suspend-to-idle + * @dev: cpuidle_device + * @drv: cpuidle driver + * @index: state index + */ +static void intel_idle_freeze(struct cpuidle_device *dev, + struct cpuidle_driver *drv, int index) +{ + unsigned long ecx = 1; /* break on interrupt flag */ + unsigned long eax = flg2MWAIT(drv->states[index].flags); + + mwait_idle_with_hints(eax, ecx); +} + static void __setup_broadcast_timer(void *arg) { unsigned long reason = (unsigned long)arg; diff --git a/fs/Kconfig.binfmt b/fs/Kconfig.binfmt index c055d56ec63d..270c48148f79 100644 --- a/fs/Kconfig.binfmt +++ b/fs/Kconfig.binfmt @@ -149,13 +149,6 @@ config BINFMT_EM86 later load the module when you want to use a Linux/Intel binary. The module will be called binfmt_em86. If unsure, say Y. -config BINFMT_SOM - tristate "Kernel support for SOM binaries" - depends on PARISC && HPUX - help - SOM is a binary executable format inherited from HP/UX. Say - Y here to be able to load and execute SOM binaries directly. - config BINFMT_MISC tristate "Kernel support for MISC binaries" ---help--- diff --git a/fs/Makefile b/fs/Makefile index 0f4635f7c49c..a88ac4838c9e 100644 --- a/fs/Makefile +++ b/fs/Makefile @@ -38,7 +38,6 @@ obj-$(CONFIG_BINFMT_SCRIPT) += binfmt_script.o obj-$(CONFIG_BINFMT_ELF) += binfmt_elf.o obj-$(CONFIG_COMPAT_BINFMT_ELF) += compat_binfmt_elf.o obj-$(CONFIG_BINFMT_ELF_FDPIC) += binfmt_elf_fdpic.o -obj-$(CONFIG_BINFMT_SOM) += binfmt_som.o obj-$(CONFIG_BINFMT_FLAT) += binfmt_flat.o obj-$(CONFIG_FS_MBCACHE) += mbcache.o diff --git a/fs/binfmt_som.c b/fs/binfmt_som.c deleted file mode 100644 index 4e00ed68d4a6..000000000000 --- a/fs/binfmt_som.c +++ /dev/null @@ -1,299 +0,0 @@ -/* - * linux/fs/binfmt_som.c - * - * These are the functions used to load SOM format executables as used - * by HP-UX. - * - * Copyright 1999 Matthew Wilcox <willy@bofh.ai> - * based on binfmt_elf which is - * Copyright 1993, 1994: Eric Youngdale (ericy@cais.com). - */ - -#include <linux/module.h> - -#include <linux/fs.h> -#include <linux/stat.h> -#include <linux/sched.h> -#include <linux/mm.h> -#include <linux/mman.h> -#include <linux/errno.h> -#include <linux/signal.h> -#include <linux/binfmts.h> -#include <linux/som.h> -#include <linux/string.h> -#include <linux/file.h> -#include <linux/fcntl.h> -#include <linux/ptrace.h> -#include <linux/slab.h> -#include <linux/shm.h> -#include <linux/personality.h> -#include <linux/init.h> - -#include <asm/uaccess.h> -#include <asm/pgtable.h> - - -#include <linux/elf.h> - -static int load_som_binary(struct linux_binprm * bprm); -static int load_som_library(struct file *); - -/* - * If we don't support core dumping, then supply a NULL so we - * don't even try. - */ -#if 0 -static int som_core_dump(struct coredump_params *cprm); -#else -#define som_core_dump NULL -#endif - -#define SOM_PAGESTART(_v) ((_v) & ~(unsigned long)(SOM_PAGESIZE-1)) -#define SOM_PAGEOFFSET(_v) ((_v) & (SOM_PAGESIZE-1)) -#define SOM_PAGEALIGN(_v) (((_v) + SOM_PAGESIZE - 1) & ~(SOM_PAGESIZE - 1)) - -static struct linux_binfmt som_format = { - .module = THIS_MODULE, - .load_binary = load_som_binary, - .load_shlib = load_som_library, - .core_dump = som_core_dump, - .min_coredump = SOM_PAGESIZE -}; - -/* - * create_som_tables() parses the env- and arg-strings in new user - * memory and creates the pointer tables from them, and puts their - * addresses on the "stack", returning the new stack pointer value. - */ -static void create_som_tables(struct linux_binprm *bprm) -{ - char **argv, **envp; - int argc = bprm->argc; - int envc = bprm->envc; - unsigned long p; - unsigned long *sp; - - /* Word-align the stack pointer */ - sp = (unsigned long *)((bprm->p + 3) & ~3); - - envp = (char **) sp; - sp += envc + 1; - argv = (char **) sp; - sp += argc + 1; - - __put_user((unsigned long) envp,++sp); - __put_user((unsigned long) argv,++sp); - - __put_user(argc, ++sp); - - bprm->p = (unsigned long) sp; - - p = current->mm->arg_start; - while (argc-- > 0) { - __put_user((char *)p,argv++); - p += strlen_user((char *)p); - } - __put_user(NULL, argv); - current->mm->arg_end = current->mm->env_start = p; - while (envc-- > 0) { - __put_user((char *)p,envp++); - p += strlen_user((char *)p); - } - __put_user(NULL, envp); - current->mm->env_end = p; -} - -static int check_som_header(struct som_hdr *som_ex) -{ - int *buf = (int *)som_ex; - int i, ck; - - if (som_ex->system_id != SOM_SID_PARISC_1_0 && - som_ex->system_id != SOM_SID_PARISC_1_1 && - som_ex->system_id != SOM_SID_PARISC_2_0) - return -ENOEXEC; - - if (som_ex->a_magic != SOM_EXEC_NONSHARE && - som_ex->a_magic != SOM_EXEC_SHARE && - som_ex->a_magic != SOM_EXEC_DEMAND) - return -ENOEXEC; - - if (som_ex->version_id != SOM_ID_OLD && - som_ex->version_id != SOM_ID_NEW) - return -ENOEXEC; - - ck = 0; - for (i=0; i<32; i++) - ck ^= buf[i]; - if (ck != 0) - return -ENOEXEC; - - return 0; -} - -static int map_som_binary(struct file *file, - const struct som_exec_auxhdr *hpuxhdr) -{ - unsigned long code_start, code_size, data_start, data_size; - unsigned long bss_start, som_brk; - int retval; - int prot = PROT_READ | PROT_EXEC; - int flags = MAP_FIXED|MAP_PRIVATE|MAP_DENYWRITE|MAP_EXECUTABLE; - - mm_segment_t old_fs = get_fs(); - set_fs(get_ds()); - - code_start = SOM_PAGESTART(hpuxhdr->exec_tmem); - code_size = SOM_PAGEALIGN(hpuxhdr->exec_tsize); - current->mm->start_code = code_start; - current->mm->end_code = code_start + code_size; - retval = vm_mmap(file, code_start, code_size, prot, - flags, SOM_PAGESTART(hpuxhdr->exec_tfile)); - if (retval < 0 && retval > -1024) - goto out; - - data_start = SOM_PAGESTART(hpuxhdr->exec_dmem); - data_size = SOM_PAGEALIGN(hpuxhdr->exec_dsize); - current->mm->start_data = data_start; - current->mm->end_data = bss_start = data_start + data_size; - retval = vm_mmap(file, data_start, data_size, - prot | PROT_WRITE, flags, - SOM_PAGESTART(hpuxhdr->exec_dfile)); - if (retval < 0 && retval > -1024) - goto out; - - som_brk = bss_start + SOM_PAGEALIGN(hpuxhdr->exec_bsize); - current->mm->start_brk = current->mm->brk = som_brk; - retval = vm_mmap(NULL, bss_start, som_brk - bss_start, - prot | PROT_WRITE, MAP_FIXED | MAP_PRIVATE, 0); - if (retval > 0 || retval < -1024) - retval = 0; -out: - set_fs(old_fs); - return retval; -} - - -/* - * These are the functions used to load SOM executables and shared - * libraries. There is no binary dependent code anywhere else. - */ - -static int -load_som_binary(struct linux_binprm * bprm) -{ - int retval; - unsigned int size; - unsigned long som_entry; - struct som_hdr *som_ex; - struct som_exec_auxhdr *hpuxhdr; - struct pt_regs *regs = current_pt_regs(); - - /* Get the exec-header */ - som_ex = (struct som_hdr *) bprm->buf; - - retval = check_som_header(som_ex); - if (retval != 0) - goto out; - - /* Now read in the auxiliary header information */ - - retval = -ENOMEM; - size = som_ex->aux_header_size; - if (size > SOM_PAGESIZE) - goto out; - hpuxhdr = kmalloc(size, GFP_KERNEL); - if (!hpuxhdr) - goto out; - - retval = kernel_read(bprm->file, som_ex->aux_header_location, - (char *) hpuxhdr, size); - if (retval != size) { - if (retval >= 0) - retval = -EIO; - goto out_free; - } - - /* Flush all traces of the currently running executable */ - retval = flush_old_exec(bprm); - if (retval) - goto out_free; - - /* OK, This is the point of no return */ - current->personality = PER_HPUX; - setup_new_exec(bprm); - - /* Set the task size for HP-UX processes such that - * the gateway page is outside the address space. - * This can be fixed later, but for now, this is much - * easier. - */ - - current->thread.task_size = 0xc0000000; - - /* Set map base to allow enough room for hp-ux heap growth */ - - current->thread.map_base = 0x80000000; - - retval = map_som_binary(bprm->file, hpuxhdr); - if (retval < 0) - goto out_free; - - som_entry = hpuxhdr->exec_entry; - kfree(hpuxhdr); - - set_binfmt(&som_format); - install_exec_creds(bprm); - setup_arg_pages(bprm, STACK_TOP, EXSTACK_DEFAULT); - - create_som_tables(bprm); - - current->mm->start_stack = bprm->p; - -#if 0 - printk("(start_brk) %08lx\n" , (unsigned long) current->mm->start_brk); - printk("(end_code) %08lx\n" , (unsigned long) current->mm->end_code); - printk("(start_code) %08lx\n" , (unsigned long) current->mm->start_code); - printk("(end_data) %08lx\n" , (unsigned long) current->mm->end_data); - printk("(start_stack) %08lx\n" , (unsigned long) current->mm->start_stack); - printk("(brk) %08lx\n" , (unsigned long) current->mm->brk); -#endif - - map_hpux_gateway_page(current,current->mm); - - start_thread_som(regs, som_entry, bprm->p); - return 0; - - /* error cleanup */ -out_free: - kfree(hpuxhdr); -out: - return retval; -} - -static int load_som_library(struct file *f) -{ -/* No lib support in SOM yet. gizza chance.. */ - return -ENOEXEC; -} - /* Install the SOM loader. - * N.B. We *rely* on the table being the right size with the - * right number of free slots... - */ - -static int __init init_som_binfmt(void) -{ - register_binfmt(&som_format); - return 0; -} - -static void __exit exit_som_binfmt(void) -{ - /* Remove the SOM loader. */ - unregister_binfmt(&som_format); -} - -core_initcall(init_som_binfmt); -module_exit(exit_som_binfmt); - -MODULE_LICENSE("GPL"); diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h index ab70f3bc44ad..f551a9299ac9 100644 --- a/include/linux/cpuidle.h +++ b/include/linux/cpuidle.h @@ -50,6 +50,15 @@ struct cpuidle_state { int index); int (*enter_dead) (struct cpuidle_device *dev, int index); + + /* + * CPUs execute ->enter_freeze with the local tick or entire timekeeping + * suspended, so it must not re-enable interrupts at any point (even + * temporarily) or attempt to change states of clock event devices. + */ + void (*enter_freeze) (struct cpuidle_device *dev, + struct cpuidle_driver *drv, + int index); }; /* Idle State Flags */ @@ -141,7 +150,7 @@ extern void cpuidle_resume(void); extern int cpuidle_enable_device(struct cpuidle_device *dev); extern void cpuidle_disable_device(struct cpuidle_device *dev); extern int cpuidle_play_dead(void); -extern void cpuidle_use_deepest_state(bool enable); +extern void cpuidle_enter_freeze(void); extern struct cpuidle_driver *cpuidle_get_cpu_driver(struct cpuidle_device *dev); #else @@ -174,7 +183,7 @@ static inline int cpuidle_enable_device(struct cpuidle_device *dev) {return -ENODEV; } static inline void cpuidle_disable_device(struct cpuidle_device *dev) { } static inline int cpuidle_play_dead(void) {return -ENODEV; } -static inline void cpuidle_use_deepest_state(bool enable) {} +static inline void cpuidle_enter_freeze(void) { } static inline struct cpuidle_driver *cpuidle_get_cpu_driver( struct cpuidle_device *dev) {return NULL; } #endif diff --git a/include/linux/suspend.h b/include/linux/suspend.h index 3388c1b6f7d8..5efe743ce1e8 100644 --- a/include/linux/suspend.h +++ b/include/linux/suspend.h @@ -201,6 +201,21 @@ struct platform_freeze_ops { */ extern void suspend_set_ops(const struct platform_suspend_ops *ops); extern int suspend_valid_only_mem(suspend_state_t state); + +/* Suspend-to-idle state machnine. */ +enum freeze_state { + FREEZE_STATE_NONE, /* Not suspended/suspending. */ + FREEZE_STATE_ENTER, /* Enter suspend-to-idle. */ + FREEZE_STATE_WAKE, /* Wake up from suspend-to-idle. */ +}; + +extern enum freeze_state __read_mostly suspend_freeze_state; + +static inline bool idle_should_freeze(void) +{ + return unlikely(suspend_freeze_state == FREEZE_STATE_ENTER); +} + extern void freeze_set_ops(const struct platform_freeze_ops *ops); extern void freeze_wake(void); @@ -228,6 +243,7 @@ extern int pm_suspend(suspend_state_t state); static inline void suspend_set_ops(const struct platform_suspend_ops *ops) {} static inline int pm_suspend(suspend_state_t state) { return -ENOSYS; } +static inline bool idle_should_freeze(void) { return false; } static inline void freeze_set_ops(const struct platform_freeze_ops *ops) {} static inline void freeze_wake(void) {} #endif /* !CONFIG_SUSPEND */ diff --git a/include/linux/tick.h b/include/linux/tick.h index eda850ca757a..9c085dc12ae9 100644 --- a/include/linux/tick.h +++ b/include/linux/tick.h @@ -79,6 +79,9 @@ extern void __init tick_init(void); extern int tick_is_oneshot_available(void); extern struct tick_device *tick_get_device(int cpu); +extern void tick_freeze(void); +extern void tick_unfreeze(void); + # ifdef CONFIG_HIGH_RES_TIMERS extern int tick_init_highres(void); extern int tick_program_event(ktime_t expires, int force); @@ -119,6 +122,8 @@ static inline int tick_oneshot_mode_active(void) { return 0; } #else /* CONFIG_GENERIC_CLOCKEVENTS */ static inline void tick_init(void) { } +static inline void tick_freeze(void) { } +static inline void tick_unfreeze(void) { } static inline void tick_cancel_sched_timer(int cpu) { } static inline void tick_clock_notify(void) { } static inline int tick_check_oneshot_change(int allow_nohz) { return 0; } @@ -226,5 +231,4 @@ static inline void tick_nohz_task_switch(struct task_struct *tsk) __tick_nohz_task_switch(tsk); } - #endif diff --git a/include/uapi/linux/Kbuild b/include/uapi/linux/Kbuild index 7b8141bf59a7..68ceb97c458c 100644 --- a/include/uapi/linux/Kbuild +++ b/include/uapi/linux/Kbuild @@ -370,7 +370,6 @@ header-y += snmp.h header-y += sock_diag.h header-y += socket.h header-y += sockios.h -header-y += som.h header-y += sonet.h header-y += sonypi.h header-y += soundcard.h diff --git a/include/uapi/linux/som.h b/include/uapi/linux/som.h deleted file mode 100644 index 166594e4e7be..000000000000 --- a/include/uapi/linux/som.h +++ /dev/null @@ -1,154 +0,0 @@ -#ifndef _LINUX_SOM_H -#define _LINUX_SOM_H - -/* File format definition for SOM executables / shared libraries */ - -/* we need struct timespec */ -#include <linux/time.h> - -#define SOM_PAGESIZE 4096 - -/* this is the SOM header */ -struct som_hdr { - short system_id; /* magic number - system */ - short a_magic; /* magic number - file type */ - unsigned int version_id; /* versiod ID: YYMMDDHH */ - struct timespec file_time; /* system clock */ - unsigned int entry_space; /* space for entry point */ - unsigned int entry_subspace; /* subspace for entry point */ - unsigned int entry_offset; /* offset of entry point */ - unsigned int aux_header_location; /* auxiliary header location */ - unsigned int aux_header_size; /* auxiliary header size */ - unsigned int som_length; /* length of entire SOM */ - unsigned int presumed_dp; /* compiler's DP value */ - unsigned int space_location; /* space dictionary location */ - unsigned int space_total; /* number of space entries */ - unsigned int subspace_location; /* subspace entries location */ - unsigned int subspace_total; /* number of subspace entries */ - unsigned int loader_fixup_location; /* MPE/iX loader fixup */ - unsigned int loader_fixup_total; /* number of fixup records */ - unsigned int space_strings_location; /* (sub)space names */ - unsigned int space_strings_size; /* size of strings area */ - unsigned int init_array_location; /* reserved */ - unsigned int init_array_total; /* reserved */ - unsigned int compiler_location; /* module dictionary */ - unsigned int compiler_total; /* number of modules */ - unsigned int symbol_location; /* symbol dictionary */ - unsigned int symbol_total; /* number of symbols */ - unsigned int fixup_request_location; /* fixup requests */ - unsigned int fixup_request_total; /* number of fixup requests */ - unsigned int symbol_strings_location;/* module & symbol names area */ - unsigned int symbol_strings_size; /* size of strings area */ - unsigned int unloadable_sp_location; /* unloadable spaces location */ - unsigned int unloadable_sp_size; /* size of data */ - unsigned int checksum; -}; - -/* values for system_id */ - -#define SOM_SID_PARISC_1_0 0x020b -#define SOM_SID_PARISC_1_1 0x0210 -#define SOM_SID_PARISC_2_0 0x0214 - -/* values for a_magic */ - -#define SOM_LIB_EXEC 0x0104 -#define SOM_RELOCATABLE 0x0106 -#define SOM_EXEC_NONSHARE 0x0107 -#define SOM_EXEC_SHARE 0x0108 -#define SOM_EXEC_DEMAND 0x010B -#define SOM_LIB_DYN 0x010D -#define SOM_LIB_SHARE 0x010E -#define SOM_LIB_RELOC 0x0619 - -/* values for version_id. Decimal not hex, yes. Grr. */ - -#define SOM_ID_OLD 85082112 -#define SOM_ID_NEW 87102412 - -struct aux_id { - unsigned int mandatory :1; /* the linker must understand this */ - unsigned int copy :1; /* Must be copied by the linker */ - unsigned int append :1; /* Must be merged by the linker */ - unsigned int ignore :1; /* Discard section if unknown */ - unsigned int reserved :12; - unsigned int type :16; /* Header type */ - unsigned int length; /* length of _following_ data */ -}; - -/* The Exec Auxiliary Header. Called The HP-UX Header within HP apparently. */ -struct som_exec_auxhdr { - struct aux_id som_auxhdr; - int exec_tsize; /* Text size in bytes */ - int exec_tmem; /* Address to load text at */ - int exec_tfile; /* Location of text in file */ - int exec_dsize; /* Data size in bytes */ - int exec_dmem; /* Address to load data at */ - int exec_dfile; /* Location of data in file */ - int exec_bsize; /* Uninitialised data (bss) */ - int exec_entry; /* Address to start executing */ - int exec_flags; /* loader flags */ - int exec_bfill; /* initialisation value for bss */ -}; - -/* Oh, the things people do to avoid casts. Shame it'll break with gcc's - * new aliasing rules really. - */ -union name_pt { - char * n_name; - unsigned int n_strx; -}; - -/* The Space Dictionary */ -struct space_dictionary_record { - union name_pt name; /* index to subspace name */ - unsigned int is_loadable :1; /* loadable */ - unsigned int is_defined :1; /* defined within file */ - unsigned int is_private :1; /* not sharable */ - unsigned int has_intermediate_code :1; /* contains intermediate code */ - unsigned int is_tspecific :1; /* thread specific */ - unsigned int reserved :11; /* for future expansion */ - unsigned int sort_key :8; /* for linker */ - unsigned int reserved2 :8; /* for future expansion */ - - int space_number; /* index */ - int subspace_index; /* index into subspace dict */ - unsigned int subspace_quantity; /* number of subspaces */ - int loader_fix_index; /* for loader */ - unsigned int loader_fix_quantity; /* for loader */ - int init_pointer_index; /* data pointer array index */ - unsigned int init_pointer_quantity; /* number of data pointers */ -}; - -/* The Subspace Dictionary */ -struct subspace_dictionary_record { - int space_index; - unsigned int access_control_bits :7; - unsigned int memory_resident :1; - unsigned int dup_common :1; - unsigned int is_common :1; - unsigned int quadrant :2; - unsigned int initially_frozen :1; - unsigned int is_first :1; - unsigned int code_only :1; - unsigned int sort_key :8; - unsigned int replicate_init :1; - unsigned int continuation :1; - unsigned int is_tspecific :1; - unsigned int is_comdat :1; - unsigned int reserved :4; - - int file_loc_init_value; - unsigned int initialization_length; - unsigned int subspace_start; - unsigned int subspace_length; - - unsigned int reserved2 :5; - unsigned int alignment :27; - - union name_pt name; - int fixup_request_index; - unsigned int fixup_request_quantity; -}; - -#endif /* _LINUX_SOM_H */ diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c index c347e3ce3a55..b7d6b3a721b1 100644 --- a/kernel/power/suspend.c +++ b/kernel/power/suspend.c @@ -37,7 +37,9 @@ const char *pm_states[PM_SUSPEND_MAX]; static const struct platform_suspend_ops *suspend_ops; static const struct platform_freeze_ops *freeze_ops; static DECLARE_WAIT_QUEUE_HEAD(suspend_freeze_wait_head); -static bool suspend_freeze_wake; + +enum freeze_state __read_mostly suspend_freeze_state; +static DEFINE_SPINLOCK(suspend_freeze_lock); void freeze_set_ops(const struct platform_freeze_ops *ops) { @@ -48,22 +50,49 @@ void freeze_set_ops(const struct platform_freeze_ops *ops) static void freeze_begin(void) { - suspend_freeze_wake = false; + suspend_freeze_state = FREEZE_STATE_NONE; } static void freeze_enter(void) { - cpuidle_use_deepest_state(true); + spin_lock_irq(&suspend_freeze_lock); + if (pm_wakeup_pending()) + goto out; + + suspend_freeze_state = FREEZE_STATE_ENTER; + spin_unlock_irq(&suspend_freeze_lock); + + get_online_cpus(); cpuidle_resume(); - wait_event(suspend_freeze_wait_head, suspend_freeze_wake); + + /* Push all the CPUs into the idle loop. */ + wake_up_all_idle_cpus(); + pr_debug("PM: suspend-to-idle\n"); + /* Make the current CPU wait so it can enter the idle loop too. */ + wait_event(suspend_freeze_wait_head, + suspend_freeze_state == FREEZE_STATE_WAKE); + pr_debug("PM: resume from suspend-to-idle\n"); + cpuidle_pause(); - cpuidle_use_deepest_state(false); + put_online_cpus(); + + spin_lock_irq(&suspend_freeze_lock); + + out: + suspend_freeze_state = FREEZE_STATE_NONE; + spin_unlock_irq(&suspend_freeze_lock); } void freeze_wake(void) { - suspend_freeze_wake = true; - wake_up(&suspend_freeze_wait_head); + unsigned long flags; + + spin_lock_irqsave(&suspend_freeze_lock, flags); + if (suspend_freeze_state > FREEZE_STATE_NONE) { + suspend_freeze_state = FREEZE_STATE_WAKE; + wake_up(&suspend_freeze_wait_head); + } + spin_unlock_irqrestore(&suspend_freeze_lock, flags); } EXPORT_SYMBOL_GPL(freeze_wake); diff --git a/kernel/sched/idle.c b/kernel/sched/idle.c index aaf1c1d5cf5d..94b2d7b88a27 100644 --- a/kernel/sched/idle.c +++ b/kernel/sched/idle.c @@ -7,6 +7,7 @@ #include <linux/tick.h> #include <linux/mm.h> #include <linux/stackprotector.h> +#include <linux/suspend.h> #include <asm/tlb.h> @@ -105,6 +106,21 @@ static void cpuidle_idle_call(void) rcu_idle_enter(); /* + * Suspend-to-idle ("freeze") is a system state in which all user space + * has been frozen, all I/O devices have been suspended and the only + * activity happens here and in iterrupts (if any). In that case bypass + * the cpuidle governor and go stratight for the deepest idle state + * available. Possibly also suspend the local tick and the entire + * timekeeping to prevent timer interrupts from kicking us out of idle + * until a proper wakeup interrupt happens. + */ + if (idle_should_freeze()) { + cpuidle_enter_freeze(); + local_irq_enable(); + goto exit_idle; + } + + /* * Ask the cpuidle framework to choose a convenient idle state. * Fall back to the default arch idle method on errors. */ diff --git a/kernel/time/tick-common.c b/kernel/time/tick-common.c index 7efeedf53ebd..f7c515595b42 100644 --- a/kernel/time/tick-common.c +++ b/kernel/time/tick-common.c @@ -394,6 +394,56 @@ void tick_resume(void) } } +static DEFINE_RAW_SPINLOCK(tick_freeze_lock); +static unsigned int tick_freeze_depth; + +/** + * tick_freeze - Suspend the local tick and (possibly) timekeeping. + * + * Check if this is the last online CPU executing the function and if so, + * suspend timekeeping. Otherwise suspend the local tick. + * + * Call with interrupts disabled. Must be balanced with %tick_unfreeze(). + * Interrupts must not be enabled before the subsequent %tick_unfreeze(). + */ +void tick_freeze(void) +{ + raw_spin_lock(&tick_freeze_lock); + + tick_freeze_depth++; + if (tick_freeze_depth == num_online_cpus()) { + timekeeping_suspend(); + } else { + tick_suspend(); + tick_suspend_broadcast(); + } + + raw_spin_unlock(&tick_freeze_lock); +} + +/** + * tick_unfreeze - Resume the local tick and (possibly) timekeeping. + * + * Check if this is the first CPU executing the function and if so, resume + * timekeeping. Otherwise resume the local tick. + * + * Call with interrupts disabled. Must be balanced with %tick_freeze(). + * Interrupts must not be enabled after the preceding %tick_freeze(). + */ +void tick_unfreeze(void) +{ + raw_spin_lock(&tick_freeze_lock); + + if (tick_freeze_depth == num_online_cpus()) + timekeeping_resume(); + else + tick_resume(); + + tick_freeze_depth--; + + raw_spin_unlock(&tick_freeze_lock); +} + /** * tick_init - initialize the tick control */ diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index b124af259800..91db94136c10 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -230,9 +230,7 @@ static inline s64 timekeeping_get_ns_raw(struct timekeeper *tk) /** * update_fast_timekeeper - Update the fast and NMI safe monotonic timekeeper. - * @tk: The timekeeper from which we take the update - * @tkf: The fast timekeeper to update - * @tbase: The time base for the fast timekeeper (mono/raw) + * @tkr: Timekeeping readout base from which we take the update * * We want to use this from any context including NMI and tracing / * instrumenting the timekeeping code itself. @@ -244,11 +242,11 @@ static inline s64 timekeeping_get_ns_raw(struct timekeeper *tk) * smp_wmb(); <- Ensure that the last base[1] update is visible * tkf->seq++; * smp_wmb(); <- Ensure that the seqcount update is visible - * update(tkf->base[0], tk); + * update(tkf->base[0], tkr); * smp_wmb(); <- Ensure that the base[0] update is visible * tkf->seq++; * smp_wmb(); <- Ensure that the seqcount update is visible - * update(tkf->base[1], tk); + * update(tkf->base[1], tkr); * * The reader side does: * @@ -269,7 +267,7 @@ static inline s64 timekeeping_get_ns_raw(struct timekeeper *tk) * slightly wrong timestamp (a few nanoseconds). See * @ktime_get_mono_fast_ns. */ -static void update_fast_timekeeper(struct timekeeper *tk) +static void update_fast_timekeeper(struct tk_read_base *tkr) { struct tk_read_base *base = tk_fast_mono.base; @@ -277,7 +275,7 @@ static void update_fast_timekeeper(struct timekeeper *tk) raw_write_seqcount_latch(&tk_fast_mono.seq); /* Update base[0] */ - memcpy(base, &tk->tkr, sizeof(*base)); + memcpy(base, tkr, sizeof(*base)); /* Force readers back to base[0] */ raw_write_seqcount_latch(&tk_fast_mono.seq); @@ -334,6 +332,35 @@ u64 notrace ktime_get_mono_fast_ns(void) } EXPORT_SYMBOL_GPL(ktime_get_mono_fast_ns); +/* Suspend-time cycles value for halted fast timekeeper. */ +static cycle_t cycles_at_suspend; + +static cycle_t dummy_clock_read(struct clocksource *cs) +{ + return cycles_at_suspend; +} + +/** + * halt_fast_timekeeper - Prevent fast timekeeper from accessing clocksource. + * @tk: Timekeeper to snapshot. + * + * It generally is unsafe to access the clocksource after timekeeping has been + * suspended, so take a snapshot of the readout base of @tk and use it as the + * fast timekeeper's readout base while suspended. It will return the same + * number of cycles every time until timekeeping is resumed at which time the + * proper readout base for the fast timekeeper will be restored automatically. + */ +static void halt_fast_timekeeper(struct timekeeper *tk) +{ + static struct tk_read_base tkr_dummy; + struct tk_read_base *tkr = &tk->tkr; + + memcpy(&tkr_dummy, tkr, sizeof(tkr_dummy)); + cycles_at_suspend = tkr->read(tkr->clock); + tkr_dummy.read = dummy_clock_read; + update_fast_timekeeper(&tkr_dummy); +} + #ifdef CONFIG_GENERIC_TIME_VSYSCALL_OLD static inline void update_vsyscall(struct timekeeper *tk) @@ -462,7 +489,7 @@ static void timekeeping_update(struct timekeeper *tk, unsigned int action) memcpy(&shadow_timekeeper, &tk_core.timekeeper, sizeof(tk_core.timekeeper)); - update_fast_timekeeper(tk); + update_fast_timekeeper(&tk->tkr); } /** @@ -1170,7 +1197,7 @@ void timekeeping_inject_sleeptime64(struct timespec64 *delta) * xtime/wall_to_monotonic/jiffies/etc are * still managed by arch specific suspend/resume code. */ -static void timekeeping_resume(void) +void timekeeping_resume(void) { struct timekeeper *tk = &tk_core.timekeeper; struct clocksource *clock = tk->tkr.clock; @@ -1251,7 +1278,7 @@ static void timekeeping_resume(void) hrtimers_resume(); } -static int timekeeping_suspend(void) +int timekeeping_suspend(void) { struct timekeeper *tk = &tk_core.timekeeper; unsigned long flags; @@ -1296,6 +1323,7 @@ static int timekeeping_suspend(void) } timekeeping_update(tk, TK_MIRROR); + halt_fast_timekeeper(tk); write_seqcount_end(&tk_core.seq); raw_spin_unlock_irqrestore(&timekeeper_lock, flags); diff --git a/kernel/time/timekeeping.h b/kernel/time/timekeeping.h index adc1fc98bde3..1d91416055d5 100644 --- a/kernel/time/timekeeping.h +++ b/kernel/time/timekeeping.h @@ -16,5 +16,7 @@ extern int timekeeping_inject_offset(struct timespec *ts); extern s32 timekeeping_get_tai_offset(void); extern void timekeeping_set_tai_offset(s32 tai_offset); extern void timekeeping_clocktai(struct timespec *ts); +extern int timekeeping_suspend(void); +extern void timekeeping_resume(void); #endif diff --git a/security/keys/request_key.c b/security/keys/request_key.c index 0c7aea4dea54..486ef6fa393b 100644 --- a/security/keys/request_key.c +++ b/security/keys/request_key.c @@ -414,6 +414,7 @@ link_check_failed: link_prealloc_failed: mutex_unlock(&user->cons_lock); + key_put(key); kleave(" = %d [prelink]", ret); return ret; diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c index a0ccce4e46f8..ed94f6f836e7 100644 --- a/security/smack/smack_lsm.c +++ b/security/smack/smack_lsm.c @@ -3818,6 +3818,18 @@ static int smack_inet_conn_request(struct sock *sk, struct sk_buff *skb, } #endif /* CONFIG_IPV6 */ +#ifdef CONFIG_SECURITY_SMACK_NETFILTER + /* + * If there is a secmark use it rather than the CIPSO label. + * If there is no secmark fall back to CIPSO. + * The secmark is assumed to reflect policy better. + */ + if (skb && skb->secmark != 0) { + skp = smack_from_secid(skb->secmark); + goto access_check; + } +#endif /* CONFIG_SECURITY_SMACK_NETFILTER */ + netlbl_secattr_init(&secattr); rc = netlbl_skbuff_getattr(skb, family, &secattr); if (rc == 0) @@ -3826,6 +3838,10 @@ static int smack_inet_conn_request(struct sock *sk, struct sk_buff *skb, skp = &smack_known_huh; netlbl_secattr_destroy(&secattr); +#ifdef CONFIG_SECURITY_SMACK_NETFILTER +access_check: +#endif + #ifdef CONFIG_AUDIT smk_ad_init_net(&ad, __func__, LSM_AUDIT_DATA_NET, &net); ad.a.u.net->family = family; |