Drop support for Renesas H8/300 (h8300) architecture

H8/300 has been dead for several years, and the kernel for it
has not compiled for ages. Drop support for it.

Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
This commit is contained in:
Guenter Roeck
2013-08-30 06:01:49 -07:00
parent 272b98c645
commit 4b08478422
179 changed files with 1 additions and 10890 deletions

View File

@@ -1,12 +0,0 @@
#
# Makefile for the linux kernel.
#
extra-y := vmlinux.lds
obj-y := process.o traps.o ptrace.o irq.o \
sys_h8300.o time.o signal.o \
setup.o gpio.o syscalls.o \
entry.o timer/
obj-$(CONFIG_MODULES) += module.o h8300_ksyms.o

View File

@@ -1,60 +0,0 @@
/*
* This program is used to generate definitions needed by
* assembly language modules.
*
* We use the technique used in the OSF Mach kernel code:
* generate asm statements containing #defines,
* compile this file to assembler, and then extract the
* #defines from the assembly-language output.
*/
#include <linux/stddef.h>
#include <linux/sched.h>
#include <linux/kernel_stat.h>
#include <linux/ptrace.h>
#include <linux/hardirq.h>
#include <linux/kbuild.h>
#include <asm/bootinfo.h>
#include <asm/irq.h>
#include <asm/ptrace.h>
int main(void)
{
/* offsets into the task struct */
DEFINE(TASK_STATE, offsetof(struct task_struct, state));
DEFINE(TASK_FLAGS, offsetof(struct task_struct, flags));
DEFINE(TASK_PTRACE, offsetof(struct task_struct, ptrace));
DEFINE(TASK_BLOCKED, offsetof(struct task_struct, blocked));
DEFINE(TASK_THREAD, offsetof(struct task_struct, thread));
DEFINE(TASK_THREAD_INFO, offsetof(struct task_struct, stack));
DEFINE(TASK_MM, offsetof(struct task_struct, mm));
DEFINE(TASK_ACTIVE_MM, offsetof(struct task_struct, active_mm));
/* offsets into the irq_cpustat_t struct */
DEFINE(CPUSTAT_SOFTIRQ_PENDING, offsetof(irq_cpustat_t, __softirq_pending));
/* offsets into the thread struct */
DEFINE(THREAD_KSP, offsetof(struct thread_struct, ksp));
DEFINE(THREAD_USP, offsetof(struct thread_struct, usp));
DEFINE(THREAD_CCR, offsetof(struct thread_struct, ccr));
/* offsets into the pt_regs struct */
DEFINE(LER0, offsetof(struct pt_regs, er0) - sizeof(long));
DEFINE(LER1, offsetof(struct pt_regs, er1) - sizeof(long));
DEFINE(LER2, offsetof(struct pt_regs, er2) - sizeof(long));
DEFINE(LER3, offsetof(struct pt_regs, er3) - sizeof(long));
DEFINE(LER4, offsetof(struct pt_regs, er4) - sizeof(long));
DEFINE(LER5, offsetof(struct pt_regs, er5) - sizeof(long));
DEFINE(LER6, offsetof(struct pt_regs, er6) - sizeof(long));
DEFINE(LORIG, offsetof(struct pt_regs, orig_er0) - sizeof(long));
DEFINE(LCCR, offsetof(struct pt_regs, ccr) - sizeof(long));
DEFINE(LVEC, offsetof(struct pt_regs, vector) - sizeof(long));
#if defined(__H8300S__)
DEFINE(LEXR, offsetof(struct pt_regs, exr) - sizeof(long));
#endif
DEFINE(LRET, offsetof(struct pt_regs, pc) - sizeof(long));
DEFINE(PT_PTRACED, PT_PTRACED);
return 0;
}

View File

@@ -1,402 +0,0 @@
/* -*- mode: asm -*-
*
* linux/arch/h8300/platform/h8300h/entry.S
*
* Yoshinori Sato <ysato@users.sourceforge.jp>
* David McCullough <davidm@snapgear.com>
*
*/
/*
* entry.S
* include exception/interrupt gateway
* system call entry
*/
#include <linux/sys.h>
#include <asm/unistd.h>
#include <asm/setup.h>
#include <asm/segment.h>
#include <asm/linkage.h>
#include <asm/asm-offsets.h>
#include <asm/thread_info.h>
#include <asm/errno.h>
#if defined(CONFIG_CPU_H8300H)
#define USERRET 8
INTERRUPTS = 64
.h8300h
.macro SHLL2 reg
shll.l \reg
shll.l \reg
.endm
.macro SHLR2 reg
shlr.l \reg
shlr.l \reg
.endm
.macro SAVEREGS
mov.l er0,@-sp
mov.l er1,@-sp
mov.l er2,@-sp
mov.l er3,@-sp
.endm
.macro RESTOREREGS
mov.l @sp+,er3
mov.l @sp+,er2
.endm
.macro SAVEEXR
.endm
.macro RESTOREEXR
.endm
#endif
#if defined(CONFIG_CPU_H8S)
#define USERRET 10
#define USEREXR 8
INTERRUPTS = 128
.h8300s
.macro SHLL2 reg
shll.l #2,\reg
.endm
.macro SHLR2 reg
shlr.l #2,\reg
.endm
.macro SAVEREGS
stm.l er0-er3,@-sp
.endm
.macro RESTOREREGS
ldm.l @sp+,er2-er3
.endm
.macro SAVEEXR
mov.w @(USEREXR:16,er0),r1
mov.w r1,@(LEXR-LER3:16,sp) /* copy EXR */
.endm
.macro RESTOREEXR
mov.w @(LEXR-LER1:16,sp),r1 /* restore EXR */
mov.b r1l,r1h
mov.w r1,@(USEREXR:16,er0)
.endm
#endif
/* CPU context save/restore macros. */
.macro SAVE_ALL
mov.l er0,@-sp
stc ccr,r0l /* check kernel mode */
btst #4,r0l
bne 5f
/* user mode */
mov.l sp,@_sw_usp
mov.l @sp,er0 /* restore saved er0 */
orc #0x10,ccr /* switch kernel stack */
mov.l @_sw_ksp,sp
sub.l #(LRET-LORIG),sp /* allocate LORIG - LRET */
SAVEREGS
mov.l @_sw_usp,er0
mov.l @(USERRET:16,er0),er1 /* copy the RET addr */
mov.l er1,@(LRET-LER3:16,sp)
SAVEEXR
mov.l @(LORIG-LER3:16,sp),er0
mov.l er0,@(LER0-LER3:16,sp) /* copy ER0 */
mov.w e1,r1 /* e1 highbyte = ccr */
and #0xef,r1h /* mask mode? flag */
bra 6f
5:
/* kernel mode */
mov.l @sp,er0 /* restore saved er0 */
subs #2,sp /* set dummy ccr */
SAVEREGS
mov.w @(LRET-LER3:16,sp),r1 /* copy old ccr */
6:
mov.b r1h,r1l
mov.b #0,r1h
mov.w r1,@(LCCR-LER3:16,sp) /* set ccr */
mov.l er6,@-sp /* syscall arg #6 */
mov.l er5,@-sp /* syscall arg #5 */
mov.l er4,@-sp /* syscall arg #4 */
.endm /* r1 = ccr */
.macro RESTORE_ALL
mov.l @sp+,er4
mov.l @sp+,er5
mov.l @sp+,er6
RESTOREREGS
mov.w @(LCCR-LER1:16,sp),r0 /* check kernel mode */
btst #4,r0l
bne 7f
orc #0x80,ccr
mov.l @_sw_usp,er0
mov.l @(LER0-LER1:16,sp),er1 /* restore ER0 */
mov.l er1,@er0
RESTOREEXR
mov.w @(LCCR-LER1:16,sp),r1 /* restore the RET addr */
mov.b r1l,r1h
mov.b @(LRET+1-LER1:16,sp),r1l
mov.w r1,e1
mov.w @(LRET+2-LER1:16,sp),r1
mov.l er1,@(USERRET:16,er0)
mov.l @sp+,er1
add.l #(LRET-LER1),sp /* remove LORIG - LRET */
mov.l sp,@_sw_ksp
andc #0xef,ccr /* switch to user mode */
mov.l er0,sp
bra 8f
7:
mov.l @sp+,er1
adds #4,sp
adds #2,sp
8:
mov.l @sp+,er0
adds #4,sp /* remove the sw created LVEC */
rte
.endm
.globl _system_call
.globl _ret_from_exception
.globl _ret_from_fork
.globl _ret_from_kernel_thread
.globl _ret_from_interrupt
.globl _interrupt_redirect_table
.globl _sw_ksp,_sw_usp
.globl _resume
.globl _interrupt_entry
.globl _trace_break
#if defined(CONFIG_ROMKERNEL)
.section .int_redirect,"ax"
_interrupt_redirect_table:
#if defined(CONFIG_CPU_H8300H)
.rept 7
.long 0
.endr
#endif
#if defined(CONFIG_CPU_H8S)
.rept 5
.long 0
.endr
jmp @_trace_break
.long 0
#endif
jsr @_interrupt_entry /* NMI */
jmp @_system_call /* TRAPA #0 (System call) */
.long 0
.long 0
jmp @_trace_break /* TRAPA #3 (breakpoint) */
.rept INTERRUPTS-12
jsr @_interrupt_entry
.endr
#endif
#if defined(CONFIG_RAMKERNEL)
.globl _interrupt_redirect_table
.section .bss
_interrupt_redirect_table:
.space 4
#endif
.section .text
.align 2
_interrupt_entry:
SAVE_ALL
mov.l sp,er0
add.l #LVEC,er0
btst #4,r1l
bne 1f
/* user LVEC */
mov.l @_sw_usp,er0
adds #4,er0
1:
mov.l @er0,er0 /* LVEC address */
#if defined(CONFIG_ROMKERNEL)
sub.l #_interrupt_redirect_table,er0
#endif
#if defined(CONFIG_RAMKERNEL)
mov.l @_interrupt_redirect_table,er1
sub.l er1,er0
#endif
SHLR2 er0
dec.l #1,er0
mov.l sp,er1
subs #4,er1 /* adjust ret_pc */
jsr @_do_IRQ
jmp @_ret_from_interrupt
_system_call:
subs #4,sp /* dummy LVEC */
SAVE_ALL
andc #0x7f,ccr
mov.l er0,er4
/* save top of frame */
mov.l sp,er0
jsr @_set_esp0
mov.l sp,er2
and.w #0xe000,r2
mov.b @((TI_FLAGS+3-(TIF_SYSCALL_TRACE >> 3)):16,er2),r2l
btst #(TIF_SYSCALL_TRACE & 7),r2l
beq 1f
jsr @_do_syscall_trace
1:
cmp.l #NR_syscalls,er4
bcc badsys
SHLL2 er4
mov.l #_sys_call_table,er0
add.l er4,er0
mov.l @er0,er4
beq _ret_from_exception:16
mov.l @(LER1:16,sp),er0
mov.l @(LER2:16,sp),er1
mov.l @(LER3:16,sp),er2
jsr @er4
mov.l er0,@(LER0:16,sp) /* save the return value */
mov.l sp,er2
and.w #0xe000,r2
mov.b @((TI_FLAGS+3-(TIF_SYSCALL_TRACE >> 3)):16,er2),r2l
btst #(TIF_SYSCALL_TRACE & 7),r2l
beq 2f
jsr @_do_syscall_trace
2:
#if defined(CONFIG_SYSCALL_PRINT)
jsr @_syscall_print
#endif
orc #0x80,ccr
bra resume_userspace
badsys:
mov.l #-ENOSYS,er0
mov.l er0,@(LER0:16,sp)
bra resume_userspace
#if !defined(CONFIG_PREEMPT)
#define resume_kernel restore_all
#endif
_ret_from_exception:
#if defined(CONFIG_PREEMPT)
orc #0x80,ccr
#endif
_ret_from_interrupt:
mov.b @(LCCR+1:16,sp),r0l
btst #4,r0l
bne resume_kernel:8 /* return from kernel */
resume_userspace:
andc #0x7f,ccr
mov.l sp,er4
and.w #0xe000,r4 /* er4 <- current thread info */
mov.l @(TI_FLAGS:16,er4),er1
and.l #_TIF_WORK_MASK,er1
beq restore_all:8
work_pending:
btst #TIF_NEED_RESCHED,r1l
bne work_resched:8
/* work notifysig */
mov.l sp,er0
subs #4,er0 /* er0: pt_regs */
jsr @_do_notify_resume
bra restore_all:8
work_resched:
mov.l sp,er0
jsr @_set_esp0
jsr @_schedule
bra resume_userspace:8
restore_all:
RESTORE_ALL /* Does RTE */
#if defined(CONFIG_PREEMPT)
resume_kernel:
mov.l @(TI_PRE_COUNT:16,er4),er0
bne restore_all:8
need_resched:
mov.l @(TI_FLAGS:16,er4),er0
btst #TIF_NEED_RESCHED,r0l
beq restore_all:8
mov.b @(LCCR+1:16,sp),r0l /* Interrupt Enabled? */
bmi restore_all:8
mov.l #PREEMPT_ACTIVE,er0
mov.l er0,@(TI_PRE_COUNT:16,er4)
andc #0x7f,ccr
mov.l sp,er0
jsr @_set_esp0
jsr @_schedule
orc #0x80,ccr
bra need_resched:8
#endif
_ret_from_fork:
mov.l er2,er0
jsr @_schedule_tail
jmp @_ret_from_exception
_ret_from_kernel_thread:
mov.l er2,er0
jsr @_schedule_tail
mov.l @(LER4:16,sp),er0
mov.l @(LER5:16,sp),er1
jsr @er1
jmp @_ret_from_exception
_resume:
/*
* Beware - when entering resume, offset of tss is in d1,
* prev (the current task) is in a0, next (the new task)
* is in a1 and d2.b is non-zero if the mm structure is
* shared between the tasks, so don't change these
* registers until their contents are no longer needed.
*/
/* save sr */
sub.w r3,r3
stc ccr,r3l
mov.w r3,@(THREAD_CCR+2:16,er0)
/* disable interrupts */
orc #0x80,ccr
mov.l @_sw_usp,er3
mov.l er3,@(THREAD_USP:16,er0)
mov.l sp,@(THREAD_KSP:16,er0)
/* Skip address space switching if they are the same. */
/* FIXME: what did we hack out of here, this does nothing! */
mov.l @(THREAD_USP:16,er1),er0
mov.l er0,@_sw_usp
mov.l @(THREAD_KSP:16,er1),sp
/* restore status register */
mov.w @(THREAD_CCR+2:16,er1),r3
ldc r3l,ccr
rts
_trace_break:
subs #4,sp
SAVE_ALL
sub.l er1,er1
dec.l #1,er1
mov.l er1,@(LORIG,sp)
mov.l sp,er0
jsr @_set_esp0
mov.l @_sw_usp,er0
mov.l @er0,er1
mov.w @(-2:16,er1),r2
cmp.w #0x5730,r2
beq 1f
subs #2,er1
mov.l er1,@er0
1:
and.w #0xff,e1
mov.l er1,er0
jsr @_trace_trap
jmp @_ret_from_exception
.section .bss
_sw_ksp:
.space 4
_sw_usp:
.space 4
.end

View File

@@ -1,178 +0,0 @@
/*
* linux/arch/h8300/kernel/gpio.c
*
* Yoshinori Sato <ysato@users.sourceforge.jp>
*
*/
/*
* Internal I/O Port Management
*/
#include <linux/stddef.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <linux/kernel.h>
#include <linux/string.h>
#include <linux/fs.h>
#include <linux/init.h>
#define _(addr) (volatile unsigned char *)(addr)
#if defined(CONFIG_H83007) || defined(CONFIG_H83068)
#include <asm/regs306x.h>
static volatile unsigned char *ddrs[] = {
_(P1DDR),_(P2DDR),_(P3DDR),_(P4DDR),_(P5DDR),_(P6DDR),
NULL, _(P8DDR),_(P9DDR),_(PADDR),_(PBDDR),
};
#define MAX_PORT 11
#endif
#if defined(CONFIG_H83002) || defined(CONFIG_H8048)
/* Fix me!! */
#include <asm/regs306x.h>
static volatile unsigned char *ddrs[] = {
_(P1DDR),_(P2DDR),_(P3DDR),_(P4DDR),_(P5DDR),_(P6DDR),
NULL, _(P8DDR),_(P9DDR),_(PADDR),_(PBDDR),
};
#define MAX_PORT 11
#endif
#if defined(CONFIG_H8S2678)
#include <asm/regs267x.h>
static volatile unsigned char *ddrs[] = {
_(P1DDR),_(P2DDR),_(P3DDR),NULL ,_(P5DDR),_(P6DDR),
_(P7DDR),_(P8DDR),NULL, _(PADDR),_(PBDDR),_(PCDDR),
_(PDDDR),_(PEDDR),_(PFDDR),_(PGDDR),_(PHDDR),
_(PADDR),_(PBDDR),_(PCDDR),_(PDDDR),_(PEDDR),_(PFDDR),
_(PGDDR),_(PHDDR)
};
#define MAX_PORT 17
#endif
#undef _
#if !defined(P1DDR)
#error Unsuppoted CPU Selection
#endif
static struct {
unsigned char used;
unsigned char ddr;
} gpio_regs[MAX_PORT];
extern char *_platform_gpio_table(int length);
int h8300_reserved_gpio(int port, unsigned int bits)
{
unsigned char *used;
if (port < 0 || port >= MAX_PORT)
return -1;
used = &(gpio_regs[port].used);
if ((*used & bits) != 0)
return 0;
*used |= bits;
return 1;
}
int h8300_free_gpio(int port, unsigned int bits)
{
unsigned char *used;
if (port < 0 || port >= MAX_PORT)
return -1;
used = &(gpio_regs[port].used);
if ((*used & bits) != bits)
return 0;
*used &= (~bits);
return 1;
}
int h8300_set_gpio_dir(int port_bit,int dir)
{
int port = (port_bit >> 8) & 0xff;
int bit = port_bit & 0xff;
if (ddrs[port] == NULL)
return 0;
if (gpio_regs[port].used & bit) {
if (dir)
gpio_regs[port].ddr |= bit;
else
gpio_regs[port].ddr &= ~bit;
*ddrs[port] = gpio_regs[port].ddr;
return 1;
} else
return 0;
}
int h8300_get_gpio_dir(int port_bit)
{
int port = (port_bit >> 8) & 0xff;
int bit = port_bit & 0xff;
if (ddrs[port] == NULL)
return 0;
if (gpio_regs[port].used & bit) {
return (gpio_regs[port].ddr & bit) != 0;
} else
return -1;
}
#if defined(CONFIG_PROC_FS)
static char *port_status(int portno)
{
static char result[10];
static const char io[2]={'I','O'};
char *rp;
int c;
unsigned char used,ddr;
used = gpio_regs[portno].used;
ddr = gpio_regs[portno].ddr;
result[8]='\0';
rp = result + 7;
for (c = 8; c > 0; c--,rp--,used >>= 1, ddr >>= 1)
if (used & 0x01)
*rp = io[ ddr & 0x01];
else
*rp = '-';
return result;
}
static int gpio_proc_show(struct seq_file *m, void *v)
{
static const char port_name[]="123456789ABCDEFGH";
int c;
for (c = 0; c < MAX_PORT; c++) {
if (ddrs[c] == NULL)
continue;
seq_printf(m, "P%c: %s\n", port_name[c], port_status(c));
}
return 0;
}
static int gpio_proc_open(struct inode *inode, struct file *file)
{
return single_open(file, gpio_proc_show, PDE_DATA(inode));
}
static const struct file_operations gpio_proc_fops = {
.open = gpio_proc_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
static __init int register_proc(void)
{
return proc_create("gpio", S_IRUGO, NULL, &gpio_proc_fops) != NULL;
}
__initcall(register_proc);
#endif
void __init h8300_gpio_init(void)
{
memcpy(gpio_regs,_platform_gpio_table(sizeof(gpio_regs)),sizeof(gpio_regs));
}

View File

@@ -1,100 +0,0 @@
#include <linux/module.h>
#include <linux/linkage.h>
#include <linux/sched.h>
#include <linux/string.h>
#include <linux/mm.h>
#include <linux/user.h>
#include <linux/elfcore.h>
#include <linux/in6.h>
#include <linux/interrupt.h>
#include <asm/setup.h>
#include <asm/pgalloc.h>
#include <asm/irq.h>
#include <asm/io.h>
#include <asm/checksum.h>
#include <asm/current.h>
#include <asm/gpio.h>
//asmlinkage long long __ashrdi3 (long long, int);
//asmlinkage long long __lshrdi3 (long long, int);
extern char h8300_debug_device[];
/* platform dependent support */
EXPORT_SYMBOL(strnlen);
EXPORT_SYMBOL(strrchr);
EXPORT_SYMBOL(strstr);
EXPORT_SYMBOL(strchr);
EXPORT_SYMBOL(strcat);
EXPORT_SYMBOL(strlen);
EXPORT_SYMBOL(strcmp);
EXPORT_SYMBOL(strncmp);
EXPORT_SYMBOL(ip_fast_csum);
EXPORT_SYMBOL(enable_irq);
EXPORT_SYMBOL(disable_irq);
/* Networking helper routines. */
EXPORT_SYMBOL(csum_partial_copy_nocheck);
/* The following are special because they're not called
explicitly (the C compiler generates them). Fortunately,
their interface isn't gonna change any time soon now, so
it's OK to leave it out of version control. */
//EXPORT_SYMBOL(__ashrdi3);
//EXPORT_SYMBOL(__lshrdi3);
EXPORT_SYMBOL(memcpy);
EXPORT_SYMBOL(memset);
EXPORT_SYMBOL(memcmp);
EXPORT_SYMBOL(memscan);
EXPORT_SYMBOL(memmove);
/*
* libgcc functions - functions that are used internally by the
* compiler... (prototypes are not correct though, but that
* doesn't really matter since they're not versioned).
*/
extern void __gcc_bcmp(void);
extern void __ashldi3(void);
extern void __ashrdi3(void);
extern void __cmpdi2(void);
extern void __divdi3(void);
extern void __divsi3(void);
extern void __lshrdi3(void);
extern void __moddi3(void);
extern void __modsi3(void);
extern void __muldi3(void);
extern void __mulsi3(void);
extern void __negdi2(void);
extern void __ucmpdi2(void);
extern void __udivdi3(void);
extern void __udivmoddi4(void);
extern void __udivsi3(void);
extern void __umoddi3(void);
extern void __umodsi3(void);
/* gcc lib functions */
EXPORT_SYMBOL(__gcc_bcmp);
EXPORT_SYMBOL(__ashldi3);
EXPORT_SYMBOL(__ashrdi3);
EXPORT_SYMBOL(__cmpdi2);
EXPORT_SYMBOL(__divdi3);
EXPORT_SYMBOL(__divsi3);
EXPORT_SYMBOL(__lshrdi3);
EXPORT_SYMBOL(__moddi3);
EXPORT_SYMBOL(__modsi3);
EXPORT_SYMBOL(__muldi3);
EXPORT_SYMBOL(__mulsi3);
EXPORT_SYMBOL(__negdi2);
EXPORT_SYMBOL(__ucmpdi2);
EXPORT_SYMBOL(__udivdi3);
EXPORT_SYMBOL(__udivmoddi4);
EXPORT_SYMBOL(__udivsi3);
EXPORT_SYMBOL(__umoddi3);
EXPORT_SYMBOL(__umodsi3);
EXPORT_SYMBOL(h8300_reserved_gpio);
EXPORT_SYMBOL(h8300_free_gpio);
EXPORT_SYMBOL(h8300_set_gpio_dir);

View File

@@ -1,165 +0,0 @@
/*
* linux/arch/h8300/kernel/irq.c
*
* Copyright 2007 Yoshinori Sato <ysato@users.sourceforge.jp>
*/
#include <linux/module.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/kernel_stat.h>
#include <linux/seq_file.h>
#include <linux/init.h>
#include <linux/random.h>
#include <linux/bootmem.h>
#include <linux/irq.h>
#include <linux/interrupt.h>
#include <asm/traps.h>
#include <asm/io.h>
#include <asm/setup.h>
#include <asm/errno.h>
/*#define DEBUG*/
extern unsigned long *interrupt_redirect_table;
extern const int h8300_saved_vectors[];
extern const h8300_vector h8300_trap_table[];
int h8300_enable_irq_pin(unsigned int irq);
void h8300_disable_irq_pin(unsigned int irq);
#define CPU_VECTOR ((unsigned long *)0x000000)
#define ADDR_MASK (0xffffff)
static inline int is_ext_irq(unsigned int irq)
{
return (irq >= EXT_IRQ0 && irq <= (EXT_IRQ0 + EXT_IRQS));
}
static void h8300_enable_irq(struct irq_data *data)
{
if (is_ext_irq(data->irq))
IER_REGS |= 1 << (data->irq - EXT_IRQ0);
}
static void h8300_disable_irq(struct irq_data *data)
{
if (is_ext_irq(data->irq))
IER_REGS &= ~(1 << (data->irq - EXT_IRQ0));
}
static unsigned int h8300_startup_irq(struct irq_data *data)
{
if (is_ext_irq(data->irq))
return h8300_enable_irq_pin(data->irq);
else
return 0;
}
static void h8300_shutdown_irq(struct irq_data *data)
{
if (is_ext_irq(data->irq))
h8300_disable_irq_pin(data->irq);
}
/*
* h8300 interrupt controller implementation
*/
struct irq_chip h8300irq_chip = {
.name = "H8300-INTC",
.irq_startup = h8300_startup_irq,
.irq_shutdown = h8300_shutdown_irq,
.irq_enable = h8300_enable_irq,
.irq_disable = h8300_disable_irq,
};
#if defined(CONFIG_RAMKERNEL)
static unsigned long __init *get_vector_address(void)
{
unsigned long *rom_vector = CPU_VECTOR;
unsigned long base,tmp;
int vec_no;
base = rom_vector[EXT_IRQ0] & ADDR_MASK;
/* check romvector format */
for (vec_no = EXT_IRQ1; vec_no <= EXT_IRQ0+EXT_IRQS; vec_no++) {
if ((base+(vec_no - EXT_IRQ0)*4) != (rom_vector[vec_no] & ADDR_MASK))
return NULL;
}
/* ramvector base address */
base -= EXT_IRQ0*4;
/* writerble check */
tmp = ~(*(volatile unsigned long *)base);
(*(volatile unsigned long *)base) = tmp;
if ((*(volatile unsigned long *)base) != tmp)
return NULL;
return (unsigned long *)base;
}
static void __init setup_vector(void)
{
int i;
unsigned long *ramvec,*ramvec_p;
const h8300_vector *trap_entry;
const int *saved_vector;
ramvec = get_vector_address();
if (ramvec == NULL)
panic("interrupt vector serup failed.");
else
printk(KERN_INFO "virtual vector at 0x%08lx\n",(unsigned long)ramvec);
/* create redirect table */
ramvec_p = ramvec;
trap_entry = h8300_trap_table;
saved_vector = h8300_saved_vectors;
for ( i = 0; i < NR_IRQS; i++) {
if (i == *saved_vector) {
ramvec_p++;
saved_vector++;
} else {
if ( i < NR_TRAPS ) {
if (*trap_entry)
*ramvec_p = VECTOR(*trap_entry);
ramvec_p++;
trap_entry++;
} else
*ramvec_p++ = REDIRECT(interrupt_entry);
}
}
interrupt_redirect_table = ramvec;
#ifdef DEBUG
ramvec_p = ramvec;
for (i = 0; i < NR_IRQS; i++) {
if ((i % 8) == 0)
printk(KERN_DEBUG "\n%p: ",ramvec_p);
printk(KERN_DEBUG "%p ",*ramvec_p);
ramvec_p++;
}
printk(KERN_DEBUG "\n");
#endif
}
#else
#define setup_vector() do { } while(0)
#endif
void __init init_IRQ(void)
{
int c;
setup_vector();
for (c = 0; c < NR_IRQS; c++)
irq_set_chip_and_handler(c, &h8300irq_chip, handle_simple_irq);
}
asmlinkage void do_IRQ(int irq)
{
irq_enter();
generic_handle_irq(irq);
irq_exit();
}

View File

@@ -1,75 +0,0 @@
#include <linux/moduleloader.h>
#include <linux/elf.h>
#include <linux/vmalloc.h>
#include <linux/fs.h>
#include <linux/string.h>
#include <linux/kernel.h>
#if 0
#define DEBUGP printk
#else
#define DEBUGP(fmt...)
#endif
int apply_relocate_add(Elf32_Shdr *sechdrs,
const char *strtab,
unsigned int symindex,
unsigned int relsec,
struct module *me)
{
unsigned int i;
Elf32_Rela *rela = (void *)sechdrs[relsec].sh_addr;
DEBUGP("Applying relocate section %u to %u\n", relsec,
sechdrs[relsec].sh_info);
for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rela); i++) {
/* This is where to make the change */
uint32_t *loc = (uint32_t *)(sechdrs[sechdrs[relsec].sh_info].sh_addr
+ rela[i].r_offset);
/* This is the symbol it is referring to. Note that all
undefined symbols have been resolved. */
Elf32_Sym *sym = (Elf32_Sym *)sechdrs[symindex].sh_addr
+ ELF32_R_SYM(rela[i].r_info);
uint32_t v = sym->st_value + rela[i].r_addend;
switch (ELF32_R_TYPE(rela[i].r_info)) {
case R_H8_DIR24R8:
loc = (uint32_t *)((uint32_t)loc - 1);
*loc = (*loc & 0xff000000) | ((*loc & 0xffffff) + v);
break;
case R_H8_DIR24A8:
if (ELF32_R_SYM(rela[i].r_info))
*loc += v;
break;
case R_H8_DIR32:
case R_H8_DIR32A16:
*loc += v;
break;
case R_H8_PCREL16:
v -= (unsigned long)loc + 2;
if ((Elf32_Sword)v > 0x7fff ||
(Elf32_Sword)v < -(Elf32_Sword)0x8000)
goto overflow;
else
*(unsigned short *)loc = v;
break;
case R_H8_PCREL8:
v -= (unsigned long)loc + 1;
if ((Elf32_Sword)v > 0x7f ||
(Elf32_Sword)v < -(Elf32_Sword)0x80)
goto overflow;
else
*(unsigned char *)loc = v;
break;
default:
printk(KERN_ERR "module %s: Unknown relocation: %u\n",
me->name, ELF32_R_TYPE(rela[i].r_info));
return -ENOEXEC;
}
}
return 0;
overflow:
printk(KERN_ERR "module %s: relocation offset overflow: %08x\n",
me->name, rela[i].r_offset);
return -ENOEXEC;
}

