at v3.9 3.5 kB view raw
1/* 2 * Process/processor support for the Hexagon architecture 3 * 4 * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved. 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License version 2 and 8 * only version 2 as published by the Free Software Foundation. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 18 * 02110-1301, USA. 19 */ 20 21#ifndef _ASM_PROCESSOR_H 22#define _ASM_PROCESSOR_H 23 24#ifndef __ASSEMBLY__ 25 26#include <asm/mem-layout.h> 27#include <asm/registers.h> 28#include <asm/hexagon_vm.h> 29 30/* must be a macro */ 31#define current_text_addr() ({ __label__ _l; _l: &&_l; }) 32 33/* task_struct, defined elsewhere, is the "process descriptor" */ 34struct task_struct; 35 36/* this is defined in arch/process.c */ 37extern unsigned long thread_saved_pc(struct task_struct *tsk); 38 39extern void start_thread(struct pt_regs *, unsigned long, unsigned long); 40 41/* 42 * thread_struct is supposed to be for context switch data. 43 * Specifically, to hold the state necessary to perform switch_to... 44 */ 45struct thread_struct { 46 void *switch_sp; 47}; 48 49/* 50 * initializes thread_struct 51 * The only thing we have in there is switch_sp 52 * which doesn't really need to be initialized. 53 */ 54 55#define INIT_THREAD { \ 56} 57 58#define cpu_relax() __vmyield() 59 60/* 61 * Decides where the kernel will search for a free chunk of vm space during 62 * mmaps. 63 * See also arch_get_unmapped_area. 64 * Doesn't affect if you have MAX_FIXED in the page flags set though... 65 * 66 * Apparently the convention is that ld.so will ask for "unmapped" private 67 * memory to be allocated SOMEWHERE, but it also asks for memory explicitly 68 * via MAP_FIXED at the lower * addresses starting at VA=0x0. 69 * 70 * If the two requests collide, you get authentic segfaulting action, so 71 * you have to kick the "unmapped" base requests higher up. 72 */ 73#define TASK_UNMAPPED_BASE (PAGE_ALIGN(TASK_SIZE/3)) 74 75 76#define task_pt_regs(task) \ 77 ((struct pt_regs *)(task_stack_page(task) + THREAD_SIZE) - 1) 78 79#define KSTK_EIP(tsk) (pt_elr(task_pt_regs(tsk))) 80#define KSTK_ESP(tsk) (pt_psp(task_pt_regs(tsk))) 81 82/* Free all resources held by a thread; defined in process.c */ 83extern void release_thread(struct task_struct *dead_task); 84 85/* Get wait channel for task P. */ 86extern unsigned long get_wchan(struct task_struct *p); 87 88/* The following stuff is pretty HEXAGON specific. */ 89 90/* This is really just here for __switch_to. 91 Offsets are pulled via asm-offsets.c */ 92 93/* 94 * No real reason why VM and native switch stacks should be different. 95 * Ultimately this should merge. Note that Rev C. ABI called out only 96 * R24-27 as callee saved GPRs needing explicit attention (R29-31 being 97 * dealt with automagically by allocframe), but the current ABI has 98 * more, R16-R27. By saving more, the worst case is that we waste some 99 * cycles if building with the old compilers. 100 */ 101 102struct hexagon_switch_stack { 103 unsigned long long r1716; 104 unsigned long long r1918; 105 unsigned long long r2120; 106 unsigned long long r2322; 107 unsigned long long r2524; 108 unsigned long long r2726; 109 unsigned long fp; 110 unsigned long lr; 111}; 112 113#endif /* !__ASSEMBLY__ */ 114 115#endif