linux/arch/mn10300/include/asm/processor.h
<<
>>
Prefs
   1/* MN10300 Processor specifics
   2 *
   3 * Copyright (C) 2007 Matsushita Electric Industrial Co., Ltd.
   4 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
   5 * Written by David Howells (dhowells@redhat.com)
   6 *
   7 * This program is free software; you can redistribute it and/or
   8 * modify it under the terms of the GNU General Public Licence
   9 * as published by the Free Software Foundation; either version
  10 * 2 of the Licence, or (at your option) any later version.
  11 */
  12
  13#ifndef _ASM_PROCESSOR_H
  14#define _ASM_PROCESSOR_H
  15
  16#include <asm/page.h>
  17#include <asm/ptrace.h>
  18#include <asm/cpu-regs.h>
  19#include <linux/threads.h>
  20
  21/* Forward declaration, a strange C thing */
  22struct task_struct;
  23struct mm_struct;
  24
  25/*
  26 * Default implementation of macro that returns current
  27 * instruction pointer ("program counter").
  28 */
  29#define current_text_addr()                     \
  30({                                              \
  31        void *__pc;                             \
  32        asm("mov pc,%0" : "=a"(__pc));          \
  33        __pc;                                   \
  34})
  35
  36extern void show_registers(struct pt_regs *regs);
  37
  38/*
  39 *  CPU type and hardware bug flags. Kept separately for each CPU.
  40 *  Members of this structure are referenced in head.S, so think twice
  41 *  before touching them. [mj]
  42 */
  43
  44struct mn10300_cpuinfo {
  45        int             type;
  46        unsigned long   loops_per_sec;
  47        char            hard_math;
  48        unsigned long   *pgd_quick;
  49        unsigned long   *pte_quick;
  50        unsigned long   pgtable_cache_sz;
  51};
  52
  53extern struct mn10300_cpuinfo boot_cpu_data;
  54
  55#define cpu_data &boot_cpu_data
  56#define current_cpu_data boot_cpu_data
  57
  58extern void identify_cpu(struct mn10300_cpuinfo *);
  59extern void print_cpu_info(struct mn10300_cpuinfo *);
  60extern void dodgy_tsc(void);
  61#define cpu_relax() barrier()
  62
  63/*
  64 * User space process size: 1.75GB (default).
  65 */
  66#define TASK_SIZE               0x70000000
  67
  68/*
  69 * Where to put the userspace stack by default
  70 */
  71#define STACK_TOP               0x70000000
  72#define STACK_TOP_MAX           STACK_TOP
  73
  74/* This decides where the kernel will search for a free chunk of vm
  75 * space during mmap's.
  76 */
  77#define TASK_UNMAPPED_BASE      0x30000000
  78
  79typedef struct {
  80        unsigned long   seg;
  81} mm_segment_t;
  82
  83struct fpu_state_struct {
  84        unsigned long   fs[32];         /* fpu registers */
  85        unsigned long   fpcr;           /* fpu control register */
  86};
  87
  88struct thread_struct {
  89        struct pt_regs          *uregs;         /* userspace register frame */
  90        unsigned long           pc;             /* kernel PC */
  91        unsigned long           sp;             /* kernel SP */
  92        unsigned long           a3;             /* kernel FP */
  93        unsigned long           wchan;
  94        unsigned long           usp;
  95        struct pt_regs          *__frame;
  96        unsigned long           fpu_flags;
  97#define THREAD_USING_FPU        0x00000001      /* T if this task is using the FPU */
  98        struct fpu_state_struct fpu_state;
  99};
 100
 101#define INIT_THREAD                             \
 102{                                               \
 103        .uregs          = init_uregs,           \
 104        .pc             = 0,                    \
 105        .sp             = 0,                    \
 106        .a3             = 0,                    \
 107        .wchan          = 0,                    \
 108        .__frame        = NULL,                 \
 109}
 110
 111#define INIT_MMAP \
 112{ &init_mm, 0, 0, NULL, PAGE_SHARED, VM_READ | VM_WRITE | VM_EXEC, 1, \
 113  NULL, NULL }
 114
 115/*
 116 * do necessary setup to start up a newly executed thread
 117 * - need to discard the frame stacked by the kernel thread invoking the execve
 118 *   syscall (see RESTORE_ALL macro)
 119 */
 120#define start_thread(regs, new_pc, new_sp) do {         \
 121        set_fs(USER_DS);                                \
 122        __frame = current->thread.uregs;                \
 123        __frame->epsw = EPSW_nSL | EPSW_IE | EPSW_IM;   \
 124        __frame->pc = new_pc;                           \
 125        __frame->sp = new_sp;                           \
 126} while (0)
 127
 128/* Free all resources held by a thread. */
 129extern void release_thread(struct task_struct *);
 130
 131/* Prepare to copy thread state - unlazy all lazy status */
 132extern void prepare_to_copy(struct task_struct *tsk);
 133
 134/*
 135 * create a kernel thread without removing it from tasklists
 136 */
 137extern int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
 138
 139/*
 140 * Return saved PC of a blocked thread.
 141 */
 142extern unsigned long thread_saved_pc(struct task_struct *tsk);
 143
 144unsigned long get_wchan(struct task_struct *p);
 145
 146#define task_pt_regs(task) ((task)->thread.uregs)
 147#define KSTK_EIP(task) (task_pt_regs(task)->pc)
 148#define KSTK_ESP(task) (task_pt_regs(task)->sp)
 149
 150#define KSTK_TOP(info)                          \
 151({                                              \
 152        (unsigned long)(info) + THREAD_SIZE;    \
 153})
 154
 155#define ARCH_HAS_PREFETCH
 156#define ARCH_HAS_PREFETCHW
 157
 158static inline void prefetch(const void *x)
 159{
 160#ifndef CONFIG_MN10300_CACHE_DISABLED
 161#ifdef CONFIG_MN10300_PROC_MN103E010
 162        asm volatile ("nop; nop; dcpf (%0)" : : "r"(x));
 163#else
 164        asm volatile ("dcpf (%0)" : : "r"(x));
 165#endif
 166#endif
 167}
 168
 169static inline void prefetchw(const void *x)
 170{
 171#ifndef CONFIG_MN10300_CACHE_DISABLED
 172#ifdef CONFIG_MN10300_PROC_MN103E010
 173        asm volatile ("nop; nop; dcpf (%0)" : : "r"(x));
 174#else
 175        asm volatile ("dcpf (%0)" : : "r"(x));
 176#endif
 177#endif
 178}
 179
 180#endif /* _ASM_PROCESSOR_H */
 181
lxr.linux.no kindly hosted by Redpill Linpro AS, provider of Linux consulting and operations services since 1995.