View File

@@ -1,154 +0,0 @@
/*
* linux/arch/h8300/kernel/process.c
*
* Yoshinori Sato <ysato@users.sourceforge.jp>
*
* Based on:
*
* linux/arch/m68knommu/kernel/process.c
*
* Copyright (C) 1998 D. Jeff Dionne <jeff@ryeham.ee.ryerson.ca>,
* Kenneth Albanowski <kjahds@kjahds.com>,
* The Silver Hammer Group, Ltd.
*
* linux/arch/m68k/kernel/process.c
*
* Copyright (C) 1995 Hamish Macdonald
*
* 68060 fixes by Jesper Skov
*/
/*
* This file handles the architecture-dependent parts of process handling..
*/
#include <linux/errno.h>
#include <linux/module.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/smp.h>
#include <linux/stddef.h>
#include <linux/unistd.h>
#include <linux/ptrace.h>
#include <linux/user.h>
#include <linux/interrupt.h>
#include <linux/reboot.h>
#include <linux/fs.h>
#include <linux/slab.h>
#include <linux/rcupdate.h>
#include <asm/uaccess.h>
#include <asm/traps.h>
#include <asm/setup.h>
#include <asm/pgtable.h>
void (*pm_power_off)(void) = NULL;
EXPORT_SYMBOL(pm_power_off);
asmlinkage void ret_from_fork(void);
asmlinkage void ret_from_kernel_thread(void);
/*
* The idle loop on an H8/300..
*/
#if !defined(CONFIG_H8300H_SIM) && !defined(CONFIG_H8S_SIM)
void arch_cpu_idle(void)
{
local_irq_enable();
/* XXX: race here! What if need_resched() gets set now? */
__asm__("sleep");
}
#endif
void machine_restart(char * __unused)
{
local_irq_disable();
__asm__("jmp @@0");
}
void machine_halt(void)
{
local_irq_disable();
__asm__("sleep");
for (;;);
}
void machine_power_off(void)
{
local_irq_disable();
__asm__("sleep");
for (;;);
}
void show_regs(struct pt_regs * regs)
{
show_regs_print_info(KERN_DEFAULT);
printk("\nPC: %08lx Status: %02x",
regs->pc, regs->ccr);
printk("\nORIG_ER0: %08lx ER0: %08lx ER1: %08lx",
regs->orig_er0, regs->er0, regs->er1);
printk("\nER2: %08lx ER3: %08lx ER4: %08lx ER5: %08lx",
regs->er2, regs->er3, regs->er4, regs->er5);
printk("\nER6' %08lx ",regs->er6);
if (user_mode(regs))
printk("USP: %08lx\n", rdusp());
else
printk("\n");
}
void flush_thread(void)
{
}
int copy_thread(unsigned long clone_flags,
unsigned long usp, unsigned long topstk,
struct task_struct * p)
{
struct pt_regs * childregs;
childregs = (struct pt_regs *) (THREAD_SIZE + task_stack_page(p)) - 1;
if (unlikely(p->flags & PF_KTHREAD)) {
memset(childregs, 0, sizeof(struct pt_regs));
childregs->retpc = (unsigned long) ret_from_kernel_thread;
childregs->er4 = topstk; /* arg */
childregs->er5 = usp; /* fn */
p->thread.ksp = (unsigned long)childregs;
}
*childregs = *current_pt_regs();
childregs->retpc = (unsigned long) ret_from_fork;
childregs->er0 = 0;
p->thread.usp = usp ?: rdusp();
p->thread.ksp = (unsigned long)childregs;
return 0;
}
unsigned long thread_saved_pc(struct task_struct *tsk)
{
return ((struct pt_regs *)tsk->thread.esp0)->pc;
}
unsigned long get_wchan(struct task_struct *p)
{
unsigned long fp, pc;
unsigned long stack_page;
int count = 0;
if (!p || p == current || p->state == TASK_RUNNING)
return 0;
stack_page = (unsigned long)p;
fp = ((struct pt_regs *)p->thread.ksp)->er6;
do {
if (fp < stack_page+sizeof(struct thread_info) ||
fp >= 8184+stack_page)
return 0;
pc = ((unsigned long *)fp)[1];
if (!in_sched_functions(pc))
return pc;
fp = *(unsigned long *) fp;
} while (count++ < 16);
return 0;
}

View File

