Commit 1edd5491 authored by Paul Mundt's avatar Paul Mundt Committed by Linus Torvalds

[PATCH] sh64: merge updates

Mostly random bugfixes and some build fixes, as well as killing off some
leftover cruft.
Signed-off-by: default avatarPaul Mundt <lethal@linux-sh.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 25fc8acb
......@@ -98,7 +98,12 @@ config BIG_ENDIAN
endchoice
config SH_FPU
bool "FPU support"
default y
config SH64_FPU_DENORM_FLUSH
depends on SH_FPU
bool "Flush floating point denorms to zero"
choice
......
......@@ -19,6 +19,13 @@ config SH64_PROC_ASIDS
config SH64_SR_WATCH
bool "Debug: set SR.WATCH to enable hardware watchpoints and trace"
config POOR_MANS_STRACE
bool "Debug: enable rudimentary strace facility"
help
This option allows system calls to be traced to the console. It also
aids in detecting kernel stack underflow. It is useful for debugging
early-userland problems (e.g. init incurring fatal exceptions.)
config SH_ALPHANUMERIC
bool "Enable debug outputs to on-board alphanumeric display"
......
......@@ -11,13 +11,6 @@
# for "archclean" and "archdep" for cleaning up and making dependencies for
# this architecture
#
# Note that top level Makefile automagically builds dependencies for SUBDIRS
# but does not automagically clean SUBDIRS. Therefore "archclean" should clean
# up all, "archdep" does nothing on added SUBDIRS.
#
ifndef include_config
-include .config
endif
cpu-y := -mb
cpu-$(CONFIG_LITTLE_ENDIAN) := -ml
......@@ -37,10 +30,17 @@ AFLAGS += -m5 -isa=sh64 -traditional
CFLAGS += $(cpu-y)
LDFLAGS_vmlinux += --defsym phys_stext=_stext-$(CONFIG_CACHED_MEMORY_OFFSET) \
-e phys_stext
--defsym phys_stext_shmedia=phys_stext+1 \
-e phys_stext_shmedia
OBJCOPYFLAGS := -O binary -R .note -R .comment -R .stab -R .stabstr -S
#
# arch/sh64/defconfig never had any hope of being
# frequently updated, so use one that does
#
KBUILD_DEFCONFIG := cayman_defconfig
ifdef LOADADDR
LINKFLAGS += -Ttext $(word 1,$(LOADADDR))
endif
......@@ -52,7 +52,11 @@ machine-$(CONFIG_SH_ROMRAM) := romram
head-y := arch/$(ARCH)/kernel/head.o arch/$(ARCH)/kernel/init_task.o
core-y += $(addprefix arch/$(ARCH)/, kernel/ mm/ mach-$(machine-y)/)
core-y += arch/sh64/kernel/ arch/sh64/mm/
ifneq ($(machine-y),)
core-y += arch/sh64/mach-$(machine-y)/
endif
LIBGCC := $(shell $(CC) $(CFLAGS) -print-libgcc-file-name)
libs-y += arch/$(ARCH)/lib/ $(LIBGCC)
......@@ -92,7 +96,7 @@ define filechk_gen-syscalltab
echo "struct syscall_info {"; \
echo " const char *name;"; \
echo "} syscall_info_table[] = {"; \
sed -e '/^.*\.long /!d;s//\t{ "/;s/\(\([^/]*\)\/\)\{1\}.*/\2/; \
sed -e '/^.*\.long /!d;s// { "/;s/\(\([^/]*\)\/\)\{1\}.*/\2/; \
s/[ \t]*$$//g;s/$$/" },/;s/\("\)sys_/\1/g'; \
echo "};"; \
echo ""; \
......
......@@ -13,7 +13,7 @@
# unless it's something special (ie not a .c file).
#
extra-y := head.o init_task.o vmlinux.lds.s
extra-y := head.o init_task.o vmlinux.lds
obj-y := process.o signal.o entry.o traps.o irq.o irq_intc.o \
ptrace.o setup.o time.o sys_sh64.o semaphore.o sh_ksyms.o \
......@@ -22,17 +22,15 @@ obj-y := process.o signal.o entry.o traps.o irq.o irq_intc.o \
obj-$(CONFIG_HEARTBEAT) += led.o
obj-$(CONFIG_SH_ALPHANUMERIC) += alphanum.o
obj-$(CONFIG_SH_DMA) += dma.o
obj-$(CONFIG_SH_FPU) += fpu.o
obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
obj-$(CONFIG_KALLSYMS) += unwind.o
obj-$(CONFIG_PCI) += pci-dma.o pcibios.o
obj-$(CONFIG_MODULES) += module.o
ifeq ($(CONFIG_PCI),y)
obj-$(CONFIG_CPU_SH5) += pci_sh5.o
endif
ifndef CONFIG_NOFPU_SUPPORT
obj-y += fpu.o
endif
USE_STANDARD_AS_RULE := true
......@@ -31,7 +31,7 @@ typedef struct {
} dma_info_t;
static dma_info_t dma_info[MAX_DMA_CHANNELS];
extern spinlock_t dma_spin_lock;
static DEFINE_SPINLOCK(dma_spin_lock);
/* arch/sh64/kernel/irq_intc.c */
extern void make_intc_irq(unsigned int irq);
......
......@@ -16,8 +16,6 @@
#include <asm/io.h>
#include <asm/hardware.h>
extern void cpu_relax(void);
#define SCIF_BASE_ADDR 0x01030000
#define SCIF_ADDR_SH5 PHYS_PERIPHERAL_BLOCK+SCIF_BASE_ADDR
......
......@@ -6,7 +6,7 @@
* arch/sh64/kernel/entry.S
*
* Copyright (C) 2000, 2001 Paolo Alberelli
* Copyright (C) 2004 Paul Mundt
* Copyright (C) 2004, 2005 Paul Mundt
* Copyright (C) 2003, 2004 Richard Curnow
*
*/
......@@ -155,7 +155,7 @@ trap_jtable:
.long tlb_miss_store /* 0x0C0 */
.long do_address_error_load /* 0x0E0 */
.long do_address_error_store /* 0x100 */
#ifndef CONFIG_NOFPU_SUPPORT
#ifdef CONFIG_SH_FPU
.long do_fpu_error /* 0x120 */
#else
.long do_exception_error /* 0x120 */
......@@ -237,6 +237,7 @@ LVBR_block:
.space 256, 0 /* Power-on class handler, */
/* not required here */
not_a_tlb_miss:
synco /* TAKum03020 (but probably a good idea anyway.) */
/* Save original stack pointer into KCR1 */
putcon SP, KCR1
......@@ -278,6 +279,7 @@ not_a_tlb_miss:
* block making sure the final alignment is correct.
*/
tlb_miss:
synco /* TAKum03020 (but probably a good idea anyway.) */
putcon SP, KCR1
movi reg_save_area, SP
/* SP is guaranteed 32-byte aligned. */
......@@ -393,6 +395,7 @@ fixup_to_invoke_general_handler:
/* VBR + 0x600 */
interrupt:
synco /* TAKum03020 (but probably a good idea anyway.) */
/* Save original stack pointer into KCR1 */
putcon SP, KCR1
......@@ -429,6 +432,7 @@ LRESVEC_block:
* (this may need to be extended...)
*/
reset_or_panic:
synco /* TAKum03020 (but probably a good idea anyway.) */
putcon SP, DCR
/* First save r0-1 and tr0, as we need to use these */
movi resvec_save_area-CONFIG_CACHED_MEMORY_OFFSET, SP
......@@ -481,6 +485,7 @@ single_step_panic:
.balign 256
debug_exception:
synco /* TAKum03020 (but probably a good idea anyway.) */
/*
* Single step/software_break_point first level handler.
* Called with MMU off, so the first thing we do is enable it
......@@ -788,9 +793,7 @@ no_underflow:
! exceptions
add SP, ZERO, r14
#define POOR_MANS_STRACE 0
#if POOR_MANS_STRACE
#ifdef CONFIG_POOR_MANS_STRACE
/* We've pushed all the registers now, so only r2-r4 hold anything
* useful. Move them into callee save registers */
or r2, ZERO, r28
......@@ -811,7 +814,6 @@ no_underflow:
or r30, ZERO, r4
#endif
/* For syscall and debug race condition, get TRA now */
getcon TRA, r5
......@@ -866,7 +868,7 @@ no_underflow:
*/
.global ret_from_irq
ret_from_irq:
#if POOR_MANS_STRACE
#ifdef CONFIG_POOR_MANS_STRACE
pta evt_debug_ret_from_irq, tr0
ori SP, 0, r2
blink tr0, LINK
......@@ -884,7 +886,7 @@ ret_from_irq:
ret_from_exception:
preempt_stop()
#if POOR_MANS_STRACE
#ifdef CONFIG_POOR_MANS_STRACE
pta evt_debug_ret_from_exc, tr0
ori SP, 0, r2
blink tr0, LINK
......@@ -1141,7 +1143,7 @@ call_do_page_fault:
fpu_error_or_IRQA:
pta its_IRQ, tr0
beqi/l r4, EVENT_INTERRUPT, tr0
#ifndef CONFIG_NOFPU_SUPPORT
#ifdef CONFIG_SH_FPU
movi do_fpu_state_restore, r6
#else
movi do_exception_error, r6
......@@ -1152,7 +1154,7 @@ fpu_error_or_IRQA:
fpu_error_or_IRQB:
pta its_IRQ, tr0
beqi/l r4, EVENT_INTERRUPT, tr0
#ifndef CONFIG_NOFPU_SUPPORT
#ifdef CONFIG_SH_FPU
movi do_fpu_state_restore, r6
#else
movi do_exception_error, r6
......@@ -1223,7 +1225,7 @@ syscall_bad:
syscall_ret:
st.q SP, FRAME_R(9), r2 /* Expecting SP back to BASIC frame */
#if POOR_MANS_STRACE
#ifdef CONFIG_POOR_MANS_STRACE
/* nothing useful in registers at this point */
movi evt_debug2, r5
......@@ -1254,7 +1256,7 @@ ret_from_fork:
ptabs r5, tr0
blink tr0, LINK
#if POOR_MANS_STRACE
#ifdef CONFIG_POOR_MANS_STRACE
/* nothing useful in registers at this point */
movi evt_debug2, r5
......
......@@ -96,8 +96,8 @@ 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 0x00800000 /* INITRD_START */
.long 0x00800000 /* INITRD_SIZE */
.long 0
.text
......@@ -310,7 +310,7 @@ hyperspace: /* ... that's the next instruction ! */
*/
movi fpu_in_use, r31 /* Temporary */
#ifndef CONFIG_NOFPU_SUPPORT
#ifdef CONFIG_SH_FPU
getcon SR, r21
movi SR_ENABLE_FPU, r22
and r21, r22, r22
......
......@@ -638,7 +638,6 @@ void free_task_struct(struct task_struct *p)
int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
{
/* A bit less processor dependent than older sh ... */
unsigned int reply;
static __inline__ _syscall2(int,clone,unsigned long,flags,unsigned long,newsp)
......@@ -671,7 +670,7 @@ void exit_thread(void)
null it here, there is no other path through which it would get safely
nulled. */
#ifndef CONFIG_NOFPU_SUPPORT
#ifdef CONFIG_SH_FPU
if (last_task_used_math == current) {
last_task_used_math = NULL;
}
......@@ -683,7 +682,7 @@ void flush_thread(void)
/* Called by fs/exec.c (flush_old_exec) to remove traces of a
* previously running executable. */
#ifndef CONFIG_NOFPU_SUPPORT
#ifdef CONFIG_SH_FPU
if (last_task_used_math == current) {
last_task_used_math = NULL;
}
......@@ -709,7 +708,7 @@ void release_thread(struct task_struct *dead_task)
/* Fill in the fpu structure for a core dump.. */
int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpu)
{
#ifndef CONFIG_NOFPU_SUPPORT
#ifdef CONFIG_SH_FPU
int fpvalid;
struct task_struct *tsk = current;
......@@ -741,7 +740,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
struct pt_regs *childregs;
unsigned long long se; /* Sign extension */
#ifndef CONFIG_NOFPU_SUPPORT
#ifdef CONFIG_SH_FPU
if(last_task_used_math == current) {
grab_fpu();
fpsave(&current->thread.fpu.hard);
......@@ -933,7 +932,7 @@ asids_proc_info(char *buf, char **start, off_t fpos, int length, int *eof, void
int len=0;
struct task_struct *p;
read_lock(&tasklist_lock);
for_each_task(p) {
for_each_process(p) {
int pid = p->pid;
struct mm_struct *mm;
if (!pid) continue;
......@@ -942,7 +941,7 @@ asids_proc_info(char *buf, char **start, off_t fpos, int length, int *eof, void
unsigned long asid, context;
context = mm->context;
asid = (context & 0xff);
len += sprintf(buf+len, "%5d : %02x\n", pid, asid);
len += sprintf(buf+len, "%5d : %02lx\n", pid, asid);
} else {
len += sprintf(buf+len, "%5d : (none)\n", pid);
}
......
......@@ -123,9 +123,26 @@ put_fpu_long(struct task_struct *task, unsigned long addr, unsigned long data)
asmlinkage int sys_ptrace(long request, long pid, long addr, long data)
{
struct task_struct *child;
extern void poke_real_address_q(unsigned long long addr, unsigned long long data);
#define WPC_DBRMODE 0x0d104008
static int first_call = 1;
int ret;
lock_kernel();
if (first_call) {
/* Set WPC.DBRMODE to 0. This makes all debug events get
* delivered through RESVEC, i.e. into the handlers in entry.S.
* (If the kernel was downloaded using a remote gdb, WPC.DBRMODE
* would normally be left set to 1, which makes debug events get
* delivered through DBRVEC, i.e. into the remote gdb's
* handlers. This prevents ptrace getting them, and confuses
* the remote gdb.) */
printk("DBRMODE set to 0 to permit native debugging\n");
poke_real_address_q(WPC_DBRMODE, 0);
first_call = 0;
}
ret = -EPERM;
if (request == PTRACE_TRACEME) {
/* are we already being traced? */
......
......@@ -19,6 +19,7 @@
#include <linux/in6.h>
#include <linux/interrupt.h>
#include <linux/smp_lock.h>
#include <linux/tty.h>
#include <asm/semaphore.h>
#include <asm/processor.h>
......@@ -50,7 +51,6 @@ EXPORT_SYMBOL(kernel_thread);
/* Networking helper routines. */
EXPORT_SYMBOL(csum_partial_copy);
EXPORT_SYMBOL(strtok);
EXPORT_SYMBOL(strpbrk);
EXPORT_SYMBOL(strstr);
......@@ -72,12 +72,18 @@ EXPORT_SYMBOL(strlen);
EXPORT_SYMBOL(flush_dcache_page);
/* For ext3 */
EXPORT_SYMBOL(sh64_page_clear);
/* Ugh. These come in from libgcc.a at link time. */
extern void __sdivsi3(void);
extern void __muldi3(void);
extern void __udivsi3(void);
extern char __div_table;
EXPORT_SYMBOL(__sdivsi3);
EXPORT_SYMBOL(__muldi3);
EXPORT_SYMBOL(__udivsi3);
EXPORT_SYMBOL(__div_table);
......@@ -178,7 +178,7 @@ struct rt_sigframe
long long retcode[2];
};
#ifndef CONFIG_NOFPU_SUPPORT
#ifdef CONFIG_SH_FPU
static inline int
restore_sigcontext_fpu(struct pt_regs *regs, struct sigcontext __user *sc)
{
......@@ -634,11 +634,9 @@ static void setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
*/
static void
handle_signal(unsigned long sig, siginfo_t *info, sigset_t *oldset,
struct pt_regs * regs)
handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka,
sigset_t *oldset, struct pt_regs * regs)
{
struct k_sigaction *ka = &current->sighand->action[sig-1];
/* Are we from a system call? */
if (regs->syscall_nr >= 0) {
/* If so, check system call restarting.. */
......@@ -666,9 +664,6 @@ handle_signal(unsigned long sig, siginfo_t *info, sigset_t *oldset,
else
setup_frame(sig, ka, oldset, regs);
if (ka->sa.sa_flags & SA_ONESHOT)
ka->sa.sa_handler = SIG_DFL;
if (!(ka->sa.sa_flags & SA_NODEFER)) {
spin_lock_irq(&current->sighand->siglock);
sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask);
......@@ -691,6 +686,7 @@ int do_signal(struct pt_regs *regs, sigset_t *oldset)
{
siginfo_t info;
int signr;
struct k_sigaction ka;
/*
* We want the common case to go fast, which
......@@ -707,11 +703,11 @@ int do_signal(struct pt_regs *regs, sigset_t *oldset)
if (!oldset)
oldset = &current->blocked;
signr = get_signal_to_deliver(&info, regs, 0);
signr = get_signal_to_deliver(&info, &ka, regs, 0);
if (signr > 0) {
/* Whee! Actually deliver the signal. */
handle_signal(signr, &info, oldset, regs);
handle_signal(signr, &info, &ka, oldset, regs);
return 1;
}
......
......@@ -27,7 +27,7 @@ sh64_switch_to:
r5 - &next->thread
Outgoing results
r2 - last (=prev)
r2 - last (=prev) : this just stays in r2 throughout
Want to create a full (struct pt_regs) on the stack to allow backtracing
functions to work. However, we only need to populate the callee-save
......@@ -188,7 +188,6 @@ sh64_switch_to:
! epilogue
ld.l r15, 0, r18
ld.l r15, 4, r14
ori r4, 0, r2 ! last = prev
ptabs r18, tr0
movi FRAME_SIZE, r0
add r15, r0, r15
......
......@@ -284,3 +284,17 @@ asmlinkage int sys_uname(struct old_utsname * name)
return err?-EFAULT:0;
}
/* Copy from mips version */
asmlinkage long sys_shmatcall(int shmid, char __user *shmaddr,
int shmflg)
{
unsigned long raddr;
int err;
err = do_shmat(shmid, shmaddr, shmflg, &raddr);
if (err)
return err;
err = raddr;
return err;
}
......@@ -268,7 +268,7 @@ sys_call_table:
.long sys_msgrcv
.long sys_msgget
.long sys_msgctl
.long sys_ni_syscall /* sys_shmatcall */
.long sys_shmatcall
.long sys_shmdt /* 245 */
.long sys_shmget
.long sys_shmctl
......@@ -337,4 +337,9 @@ sys_call_table:
.long sys_mq_timedreceive
.long sys_mq_notify
.long sys_mq_getsetattr /* 310 */
.long sys_ni_syscall /* Reserved for kexec */
.long sys_waitid
.long sys_add_key
.long sys_request_key
.long sys_keyctl /* 315 */
......@@ -30,6 +30,7 @@
#include <linux/kallsyms.h>
#include <linux/interrupt.h>
#include <linux/sysctl.h>
#include <linux/module.h>
#include <asm/system.h>
#include <asm/uaccess.h>
......@@ -286,6 +287,8 @@ void dump_stack(void)
{
show_task(NULL);
}
/* Needed by any user of WARN_ON in view of the defn in include/asm-sh/bug.h */
EXPORT_SYMBOL(dump_stack);
static void do_unhandled_exception(int trapnr, int signr, char *str, char *fn_name,
unsigned long error_code, struct pt_regs *regs, struct task_struct *tsk)
......
......@@ -46,6 +46,11 @@
*/
/* NOTE : Prefetches removed and allocos guarded by synco to avoid TAKum03020
* erratum. The first two prefetches are nop-ed out to avoid upsetting the
* instruction counts used in the jump address calculation.
* */
.section .text..SHmedia32,"ax"
.little
.balign 32
......@@ -58,7 +63,7 @@ copy_user_memcpy:
#define LDUAL(P,O,D0,D1) ldlo.l P,O,D0; ldhi.l P,O+3,D1
#define STUAL(P,O,D0,D1) stlo.l P,O,D0; sthi.l P,O+3,D1
ld.b r3,0,r63
nop ! ld.b r3,0,r63 ! TAKum03020
pta/l Large,tr0
movi 25,r0
bgeu/u r4,r0,tr0
......@@ -108,7 +113,7 @@ L8_15: /* 8..15 byte memcpy cntd. */
/* 2 or 3 byte memcpy */
ld.b r3,0,r0
ld.b r2,0,r63
nop ! ld.b r2,0,r63 ! TAKum03020
ld.b r3,1,r1
st.b r2,0,r0
pta/l L2_3,tr0
......@@ -151,7 +156,7 @@ L8_15: /* 8..15 byte memcpy cntd. */
blink tr1,r63
Large:
ld.b r2, 0, r63
! ld.b r2, 0, r63 ! TAKum03020
pta/l Loop_ua, tr1
ori r3, -8, r7
sub r2, r7, r22
......@@ -173,8 +178,7 @@ Large:
addi r6, -8, r21
Loop_line:
ldx.q r22, r36, r63
synco
! ldx.q r22, r36, r63 ! TAKum03020
alloco r22, 32
synco
addi r22, 32, r22
......
......@@ -8,6 +8,7 @@
-- Copyright 2004 Richard Curnow (evt_debug etc)
--
--------------------------------------------------------------------------*/
#include <linux/config.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/sched.h>
......@@ -136,6 +137,8 @@ void print_itlb(void)
/* ======================================================================= */
#ifdef CONFIG_POOR_MANS_STRACE
#include "syscalltab.h"
struct ring_node {
......@@ -151,6 +154,17 @@ struct ring_node {
static struct ring_node event_ring[16];
static int event_ptr = 0;
struct stored_syscall_data {
int pid;
int syscall_number;
};
#define N_STORED_SYSCALLS 16
static struct stored_syscall_data stored_syscalls[N_STORED_SYSCALLS];
static int syscall_next=0;
static int syscall_next_print=0;
void evt_debug(int evt, int ret_addr, int event, int tra, struct pt_regs *regs)
{
int syscallno = tra & 0xff;
......@@ -187,15 +201,35 @@ void evt_debug(int evt, int ret_addr, int event, int tra, struct pt_regs *regs)
event_ptr = (event_ptr + 1) & 15;
if ((event == 2) && (evt == 0x160)) {
if (syscallno < NUM_SYSCALL_INFO_ENTRIES)
printk("Task %d: %s()\n",
current->pid,
syscall_info_table[syscallno].name);
if (syscallno < NUM_SYSCALL_INFO_ENTRIES) {
/* Store the syscall information to print later. We
* can't print this now - currently we're running with
* SR.BL=1, so we can't take a tlbmiss (which could occur
* in the console drivers under printk).
*
* Just overwrite old entries on ring overflow - this
* is only for last-hope debugging. */
stored_syscalls[syscall_next].pid = current->pid;
stored_syscalls[syscall_next].syscall_number = syscallno;
syscall_next++;
syscall_next &= (N_STORED_SYSCALLS - 1);
}
}
}
static void drain_syscalls(void) {
while (syscall_next_print != syscall_next) {
printk("Task %d: %s()\n",
stored_syscalls[syscall_next_print].pid,
syscall_info_table[stored_syscalls[syscall_next_print].syscall_number].name);
syscall_next_print++;
syscall_next_print &= (N_STORED_SYSCALLS - 1);
}
}
void evt_debug2(unsigned int ret)
{
drain_syscalls();
printk("Task %d: syscall returns %08x\n", current->pid, ret);
}
......@@ -231,6 +265,8 @@ void evt_debug_ret_from_exc(struct pt_regs *regs)
event_ptr = (event_ptr + 1) & 15;
}
#endif /* CONFIG_POOR_MANS_STRACE */
/* ======================================================================= */
void show_excp_regs(char *from, int trapnr, int signr, struct pt_regs *regs)
......
/*
* FIXME: old compatibility stuff, will be removed soon.
*/
#include <net/checksum.h>
unsigned int csum_partial_copy( const char *src, char *dst, int len, int sum)
{
int src_err=0, dst_err=0;
sum = csum_partial_copy_generic ( src, dst, len, sum, &src_err, &dst_err);
if (src_err || dst_err)
printk("old csum_partial_copy_fromuser(), tell mingo to convert me.\n");
return sum;
}
......@@ -17,6 +17,8 @@
Always clears 4096 bytes.
Note : alloco guarded by synco to avoid TAKum03020 erratum
*/
.section .text..SHmedia32,"ax"
......@@ -34,6 +36,7 @@ sh64_page_clear:
add r2, r63, r6
1:
alloco r6, 0
synco ! TAKum03020
addi r6, 32, r6
bgt/l r7, r6, tr1
......
......@@ -39,12 +39,17 @@ sh64_page_copy:
pta 3f, tr3
ptabs r18, tr0
#if 0
/* TAKum03020 */
ld.q r2, 0x00, r63
ld.q r2, 0x20, r63
ld.q r2, 0x40, r63
ld.q r2, 0x60, r63
#endif
alloco r3, 0x00
synco ! TAKum03020
alloco r3, 0x20
synco ! TAKum03020
movi 3968, r6
add r3, r6, r6
......@@ -60,11 +65,15 @@ sh64_page_copy:
because they overlap with the time spent waiting for prefetches to
complete. */
1:
#if 0
/* TAKum03020 */
bge/u r3, r6, tr2 ! skip prefetch for last 4 lines
ldx.q r3, r22, r63 ! prefetch 4 lines hence
#endif
2:
bge/u r3, r7, tr3 ! skip alloco for last 2 lines
alloco r3, 0x40 ! alloc destination line 2 lines ahead
synco ! TAKum03020
3:
ldx.q r3, r60, r36
ldx.q r3, r61, r37
......
......@@ -15,7 +15,8 @@
#include <linux/module.h>
#include <asm/uaccess.h>
extern unsigned long copy_user_memcpy, copy_user_memcpy_end, __copy_user_fixup;
extern unsigned long copy_user_memcpy, copy_user_memcpy_end;
extern void __copy_user_fixup(void);
static const struct exception_table_entry __copy_user_fixup_ex = {
.fixup = (unsigned long)&__copy_user_fixup,
......
......@@ -203,17 +203,17 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long writeaccess,
* we can handle it..
*/
good_area:
if (writeaccess) {
if (!(vma->vm_flags & VM_WRITE))
goto bad_area;
} else {
if (!(vma->vm_flags & (VM_READ | VM_EXEC)))
goto bad_area;
}
if (textaccess) {
if (!(vma->vm_flags & VM_EXEC))
goto bad_area;
} else {
if (writeaccess) {
if (!(vma->vm_flags & VM_WRITE))
goto bad_area;
} else {
if (!(vma->vm_flags & VM_READ))
goto bad_area;
}
}
/*
......@@ -264,17 +264,28 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long writeaccess,
up_read(&mm->mmap_sem);
if (user_mode(regs)) {
printk("user mode bad_area address=%08lx pid=%d (%s) pc=%08lx opcode=%08lx\n",
address, current->pid, current->comm,
(unsigned long) regs->pc,
*(unsigned long *)(u32)(regs->pc & ~3));
show_regs(regs);
static int count=0;
siginfo_t info;
if (count < 4) {
/* This is really to help debug faults when starting
* usermode, so only need a few */
count++;
printk("user mode bad_area address=%08lx pid=%d (%s) pc=%08lx\n",
address, current->pid, current->comm,
(unsigned long) regs->pc);
#if 0
show_regs(regs);
#endif
}
if (tsk->pid == 1) {
panic("INIT had user mode bad_area\n");
}
tsk->thread.address = address;
tsk->thread.error_code = writeaccess;
force_sig(SIGSEGV, tsk);
info.si_signo = SIGSEGV;
info.si_errno = 0;
info.si_addr = (void *) address;
force_sig_info(SIGSEGV, &info, tsk);
return;
}
......
......@@ -182,8 +182,8 @@ void iounmap(void *addr)
}
static struct resource shmedia_iomap = {
.name = "shmedia_iomap",
.start = IOBASE_VADDR,
.name = "shmedia_iomap",
.start = IOBASE_VADDR + PAGE_SIZE,
.end = IOBASE_END - 1,
};
......
......@@ -75,7 +75,6 @@ inline void __do_tlb_refill(unsigned long address,
/* Set PTEL register, set_pte has performed the sign extension */
ptel &= _PAGE_FLAGS_HARDWARE_MASK; /* drop software flags */
ptel |= _PAGE_FLAGS_HARDWARE_DEFAULT; /* add default flags */
tlbp = is_text_not_data ? &(cpu_data->itlb) : &(cpu_data->dtlb);
next = tlbp->next;
......
......@@ -12,7 +12,7 @@
#include <linux/init.h>
#include <linux/errno.h>
int __init oprofile_arch_init(struct oprofile_operations **ops)
int __init oprofile_arch_init(struct oprofile_operations *ops)
{
return -ENODEV;
}
......
#ifndef __ASM_SH64_BUG_H
#define __ASM_SH64_BUG_H
#include <asm-sh/bug.h>
#include <linux/config.h>
/*
* Tell the user there is some problem, then force a segfault (in process
* context) or a panic (interrupt context).
*/
#define BUG() do { \
printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \
*(volatile int *)0 = 0; \
} while (0)
#define BUG_ON(condition) do { \
if (unlikely((condition)!=0)) \
BUG(); \
} while(0)
#define PAGE_BUG(page) do { \
BUG(); \
} while (0)
#define WARN_ON(condition) do { \
if (unlikely((condition)!=0)) { \
printk("Badness in %s at %s:%d\n", __FUNCTION__, __FILE__, __LINE__); \
dump_stack(); \
} \
} while (0)
#endif /* __ASM_SH64_BUG_H */
......@@ -17,29 +17,6 @@
#define PHYS_PERIPHERAL_BLOCK 0x09000000
#define PHYS_DMAC_BLOCK 0x0e000000
#define PHYS_PCI_BLOCK 0x60000000
#ifndef __ASSEMBLY__
#include <linux/types.h>
#include <asm/io.h>
struct vcr_info {
u8 perr_flags; /* P-port Error flags */
u8 merr_flags; /* Module Error flags */
u16 mod_vers; /* Module Version */
u16 mod_id; /* Module ID */
u8 bot_mb; /* Bottom Memory block */
u8 top_mb; /* Top Memory block */
};
static inline struct vcr_info sh64_get_vcr_info(unsigned long base)
{
unsigned long long tmp;
tmp = sh64_in64(base);
return *((struct vcr_info *)&tmp);
}
#endif /* __ASSEMBLY__ */
#define PHYS_EMI_BLOCK 0xff000000
#endif /* __ASM_SH64_HARDWARE_H */
......@@ -9,103 +9,108 @@
* include/asm-sh64/ioctls.h
*
* Copyright (C) 2000, 2001 Paolo Alberelli
* Copyright (C) 2004 Richard Curnow
*
*/
#include <asm/ioctl.h>
#define FIOCLEX _IO('f', 1)
#define FIONCLEX _IO('f', 2)
#define FIOASYNC _IOW('f', 125, int)
#define FIONBIO _IOW('f', 126, int)
#define FIONREAD _IOR('f', 127, int)
#define FIOCLEX 0x6601 /* _IO('f', 1) */
#define FIONCLEX 0x6602 /* _IO('f', 2) */
#define FIOASYNC 0x4004667d /* _IOW('f', 125, int) */
#define FIONBIO 0x4004667e /* _IOW('f', 126, int) */
#define FIONREAD 0x8004667f /* _IOW('f', 127, int) */
#define TIOCINQ FIONREAD
#define FIOQSIZE _IOR('f', 128, loff_t)
#define FIOQSIZE 0x80086680 /* _IOR('f', 128, loff_t) */
#define TCGETS 0x5401
#define TCSETS 0x5402
#define TCSETSW 0x5403
#define TCSETSF 0x5404
#define TCGETA _IOR('t', 23, struct termio)
#define TCSETA _IOW('t', 24, struct termio)
#define TCSETAW _IOW('t', 25, struct termio)
#define TCSETAF _IOW('t', 28, struct termio)
#define TCSBRK _IO('t', 29)
#define TCXONC _IO('t', 30)
#define TCFLSH _IO('t', 31)
#define TIOCSWINSZ _IOW('t', 103, struct winsize)
#define TIOCGWINSZ _IOR('t', 104, struct winsize)
#define TIOCSTART _IO('t', 110) /* start output, like ^Q */
#define TIOCSTOP _IO('t', 111) /* stop output, like ^S */
#define TIOCOUTQ _IOR('t', 115, int) /* output queue size */
#define TIOCSPGRP _IOW('t', 118, int)
#define TIOCGPGRP _IOR('t', 119, int)
#define TIOCEXCL _IO('T', 12) /* 0x540C */
#define TIOCNXCL _IO('T', 13) /* 0x540D */
#define TIOCSCTTY _IO('T', 14) /* 0x540E */
#define TIOCSTI _IOW('T', 18, char) /* 0x5412 */
#define TIOCMGET _IOR('T', 21, unsigned int) /* 0x5415 */
#define TIOCMBIS _IOW('T', 22, unsigned int) /* 0x5416 */
#define TIOCMBIC _IOW('T', 23, unsigned int) /* 0x5417 */
#define TIOCMSET _IOW('T', 24, unsigned int) /* 0x5418 */
# define TIOCM_LE 0x001
# define TIOCM_DTR 0x002
# define TIOCM_RTS 0x004
# define TIOCM_ST 0x008
# define TIOCM_SR 0x010
# define TIOCM_CTS 0x020
# define TIOCM_CAR 0x040
# define TIOCM_RNG 0x080
# define TIOCM_DSR 0x100
# define TIOCM_CD TIOCM_CAR
# define TIOCM_RI TIOCM_RNG
#define TIOCGSOFTCAR _IOR('T', 25, unsigned int) /* 0x5419 */
#define TIOCSSOFTCAR _IOW('T', 26, unsigned int) /* 0x541A */
#define TIOCLINUX _IOW('T', 28, char) /* 0x541C */
#define TIOCCONS _IO('T', 29) /* 0x541D */
#define TIOCGSERIAL _IOR('T', 30, struct serial_struct) /* 0x541E */
#define TIOCSSERIAL _IOW('T', 31, struct serial_struct) /* 0x541F */
#define TIOCPKT _IOW('T', 32, int) /* 0x5420 */
# define TIOCPKT_DATA 0
# define TIOCPKT_FLUSHREAD 1
# define TIOCPKT_FLUSHWRITE 2
# define TIOCPKT_STOP 4
# define TIOCPKT_START 8
# define TIOCPKT_NOSTOP 16
# define TIOCPKT_DOSTOP 32
#define TIOCNOTTY _IO('T', 34) /* 0x5422 */
#define TIOCSETD _IOW('T', 35, int) /* 0x5423 */
#define TIOCGETD _IOR('T', 36, int) /* 0x5424 */
#define TCSBRKP _IOW('T', 37, int) /* 0x5425 */ /* Needed for POSIX tcsendbreak() */
#define TIOCTTYGSTRUCT _IOR('T', 38, struct tty_struct) /* 0x5426 */ /* For debugging only */
#define TIOCSBRK _IO('T', 39) /* 0x5427 */ /* BSD compatibility */
#define TIOCCBRK _IO('T', 40) /* 0x5428 */ /* BSD compatibility */
#define TIOCGSID _IOR('T', 41, pid_t) /* 0x5429 */ /* Return the session ID of FD */
#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
#define TIOCSERCONFIG _IO('T', 83) /* 0x5453 */
#define TIOCSERGWILD _IOR('T', 84, int) /* 0x5454 */
#define TIOCSERSWILD _IOW('T', 85, int) /* 0x5455 */
#define TCGETA 0x80127417 /* _IOR('t', 23, struct termio) */
#define TCSETA 0x40127418 /* _IOW('t', 24, struct termio) */
#define TCSETAW 0x40127419 /* _IOW('t', 25, struct termio) */
#define TCSETAF 0x4012741c /* _IOW('t', 28, struct termio) */
#define TCSBRK 0x741d /* _IO('t', 29) */
#define TCXONC 0x741e /* _IO('t', 30) */
#define TCFLSH 0x741f /* _IO('t', 31) */
#define TIOCSWINSZ 0x40087467 /* _IOW('t', 103, struct winsize) */
#define TIOCGWINSZ 0x80087468 /* _IOR('t', 104, struct winsize) */
#define TIOCSTART 0x746e /* _IO('t', 110) start output, like ^Q */
#define TIOCSTOP 0x746f /* _IO('t', 111) stop output, like ^S */
#define TIOCOUTQ 0x80047473 /* _IOR('t', 115, int) output queue size */
#define TIOCSPGRP 0x40047476 /* _IOW('t', 118, int) */
#define TIOCGPGRP 0x80047477 /* _IOR('t', 119, int) */
#define TIOCEXCL 0x540c /* _IO('T', 12) */
#define TIOCNXCL 0x540d /* _IO('T', 13) */
#define TIOCSCTTY 0x540e /* _IO('T', 14) */
#define TIOCSTI 0x40015412 /* _IOW('T', 18, char) 0x5412 */
#define TIOCMGET 0x80045415 /* _IOR('T', 21, unsigned int) 0x5415 */
#define TIOCMBIS 0x40045416 /* _IOW('T', 22, unsigned int) 0x5416 */
#define TIOCMBIC 0x40045417 /* _IOW('T', 23, unsigned int) 0x5417 */
#define TIOCMSET 0x40045418 /* _IOW('T', 24, unsigned int) 0x5418 */
#define TIOCM_LE 0x001
#define TIOCM_DTR 0x002
#define TIOCM_RTS 0x004
#define TIOCM_ST 0x008
#define TIOCM_SR 0x010
#define TIOCM_CTS 0x020
#define TIOCM_CAR 0x040
#define TIOCM_RNG 0x080
#define TIOCM_DSR 0x100
#define TIOCM_CD TIOCM_CAR
#define TIOCM_RI TIOCM_RNG
#define TIOCGSOFTCAR 0x80045419 /* _IOR('T', 25, unsigned int) 0x5419 */
#define TIOCSSOFTCAR 0x4004541a /* _IOW('T', 26, unsigned int) 0x541A */
#define TIOCLINUX 0x4004541c /* _IOW('T', 28, char) 0x541C */
#define TIOCCONS 0x541d /* _IO('T', 29) */
#define TIOCGSERIAL 0x803c541e /* _IOR('T', 30, struct serial_struct) 0x541E */
#define TIOCSSERIAL 0x403c541f /* _IOW('T', 31, struct serial_struct) 0x541F */
#define TIOCPKT 0x40045420 /* _IOW('T', 32, int) 0x5420 */
#define TIOCPKT_DATA 0
#define TIOCPKT_FLUSHREAD 1
#define TIOCPKT_FLUSHWRITE 2
#define TIOCPKT_STOP 4
#define TIOCPKT_START 8
#define TIOCPKT_NOSTOP 16
#define TIOCPKT_DOSTOP 32
#define TIOCNOTTY 0x5422 /* _IO('T', 34) */
#define TIOCSETD 0x40045423 /* _IOW('T', 35, int) 0x5423 */
#define TIOCGETD 0x80045424 /* _IOR('T', 36, int) 0x5424 */
#define TCSBRKP 0x40045424 /* _IOW('T', 37, int) 0x5425 */ /* Needed for POSIX tcsendbreak() */
#define TIOCTTYGSTRUCT 0x8c105426 /* _IOR('T', 38, struct tty_struct) 0x5426 */ /* For debugging only */
#define TIOCSBRK 0x5427 /* _IO('T', 39) */ /* BSD compatibility */
#define TIOCCBRK 0x5428 /* _IO('T', 40) */ /* BSD compatibility */
#define TIOCGSID 0x80045429 /* _IOR('T', 41, pid_t) 0x5429 */ /* Return the session ID of FD */
#define TIOCGPTN 0x80045430 /* _IOR('T',0x30, unsigned int) 0x5430 Get Pty Number (of pty-mux device) */
#define TIOCSPTLCK 0x40045431 /* _IOW('T',0x31, int) Lock/unlock Pty */
#define TIOCSERCONFIG 0x5453 /* _IO('T', 83) */
#define TIOCSERGWILD 0x80045454 /* _IOR('T', 84, int) 0x5454 */
#define TIOCSERSWILD 0x40045455 /* _IOW('T', 85, int) 0x5455 */
#define TIOCGLCKTRMIOS 0x5456
#define TIOCSLCKTRMIOS 0x5457
#define TIOCSERGSTRUCT _IOR('T', 88, struct async_struct) /* 0x5458 */ /* For debugging only */
#define TIOCSERGETLSR _IOR('T', 89, unsigned int) /* 0x5459 */ /* Get line status register */
/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
# define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
#define TIOCSERGETMULTI _IOR('T', 90, struct serial_multiport_struct) /* 0x545A */ /* Get multiport config */
#define TIOCSERSETMULTI _IOW('T', 91, struct serial_multiport_struct) /* 0x545B */ /* Set multiport config */
#define TIOCMIWAIT _IO('T', 92) /* 0x545C */ /* wait for a change on serial input line(s) */
#define TIOCGICOUNT _IOR('T', 93, struct async_icount) /* 0x545D */ /* read serial port inline interrupt counts */
#define TIOCSERGSTRUCT 0x80d85458 /* _IOR('T', 88, struct async_struct) 0x5458 */ /* For debugging only */
#define TIOCSERGETLSR 0x80045459 /* _IOR('T', 89, unsigned int) 0x5459 */ /* Get line status register */
/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
#define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
#define TIOCSERGETMULTI 0x80a8545a /* _IOR('T', 90, struct serial_multiport_struct) 0x545A */ /* Get multiport config */
#define TIOCSERSETMULTI 0x40a8545b /* _IOW('T', 91, struct serial_multiport_struct) 0x545B */ /* Set multiport config */
#define TIOCMIWAIT 0x545c /* _IO('T', 92) wait for a change on serial input line(s) */
#define TIOCGICOUNT 0x802c545d /* _IOR('T', 93, struct async_icount) 0x545D */ /* read serial port inline interrupt counts */
#endif /* __ASM_SH64_IOCTLS_H */
......@@ -281,8 +281,6 @@ static inline pmd_t * pmd_offset(pgd_t * dir, unsigned long address)
/* Mask which drops software flags */
#define _PAGE_FLAGS_HARDWARE_MASK 0xfffffffffffff3dbLL
/* Flags default: 4KB, Read, Not write, Not execute, Not user */
#define _PAGE_FLAGS_HARDWARE_DEFAULT 0x0000000000000040LL
/*
* HugeTLB support
......
......@@ -15,7 +15,6 @@
*/
#include <linux/config.h>
#include <linux/kernel.h>
#include <asm/registers.h>
#include <asm/processor.h>
......
......@@ -61,13 +61,18 @@ static inline struct thread_info *current_thread_info(void)
}
/* thread information allocation */
#define alloc_thread_info(ti) ((struct thread_info *) __get_free_pages(GFP_KERNEL,2))
#define alloc_thread_info(ti) ((struct thread_info *) __get_free_pages(GFP_KERNEL,1))
#define free_thread_info(ti) free_pages((unsigned long) (ti), 1)
#define get_thread_info(ti) get_task_struct((ti)->task)
#define put_thread_info(ti) put_task_struct((ti)->task)
#endif /* __ASSEMBLY__ */
#define THREAD_SIZE 8192
#define PREEMPT_ACTIVE 0x4000000
/* thread information flags */
......@@ -76,7 +81,6 @@ static inline struct thread_info *current_thread_info(void)
#define TIF_NEED_RESCHED 3 /* rescheduling necessary */
#define TIF_MEMDIE 4
#define THREAD_SIZE 16384
#endif /* __KERNEL__ */
......
......@@ -333,8 +333,13 @@
#define __NR_mq_timedreceive (__NR_mq_open+3)
#define __NR_mq_notify (__NR_mq_open+4)
#define __NR_mq_getsetattr (__NR_mq_open+5)
#define __NR_sys_kexec_load 311
#define __NR_waitid 312
#define __NR_add_key 313
#define __NR_request_key 314
#define __NR_keyctl 315
#define NR_syscalls 311
#define NR_syscalls 316
/* user-visible error numbers are in the range -1 - -125: see <asm-sh64/errno.h> */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment