Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifndef _ASM_M32R_PROCESSOR_H |
| 2 | #define _ASM_M32R_PROCESSOR_H |
| 3 | |
| 4 | /* |
| 5 | * include/asm-m32r/processor.h |
| 6 | * |
| 7 | * This file is subject to the terms and conditions of the GNU General Public |
| 8 | * License. See the file "COPYING" in the main directory of this archive |
| 9 | * for more details. |
| 10 | * |
| 11 | * Copyright (C) 1994 Linus Torvalds |
| 12 | * Copyright (C) 2001 Hiroyuki Kondo, Hirokazu Takata, and Hitoshi Yamamoto |
| 13 | * Copyright (C) 2004 Hirokazu Takata <takata at linux-m32r.org> |
| 14 | */ |
| 15 | |
| 16 | #include <linux/kernel.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17 | #include <asm/cache.h> |
| 18 | #include <asm/ptrace.h> /* pt_regs */ |
| 19 | |
| 20 | /* |
| 21 | * Default implementation of macro that returns current |
| 22 | * instruction pointer ("program counter"). |
| 23 | */ |
| 24 | #define current_text_addr() ({ __label__ _l; _l: &&_l; }) |
| 25 | |
| 26 | /* |
| 27 | * CPU type and hardware bug flags. Kept separately for each CPU. |
| 28 | * Members of this structure are referenced in head.S, so think twice |
| 29 | * before touching them. [mj] |
| 30 | */ |
| 31 | |
| 32 | struct cpuinfo_m32r { |
| 33 | unsigned long pgtable_cache_sz; |
| 34 | unsigned long cpu_clock; |
| 35 | unsigned long bus_clock; |
| 36 | unsigned long timer_divide; |
| 37 | unsigned long loops_per_jiffy; |
| 38 | }; |
| 39 | |
| 40 | /* |
| 41 | * capabilities of CPUs |
| 42 | */ |
| 43 | |
| 44 | extern struct cpuinfo_m32r boot_cpu_data; |
| 45 | |
| 46 | #ifdef CONFIG_SMP |
| 47 | extern struct cpuinfo_m32r cpu_data[]; |
| 48 | #define current_cpu_data cpu_data[smp_processor_id()] |
| 49 | #else |
| 50 | #define cpu_data (&boot_cpu_data) |
| 51 | #define current_cpu_data boot_cpu_data |
| 52 | #endif |
| 53 | |
| 54 | /* |
| 55 | * User space process size: 2GB (default). |
| 56 | */ |
| 57 | #ifdef CONFIG_MMU |
| 58 | #define TASK_SIZE (0x80000000UL) |
| 59 | #else |
| 60 | #define TASK_SIZE (0x00400000UL) |
| 61 | #endif |
| 62 | |
David Howells | 922a70d | 2008-02-08 04:19:26 -0800 | [diff] [blame] | 63 | #ifdef __KERNEL__ |
| 64 | #define STACK_TOP TASK_SIZE |
| 65 | #define STACK_TOP_MAX STACK_TOP |
| 66 | #endif |
| 67 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 68 | /* This decides where the kernel will search for a free chunk of vm |
| 69 | * space during mmap's. |
| 70 | */ |
| 71 | #define TASK_UNMAPPED_BASE PAGE_ALIGN(TASK_SIZE / 3) |
| 72 | |
| 73 | typedef struct { |
| 74 | unsigned long seg; |
| 75 | } mm_segment_t; |
| 76 | |
| 77 | #define MAX_TRAPS 10 |
| 78 | |
| 79 | struct debug_trap { |
| 80 | int nr_trap; |
| 81 | unsigned long addr[MAX_TRAPS]; |
| 82 | unsigned long insn[MAX_TRAPS]; |
| 83 | }; |
| 84 | |
| 85 | struct thread_struct { |
| 86 | unsigned long address; |
| 87 | unsigned long trap_no; /* Trap number */ |
| 88 | unsigned long error_code; /* Error code of trap */ |
| 89 | unsigned long lr; /* saved pc */ |
| 90 | unsigned long sp; /* user stack pointer */ |
| 91 | struct debug_trap debug_trap; |
| 92 | }; |
| 93 | |
| 94 | #define INIT_SP (sizeof(init_stack) + (unsigned long) &init_stack) |
| 95 | |
| 96 | #define INIT_THREAD { \ |
| 97 | .sp = INIT_SP, \ |
| 98 | } |
| 99 | |
| 100 | /* |
| 101 | * Do necessary setup to start up a newly executed thread. |
| 102 | */ |
| 103 | |
| 104 | /* User process Backup PSW */ |
| 105 | #define USERPS_BPSW (M32R_PSW_BSM|M32R_PSW_BIE|M32R_PSW_BPM) |
| 106 | |
| 107 | #define start_thread(regs, new_pc, new_spu) \ |
| 108 | do { \ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 109 | regs->psw = (regs->psw | USERPS_BPSW) & 0x0000FFFFUL; \ |
| 110 | regs->bpc = new_pc; \ |
| 111 | regs->spu = new_spu; \ |
| 112 | } while (0) |
| 113 | |
| 114 | /* Forward declaration, a strange C thing */ |
| 115 | struct task_struct; |
| 116 | struct mm_struct; |
| 117 | |
| 118 | /* Free all resources held by a thread. */ |
| 119 | extern void release_thread(struct task_struct *); |
| 120 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 121 | /* Copy and release all segment info associated with a VM */ |
| 122 | extern void copy_segments(struct task_struct *p, struct mm_struct * mm); |
| 123 | extern void release_segments(struct mm_struct * mm); |
| 124 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 125 | /* Copy and release all segment info associated with a VM */ |
| 126 | #define copy_segments(p, mm) do { } while (0) |
| 127 | #define release_segments(mm) do { } while (0) |
| 128 | |
| 129 | unsigned long get_wchan(struct task_struct *p); |
| 130 | #define KSTK_EIP(tsk) ((tsk)->thread.lr) |
| 131 | #define KSTK_ESP(tsk) ((tsk)->thread.sp) |
| 132 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 133 | #define cpu_relax() barrier() |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 134 | |
| 135 | #endif /* _ASM_M32R_PROCESSOR_H */ |