@@ -1,168 +0,0 @@
/*
* linux/arch/h8300/kernel/ptrace.c
*
* Yoshinori Sato <ysato@users.sourceforge.jp>
*
* Based on:
* linux/arch/m68k/kernel/ptrace.c
*
* Copyright (C) 1994 by Hamish Macdonald
* Taken from linux/kernel/ptrace.c and modified for M680x0.
* linux/kernel/ptrace.c is by Ross Biro 1/23/92, edited by Linus Torvalds
*
* 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/kernel.h>
#include <linux/sched.h>
#include <linux/mm.h>
#include <linux/smp.h>
#include <linux/errno.h>
#include <linux/ptrace.h>
#include <linux/user.h>
#include <linux/signal.h>
#include <asm/uaccess.h>
#include <asm/page.h>
#include <asm/pgtable.h>
#include <asm/processor.h>
#include <asm/signal.h>
/* cpu depend functions */
extern long h8300_get_reg(struct task_struct *task, int regno);
extern int h8300_put_reg(struct task_struct *task, int regno, unsigned long data);
void user_disable_single_step(struct task_struct *child)
{
}
/*
* does not yet catch signals sent when the child dies.
* in exit.c or in signal.c.
*/
void ptrace_disable(struct task_struct *child)
{
user_disable_single_step(child);
}
long arch_ptrace(struct task_struct *child, long request,
unsigned long addr, unsigned long data)
{
int ret;
int regno = addr >> 2;
unsigned long __user *datap = (unsigned long __user *) data;
switch (request) {
/* read the word at location addr in the USER area. */
case PTRACE_PEEKUSR: {
unsigned long tmp = 0;
if ((addr & 3) || addr >= sizeof(struct user)) {
ret = -EIO;
break ;
}
ret = 0; /* Default return condition */
if (regno < H8300_REGS_NO)
tmp = h8300_get_reg(child, regno);
else {
switch (regno) {
case 49:
tmp = child->mm->start_code;
break ;
case 50:
tmp = child->mm->start_data;
break ;
case 51:
tmp = child->mm->end_code;
break ;
case 52:
tmp = child->mm->end_data;
break ;
default:
ret = -EIO;
}
}
if (!ret)
ret = put_user(tmp, datap);
break ;
}
/* when I and D space are separate, this will have to be fixed. */
case PTRACE_POKEUSR: /* write the word at location addr in the USER area */
if ((addr & 3) || addr >= sizeof(struct user)) {
ret = -EIO;
break ;
}
if (regno == PT_ORIG_ER0) {
ret = -EIO;
break ;
}
if (regno < H8300_REGS_NO) {
ret = h8300_put_reg(child, regno, data);
break ;
}
ret = -EIO;
break ;
case PTRACE_GETREGS: { /* Get all gp regs from the child. */
int i;
unsigned long tmp;
for (i = 0; i < H8300_REGS_NO; i++) {
tmp = h8300_get_reg(child, i);
if (put_user(tmp, datap)) {
ret = -EFAULT;
break;
}
datap++;
}
ret = 0;
break;
}
case PTRACE_SETREGS: { /* Set all gp regs in the child. */
int i;
unsigned long tmp;
for (i = 0; i < H8300_REGS_NO; i++) {
if (get_user(tmp, datap)) {
ret = -EFAULT;
break;
}
h8300_put_reg(child, i, tmp);
datap++;
}
ret = 0;
break;
}
default:
ret = ptrace_request(child, request, addr, data);
break;
}
return ret;
}
asmlinkage void do_syscall_trace(void)
{
if (!test_thread_flag(TIF_SYSCALL_TRACE))
return;
if (!(current->ptrace & PT_PTRACED))
return;
ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD)
? 0x80 : 0));
/*
* this isn't the same as continuing with a signal, but it will do
* for normal use. strace only continues with a signal if the
* stopping signal is not SIGTRAP. -brl
*/
if (current->exit_code) {
send_sig(current->exit_code, current, 1);
current->exit_code = 0;
}
}

View File

@@ -1,242 +0,0 @@
/*
* linux/arch/h8300/kernel/setup.c
*
* Copyleft ()) 2000 James D. Schettine {james@telos-systems.com}
* Copyright (C) 1999,2000 Greg Ungerer (gerg@snapgear.com)
* Copyright (C) 1998,1999 D. Jeff Dionne <jeff@lineo.ca>
* Copyright (C) 1998 Kenneth Albanowski <kjahds@kjahds.com>
* Copyright (C) 1995 Hamish Macdonald
* Copyright (C) 2000 Lineo Inc. (www.lineo.com)
* Copyright (C) 2001 Lineo, Inc. <www.lineo.com>
*
* H8/300 porting Yoshinori Sato <ysato@users.sourceforge.jp>
*/
/*
* This file handles the architecture-dependent parts of system setup
*/
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/delay.h>
#include <linux/interrupt.h>
#include <linux/mm.h>
#include <linux/fs.h>
#include <linux/fb.h>
#include <linux/console.h>
#include <linux/genhd.h>
#include <linux/errno.h>
#include <linux/string.h>
#include <linux/major.h>
#include <linux/bootmem.h>
#include <linux/seq_file.h>
#include <linux/init.h>
#include <asm/setup.h>
#include <asm/irq.h>
#include <asm/pgtable.h>
#include <asm/sections.h>
#if defined(__H8300H__)
#define CPU "H8/300H"
#include <asm/regs306x.h>
#endif
#if defined(__H8300S__)
#define CPU "H8S"
#include <asm/regs267x.h>
#endif
#define STUBSIZE 0xc000
unsigned long rom_length;
unsigned long memory_start;
unsigned long memory_end;
char __initdata command_line[COMMAND_LINE_SIZE];
extern int _ramstart, _ramend;
extern char _target_name[];
extern void h8300_gpio_init(void);
#if (defined(CONFIG_H8300H_SIM) || defined(CONFIG_H8S_SIM)) \
&& defined(CONFIG_GDB_MAGICPRINT)
/* printk with gdb service */
static void gdb_console_output(struct console *c, const char *msg, unsigned len)
{
for (; len > 0; len--) {
asm("mov.w %0,r2\n\t"
"jsr @0xc4"::"r"(*msg++):"er2");
}
}
/*
* Setup initial baud/bits/parity. We do two things here:
* - construct a cflag setting for the first rs_open()
* - initialize the serial port
* Return non-zero if we didn't find a serial port.
*/
static int __init gdb_console_setup(struct console *co, char *options)
{
return 0;
}
static const struct console gdb_console = {
.name = "gdb_con",
.write = gdb_console_output,
.device = NULL,
.setup = gdb_console_setup,
.flags = CON_PRINTBUFFER,
.index = -1,
};
#endif
void __init setup_arch(char **cmdline_p)
{
int bootmap_size;
memory_start = (unsigned long) &_ramstart;
/* allow for ROMFS on the end of the kernel */
if (memcmp((void *)memory_start, "-rom1fs-", 8) == 0) {
#if defined(CONFIG_BLK_DEV_INITRD)
initrd_start = memory_start;
initrd_end = memory_start += be32_to_cpu(((unsigned long *) (memory_start))[2]);
#else
memory_start += be32_to_cpu(((unsigned long *) memory_start)[2]);
#endif
}
memory_start = PAGE_ALIGN(memory_start);
#if !defined(CONFIG_BLKDEV_RESERVE)
memory_end = (unsigned long) &_ramend; /* by now the stack is part of the init task */
#if defined(CONFIG_GDB_DEBUG)
memory_end -= STUBSIZE;
#endif
#else
if ((memory_end < CONFIG_BLKDEV_RESERVE_ADDRESS) &&
(memory_end > CONFIG_BLKDEV_RESERVE_ADDRESS))
/* overlap userarea */
memory_end = CONFIG_BLKDEV_RESERVE_ADDRESS;
#endif
init_mm.start_code = (unsigned long) _stext;
init_mm.end_code = (unsigned long) _etext;
init_mm.end_data = (unsigned long) _edata;
init_mm.brk = (unsigned long) 0;
#if (defined(CONFIG_H8300H_SIM) || defined(CONFIG_H8S_SIM)) && defined(CONFIG_GDB_MAGICPRINT)
register_console((struct console *)&gdb_console);
#endif
printk(KERN_INFO "\r\n\nuClinux " CPU "\n");
printk(KERN_INFO "Target Hardware: %s\n",_target_name);
printk(KERN_INFO "Flat model support (C) 1998,1999 Kenneth Albanowski, D. Jeff Dionne\n");
printk(KERN_INFO "H8/300 series support by Yoshinori Sato <ysato@users.sourceforge.jp>\n");
#ifdef DEBUG
printk(KERN_DEBUG "KERNEL -> TEXT=0x%p-0x%p DATA=0x%p-0x%p "
"BSS=0x%p-0x%p\n", _stext, _etext, _sdata, _edata, __bss_start,
__bss_stop);
printk(KERN_DEBUG "KERNEL -> ROMFS=0x%p-0x%06lx MEM=0x%06lx-0x%06lx "
"STACK=0x%06lx-0x%p\n", __bss_stop, memory_start, memory_start,
memory_end, memory_end, &_ramend);
#endif
#ifdef CONFIG_DEFAULT_CMDLINE
/* set from default command line */
if (*command_line == '\0')
strcpy(command_line,CONFIG_KERNEL_COMMAND);
#endif
/* Keep a copy of command line */
*cmdline_p = &command_line[0];
memcpy(boot_command_line, command_line, COMMAND_LINE_SIZE);
boot_command_line[COMMAND_LINE_SIZE-1] = 0;
#ifdef DEBUG
if (strlen(*cmdline_p))
printk(KERN_DEBUG "Command line: '%s'\n", *cmdline_p);
#endif
/*
* give all the memory to the bootmap allocator, tell it to put the
* boot mem_map at the start of memory
*/
bootmap_size = init_bootmem_node(
NODE_DATA(0),
memory_start >> PAGE_SHIFT, /* map goes here */
PAGE_OFFSET >> PAGE_SHIFT, /* 0 on coldfire */
memory_end >> PAGE_SHIFT);
/*
* free the usable memory, we have to make sure we do not free
* the bootmem bitmap so we then reserve it after freeing it :-)
*/
free_bootmem(memory_start, memory_end - memory_start);
reserve_bootmem(memory_start, bootmap_size, BOOTMEM_DEFAULT);
/*
* get kmalloc into gear
*/
paging_init();
h8300_gpio_init();
#if defined(CONFIG_H8300_AKI3068NET) && defined(CONFIG_IDE)
{
#define AREABIT(addr) (1 << (((addr) >> 21) & 7))
/* setup BSC */
volatile unsigned char *abwcr = (volatile unsigned char *)ABWCR;
volatile unsigned char *cscr = (volatile unsigned char *)CSCR;
*abwcr &= ~(AREABIT(CONFIG_H8300_IDE_BASE) | AREABIT(CONFIG_H8300_IDE_ALT));
*cscr |= (AREABIT(CONFIG_H8300_IDE_BASE) | AREABIT(CONFIG_H8300_IDE_ALT)) | 0x0f;
}
#endif
#ifdef DEBUG
printk(KERN_DEBUG "Done setup_arch\n");
#endif
}
/*
* Get CPU information for use by the procfs.
*/
static int show_cpuinfo(struct seq_file *m, void *v)
{
char *cpu;
int mode;
u_long clockfreq;
cpu = CPU;
mode = *(volatile unsigned char *)MDCR & 0x07;
clockfreq = CONFIG_CPU_CLOCK;
seq_printf(m, "CPU:\t\t%s (mode:%d)\n"
"Clock:\t\t%lu.%1luMHz\n"
"BogoMips:\t%lu.%02lu\n"
"Calibration:\t%lu loops\n",
cpu,mode,
clockfreq/1000,clockfreq%1000,
(loops_per_jiffy*HZ)/500000,((loops_per_jiffy*HZ)/5000)%100,
(loops_per_jiffy*HZ));
return 0;
}
static void *c_start(struct seq_file *m, loff_t *pos)
{
return *pos < NR_CPUS ? ((void *) 0x12345678) : NULL;
}
static void *c_next(struct seq_file *m, void *v, loff_t *pos)
{
++*pos;
return c_start(m, pos);
}
static void c_stop(struct seq_file *m, void *v)
{
}
const struct seq_operations cpuinfo_op = {
.start = c_start,
.next = c_next,
.stop = c_stop,
.show = show_cpuinfo,
};

