From ccdfc526a92c5ebb549a7de06adca3fd54f03c7e Mon Sep 17 00:00:00 2001 From: Paul Mundt Date: Tue, 12 Sep 2006 14:21:25 +0900 Subject: sh64: Drop deprecated ISA tuning for legacy toolchains. The original sh64 toolchains required that we tune the ISA level accordingly to not have head.S/entry.S blow up. With current toolchains, this is no longer the case, and the syntax magically changed as well, causing all current toolchains to die a horrible death. Incidentally, code generation in other parts of the kernel is now significantly complex enough that none of the older toolchains make it very far these days, so there's not even any point in preserving legacy compatability via as-option. This fixes a long-standing issue, as noted here: http://lkml.org/lkml/2005/1/5/223 Though at the time the current toolchains were too broken to make adjusting the tuning worthwhile. Signed-off-by: Paul Mundt --- arch/sh64/Makefile | 1 - 1 file changed, 1 deletion(-) (limited to 'arch') diff --git a/arch/sh64/Makefile b/arch/sh64/Makefile index 8ca57ffa2b70..ebf20043991c 100644 --- a/arch/sh64/Makefile +++ b/arch/sh64/Makefile @@ -26,7 +26,6 @@ LDFLAGS += -EB -mshelf32_linux endif # No requirements for endianess support from AFLAGS, 'as' always run through gcc -AFLAGS += -m5 -isa=sh64 -traditional CFLAGS += $(cpu-y) LDFLAGS_vmlinux += --defsym phys_stext=_stext-$(CONFIG_CACHED_MEMORY_OFFSET) \ -- cgit v1.2.3 From 21264136ce7c3c7032c42e7c2440f5d89039ca5a Mon Sep 17 00:00:00 2001 From: Paul Mundt Date: Tue, 12 Sep 2006 14:36:46 +0900 Subject: sh64: Trivial build fixes. While we've been sorting out the toolchain fiasco, some of the code has suffered a bit of bitrot. Building with GCC4 also brings up some more build warnings. Trivial fixes for both issues. Signed-off-by: Paul Mundt --- arch/sh64/mach-cayman/setup.c | 6 ++++-- arch/sh64/mm/ioremap.c | 4 +++- drivers/serial/sh-sci.c | 4 ++-- include/asm-sh64/byteorder.h | 4 ++-- include/asm-sh64/dma-mapping.h | 16 ++++++++++++---- include/asm-sh64/io.h | 7 +++++++ include/asm-sh64/ptrace.h | 2 +- include/asm-sh64/system.h | 2 +- include/asm-sh64/uaccess.h | 19 +++++++------------ 9 files changed, 39 insertions(+), 25 deletions(-) (limited to 'arch') diff --git a/arch/sh64/mach-cayman/setup.c b/arch/sh64/mach-cayman/setup.c index d84895dda3cd..3ed87cd059d0 100644 --- a/arch/sh64/mach-cayman/setup.c +++ b/arch/sh64/mach-cayman/setup.c @@ -112,8 +112,10 @@ struct resource io_resources[] = { }; struct resource kram_resources[] = { - { "Kernel code", 0, 0 }, /* These must be last in the array */ - { "Kernel data", 0, 0 } /* These must be last in the array */ + /* These must be last in the array */ + { .name = "Kernel code", .start = 0, .end = 0 }, + /* These must be last in the array */ + { .name = "Kernel data", .start = 0, .end = 0 } }; struct resource xram_resources[] = { diff --git a/arch/sh64/mm/ioremap.c b/arch/sh64/mm/ioremap.c index fb1866fa2c9d..80c56754f513 100644 --- a/arch/sh64/mm/ioremap.c +++ b/arch/sh64/mm/ioremap.c @@ -449,7 +449,9 @@ ioremap_proc_info(char *buf, char **start, off_t fpos, int length, int *eof, if (p + 32 >= e) /* Better than nothing */ break; if ((nm = r->name) == 0) nm = "???"; - p += sprintf(p, "%08lx-%08lx: %s\n", r->start, r->end, nm); + p += sprintf(p, "%08lx-%08lx: %s\n", + (unsigned long)r->start, + (unsigned long)r->end, nm); } return p-buf; diff --git a/drivers/serial/sh-sci.c b/drivers/serial/sh-sci.c index 301573373c30..cbede06cac27 100644 --- a/drivers/serial/sh-sci.c +++ b/drivers/serial/sh-sci.c @@ -1579,7 +1579,7 @@ static int __init serial_console_setup(struct console *co, char *options) h8300_sci_enable(port, sci_enable); #endif #elif defined(CONFIG_SUPERH64) - port->uartclk = current_cpu_info.module_clock * 16; + port->uartclk = current_cpu_data.module_clock * 16; #else { struct clk *clk = clk_get("module_clk"); @@ -1720,7 +1720,7 @@ static int __init sci_init(void) #if defined(__H8300H__) || defined(__H8300S__) sciport->port.uartclk = CONFIG_CPU_CLOCK; #elif defined(CONFIG_SUPERH64) - sciport->port.uartclk = current_cpu_info.module_clock * 16; + sciport->port.uartclk = current_cpu_data.module_clock * 16; #else struct clk *clk = clk_get("module_clk"); sciport->port.uartclk = clk_get_rate(clk) * 16; diff --git a/include/asm-sh64/byteorder.h b/include/asm-sh64/byteorder.h index f602ebe334eb..7419d78820ee 100644 --- a/include/asm-sh64/byteorder.h +++ b/include/asm-sh64/byteorder.h @@ -14,7 +14,7 @@ #include -static __inline__ __const__ __u32 ___arch__swab32(__u32 x) +static inline __attribute_const__ __u32 ___arch__swab32(__u32 x) { __asm__("byterev %0, %0\n\t" "shari %0, 32, %0" @@ -23,7 +23,7 @@ static __inline__ __const__ __u32 ___arch__swab32(__u32 x) return x; } -static __inline__ __const__ __u16 ___arch__swab16(__u16 x) +static inline __attribute_const__ __u16 ___arch__swab16(__u16 x) { __asm__("byterev %0, %0\n\t" "shari %0, 48, %0" diff --git a/include/asm-sh64/dma-mapping.h b/include/asm-sh64/dma-mapping.h index a74a49e47922..68e27a8fca31 100644 --- a/include/asm-sh64/dma-mapping.h +++ b/include/asm-sh64/dma-mapping.h @@ -126,22 +126,30 @@ static inline void dma_sync_sg(struct device *dev, struct scatterlist *sg, static inline void dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, size_t size, enum dma_data_direction dir) - __attribute__ ((alias("dma_sync_single"))); +{ + dma_sync_single(dev, dma_handle, size, dir); +} static inline void dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle, size_t size, enum dma_data_direction dir) - __attribute__ ((alias("dma_sync_single"))); +{ + dma_sync_single(dev, dma_handle, size, dir); +} static inline void dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems, enum dma_data_direction dir) - __attribute__ ((alias("dma_sync_sg"))); +{ + dma_sync_sg(dev, sg, nelems, dir); +} static inline void dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nelems, enum dma_data_direction dir) - __attribute__ ((alias("dma_sync_sg"))); +{ + dma_sync_sg(dev, sg, nelems, dir); +} static inline int dma_get_cache_alignment(void) { diff --git a/include/asm-sh64/io.h b/include/asm-sh64/io.h index dee4f77929a4..252fedbb6621 100644 --- a/include/asm-sh64/io.h +++ b/include/asm-sh64/io.h @@ -123,6 +123,13 @@ void insw(unsigned long port, void *addr, unsigned long count); void outsl(unsigned long port, const void *addr, unsigned long count); void insl(unsigned long port, void *addr, unsigned long count); +#define __raw_readb readb +#define __raw_readw readw +#define __raw_readl readl +#define __raw_writeb writeb +#define __raw_writew writew +#define __raw_writel writel + void memcpy_toio(void __iomem *to, const void *from, long count); void memcpy_fromio(void *to, void __iomem *from, long count); diff --git a/include/asm-sh64/ptrace.h b/include/asm-sh64/ptrace.h index 56190f521587..a6d4da519db6 100644 --- a/include/asm-sh64/ptrace.h +++ b/include/asm-sh64/ptrace.h @@ -28,7 +28,7 @@ struct pt_regs { #ifdef __KERNEL__ #define user_mode(regs) (((regs)->sr & 0x40000000)==0) #define instruction_pointer(regs) ((regs)->pc) -#define profile_pc(regs) instruction_pointer(regs) +#define profile_pc(regs) ((unsigned long)instruction_pointer(regs)) extern void show_regs(struct pt_regs *); #endif diff --git a/include/asm-sh64/system.h b/include/asm-sh64/system.h index 87ef6f1ad5a4..b1598c26fcb0 100644 --- a/include/asm-sh64/system.h +++ b/include/asm-sh64/system.h @@ -64,7 +64,7 @@ extern void __xchg_called_with_bad_pointer(void); #define smp_read_barrier_depends() do { } while (0) #endif /* CONFIG_SMP */ -#define set_rmb(var, value) do { xchg(&var, value); } while (0) +#define set_rmb(var, value) do { (void)xchg(&var, value); } while (0) #define set_mb(var, value) set_rmb(var, value) /* Interrupt Control */ diff --git a/include/asm-sh64/uaccess.h b/include/asm-sh64/uaccess.h index f4936d8fa617..644c67b65f94 100644 --- a/include/asm-sh64/uaccess.h +++ b/include/asm-sh64/uaccess.h @@ -128,25 +128,20 @@ do { \ #define __get_user_nocheck(x,ptr,size) \ ({ \ - long __gu_addr = (long)(ptr); \ - long __gu_err; \ - __typeof(*(ptr)) __gu_val; \ - __asm__ ("":"=r" (__gu_val)); \ - __asm__ ("":"=r" (__gu_err)); \ - __get_user_size((void *)&__gu_val, __gu_addr, (size), __gu_err); \ - (x) = (__typeof__(*(ptr))) __gu_val; \ + long __gu_err, __gu_val; \ + __get_user_size((void *)&__gu_val, (long)(ptr), \ + (size), __gu_err); \ + (x) = (__typeof__(*(ptr)))__gu_val; \ __gu_err; \ }) #define __get_user_check(x,ptr,size) \ ({ \ long __gu_addr = (long)(ptr); \ - long __gu_err = -EFAULT; \ - __typeof(*(ptr)) __gu_val; \ - __asm__ ("":"=r" (__gu_val)); \ - __asm__ ("":"=r" (__gu_err)); \ + long __gu_err = -EFAULT, __gu_val; \ if (__access_ok(__gu_addr, (size))) \ - __get_user_size((void *)&__gu_val, __gu_addr, (size), __gu_err); \ + __get_user_size((void *)&__gu_val, __gu_addr, \ + (size), __gu_err); \ (x) = (__typeof__(*(ptr))) __gu_val; \ __gu_err; \ }) -- cgit v1.2.3 From 1bb99a649af92e53ed7391afaf6c2d45a6f57b42 Mon Sep 17 00:00:00 2001 From: Paul Mundt Date: Tue, 12 Sep 2006 14:40:09 +0900 Subject: sh64: Add a sane pm_power_off implementation. sh64 wasn't providing a sensible pm_power_off(), add one, and just wrap it to machine_power_off, which already does the right thing. Signed-off-by: Paul Mundt --- arch/sh64/kernel/process.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'arch') diff --git a/arch/sh64/kernel/process.c b/arch/sh64/kernel/process.c index dba8e14013b6..db475b7833fb 100644 --- a/arch/sh64/kernel/process.c +++ b/arch/sh64/kernel/process.c @@ -355,6 +355,9 @@ void machine_power_off(void) enter_deep_standby(); } +void (*pm_power_off)(void) = machine_power_off; +EXPORT_SYMBOL(pm_power_off); + void show_regs(struct pt_regs * regs) { unsigned long long ah, al, bh, bl, ch, cl; -- cgit v1.2.3 From e65e1fc2d24b09c496af76e9c5253ac30b300a89 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Tue, 12 Sep 2006 03:04:40 -0400 Subject: [PATCH] syscall class hookup for all normal targets Take default arch/*/kernel/audit.c to lib/, have those with special needs (== biarch) define AUDIT_ARCH in their Kconfig. Signed-off-by: Al Viro --- arch/i386/kernel/Makefile | 1 - arch/i386/kernel/audit.c | 51 --------------------------------------------- arch/ia64/Kconfig | 4 ++++ arch/powerpc/Kconfig | 4 ++++ arch/s390/Kconfig | 4 ++++ arch/x86_64/Kconfig | 4 ++++ lib/Kconfig | 5 +++++ lib/Makefile | 1 + lib/audit.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++ 9 files changed, 75 insertions(+), 52 deletions(-) delete mode 100644 arch/i386/kernel/audit.c create mode 100644 lib/audit.c (limited to 'arch') diff --git a/arch/i386/kernel/Makefile b/arch/i386/kernel/Makefile index ab98fc21a541..5427a842e841 100644 --- a/arch/i386/kernel/Makefile +++ b/arch/i386/kernel/Makefile @@ -39,7 +39,6 @@ obj-$(CONFIG_VM86) += vm86.o obj-$(CONFIG_EARLY_PRINTK) += early_printk.o obj-$(CONFIG_HPET_TIMER) += hpet.o obj-$(CONFIG_K8_NB) += k8.o -obj-$(CONFIG_AUDIT) += audit.o EXTRA_AFLAGS := -traditional diff --git a/arch/i386/kernel/audit.c b/arch/i386/kernel/audit.c deleted file mode 100644 index 3b97cff41549..000000000000 --- a/arch/i386/kernel/audit.c +++ /dev/null @@ -1,51 +0,0 @@ -#include -#include -#include -#include - -static unsigned dir_class[] = { -#include -~0U -}; - -static unsigned read_class[] = { -#include -~0U -}; - -static unsigned write_class[] = { -#include -~0U -}; - -static unsigned chattr_class[] = { -#include -~0U -}; - -int audit_classify_syscall(int abi, unsigned syscall) -{ - switch(syscall) { - case __NR_open: - return 2; - case __NR_openat: - return 3; - case __NR_socketcall: - return 4; - case __NR_execve: - return 5; - default: - return 0; - } -} - -static int __init audit_classes_init(void) -{ - audit_register_class(AUDIT_CLASS_WRITE, write_class); - audit_register_class(AUDIT_CLASS_READ, read_class); - audit_register_class(AUDIT_CLASS_DIR_WRITE, dir_class); - audit_register_class(AUDIT_CLASS_CHATTR, chattr_class); - return 0; -} - -__initcall(audit_classes_init); diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig index 674de8943478..db274da7dba1 100644 --- a/arch/ia64/Kconfig +++ b/arch/ia64/Kconfig @@ -75,6 +75,10 @@ config DMA_IS_NORMAL depends on IA64_SGI_SN2 default y +config AUDIT_ARCH + bool + default y + choice prompt "System type" default IA64_GENERIC diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 4d4b6fb156e1..694b0c63ee50 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -95,6 +95,10 @@ config GENERIC_TBSYNC default y if PPC32 && SMP default n +config AUDIT_ARCH + bool + default y + config DEFAULT_UIMAGE bool help diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig index ae071a11ce71..2f4f70c4dbb2 100644 --- a/arch/s390/Kconfig +++ b/arch/s390/Kconfig @@ -118,6 +118,10 @@ config SYSVIPC_COMPAT depends on COMPAT && SYSVIPC default y +config AUDIT_ARCH + bool + default y + comment "Code generation options" choice diff --git a/arch/x86_64/Kconfig b/arch/x86_64/Kconfig index 28df7d88ce2c..6cd4878625f1 100644 --- a/arch/x86_64/Kconfig +++ b/arch/x86_64/Kconfig @@ -85,6 +85,10 @@ config DMI bool default y +config AUDIT_ARCH + bool + default y + source "init/Kconfig" diff --git a/lib/Kconfig b/lib/Kconfig index f6299342b882..734ce95a93d1 100644 --- a/lib/Kconfig +++ b/lib/Kconfig @@ -38,6 +38,11 @@ config LIBCRC32C require M here. See Castagnoli93. Module will be libcrc32c. +config AUDIT_GENERIC + bool + depends on AUDIT && !AUDIT_ARCH + default y + # # compression support is select'ed if needed # diff --git a/lib/Makefile b/lib/Makefile index be9719ae82d0..ef1d37afbbb6 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -49,6 +49,7 @@ obj-$(CONFIG_TEXTSEARCH_KMP) += ts_kmp.o obj-$(CONFIG_TEXTSEARCH_BM) += ts_bm.o obj-$(CONFIG_TEXTSEARCH_FSM) += ts_fsm.o obj-$(CONFIG_SMP) += percpu_counter.o +obj-$(CONFIG_AUDIT_GENERIC) += audit.o obj-$(CONFIG_SWIOTLB) += swiotlb.o diff --git a/lib/audit.c b/lib/audit.c new file mode 100644 index 000000000000..8c21625ef938 --- /dev/null +++ b/lib/audit.c @@ -0,0 +1,53 @@ +#include +#include +#include +#include + +static unsigned dir_class[] = { +#include +~0U +}; + +static unsigned read_class[] = { +#include +~0U +}; + +static unsigned write_class[] = { +#include +~0U +}; + +static unsigned chattr_class[] = { +#include +~0U +}; + +int audit_classify_syscall(int abi, unsigned syscall) +{ + switch(syscall) { + case __NR_open: + return 2; + case __NR_openat: + return 3; +#ifdef __NR_socketcall + case __NR_socketcall: + return 4; +#endif + case __NR_execve: + return 5; + default: + return 0; + } +} + +static int __init audit_classes_init(void) +{ + audit_register_class(AUDIT_CLASS_WRITE, write_class); + audit_register_class(AUDIT_CLASS_READ, read_class); + audit_register_class(AUDIT_CLASS_DIR_WRITE, dir_class); + audit_register_class(AUDIT_CLASS_CHATTR, chattr_class); + return 0; +} + +__initcall(audit_classes_init); -- cgit v1.2.3 From f6bc0c1c5b0fe393efaf922e01887c33b35f2910 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Tue, 12 Sep 2006 02:59:45 -0400 Subject: [PATCH] sparc64 audit syscall classes hookup ... that should do it for all targets; the only remaining issues are mips (currently treated as non-biarch) and handling of other OS emulations (OSF/SunOS/Solaris/???). The latter would need to be assigned new AUDIT_ARCH_... ABI numbers anyway... Signed-off-by: Al Viro --- arch/sparc64/Kconfig | 4 +++ arch/sparc64/kernel/Makefile | 3 ++ arch/sparc64/kernel/audit.c | 66 ++++++++++++++++++++++++++++++++++++++ arch/sparc64/kernel/compat_audit.c | 37 +++++++++++++++++++++ 4 files changed, 110 insertions(+) create mode 100644 arch/sparc64/kernel/audit.c create mode 100644 arch/sparc64/kernel/compat_audit.c (limited to 'arch') diff --git a/arch/sparc64/Kconfig b/arch/sparc64/Kconfig index 8a36ba8868db..8d8ca716f7a7 100644 --- a/arch/sparc64/Kconfig +++ b/arch/sparc64/Kconfig @@ -34,6 +34,10 @@ config ARCH_MAY_HAVE_PC_FDC bool default y +config AUDIT_ARCH + bool + default y + choice prompt "Kernel page size" default SPARC64_PAGE_SIZE_8KB diff --git a/arch/sparc64/kernel/Makefile b/arch/sparc64/kernel/Makefile index 86c9fe3f3e4a..e1eabebaed39 100644 --- a/arch/sparc64/kernel/Makefile +++ b/arch/sparc64/kernel/Makefile @@ -25,6 +25,9 @@ obj-$(CONFIG_MODULES) += module.o obj-$(CONFIG_US3_FREQ) += us3_cpufreq.o obj-$(CONFIG_US2E_FREQ) += us2e_cpufreq.o obj-$(CONFIG_KPROBES) += kprobes.o +obj-$(CONFIG_AUDIT) += audit.o +obj-$(CONFIG_AUDIT)$(CONFIG_SPARC32_COMPAT) += compat_audit.o +obj-y += $(obj-yy) ifdef CONFIG_SUNOS_EMUL obj-y += sys_sunos32.o sunos_ioctl32.o diff --git a/arch/sparc64/kernel/audit.c b/arch/sparc64/kernel/audit.c new file mode 100644 index 000000000000..aef19cc27072 --- /dev/null +++ b/arch/sparc64/kernel/audit.c @@ -0,0 +1,66 @@ +#include +#include +#include +#include + +static unsigned dir_class[] = { +#include +~0U +}; + +static unsigned read_class[] = { +#include +~0U +}; + +static unsigned write_class[] = { +#include +~0U +}; + +static unsigned chattr_class[] = { +#include +~0U +}; + +int audit_classify_syscall(int abi, unsigned syscall) +{ +#ifdef CONFIG_SPARC32_COMPAT + extern int sparc32_classify_syscall(unsigned); + if (abi == AUDIT_ARCH_SPARC) + return sparc32_classify_syscall(syscall); +#endif + switch(syscall) { + case __NR_open: + return 2; + case __NR_openat: + return 3; + case __NR_socketcall: + return 4; + case __NR_execve: + return 5; + default: + return 0; + } +} + +static int __init audit_classes_init(void) +{ +#ifdef CONFIG_SPARC32_COMPAT + extern __u32 sparc32_dir_class[]; + extern __u32 sparc32_write_class[]; + extern __u32 sparc32_read_class[]; + extern __u32 sparc32_chattr_class[]; + audit_register_class(AUDIT_CLASS_WRITE_32, sparc32_write_class); + audit_register_class(AUDIT_CLASS_READ_32, sparc32_read_class); + audit_register_class(AUDIT_CLASS_DIR_WRITE_32, sparc32_dir_class); + audit_register_class(AUDIT_CLASS_CHATTR_32, sparc32_chattr_class); +#endif + audit_register_class(AUDIT_CLASS_WRITE, write_class); + audit_register_class(AUDIT_CLASS_READ, read_class); + audit_register_class(AUDIT_CLASS_DIR_WRITE, dir_class); + audit_register_class(AUDIT_CLASS_CHATTR, chattr_class); + return 0; +} + +__initcall(audit_classes_init); diff --git a/arch/sparc64/kernel/compat_audit.c b/arch/sparc64/kernel/compat_audit.c new file mode 100644 index 000000000000..cca96c91b780 --- /dev/null +++ b/arch/sparc64/kernel/compat_audit.c @@ -0,0 +1,37 @@ +#include + +unsigned sparc32_dir_class[] = { +#include +~0U +}; + +unsigned sparc32_chattr_class[] = { +#include +~0U +}; + +unsigned sparc32_write_class[] = { +#include +~0U +}; + +unsigned sparc32_read_class[] = { +#include +~0U +}; + +int sparc32_classify_syscall(unsigned syscall) +{ + switch(syscall) { + case __NR_open: + return 2; + case __NR_openat: + return 3; + case __NR_socketcall: + return 4; + case __NR_execve: + return 5; + default: + return 1; + } +} -- cgit v1.2.3