diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7785.c b/arch/sh/kernel/cpu/sh4a/clock-sh7785.c index 805535aa505e42dbaddefb5f0ab2681f39a91922..27fa81bef6a07f4a4b1cfceb525dba54ed706fb1 100644 --- a/arch/sh/kernel/cpu/sh4a/clock-sh7785.c +++ b/arch/sh/kernel/cpu/sh4a/clock-sh7785.c @@ -26,7 +26,7 @@ static int pfc_divisors[] = { 1, 1, 1, 1, 1, 1, 1, 18, static void master_clk_init(struct clk *clk) { - clk->rate *= 36; + clk->rate *= pfc_divisors[ctrl_inl(FRQMR1) & 0x000f]; } static struct clk_ops sh7785_master_clk_ops = { diff --git a/arch/sh/kernel/entry-common.S b/arch/sh/kernel/entry-common.S index 926b2e7b11c13a602fcce925c07439e1cdb09229..718bd2356b34bf109a9608d0b6b7d20549dc310a 100644 --- a/arch/sh/kernel/entry-common.S +++ b/arch/sh/kernel/entry-common.S @@ -1,9 +1,6 @@ -/* $Id: entry.S,v 1.37 2004/06/11 13:02:46 doyu Exp $ - * - * linux/arch/sh/entry.S - * +/* * Copyright (C) 1999, 2000, 2002 Niibe Yutaka - * Copyright (C) 2003 Paul Mundt + * Copyright (C) 2003 - 2008 Paul Mundt * * 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 @@ -262,6 +259,7 @@ __restore_all: .align 2 syscall_badsys: ! Bad syscall number + get_current_thread_info r8, r0 mov #-ENOSYS, r0 bra resume_userspace mov.l r0, @(OFF_R0,r15) ! Return value @@ -281,7 +279,9 @@ debug_trap: mov.l 1f, r8 add r0, r8 mov.l @r8, r8 - jmp @r8 + jsr @r8 + nop + bra __restore_all nop .align 2 diff --git a/arch/sh/kernel/head_32.S b/arch/sh/kernel/head_32.S index d67d7ed09f2242283fb5cf666149a5c7cb8d0e4b..ae0a382a82ebbf0f18d54767413c3d31ff87685a 100644 --- a/arch/sh/kernel/head_32.S +++ b/arch/sh/kernel/head_32.S @@ -30,8 +30,8 @@ ENTRY(empty_zero_page) .long 0 /* RAMDISK_FLAGS */ .long 0x0200 /* ORIG_ROOT_DEV */ .long 1 /* LOADER_TYPE */ - .long 0x00360000 /* INITRD_START */ - .long 0x000a0000 /* INITRD_SIZE */ + .long 0x00000000 /* INITRD_START */ + .long 0x00000000 /* INITRD_SIZE */ #ifdef CONFIG_32BIT .long 0x53453f00 + 32 /* "SE?" = 32 bit */ #else diff --git a/arch/sh/kernel/kgdb_stub.c b/arch/sh/kernel/kgdb_stub.c index 832641bbd47d0c47465f51beac0a779696f0067a..bf8ac4c716402c2b37178a8df448d318dd60af1c 100644 --- a/arch/sh/kernel/kgdb_stub.c +++ b/arch/sh/kernel/kgdb_stub.c @@ -274,8 +274,7 @@ static char *mem_to_hex(const char *mem, char *buf, const int count) } for (i = 0; i < count; i++) { ch = *mem++; - *buf++ = highhex(ch); - *buf++ = lowhex(ch); + buf = pack_hex_byte(buf, ch); } *buf = 0; return (buf); @@ -427,8 +426,8 @@ static void put_packet(char *buffer) /* '#' Separator, put high and low components of checksum */ put_debug_char('#'); - put_debug_char(highhex(checksum)); - put_debug_char(lowhex(checksum)); + put_debug_char(hex_asc_hi(checksum)); + put_debug_char(hex_asc_lo(checksum)); } while ((get_debug_char()) != '+'); /* While no ack */ } @@ -650,8 +649,8 @@ static void undo_single_step(void) static void send_signal_msg(const int signum) { out_buffer[0] = 'S'; - out_buffer[1] = highhex(signum); - out_buffer[2] = lowhex(signum); + out_buffer[1] = hex_asc_hi(signum); + out_buffer[2] = hex_asc_lo(signum); out_buffer[3] = 0; put_packet(out_buffer); } diff --git a/arch/sh/kernel/setup.c b/arch/sh/kernel/setup.c index 516bde9c50fad25bbebbf7b00e9dcd3cc23577f2..bca2bbc575dbe034e7c0ded352c437997ee8308d 100644 --- a/arch/sh/kernel/setup.c +++ b/arch/sh/kernel/setup.c @@ -292,6 +292,17 @@ void __init setup_arch(char **cmdline_p) ROOT_DEV = old_decode_dev(ORIG_ROOT_DEV); + printk(KERN_NOTICE "Boot params:\n" + "... MOUNT_ROOT_RDONLY - %08lx\n" + "... RAMDISK_FLAGS - %08lx\n" + "... ORIG_ROOT_DEV - %08lx\n" + "... LOADER_TYPE - %08lx\n" + "... INITRD_START - %08lx\n" + "... INITRD_SIZE - %08lx\n", + MOUNT_ROOT_RDONLY, RAMDISK_FLAGS, + ORIG_ROOT_DEV, LOADER_TYPE, + INITRD_START, INITRD_SIZE); + #ifdef CONFIG_BLK_DEV_RAM rd_image_start = RAMDISK_FLAGS & RAMDISK_IMAGE_START_MASK; rd_prompt = ((RAMDISK_FLAGS & RAMDISK_PROMPT_FLAG) != 0); diff --git a/arch/sh/kernel/traps.c b/arch/sh/kernel/traps.c index a3bdc68ef02c75adcdbfaca4b5d61c3218c60521..438f1ebcc45330cc0a5d320fee82a4b6840bcf1d 100644 --- a/arch/sh/kernel/traps.c +++ b/arch/sh/kernel/traps.c @@ -4,6 +4,7 @@ #include #include #include +#include #include #ifdef CONFIG_BUG @@ -21,7 +22,14 @@ static void handle_BUG(struct pt_regs *regs) int is_valid_bugaddr(unsigned long addr) { - return addr >= PAGE_OFFSET; + unsigned short opcode; + + if (addr < PAGE_OFFSET) + return 0; + if (probe_kernel_address((u16 *)addr, opcode)) + return 0; + + return opcode == TRAPA_BUG_OPCODE; } #endif diff --git a/arch/sh/lib/memcpy-sh4.S b/arch/sh/lib/memcpy-sh4.S index 560bc17eebdd6748d1e49e40730a476b3cbe1c3a..459fa92a7c5311b02c1e1f21c74536eb27432ed2 100644 --- a/arch/sh/lib/memcpy-sh4.S +++ b/arch/sh/lib/memcpy-sh4.S @@ -126,10 +126,10 @@ mov.l r3,@-r0 ! 30 LS #else -3: mov r1,r3 ! OPQR +3: mov r7,r3 ! OPQR shlr8 r3 ! xOPQ - mov.l @(r0,r5),r1 ! KLMN - mov r1,r6 + mov.l @(r0,r5),r7 ! KLMN + mov r7,r6 shll16 r6 shll8 r6 ! Nxxx or r6,r3 ! NOPQ @@ -733,24 +733,24 @@ ENTRY(memcpy) movca.l r0,@r1 ! 40 LS (latency=3-7) add #-0x1c, r1 ! 50 EX - mov.l r3, @(0x1c,r1) ! 33 LS + mov.l r3, @(0x18,r1) ! 33 LS xtrct r11, r10 ! 48 EX - mov.l r6, @(0x18,r1) ! 33 LS + mov.l r6, @(0x14,r1) ! 33 LS xtrct r12, r11 ! 48 EX - mov.l r7, @(0x14,r1) ! 33 LS + mov.l r7, @(0x10,r1) ! 33 LS - mov.l r8, @(0x10,r1) ! 33 LS - add #-0x3e, r5 ! 50 EX + mov.l r8, @(0x0c,r1) ! 33 LS + add #-0x1e, r5 ! 50 EX - mov.l r9, @(0x0c,r1) ! 33 LS + mov.l r9, @(0x08,r1) ! 33 LS cmp/eq r2,r1 ! 54 MT - mov.l r10, @(0x08,r1) ! 33 LS + mov.l r10, @(0x04,r1) ! 33 LS bf/s 2b ! 109 BR - mov.l r11, @(0x04,r1) ! 33 LS + mov.l r11, @(0x00,r1) ! 33 LS #endif mov.l @r15+, r12 diff --git a/drivers/serial/sh-sci.c b/drivers/serial/sh-sci.c index 8fdafc27fce8a3bccfcfb840d288c30d7a34857f..ce6ee92b3a1b32fa001dc79c3716ea797288d57b 100644 --- a/drivers/serial/sh-sci.c +++ b/drivers/serial/sh-sci.c @@ -184,15 +184,15 @@ static void put_string(struct sci_port *sci_port, const char *buffer, int count) int h, l; c = *p++; - h = highhex(c); - l = lowhex(c); + h = hex_asc_hi(c); + l = hex_asc_lo(c); put_char(port, h); put_char(port, l); checksum += h + l; } put_char(port, '#'); - put_char(port, highhex(checksum)); - put_char(port, lowhex(checksum)); + put_char(port, hex_asc_hi(checksum)); + put_char(port, hex_asc_lo(checksum)); } while (get_char(port) != '+'); } else #endif /* CONFIG_SH_STANDARD_BIOS || CONFIG_SH_KGDB */ diff --git a/include/asm-sh/kgdb.h b/include/asm-sh/kgdb.h index 4bc8cb187d119a8d66bff3995b9f7add0d79e09d..24e42078f36fa80e780cebd92204bacb62ab3e5e 100644 --- a/include/asm-sh/kgdb.h +++ b/include/asm-sh/kgdb.h @@ -66,18 +66,4 @@ extern int setjmp(jmp_buf __jmpb); /* Forced breakpoint */ #define breakpoint() __asm__ __volatile__("trapa #0x3c") -/* Taken from sh-stub.c of GDB 4.18 */ -static const char hexchars[] = "0123456789abcdef"; - -/* Get high hex bits */ -static inline char highhex(const int x) -{ - return hexchars[(x >> 4) & 0xf]; -} - -/* Get low hex bits */ -static inline char lowhex(const int x) -{ - return hexchars[x & 0xf]; -} #endif