View File

@@ -1,444 +0,0 @@
/*
* linux/arch/h8300/kernel/signal.c
*
* Copyright (C) 1991, 1992 Linus Torvalds
*
* 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.
*/
/*
* uClinux H8/300 support by Yoshinori Sato <ysato@users.sourceforge.jp>
* and David McCullough <davidm@snapgear.com>
*
* Based on
* Linux/m68k by Hamish Macdonald
*/
/*
* ++roman (07/09/96): implemented signal stacks (specially for tosemu on
* Atari :-) Current limitation: Only one sigstack can be active at one time.
* If a second signal with SA_ONSTACK set arrives while working on a sigstack,
* SA_ONSTACK is ignored. This behaviour avoids lots of trouble with nested
* signal handlers!
*/
#include <linux/sched.h>
#include <linux/mm.h>
#include <linux/kernel.h>
#include <linux/signal.h>
#include <linux/syscalls.h>
#include <linux/errno.h>
#include <linux/wait.h>
#include <linux/ptrace.h>
#include <linux/unistd.h>
#include <linux/stddef.h>
#include <linux/highuid.h>
#include <linux/personality.h>
#include <linux/tty.h>
#include <linux/binfmts.h>
#include <linux/tracehook.h>
#include <asm/setup.h>
#include <asm/uaccess.h>
#include <asm/pgtable.h>
#include <asm/traps.h>
#include <asm/ucontext.h>
/*
* Do a signal return; undo the signal stack.
*
* Keep the return code on the stack quadword aligned!
* That makes the cache flush below easier.
*/
struct sigframe
{
long dummy_er0;
long dummy_vector;
#if defined(CONFIG_CPU_H8S)
short dummy_exr;
#endif
long dummy_pc;
char *pretcode;
unsigned char retcode[8];
unsigned long extramask[_NSIG_WORDS-1];
struct sigcontext sc;
int sig;
} __attribute__((aligned(2),packed));
struct rt_sigframe
{
long dummy_er0;
long dummy_vector;
#if defined(CONFIG_CPU_H8S)
short dummy_exr;
#endif
long dummy_pc;
char *pretcode;
struct siginfo *pinfo;
void *puc;
unsigned char retcode[8];
struct siginfo info;
struct ucontext uc;
int sig;
} __attribute__((aligned(2),packed));
static inline int
restore_sigcontext(struct sigcontext *usc, int *pd0)
{
struct pt_regs *regs = current_pt_regs();
int err = 0;
unsigned int ccr;
unsigned int usp;
unsigned int er0;
/* Always make any pending restarted system calls return -EINTR */
current_thread_info()->restart_block.fn = do_no_restart_syscall;
#define COPY(r) err |= __get_user(regs->r, &usc->sc_##r) /* restore passed registers */
COPY(er1);
COPY(er2);
COPY(er3);
COPY(er5);
COPY(pc);
ccr = regs->ccr & 0x10;
COPY(ccr);
#undef COPY
regs->ccr &= 0xef;
regs->ccr |= ccr;
regs->orig_er0 = -1; /* disable syscall checks */
err |= __get_user(usp, &usc->sc_usp);
wrusp(usp);
err |= __get_user(er0, &usc->sc_er0);
*pd0 = er0;
return err;
}
asmlinkage int sys_sigreturn(void)
{
unsigned long usp = rdusp();
struct sigframe *frame = (struct sigframe *)(usp - 4);
sigset_t set;
int er0;
if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
goto badframe;
if (__get_user(set.sig[0], &frame->sc.sc_mask) ||
(_NSIG_WORDS > 1 &&
__copy_from_user(&set.sig[1], &frame->extramask,
sizeof(frame->extramask))))
goto badframe;
set_current_blocked(&set);
if (restore_sigcontext(&frame->sc, &er0))
goto badframe;
return er0;
badframe:
force_sig(SIGSEGV, current);
return 0;
}
asmlinkage int sys_rt_sigreturn(void)
{
unsigned long usp = rdusp();
struct rt_sigframe *frame = (struct rt_sigframe *)(usp - 4);
sigset_t set;
int er0;
if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
goto badframe;
if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set)))
goto badframe;
set_current_blocked(&set);
if (restore_sigcontext(&frame->uc.uc_mcontext, &er0))
goto badframe;
if (restore_altstack(&frame->uc.uc_stack))
goto badframe;
return er0;
badframe:
force_sig(SIGSEGV, current);
return 0;
}
static int setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs,
unsigned long mask)
{
int err = 0;
err |= __put_user(regs->er0, &sc->sc_er0);
err |= __put_user(regs->er1, &sc->sc_er1);
err |= __put_user(regs->er2, &sc->sc_er2);
err |= __put_user(regs->er3, &sc->sc_er3);
err |= __put_user(regs->er4, &sc->sc_er4);
err |= __put_user(regs->er5, &sc->sc_er5);
err |= __put_user(regs->er6, &sc->sc_er6);
err |= __put_user(rdusp(), &sc->sc_usp);
err |= __put_user(regs->pc, &sc->sc_pc);
err |= __put_user(regs->ccr, &sc->sc_ccr);
err |= __put_user(mask, &sc->sc_mask);
return err;
}
static inline void *
get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size)
{
unsigned long usp;
/* Default to using normal stack. */
usp = rdusp();
/* This is the X/Open sanctioned signal stack switching. */
if (ka->sa.sa_flags & SA_ONSTACK) {
if (!sas_ss_flags(usp))
usp = current->sas_ss_sp + current->sas_ss_size;
}
return (void *)((usp - frame_size) & -8UL);
}
static int setup_frame (int sig, struct k_sigaction *ka,
sigset_t *set, struct pt_regs *regs)
{
struct sigframe *frame;
int err = 0;
int usig;
unsigned char *ret;
frame = get_sigframe(ka, regs, sizeof(*frame));
if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
goto give_sigsegv;
usig = current_thread_info()->exec_domain
&& current_thread_info()->exec_domain->signal_invmap
&& sig < 32
? current_thread_info()->exec_domain->signal_invmap[sig]
: sig;
err |= __put_user(usig, &frame->sig);
if (err)
goto give_sigsegv;
err |= setup_sigcontext(&frame->sc, regs, set->sig[0]);
if (err)
goto give_sigsegv;
if (_NSIG_WORDS > 1) {
err |= copy_to_user(frame->extramask, &set->sig[1],
sizeof(frame->extramask));
if (err)
goto give_sigsegv;
}
ret = frame->retcode;
if (ka->sa.sa_flags & SA_RESTORER)
ret = (unsigned char *)(ka->sa.sa_restorer);
else {
/* sub.l er0,er0; mov.b #__NR_sigreturn,r0l; trapa #0 */
err |= __put_user(0x1a80f800 + (__NR_sigreturn & 0xff),
(unsigned long *)(frame->retcode + 0));
err |= __put_user(0x5700, (unsigned short *)(frame->retcode + 4));
}
/* Set up to return from userspace. */
err |= __put_user(ret, &frame->pretcode);
if (err)
goto give_sigsegv;
/* Set up registers for signal handler */
wrusp ((unsigned long) frame);
regs->pc = (unsigned long) ka->sa.sa_handler;
regs->er0 = (current_thread_info()->exec_domain
&& current_thread_info()->exec_domain->signal_invmap
&& sig < 32
? current_thread_info()->exec_domain->signal_invmap[sig]
: sig);
regs->er1 = (unsigned long)&(frame->sc);
regs->er5 = current->mm->start_data; /* GOT base */
return 0;
give_sigsegv:
force_sigsegv(sig, current);
return -EFAULT;
}
static int setup_rt_frame (int sig, struct k_sigaction *ka, siginfo_t *info,
sigset_t *set, struct pt_regs *regs)
{
struct rt_sigframe *frame;
int err = 0;
int usig;
unsigned char *ret;
frame = get_sigframe(ka, regs, sizeof(*frame));
if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
goto give_sigsegv;
usig = current_thread_info()->exec_domain
&& current_thread_info()->exec_domain->signal_invmap
&& sig < 32
? current_thread_info()->exec_domain->signal_invmap[sig]
: sig;
err |= __put_user(usig, &frame->sig);
if (err)
goto give_sigsegv;
err |= __put_user(&frame->info, &frame->pinfo);
err |= __put_user(&frame->uc, &frame->puc);
err |= copy_siginfo_to_user(&frame->info, info);
if (err)
goto give_sigsegv;
/* Create the ucontext. */
err |= __put_user(0, &frame->uc.uc_flags);
err |= __put_user(0, &frame->uc.uc_link);
err |= __save_altstack(&frame->uc.uc_stack, rdusp());
err |= setup_sigcontext(&frame->uc.uc_mcontext, regs, set->sig[0]);
err |= copy_to_user (&frame->uc.uc_sigmask, set, sizeof(*set));
if (err)
goto give_sigsegv;
/* Set up to return from userspace. */
ret = frame->retcode;
if (ka->sa.sa_flags & SA_RESTORER)
ret = (unsigned char *)(ka->sa.sa_restorer);
else {
/* sub.l er0,er0; mov.b #__NR_sigreturn,r0l; trapa #0 */
err |= __put_user(0x1a80f800 + (__NR_sigreturn & 0xff),
(unsigned long *)(frame->retcode + 0));
err |= __put_user(0x5700, (unsigned short *)(frame->retcode + 4));
}
err |= __put_user(ret, &frame->pretcode);
if (err)
goto give_sigsegv;
/* Set up registers for signal handler */
wrusp ((unsigned long) frame);
regs->pc = (unsigned long) ka->sa.sa_handler;
regs->er0 = (current_thread_info()->exec_domain
&& current_thread_info()->exec_domain->signal_invmap
&& sig < 32
? current_thread_info()->exec_domain->signal_invmap[sig]
: sig);
regs->er1 = (unsigned long)&(frame->info);
regs->er2 = (unsigned long)&frame->uc;
regs->er5 = current->mm->start_data; /* GOT base */
return 0;
give_sigsegv:
force_sigsegv(sig, current);
return -EFAULT;
}
/*
* OK, we're invoking a handler
*/
static void
handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka,
struct pt_regs * regs)
{
sigset_t *oldset = sigmask_to_save();
int ret;
/* are we from a system call? */
if (regs->orig_er0 >= 0) {
switch (regs->er0) {
case -ERESTART_RESTARTBLOCK:
case -ERESTARTNOHAND:
regs->er0 = -EINTR;
break;
case -ERESTARTSYS:
if (!(ka->sa.sa_flags & SA_RESTART)) {
regs->er0 = -EINTR;
break;
}
/* fallthrough */
case -ERESTARTNOINTR:
regs->er0 = regs->orig_er0;
regs->pc -= 2;
}
}
/* set up the stack frame */
if (ka->sa.sa_flags & SA_SIGINFO)
ret = setup_rt_frame(sig, ka, info, oldset, regs);
else
ret = setup_frame(sig, ka, oldset, regs);
if (!ret)
signal_delivered(sig, info, ka, regs, 0);
}
/*
* Note that 'init' is a special process: it doesn't get signals it doesn't
* want to handle. Thus you cannot kill init even with a SIGKILL even by
* mistake.
*/
static void do_signal(struct pt_regs *regs)
{
siginfo_t info;
int signr;
struct k_sigaction ka;
/*
* We want the common case to go fast, which
* is why we may in certain cases get here from
* kernel mode. Just return without doing anything
* if so.
*/
if ((regs->ccr & 0x10))
return;
current->thread.esp0 = (unsigned long) regs;
signr = get_signal_to_deliver(&info, &ka, regs, NULL);
if (signr > 0) {
/* Whee! Actually deliver the signal. */
handle_signal(signr, &info, &ka, regs);
return;
}
/* Did we come from a system call? */
if (regs->orig_er0 >= 0) {
/* Restart the system call - no handlers present */
if (regs->er0 == -ERESTARTNOHAND ||
regs->er0 == -ERESTARTSYS ||
regs->er0 == -ERESTARTNOINTR) {
regs->er0 = regs->orig_er0;
regs->pc -= 2;
}
if (regs->er0 == -ERESTART_RESTARTBLOCK){
regs->er0 = __NR_restart_syscall;
regs->pc -= 2;
}
}
/* If there's no signal to deliver, we just restore the saved mask. */
restore_saved_sigmask();
}
asmlinkage void do_notify_resume(struct pt_regs *regs, u32 thread_info_flags)
{
if (thread_info_flags & _TIF_SIGPENDING)
do_signal(regs);
if (thread_info_flags & _TIF_NOTIFY_RESUME) {
clear_thread_flag(TIF_NOTIFY_RESUME);
tracehook_notify_resume(regs);
}
}

