00001 /* 00002 * Copyright (C) 2005 Jakub Jermar 00003 * All rights reserved. 00004 * 00005 * Redistribution and use in source and binary forms, with or without 00006 * modification, are permitted provided that the following conditions 00007 * are met: 00008 * 00009 * - Redistributions of source code must retain the above copyright 00010 * notice, this list of conditions and the following disclaimer. 00011 * - Redistributions in binary form must reproduce the above copyright 00012 * notice, this list of conditions and the following disclaimer in the 00013 * documentation and/or other materials provided with the distribution. 00014 * - The name of the author may not be used to endorse or promote products 00015 * derived from this software without specific prior written permission. 00016 * 00017 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 00018 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 00019 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 00020 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 00021 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 00022 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00023 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 00024 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00025 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 00026 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00027 */ 00028 00035 #ifndef __sparc64_CONTEXT_H__ 00036 #define __sparc64_CONTEXT_H__ 00037 00038 #ifndef __sparc64_STACK_H__ 00039 # include <arch/stack.h> 00040 #endif 00041 00042 #ifndef __sparc64_TYPES_H__ 00043 # include <arch/types.h> 00044 #endif 00045 00046 #ifndef __ALIGN_H__ 00047 # include <align.h> 00048 #endif 00049 00050 #define SP_DELTA STACK_WINDOW_SAVE_AREA_SIZE 00051 00052 #ifdef context_set 00053 #undef context_set 00054 #endif 00055 00056 #define context_set(c, _pc, stack, size) \ 00057 (c)->pc = ((__address) _pc) - 8; \ 00058 (c)->sp = ((__address) stack) + ALIGN_UP((size), STACK_ALIGNMENT) - (STACK_BIAS + SP_DELTA); \ 00059 (c)->fp = -STACK_BIAS; \ 00060 (c)->cleanwin = 0 00061 00062 00063 /* 00064 * Only save registers that must be preserved across 00065 * function calls. 00066 */ 00067 struct context { 00068 __address sp; /* %o6 */ 00069 __address pc; /* %o7 */ 00070 __u64 i0; 00071 __u64 i1; 00072 __u64 i2; 00073 __u64 i3; 00074 __u64 i4; 00075 __u64 i5; 00076 __address fp; /* %i6 */ 00077 __address i7; 00078 __u64 l0; 00079 __u64 l1; 00080 __u64 l2; 00081 __u64 l3; 00082 __u64 l4; 00083 __u64 l5; 00084 __u64 l6; 00085 __u64 l7; 00086 ipl_t ipl; 00087 __u64 cleanwin; 00088 }; 00089 00090 #endif 00091