| 1 |
|
| 2 | |
| 3 | * OpenRISC Linux
|
| 4 | *
|
| 5 | * Linux architectural port borrowing liberally from similar works of
|
| 6 | * others. All original copyrights apply as per the original source
|
| 7 | * declaration.
|
| 8 | *
|
| 9 | * OpenRISC implementation:
|
| 10 | * Copyright (C) 2003 Matjaz Breskvar <[email protected]>
|
| 11 | * Copyright (C) 2010-2011 Jonas Bonn <[email protected]>
|
| 12 | * et al.
|
| 13 |
|
| 14 |
|
| 15 | #ifndef __ASM_OPENRISC_PROCESSOR_H
|
| 16 | #define __ASM_OPENRISC_PROCESSOR_H
|
| 17 |
|
| 18 | #include <asm/spr_defs.h>
|
| 19 | #include <asm/page.h>
|
| 20 | #include <asm/ptrace.h>
|
| 21 |
|
| 22 | #define STACK_TOP TASK_SIZE
|
| 23 | #define STACK_TOP_MAX STACK_TOP
|
| 24 |
|
| 25 | #define KERNEL_SR (SPR_SR_DME | SPR_SR_IME | SPR_SR_ICE \
|
| 26 | | SPR_SR_DCE | SPR_SR_SM)
|
| 27 | #define USER_SR (SPR_SR_DME | SPR_SR_IME | SPR_SR_ICE \
|
| 28 | | SPR_SR_DCE | SPR_SR_IEE | SPR_SR_TEE)
|
| 29 |
|
| 30 | #define SPR_SR_USER_MASK (SPR_SR_F | SPR_SR_CY | SPR_SR_OV)
|
| 31 |
|
| 32 | |
| 33 | * User space process size. This is hardcoded into a few places,
|
| 34 | * so don't change it unless you know what you are doing.
|
| 35 |
|
| 36 |
|
| 37 | #define TASK_SIZE (0x80000000UL)
|
| 38 |
|
| 39 | |
| 40 | * space during mmap's.
|
| 41 |
|
| 42 | #define TASK_UNMAPPED_BASE (TASK_SIZE / 8 * 3)
|
| 43 |
|
| 44 | #ifndef __ASSEMBLER__
|
| 45 |
|
| 46 | struct task_struct;
|
| 47 |
|
| 48 | struct thread_struct {
|
| 49 | long fpcsr;
|
| 50 | };
|
| 51 |
|
| 52 | |
| 53 | * At user->kernel entry, the pt_regs struct is stacked on the top of the
|
| 54 | * kernel-stack. This macro allows us to find those regs for a task.
|
| 55 | * Notice that subsequent pt_regs stackings, like recursive interrupts
|
| 56 | * occurring while we're in the kernel, won't affect this - only the first
|
| 57 | * user->kernel transition registers are reached by this (i.e. not regs
|
| 58 | * for running signal handler)
|
| 59 |
|
| 60 | #define user_regs(thread_info) (((struct pt_regs *)((unsigned long)(thread_info) + THREAD_SIZE - STACK_FRAME_OVERHEAD)) - 1)
|
| 61 |
|
| 62 | |
| 63 | * Dito but for the currently running task
|
| 64 |
|
| 65 |
|
| 66 | #define task_pt_regs(task) user_regs(task_thread_info(task))
|
| 67 |
|
| 68 | #define INIT_SP (sizeof(init_stack) + (unsigned long) &init_stack)
|
| 69 |
|
| 70 | #define INIT_THREAD { }
|
| 71 |
|
| 72 |
|
| 73 | #define KSTK_EIP(tsk) (task_pt_regs(tsk)->pc)
|
| 74 | #define KSTK_ESP(tsk) (task_pt_regs(tsk)->sp)
|
| 75 |
|
| 76 |
|
| 77 | void start_thread(struct pt_regs *regs, unsigned long nip, unsigned long sp);
|
| 78 | unsigned long __get_wchan(struct task_struct *p);
|
| 79 | void show_registers(struct pt_regs *regs);
|
| 80 |
|
| 81 | #define cpu_relax() barrier()
|
| 82 |
|
| 83 | #endif
|
| 84 | #endif
|