View File

@@ -1,48 +0,0 @@
/*
* linux/arch/h8300/kernel/sys_h8300.c
*
* This file contains various random system calls that
* have a non-standard calling sequence on the H8/300
* platform.
*/
#include <linux/errno.h>
#include <linux/sched.h>
#include <linux/mm.h>
#include <linux/smp.h>
#include <linux/sem.h>
#include <linux/msg.h>
#include <linux/shm.h>
#include <linux/stat.h>
#include <linux/syscalls.h>
#include <linux/mman.h>
#include <linux/file.h>
#include <linux/fs.h>
#include <linux/ipc.h>
#include <asm/setup.h>
#include <asm/uaccess.h>
#include <asm/cachectl.h>
#include <asm/traps.h>
#include <asm/unistd.h>
/* sys_cacheflush -- no support. */
asmlinkage int
sys_cacheflush (unsigned long addr, int scope, int cache, unsigned long len)
{
return -EINVAL;
}
asmlinkage int sys_getpagesize(void)
{
return PAGE_SIZE;
}
#if defined(CONFIG_SYSCALL_PRINT)
asmlinkage void syscall_print(void *dummy,...)
{
struct pt_regs *regs = (struct pt_regs *) ((unsigned char *)&dummy-4);
printk("call %06lx:%ld 1:%08lx,2:%08lx,3:%08lx,ret:%08lx\n",
((regs->pc)&0xffffff)-2,regs->orig_er0,regs->er1,regs->er2,regs->er3,regs->er0);
}
#endif

View File

@@ -1,338 +0,0 @@
/* Systemcall Entry Table */
#include <linux/sys.h>
#include <asm/linkage.h>
#include <asm/unistd.h>
#define CALL(x) .long _ ## x
.globl _sys_call_table
#if defined(CONFIG_CPU_H8300H)
.h8300h
#endif
#if defined(CONFIG_CPU_H8S)
.h8300s
#endif
.section .text
.align 2
_sys_call_table:
CALL(sys_ni_syscall) /* 0 - old "setup()" system call*/
CALL(sys_exit)
CALL(sys_fork)
CALL(sys_read)
CALL(sys_write)
CALL(sys_open) /* 5 */
CALL(sys_close)
CALL(sys_waitpid)
CALL(sys_creat)
CALL(sys_link)
CALL(sys_unlink) /* 10 */
CALL(sys_execve)
CALL(sys_chdir)
CALL(sys_time)
CALL(sys_mknod)
CALL(sys_chmod) /* 15 */
CALL(sys_chown16)
CALL(sys_ni_syscall) /* old break syscall holder */
CALL(sys_stat)
CALL(sys_lseek)
CALL(sys_getpid) /* 20 */
CALL(sys_mount)
CALL(sys_oldumount)
CALL(sys_setuid16)
CALL(sys_getuid16)
CALL(sys_stime) /* 25 */
CALL(sys_ptrace)
CALL(sys_alarm)
CALL(sys_fstat)
CALL(sys_pause)
CALL(sys_utime) /* 30 */
CALL(sys_ni_syscall) /* old stty syscall holder */
CALL(sys_ni_syscall) /* old gtty syscall holder */
CALL(sys_access)
CALL(sys_nice)
CALL(sys_ni_syscall) /* 35 old ftime syscall holder */
CALL(sys_sync)
CALL(sys_kill)
CALL(sys_rename)
CALL(sys_mkdir)
CALL(sys_rmdir) /* 40 */
CALL(sys_dup)
CALL(sys_pipe)
CALL(sys_times)
CALL(sys_ni_syscall) /* old prof syscall holder */
CALL(sys_brk) /* 45 */
CALL(sys_setgid16)
CALL(sys_getgid16)
CALL(sys_signal)
CALL(sys_geteuid16)
CALL(sys_getegid16) /* 50 */
CALL(sys_acct)
CALL(sys_umount) /* recycled never used phys() */
CALL(sys_ni_syscall) /* old lock syscall holder */
CALL(sys_ioctl)
CALL(sys_fcntl) /* 55 */
CALL(sys_ni_syscall) /* old mpx syscall holder */
CALL(sys_setpgid)
CALL(sys_ni_syscall) /* old ulimit syscall holder */
CALL(sys_ni_syscall)
CALL(sys_umask) /* 60 */
CALL(sys_chroot)
CALL(sys_ustat)
CALL(sys_dup2)
CALL(sys_getppid)
CALL(sys_getpgrp) /* 65 */
CALL(sys_setsid)
CALL(sys_sigaction)
CALL(sys_sgetmask)
CALL(sys_ssetmask)
CALL(sys_setreuid16) /* 70 */
CALL(sys_setregid16)
CALL(sys_sigsuspend)
CALL(sys_sigpending)
CALL(sys_sethostname)
CALL(sys_setrlimit) /* 75 */
CALL(sys_old_getrlimit)
CALL(sys_getrusage)
CALL(sys_gettimeofday)
CALL(sys_settimeofday)
CALL(sys_getgroups16) /* 80 */
CALL(sys_setgroups16)
CALL(sys_old_select)
CALL(sys_symlink)
CALL(sys_lstat)
CALL(sys_readlink) /* 85 */
CALL(sys_uselib)
CALL(sys_swapon)
CALL(sys_reboot)
CALL(sys_old_readdir)
CALL(sys_old_mmap) /* 90 */
CALL(sys_munmap)
CALL(sys_truncate)
CALL(sys_ftruncate)
CALL(sys_fchmod)
CALL(sys_fchown16) /* 95 */
CALL(sys_getpriority)
CALL(sys_setpriority)
CALL(sys_ni_syscall) /* old profil syscall holder */
CALL(sys_statfs)
CALL(sys_fstatfs) /* 100 */
CALL(sys_ni_syscall) /* ioperm for i386 */
CALL(sys_socketcall)
CALL(sys_syslog)
CALL(sys_setitimer)
CALL(sys_getitimer) /* 105 */
CALL(sys_newstat)
CALL(sys_newlstat)
CALL(sys_newfstat)
CALL(sys_ni_syscall)
CALL(sys_ni_syscall) /* iopl for i386 */ /* 110 */
CALL(sys_vhangup)
CALL(sys_ni_syscall) /* obsolete idle() syscall */
CALL(sys_ni_syscall) /* vm86old for i386 */
CALL(sys_wait4)
CALL(sys_swapoff) /* 115 */
CALL(sys_sysinfo)
CALL(sys_ipc)
CALL(sys_fsync)
CALL(sys_sigreturn)
CALL(sys_clone) /* 120 */
CALL(sys_setdomainname)
CALL(sys_newuname)
CALL(sys_cacheflush) /* modify_ldt for i386 */
CALL(sys_adjtimex)
CALL(sys_ni_syscall) /* 125 sys_mprotect */
CALL(sys_sigprocmask)
CALL(sys_ni_syscall) /* sys_create_module */
CALL(sys_init_module)
CALL(sys_delete_module)
CALL(sys_ni_syscall) /* 130 sys_get_kernel_syms */
CALL(sys_quotactl)
CALL(sys_getpgid)
CALL(sys_fchdir)
CALL(sys_bdflush)
CALL(sys_sysfs) /* 135 */
CALL(sys_personality)
CALL(sys_ni_syscall) /* for afs_syscall */
CALL(sys_setfsuid16)
CALL(sys_setfsgid16)
CALL(sys_llseek) /* 140 */
CALL(sys_getdents)
CALL(sys_select)
CALL(sys_flock)
CALL(sys_ni_syscall) /* sys_msync */
CALL(sys_readv) /* 145 */
CALL(sys_writev)
CALL(sys_getsid)
CALL(sys_fdatasync)
CALL(sys_sysctl)
CALL(sys_ni_syscall) /* 150 sys_mlock */
CALL(sys_ni_syscall) /* sys_munlock */
CALL(sys_ni_syscall) /* sys_mlockall */
CALL(sys_ni_syscall) /* sys_munlockall */
CALL(sys_sched_setparam)
CALL(sys_sched_getparam) /* 155 */
CALL(sys_sched_setscheduler)
CALL(sys_sched_getscheduler)
CALL(sys_sched_yield)
CALL(sys_sched_get_priority_max)
CALL(sys_sched_get_priority_min) /* 160 */
CALL(sys_sched_rr_get_interval)
CALL(sys_nanosleep)
CALL(sys_ni_syscall) /* sys_mremap */
CALL(sys_setresuid16)
CALL(sys_getresuid16) /* 165 */
CALL(sys_ni_syscall) /* for vm86 */
CALL(sys_ni_syscall) /* sys_query_module */
CALL(sys_poll)
CALL(sys_ni_syscall) /* old nfsservctl */
CALL(sys_setresgid16) /* 170 */
CALL(sys_getresgid16)
CALL(sys_prctl)
CALL(sys_rt_sigreturn)
CALL(sys_rt_sigaction)
CALL(sys_rt_sigprocmask) /* 175 */
CALL(sys_rt_sigpending)
CALL(sys_rt_sigtimedwait)
CALL(sys_rt_sigqueueinfo)
CALL(sys_rt_sigsuspend)
CALL(sys_pread64) /* 180 */
CALL(sys_pwrite64)
CALL(sys_lchown16);
CALL(sys_getcwd)
CALL(sys_capget)
CALL(sys_capset) /* 185 */
CALL(sys_sigaltstack)
CALL(sys_sendfile)
CALL(sys_ni_syscall) /* streams1 */
CALL(sys_ni_syscall) /* streams2 */
CALL(sys_vfork) /* 190 */
CALL(sys_getrlimit)
CALL(sys_mmap_pgoff)
CALL(sys_truncate64)
CALL(sys_ftruncate64)
CALL(sys_stat64) /* 195 */
CALL(sys_lstat64)
CALL(sys_fstat64)
CALL(sys_chown)
CALL(sys_getuid)
CALL(sys_getgid) /* 200 */
CALL(sys_geteuid)
CALL(sys_getegid)
CALL(sys_setreuid)
CALL(sys_setregid)
CALL(sys_getgroups) /* 205 */
CALL(sys_setgroups)
CALL(sys_fchown)
CALL(sys_setresuid)
CALL(sys_getresuid)
CALL(sys_setresgid) /* 210 */
CALL(sys_getresgid)
CALL(sys_lchown)
CALL(sys_setuid)
CALL(sys_setgid)
CALL(sys_setfsuid) /* 215 */
CALL(sys_setfsgid)
CALL(sys_pivot_root)
CALL(sys_ni_syscall)
CALL(sys_ni_syscall)
CALL(sys_getdents64) /* 220 */
CALL(sys_fcntl64)
CALL(sys_ni_syscall) /* reserved TUX */
CALL(sys_ni_syscall) /* reserved Security */
CALL(sys_gettid)
CALL(sys_readahead) /* 225 */
CALL(sys_setxattr)
CALL(sys_lsetxattr)
CALL(sys_fsetxattr)
CALL(sys_getxattr)
CALL(sys_lgetxattr) /* 230 */
CALL(sys_fgetxattr)
CALL(sys_listxattr)
CALL(sys_llistxattr)
CALL(sys_flistxattr)
CALL(sys_removexattr) /* 235 */
CALL(sys_lremovexattr)
CALL(sys_fremovexattr)
CALL(sys_tkill)
CALL(sys_sendfile64)
CALL(sys_futex) /* 240 */
CALL(sys_sched_setaffinity)
CALL(sys_sched_getaffinity)
CALL(sys_ni_syscall)
CALL(sys_ni_syscall)
CALL(sys_io_setup) /* 245 */
CALL(sys_io_destroy)
CALL(sys_io_getevents)
CALL(sys_io_submit)
CALL(sys_io_cancel)
CALL(sys_fadvise64) /* 250 */
CALL(sys_ni_syscall)
CALL(sys_exit_group)
CALL(sys_lookup_dcookie)
CALL(sys_epoll_create)
CALL(sys_epoll_ctl) /* 255 */
CALL(sys_epoll_wait)
CALL(sys_ni_syscall) /* sys_remap_file_pages */
CALL(sys_set_tid_address)
CALL(sys_timer_create)
CALL(sys_timer_settime) /* 260 */
CALL(sys_timer_gettime)
CALL(sys_timer_getoverrun)
CALL(sys_timer_delete)
CALL(sys_clock_settime)
CALL(sys_clock_gettime) /* 265 */
CALL(sys_clock_getres)
CALL(sys_clock_nanosleep)
CALL(sys_statfs64)
CALL(sys_fstatfs64)
CALL(sys_tgkill) /* 270 */
CALL(sys_utimes)
CALL(sys_fadvise64_64)
CALL(sys_ni_syscall) /* sys_vserver */
CALL(sys_ni_syscall)
CALL(sys_get_mempolicy) /* 275 */
CALL(sys_set_mempolicy)
CALL(sys_mq_open)
CALL(sys_mq_unlink)
CALL(sys_mq_timedsend)
CALL(sys_mq_timedreceive) /* 280 */
CALL(sys_mq_notify)
CALL(sys_mq_getsetattr)
CALL(sys_waitid)
CALL(sys_ni_syscall) /* sys_kexec_load */
CALL(sys_add_key) /* 285 */
CALL(sys_request_key)
CALL(sys_keyctl)
CALL(sys_ioprio_set)
CALL(sys_ioprio_get) /* 290 */
CALL(sys_inotify_init)
CALL(sys_inotify_add_watch)
CALL(sys_inotify_rm_watch)
CALL(sys_migrate_pages)
CALL(sys_openat) /* 295 */
CALL(sys_mkdirat)
CALL(sys_mknodat)
CALL(sys_fchownat)
CALL(sys_futimesat)
CALL(sys_fstatat64) /* 300 */
CALL(sys_unlinkat)
CALL(sys_renameat)
CALL(sys_linkat)
CALL(sys_symlinkat)
CALL(sys_readlinkat) /* 305 */
CALL(sys_fchmodat)
CALL(sys_faccessat)
CALL(sys_ni_syscall) /* sys_pselect6 */
CALL(sys_ni_syscall) /* sys_ppoll */
CALL(sys_unshare) /* 310 */
CALL(sys_set_robust_list)
CALL(sys_get_robust_list)
CALL(sys_splice)
CALL(sys_sync_file_range)
CALL(sys_tee) /* 315 */
CALL(sys_vmsplice)
CALL(sys_ni_syscall) /* sys_move_pages */
CALL(sys_getcpu)
CALL(sys_ni_syscall) /* sys_epoll_pwait */
CALL(sys_setns) /* 320 */

