| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* processor.h: FRV processor definitions | 
|  | 2 | * | 
|  | 3 | * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved. | 
|  | 4 | * Written by David Howells (dhowells@redhat.com) | 
|  | 5 | * | 
|  | 6 | * This program is free software; you can redistribute it and/or | 
|  | 7 | * modify it under the terms of the GNU General Public License | 
|  | 8 | * as published by the Free Software Foundation; either version | 
|  | 9 | * 2 of the License, or (at your option) any later version. | 
|  | 10 | */ | 
|  | 11 |  | 
|  | 12 | #ifndef _ASM_PROCESSOR_H | 
|  | 13 | #define _ASM_PROCESSOR_H | 
|  | 14 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 15 | #include <asm/mem-layout.h> | 
|  | 16 |  | 
|  | 17 | #ifndef __ASSEMBLY__ | 
|  | 18 | /* | 
|  | 19 | * Default implementation of macro that returns current | 
|  | 20 | * instruction pointer ("program counter"). | 
|  | 21 | */ | 
|  | 22 | #define current_text_addr() ({ __label__ _l; _l: &&_l;}) | 
|  | 23 |  | 
| Chase Venters | f6dc8c5 | 2006-07-08 11:10:29 -0500 | [diff] [blame] | 24 | #include <linux/compiler.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 25 | #include <linux/linkage.h> | 
|  | 26 | #include <asm/sections.h> | 
|  | 27 | #include <asm/segment.h> | 
|  | 28 | #include <asm/fpu.h> | 
|  | 29 | #include <asm/registers.h> | 
|  | 30 | #include <asm/ptrace.h> | 
|  | 31 | #include <asm/current.h> | 
|  | 32 | #include <asm/cache.h> | 
|  | 33 |  | 
|  | 34 | /* Forward declaration, a strange C thing */ | 
|  | 35 | struct task_struct; | 
|  | 36 |  | 
|  | 37 | /* | 
|  | 38 | *  CPU type and hardware bug flags. Kept separately for each CPU. | 
|  | 39 | */ | 
|  | 40 | struct cpuinfo_frv { | 
|  | 41 | #ifdef CONFIG_MMU | 
|  | 42 | unsigned long	*pgd_quick; | 
|  | 43 | unsigned long	*pte_quick; | 
|  | 44 | unsigned long	pgtable_cache_sz; | 
|  | 45 | #endif | 
|  | 46 | } __cacheline_aligned; | 
|  | 47 |  | 
|  | 48 | extern struct cpuinfo_frv __nongprelbss boot_cpu_data; | 
|  | 49 |  | 
|  | 50 | #define cpu_data		(&boot_cpu_data) | 
|  | 51 | #define current_cpu_data	boot_cpu_data | 
|  | 52 |  | 
|  | 53 | /* | 
|  | 54 | * Bus types | 
|  | 55 | */ | 
|  | 56 | #define EISA_bus 0 | 
|  | 57 | #define MCA_bus 0 | 
|  | 58 |  | 
|  | 59 | struct thread_struct { | 
|  | 60 | struct pt_regs		*frame;		/* [GR28] exception frame ptr for this thread */ | 
|  | 61 | struct task_struct	*curr;		/* [GR29] current pointer for this thread */ | 
|  | 62 | unsigned long		sp;		/* [GR1 ] kernel stack pointer */ | 
|  | 63 | unsigned long		fp;		/* [GR2 ] kernel frame pointer */ | 
|  | 64 | unsigned long		lr;		/* link register */ | 
|  | 65 | unsigned long		pc;		/* program counter */ | 
|  | 66 | unsigned long		gr[12];		/* [GR16-GR27] */ | 
|  | 67 | unsigned long		sched_lr;	/* LR from schedule() */ | 
|  | 68 |  | 
|  | 69 | union { | 
|  | 70 | struct pt_regs		*frame0;	/* top (user) stack frame */ | 
|  | 71 | struct user_context	*user;		/* userspace context */ | 
|  | 72 | }; | 
|  | 73 | } __attribute__((aligned(8))); | 
|  | 74 |  | 
|  | 75 | extern struct pt_regs *__kernel_frame0_ptr; | 
|  | 76 | extern struct task_struct *__kernel_current_task; | 
|  | 77 |  | 
|  | 78 | #endif | 
|  | 79 |  | 
|  | 80 | #ifndef __ASSEMBLY__ | 
|  | 81 | #define INIT_THREAD_FRAME0 \ | 
|  | 82 | ((struct pt_regs *) \ | 
|  | 83 | (sizeof(init_stack) + (unsigned long) init_stack - sizeof(struct user_context))) | 
|  | 84 |  | 
|  | 85 | #define INIT_THREAD {				\ | 
|  | 86 | NULL,					\ | 
|  | 87 | (struct task_struct *) init_stack,	\ | 
|  | 88 | 0, 0, 0, 0,				\ | 
|  | 89 | { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },	\ | 
|  | 90 | 0,					\ | 
|  | 91 | { INIT_THREAD_FRAME0 },			\ | 
|  | 92 | } | 
|  | 93 |  | 
|  | 94 | /* | 
|  | 95 | * do necessary setup to start up a newly executed thread. | 
|  | 96 | * - need to discard the frame stacked by init() invoking the execve syscall | 
|  | 97 | */ | 
|  | 98 | #define start_thread(_regs, _pc, _usp)			\ | 
|  | 99 | do {							\ | 
|  | 100 | set_fs(USER_DS); /* reads from user space */	\ | 
|  | 101 | __frame = __kernel_frame0_ptr;			\ | 
|  | 102 | __frame->pc	= (_pc);			\ | 
|  | 103 | __frame->psr	&= ~PSR_S;			\ | 
|  | 104 | __frame->sp	= (_usp);			\ | 
|  | 105 | } while(0) | 
|  | 106 |  | 
|  | 107 | extern void prepare_to_copy(struct task_struct *tsk); | 
|  | 108 |  | 
|  | 109 | /* Free all resources held by a thread. */ | 
|  | 110 | static inline void release_thread(struct task_struct *dead_task) | 
|  | 111 | { | 
|  | 112 | } | 
|  | 113 |  | 
|  | 114 | extern asmlinkage int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); | 
|  | 115 | extern asmlinkage void save_user_regs(struct user_context *target); | 
|  | 116 | extern asmlinkage void *restore_user_regs(const struct user_context *target, ...); | 
|  | 117 |  | 
|  | 118 | #define copy_segments(tsk, mm)		do { } while (0) | 
|  | 119 | #define release_segments(mm)		do { } while (0) | 
|  | 120 | #define forget_segments()		do { } while (0) | 
|  | 121 |  | 
|  | 122 | /* | 
|  | 123 | * Free current thread data structures etc.. | 
|  | 124 | */ | 
|  | 125 | static inline void exit_thread(void) | 
|  | 126 | { | 
|  | 127 | } | 
|  | 128 |  | 
|  | 129 | /* | 
|  | 130 | * Return saved PC of a blocked thread. | 
|  | 131 | */ | 
|  | 132 | extern unsigned long thread_saved_pc(struct task_struct *tsk); | 
|  | 133 |  | 
|  | 134 | unsigned long get_wchan(struct task_struct *p); | 
|  | 135 |  | 
|  | 136 | #define	KSTK_EIP(tsk)	((tsk)->thread.frame0->pc) | 
|  | 137 | #define	KSTK_ESP(tsk)	((tsk)->thread.frame0->sp) | 
|  | 138 |  | 
|  | 139 | /* Allocation and freeing of basic task resources. */ | 
|  | 140 | extern struct task_struct *alloc_task_struct(void); | 
|  | 141 | extern void free_task_struct(struct task_struct *p); | 
|  | 142 |  | 
| Chase Venters | f6dc8c5 | 2006-07-08 11:10:29 -0500 | [diff] [blame] | 143 | #define cpu_relax()    barrier() | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 144 |  | 
|  | 145 | /* data cache prefetch */ | 
|  | 146 | #define ARCH_HAS_PREFETCH | 
|  | 147 | static inline void prefetch(const void *x) | 
|  | 148 | { | 
|  | 149 | asm volatile("dcpl %0,gr0,#0" : : "r"(x)); | 
|  | 150 | } | 
|  | 151 |  | 
|  | 152 | #endif /* __ASSEMBLY__ */ | 
|  | 153 | #endif /* _ASM_PROCESSOR_H */ |