linux/arch/microblaze/include/asm/processor.h
<<
>>
Prefs
   1/*
   2 * Copyright (C) 2008-2009 Michal Simek <monstr@monstr.eu>
   3 * Copyright (C) 2008-2009 PetaLogix
   4 * Copyright (C) 2006 Atmark Techno, Inc.
   5 *
   6 * This file is subject to the terms and conditions of the GNU General Public
   7 * License. See the file "COPYING" in the main directory of this archive
   8 * for more details.
   9 */
  10
  11#ifndef _ASM_MICROBLAZE_PROCESSOR_H
  12#define _ASM_MICROBLAZE_PROCESSOR_H
  13
  14#include <asm/ptrace.h>
  15#include <asm/setup.h>
  16#include <asm/registers.h>
  17#include <asm/segment.h>
  18#include <asm/entry.h>
  19#include <asm/current.h>
  20
  21# ifndef __ASSEMBLY__
  22/* from kernel/cpu/mb.c */
  23extern const struct seq_operations cpuinfo_op;
  24
  25# define cpu_relax()            barrier()
  26# define cpu_sleep()            do {} while (0)
  27# define prepare_to_copy(tsk)   do {} while (0)
  28
  29#define task_pt_regs(tsk) \
  30                (((struct pt_regs *)(THREAD_SIZE + task_stack_page(tsk))) - 1)
  31
  32/* Do necessary setup to start up a newly executed thread. */
  33void start_thread(struct pt_regs *regs, unsigned long pc, unsigned long usp);
  34
  35# endif /* __ASSEMBLY__ */
  36
  37# ifndef CONFIG_MMU
  38/*
  39 * User space process size: memory size
  40 *
  41 * TASK_SIZE on MMU cpu is usually 1GB. However, on no-MMU arch, both
  42 * user processes and the kernel is on the same memory region. They
  43 * both share the memory space and that is limited by the amount of
  44 * physical memory. thus, we set TASK_SIZE == amount of total memory.
  45 */
  46# define TASK_SIZE      (0x81000000 - 0x80000000)
  47
  48/*
  49 * Default implementation of macro that returns current
  50 * instruction pointer ("program counter").
  51 */
  52# define current_text_addr() ({ __label__ _l; _l: &&_l; })
  53
  54/*
  55 * This decides where the kernel will search for a free chunk of vm
  56 * space during mmap's. We won't be using it
  57 */
  58# define TASK_UNMAPPED_BASE     0
  59
  60/* definition in include/linux/sched.h */
  61struct task_struct;
  62
  63/* thread_struct is gone. use thread_info instead. */
  64struct thread_struct { };
  65# define INIT_THREAD    { }
  66
  67/* Free all resources held by a thread. */
  68static inline void release_thread(struct task_struct *dead_task)
  69{
  70}
  71
  72/* Free all resources held by a thread. */
  73static inline void exit_thread(void)
  74{
  75}
  76
  77extern unsigned long thread_saved_pc(struct task_struct *t);
  78
  79extern unsigned long get_wchan(struct task_struct *p);
  80
  81/*
  82 * create a kernel thread without removing it from tasklists
  83 */
  84extern int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
  85
  86# define KSTK_EIP(tsk)  (0)
  87# define KSTK_ESP(tsk)  (0)
  88
  89# else /* CONFIG_MMU */
  90
  91/*
  92 * This is used to define STACK_TOP, and with MMU it must be below
  93 * kernel base to select the correct PGD when handling MMU exceptions.
  94 */
  95# define TASK_SIZE      (CONFIG_KERNEL_START)
  96
  97/*
  98 * This decides where the kernel will search for a free chunk of vm
  99 * space during mmap's.
 100 */
 101# define TASK_UNMAPPED_BASE     (TASK_SIZE / 8 * 3)
 102
 103# define THREAD_KSP     0
 104
 105#  ifndef __ASSEMBLY__
 106
 107/*
 108 * Default implementation of macro that returns current
 109 * instruction pointer ("program counter").
 110 */
 111#  define current_text_addr()   ({ __label__ _l; _l: &&_l; })
 112
 113/* If you change this, you must change the associated assembly-languages
 114 * constants defined below, THREAD_*.
 115 */
 116struct thread_struct {
 117        /* kernel stack pointer (must be first field in structure) */
 118        unsigned long   ksp;
 119        unsigned long   ksp_limit;      /* if ksp <= ksp_limit stack overflow */
 120        void            *pgdir;         /* root of page-table tree */
 121        struct pt_regs  *regs;          /* Pointer to saved register state */
 122};
 123
 124#  define INIT_THREAD { \
 125        .ksp   = sizeof init_stack + (unsigned long)init_stack, \
 126        .pgdir = swapper_pg_dir, \
 127}
 128
 129/* Do necessary setup to start up a newly executed thread.  */
 130void start_thread(struct pt_regs *regs,
 131                unsigned long pc, unsigned long usp);
 132
 133/* Free all resources held by a thread. */
 134extern inline void release_thread(struct task_struct *dead_task)
 135{
 136}
 137
 138extern int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
 139
 140/* Free current thread data structures etc.  */
 141static inline void exit_thread(void)
 142{
 143}
 144
 145/* Return saved (kernel) PC of a blocked thread.  */
 146#  define thread_saved_pc(tsk)  \
 147        ((tsk)->thread.regs ? (tsk)->thread.regs->r15 : 0)
 148
 149unsigned long get_wchan(struct task_struct *p);
 150
 151/* The size allocated for kernel stacks. This _must_ be a power of two! */
 152# define KERNEL_STACK_SIZE      0x2000
 153
 154/* Return some info about the user process TASK.  */
 155#  define task_tos(task)        ((unsigned long)(task) + KERNEL_STACK_SIZE)
 156#  define task_regs(task) ((struct pt_regs *)task_tos(task) - 1)
 157
 158#  define task_pt_regs_plus_args(tsk) \
 159        (((void *)task_pt_regs(tsk)) - STATE_SAVE_ARG_SPACE)
 160
 161#  define task_sp(task) (task_regs(task)->r1)
 162#  define task_pc(task) (task_regs(task)->pc)
 163/* Grotty old names for some.  */
 164#  define KSTK_EIP(task)        (task_pc(task))
 165#  define KSTK_ESP(task)        (task_sp(task))
 166
 167/* FIXME */
 168#  define deactivate_mm(tsk, mm)        do { } while (0)
 169
 170#  define STACK_TOP     TASK_SIZE
 171#  define STACK_TOP_MAX STACK_TOP
 172
 173#  endif /* __ASSEMBLY__ */
 174# endif /* CONFIG_MMU */
 175#endif /* _ASM_MICROBLAZE_PROCESSOR_H */
 176