View File

@@ -1,66 +0,0 @@
/*
* linux/arch/h8300/kernel/time.c
*
* Yoshinori Sato <ysato@users.sourceforge.jp>
*
* Copied/hacked from:
*
* linux/arch/m68k/kernel/time.c
*
* Copyright (C) 1991, 1992, 1995 Linus Torvalds
*
* This file contains the m68k-specific time handling details.
* Most of the stuff is located in the machine specific files.
*
* 1997-09-10 Updated NTP code according to technical memorandum Jan '96
* "A Kernel Model for Precision Timekeeping" by Dave Mills
*/
#include <linux/errno.h>
#include <linux/module.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <linux/param.h>
#include <linux/string.h>
#include <linux/mm.h>
#include <linux/timex.h>
#include <linux/profile.h>
#include <asm/io.h>
#include <asm/irq_regs.h>
#include <asm/timer.h>
#define TICK_SIZE (tick_nsec / 1000)
void h8300_timer_tick(void)
{
if (current->pid)
profile_tick(CPU_PROFILING);
xtime_update(1);
update_process_times(user_mode(get_irq_regs()));
}
void read_persistent_clock(struct timespec *ts)
{
unsigned int year, mon, day, hour, min, sec;
/* FIX by dqg : Set to zero for platforms that don't have tod */
/* without this time is undefined and can overflow time_t, causing */
/* very strange errors */
year = 1980;
mon = day = 1;
hour = min = sec = 0;
#ifdef CONFIG_H8300_GETTOD
h8300_gettod (&year, &mon, &day, &hour, &min, &sec);
#endif
if ((year += 1900) < 1970)
year += 100;
ts->tv_sec = mktime(year, mon, day, hour, min, sec);
ts->tv_nsec = 0;
}
void __init time_init(void)
{
h8300_timer_setup();
}

View File

@@ -1,6 +0,0 @@
# h8300 internal timer handler
obj-$(CONFIG_H8300_TIMER8) := timer8.o
obj-$(CONFIG_H8300_TIMER16) := timer16.o
obj-$(CONFIG_H8300_ITU) := itu.o
obj-$(CONFIG_H8300_TPU) := tpu.o

View File

@@ -1,82 +0,0 @@
/*
* linux/arch/h8300/kernel/timer/itu.c
*
* Yoshinori Sato <ysato@users.sourcefoge.jp>
*
* ITU Timer Handler
*
*/
#include <linux/errno.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <linux/param.h>
#include <linux/string.h>
#include <linux/mm.h>
#include <linux/interrupt.h>
#include <linux/init.h>
#include <linux/timex.h>
#include <asm/segment.h>
#include <asm/io.h>
#include <asm/irq.h>
#include <asm/regs306x.h>
#if CONFIG_H8300_ITU_CH == 0
#define ITUBASE 0xffff64
#define ITUIRQ 24
#elif CONFIG_H8300_ITU_CH == 1
#define ITUBASE 0xffff6e
#define ITUIRQ 28
#elif CONFIG_H8300_ITU_CH == 2
#define ITUBASE 0xffff78
#define ITUIRQ 32
#elif CONFIG_H8300_ITU_CH == 3
#define ITUBASE 0xffff82
#define ITUIRQ 36
#elif CONFIG_H8300_ITU_CH == 4
#define ITUBASE 0xffff92
#define ITUIRQ 40
#else
#error Unknown timer channel.
#endif
#define TCR 0
#define TIOR 1
#define TIER 2
#define TSR 3
#define TCNT 4
#define GRA 6
#define GRB 8
static irqreturn_t timer_interrupt(int irq, void *dev_id)
{
h8300_timer_tick();
ctrl_bclr(IMFA, ITUBASE + TSR);
return IRQ_HANDLED;
}
static struct irqaction itu_irq = {
.name = "itu",
.handler = timer_interrupt,
.flags = IRQF_DISABLED | IRQF_TIMER,
};
static const int __initconst divide_rate[] = {1, 2, 4, 8};
void __init h8300_timer_setup(void)
{
unsigned int div;
unsigned int cnt;
calc_param(cnt, div, divide_rate, 0x10000);
setup_irq(ITUIRQ, &itu_irq);
/* initialize timer */
ctrl_outb(0, TSTR);
ctrl_outb(CCLR0 | div, ITUBASE + TCR);
ctrl_outb(0x01, ITUBASE + TIER);
ctrl_outw(cnt, ITUBASE + GRA);
ctrl_bset(CONFIG_H8300_ITU_CH, TSTR);
}

View File

@@ -1,77 +0,0 @@
/*
* linux/arch/h8300/kernel/timer/timer16.c
*
* Yoshinori Sato <ysato@users.sourcefoge.jp>
*
* 16bit Timer Handler
*
*/
#include <linux/errno.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <linux/param.h>
#include <linux/string.h>
#include <linux/mm.h>
#include <linux/interrupt.h>
#include <linux/init.h>
#include <linux/timex.h>
#include <asm/segment.h>
#include <asm/io.h>
#include <asm/irq.h>
#include <asm/regs306x.h>
/* 16bit timer */
#if CONFIG_H8300_TIMER16_CH == 0
#define _16BASE 0xffff78
#define _16IRQ 24
#elif CONFIG_H8300_TIMER16_CH == 1
#define _16BASE 0xffff80
#define _16IRQ 28
#elif CONFIG_H8300_TIMER16_CH == 2
#define _16BASE 0xffff88
#define _16IRQ 32
#else
#error Unknown timer channel.
#endif
#define TCR 0
#define TIOR 1
#define TCNT 2
#define GRA 4
#define GRB 6
#define H8300_TIMER_FREQ CONFIG_CPU_CLOCK*10000 /* Timer input freq. */
static irqreturn_t timer_interrupt(int irq, void *dev_id)
{
h8300_timer_tick();
ctrl_bclr(CONFIG_H8300_TIMER16_CH, TISRA);
return IRQ_HANDLED;
}
static struct irqaction timer16_irq = {
.name = "timer-16",
.handler = timer_interrupt,
.flags = IRQF_DISABLED | IRQF_TIMER,
};
static const int __initconst divide_rate[] = {1, 2, 4, 8};
void __init h8300_timer_setup(void)
{
unsigned int div;
unsigned int cnt;
calc_param(cnt, div, divide_rate, 0x10000);
setup_irq(_16IRQ, &timer16_irq);
/* initialize timer */
ctrl_outb(0, TSTR);
ctrl_outb(CCLR0 | div, _16BASE + TCR);
ctrl_outw(cnt, _16BASE + GRA);
ctrl_bset(4 + CONFIG_H8300_TIMER16_CH, TISRA);
ctrl_bset(CONFIG_H8300_TIMER16_CH, TSTR);
}

View File

@@ -1,102 +0,0 @@
/*
* linux/arch/h8300/kernel/cpu/timer/timer8.c
*
* Yoshinori Sato <ysato@users.sourcefoge.jp>
*
* 8bit Timer Handler
*
*/
#include <linux/errno.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <linux/param.h>
#include <linux/string.h>
#include <linux/mm.h>
#include <linux/interrupt.h>
#include <linux/init.h>
#include <linux/profile.h>
#include <asm/io.h>
#include <asm/irq.h>
#include <asm/timer.h>
#if defined(CONFIG_CPU_H8300H)
#include <asm/regs306x.h>
#endif
#if defined(CONFIG_CPU_H8S)
#include <asm/regs267x.h>
#endif
/* 8bit timer x2 */
#define CMFA 6
#if defined(CONFIG_H8300_TIMER8_CH0)
#define _8BASE _8TCR0
#ifdef CONFIG_CPU_H8300H
#define _8IRQ 36
#endif
#ifdef CONFIG_CPU_H8S
#define _8IRQ 72
#endif
#elif defined(CONFIG_H8300_TIMER8_CH2)
#ifdef CONFIG_CPU_H8300H
#define _8BASE _8TCR2
#define _8IRQ 40
#endif
#endif
#ifndef _8BASE
#error Unknown timer channel.
#endif
#define _8TCR 0
#define _8TCSR 2
#define TCORA 4
#define TCORB 6
#define _8TCNT 8
#define CMIEA 0x40
#define CCLR_CMA 0x08
#define CKS2 0x04
/*
* timer_interrupt() needs to keep up the real-time clock,
* as well as call the "xtime_update()" routine every clocktick
*/
static irqreturn_t timer_interrupt(int irq, void *dev_id)
{
h8300_timer_tick();
ctrl_bclr(CMFA, _8BASE + _8TCSR);
return IRQ_HANDLED;
}
static struct irqaction timer8_irq = {
.name = "timer-8",
.handler = timer_interrupt,
.flags = IRQF_DISABLED | IRQF_TIMER,
};
static const int __initconst divide_rate[] = {8, 64, 8192};
void __init h8300_timer_setup(void)
{
unsigned int div;
unsigned int cnt;
calc_param(cnt, div, divide_rate, 0x10000);
div++;
setup_irq(_8IRQ, &timer8_irq);
#if defined(CONFIG_CPU_H8S)
/* Timer module enable */
ctrl_bclr(0, MSTPCRL)
#endif
/* initialize timer */
ctrl_outw(cnt, _8BASE + TCORA);
ctrl_outw(0x0000, _8BASE + _8TCSR);
ctrl_outw((CMIEA|CCLR_CMA|CKS2) << 8 | div,
_8BASE + _8TCR);
}

View File

@@ -1,100 +0,0 @@
/*
* linux/arch/h8300/kernel/timer/tpu.c
*
* Yoshinori Sato <ysato@users.sourceforge.jp>
*
* TPU Timer Handler
*
*/
#include <linux/errno.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <linux/param.h>
#include <linux/string.h>
#include <linux/mm.h>
#include <linux/interrupt.h>
#include <linux/init.h>
#include <linux/timex.h>
#include <asm/segment.h>
#include <asm/io.h>
#include <asm/irq.h>
#include <asm/regs267x.h>
/* TPU */
#if CONFIG_H8300_TPU_CH == 0
#define TPUBASE 0xffffd0
#define TPUIRQ 40
#elif CONFIG_H8300_TPU_CH == 1
#define TPUBASE 0xffffe0
#define TPUIRQ 48
#elif CONFIG_H8300_TPU_CH == 2
#define TPUBASE 0xfffff0
#define TPUIRQ 52
#elif CONFIG_H8300_TPU_CH == 3
#define TPUBASE 0xfffe80
#define TPUIRQ 56
#elif CONFIG_H8300_TPU_CH == 4
#define TPUBASE 0xfffe90
#define TPUIRQ 64
#else
#error Unknown timer channel.
#endif
#define _TCR 0
#define _TMDR 1
#define _TIOR 2
#define _TIER 4
#define _TSR 5
#define _TCNT 6
#define _GRA 8
#define _GRB 10
#define CCLR0 0x20
static irqreturn_t timer_interrupt(int irq, void *dev_id)
{
h8300_timer_tick();
ctrl_bclr(0, TPUBASE + _TSR);
return IRQ_HANDLED;
}
static struct irqaction tpu_irq = {
.name = "tpu",
.handler = timer_interrupt,
.flags = IRQF_DISABLED | IRQF_TIMER,
};
static const int __initconst divide_rate[] = {
#if CONFIG_H8300_TPU_CH == 0
1,4,16,64,0,0,0,0,
#elif (CONFIG_H8300_TPU_CH == 1) || (CONFIG_H8300_TPU_CH == 5)
1,4,16,64,0,0,256,0,
#elif (CONFIG_H8300_TPU_CH == 2) || (CONFIG_H8300_TPU_CH == 4)
1,4,16,64,0,0,0,1024,
#elif CONFIG_H8300_TPU_CH == 3
1,4,16,64,0,1024,256,4096,
#endif
};
void __init h8300_timer_setup(void)
{
unsigned int cnt;
unsigned int div;
calc_param(cnt, div, divide_rate, 0x10000);
setup_irq(TPUIRQ, &tpu_irq);
/* TPU module enabled */
ctrl_bclr(3, MSTPCRH);
ctrl_outb(0, TSTR);
ctrl_outb(CCLR0 | div, TPUBASE + _TCR);
ctrl_outb(0, TPUBASE + _TMDR);
ctrl_outw(0, TPUBASE + _TIOR);
ctrl_outb(0x01, TPUBASE + _TIER);
ctrl_outw(cnt, TPUBASE + _GRA);
ctrl_bset(CONFIG_H8300_TPU_CH, TSTR);
}

View File

@@ -1,166 +0,0 @@
/*
* linux/arch/h8300/boot/traps.c -- general exception handling code
* H8/300 support Yoshinori Sato <ysato@users.sourceforge.jp>
*
* Cloned from Linux/m68k.
*
* No original Copyright holder listed,
* Probable original (C) Roman Zippel (assigned DJD, 1999)
*
* Copyright 1999-2000 D. Jeff Dionne, <jeff@rt-control.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/types.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/bug.h>
#include <asm/irq.h>
#include <asm/traps.h>
#include <asm/page.h>
static DEFINE_SPINLOCK(die_lock);
/*
* this must be called very early as the kernel might
* use some instruction that are emulated on the 060
*/
void __init base_trap_init(void)
{
}
void __init trap_init (void)
{
}
asmlinkage void set_esp0 (unsigned long ssp)
{
current->thread.esp0 = ssp;
}
/*
* Generic dumping code. Used for panic and debug.
*/
static void dump(struct pt_regs *fp)
{
unsigned long *sp;
unsigned char *tp;
int i;
printk("\nCURRENT PROCESS:\n\n");
printk("COMM=%s PID=%d\n", current->comm, current->pid);
if (current->mm) {
printk("TEXT=%08x-%08x DATA=%08x-%08x BSS=%08x-%08x\n",
(int) current->mm->start_code,
(int) current->mm->end_code,
(int) current->mm->start_data,
(int) current->mm->end_data,
(int) current->mm->end_data,
(int) current->mm->brk);
printk("USER-STACK=%08x KERNEL-STACK=%08lx\n\n",
(int) current->mm->start_stack,
(int) PAGE_SIZE+(unsigned long)current);
}
show_regs(fp);
printk("\nCODE:");
tp = ((unsigned char *) fp->pc) - 0x20;
for (sp = (unsigned long *) tp, i = 0; (i < 0x40); i += 4) {
if ((i % 0x10) == 0)
printk("\n%08x: ", (int) (tp + i));
printk("%08x ", (int) *sp++);
}
printk("\n");
printk("\nKERNEL STACK:");
tp = ((unsigned char *) fp) - 0x40;
for (sp = (unsigned long *) tp, i = 0; (i < 0xc0); i += 4) {
if ((i % 0x10) == 0)
printk("\n%08x: ", (int) (tp + i));
printk("%08x ", (int) *sp++);
}
printk("\n");
if (STACK_MAGIC != *(unsigned long *)((unsigned long)current+PAGE_SIZE))
printk("(Possibly corrupted stack page??)\n");
printk("\n\n");
}
void die(const char *str, struct pt_regs *fp, unsigned long err)
{
static int diecount;
oops_enter();
console_verbose();
spin_lock_irq(&die_lock);
report_bug(fp->pc, fp);
printk(KERN_EMERG "%s: %04lx [#%d] ", str, err & 0xffff, ++diecount);
dump(fp);
spin_unlock_irq(&die_lock);
do_exit(SIGSEGV);
}
extern char _start, _etext;
#define check_kernel_text(addr) \
((addr >= (unsigned long)(&_start)) && \
(addr < (unsigned long)(&_etext)))
static int kstack_depth_to_print = 24;
void show_stack(struct task_struct *task, unsigned long *esp)
{
unsigned long *stack, addr;
int i;
if (esp == NULL)
esp = (unsigned long *) &esp;
stack = esp;
printk("Stack from %08lx:", (unsigned long)stack);
for (i = 0; i < kstack_depth_to_print; i++) {
if (((unsigned long)stack & (THREAD_SIZE - 1)) == 0)
break;
if (i % 8 == 0)
printk("\n ");
printk(" %08lx", *stack++);
}
printk("\nCall Trace:");
i = 0;
stack = esp;
while (((unsigned long)stack & (THREAD_SIZE - 1)) != 0) {
addr = *stack++;
/*
* If the address is either in the text segment of the
* kernel, or in the region which contains vmalloc'ed
* memory, it *may* be the address of a calling
* routine; if so, print it so that someone tracing
* down the cause of the crash will be able to figure
* out the call path that was taken.
*/
if (check_kernel_text(addr)) {
if (i % 4 == 0)
printk("\n ");
printk(" [<%08lx>]", addr);
i++;
}
}
printk("\n");
}
void show_trace_task(struct task_struct *tsk)
{
show_stack(tsk,(unsigned long *)tsk->thread.esp0);
}

View File

@@ -1,157 +0,0 @@
#include <asm-generic/vmlinux.lds.h>
#include <asm/page.h>
/* target memory map */
#ifdef CONFIG_H8300H_GENERIC
#define ROMTOP 0x000000
#define ROMSIZE 0x400000
#define RAMTOP 0x400000
#define RAMSIZE 0x400000
#endif
#ifdef CONFIG_H8300H_AKI3068NET
#define ROMTOP 0x000000
#define ROMSIZE 0x080000
#define RAMTOP 0x400000
#define RAMSIZE 0x200000
#endif
#ifdef CONFIG_H8300H_H8MAX
#define ROMTOP 0x000000
#define ROMSIZE 0x080000
#define RAMTOP 0x400000
#define RAMSIZE 0x200000
#endif
#ifdef CONFIG_H8300H_SIM
#define ROMTOP 0x000000
#define ROMSIZE 0x400000
#define RAMTOP 0x400000
#define RAMSIZE 0x400000
#endif
#ifdef CONFIG_H8S_SIM
#define ROMTOP 0x000000
#define ROMSIZE 0x400000
#define RAMTOP 0x400000
#define RAMSIZE 0x800000
#endif
#ifdef CONFIG_H8S_EDOSK2674
#define ROMTOP 0x000000
#define ROMSIZE 0x400000
#define RAMTOP 0x400000
#define RAMSIZE 0x800000
#endif
#if defined(CONFIG_H8300H_SIM) || defined(CONFIG_H8S_SIM)
INPUT(romfs.o)
#endif
_jiffies = _jiffies_64 + 4;
ENTRY(__start)
SECTIONS
{
#if defined(CONFIG_ROMKERNEL)
. = ROMTOP;
.vectors :
{
__vector = . ;
*(.vectors*)
}
#else
. = RAMTOP;
.bootvec :
{
*(.bootvec)
}
#endif
.text :
{
_text = .;
#if defined(CONFIG_ROMKERNEL)
*(.int_redirect)
#endif
__stext = . ;
TEXT_TEXT
SCHED_TEXT
LOCK_TEXT
__etext = . ;
}
EXCEPTION_TABLE(16)
RODATA
#if defined(CONFIG_ROMKERNEL)
SECURITY_INIT
#endif
ROEND = .;
#if defined(CONFIG_ROMKERNEL)
. = RAMTOP;
.data : AT(ROEND)
#else
.data :
#endif
{
__sdata = . ;
___data_start = . ;
INIT_TASK_DATA(0x2000)
. = ALIGN(0x4) ;
DATA_DATA
. = ALIGN(0x4) ;
*(.data.*)
. = ALIGN(0x4) ;
___init_begin = .;
__sinittext = .;
INIT_TEXT
__einittext = .;
INIT_DATA
. = ALIGN(0x4) ;
INIT_SETUP(0x4)
___setup_start = .;
*(.init.setup)
. = ALIGN(0x4) ;
___setup_end = .;
INIT_CALLS
CON_INITCALL
EXIT_TEXT
EXIT_DATA
INIT_RAM_FS
. = ALIGN(0x4) ;
___init_end = .;
__edata = . ;
}
#if defined(CONFIG_RAMKERNEL)
SECURITY_INIT
#endif
__begin_data = LOADADDR(.data);
.bss :
{
. = ALIGN(0x4) ;
__sbss = . ;
___bss_start = . ;
*(.bss*)
. = ALIGN(0x4) ;
*(COMMON)
. = ALIGN(0x4) ;
___bss_stop = . ;
__ebss = . ;
__end = . ;
__ramstart = .;
}
.romfs :
{
*(.romfs*)
}
. = RAMTOP+RAMSIZE;
.dummy :
{
COMMAND_START = . - 0x200 ;
__ramend = . ;
}
DISCARDS
}