Nut/OS  4.10.3
API Reference
ptrace.h
Go to the documentation of this file.
00001 #ifndef ARCH_ARM_PTRACE_H
00002 #define ARCH_ARM_PTRACE_H
00003 /*
00004  * Copyright (C) 2008 by Duane Ellis
00005  *
00006  * All rights reserved.
00007  *
00008  * The original code had been released as part of the LoastARM Project 
00009  * under GPL Version 2 and is published here under the following license
00010  * with kind permission from the author:
00011  *
00012  * Redistribution and use in source and binary forms, with or without
00013  * modification, are permitted provided that the following conditions
00014  * are met:
00015  *
00016  * 1. Redistributions of source code must retain the above copyright
00017  *    notice, this list of conditions and the following disclaimer.
00018  * 2. Redistributions in binary form must reproduce the above copyright
00019  *    notice, this list of conditions and the following disclaimer in the
00020  *    documentation and/or other materials provided with the distribution.
00021  * 3. Neither the name of the copyright holders nor the names of
00022  *    contributors may be used to endorse or promote products derived
00023  *    from this software without specific prior written permission.
00024  *
00025  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00026  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00027  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00028  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
00029  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00030  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00031  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
00032  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
00033  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00034  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
00035  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00036  * SUCH DAMAGE.
00037  *
00038  * For additional information see http://lostarm.sourceforge.net/
00039  */
00040 
00049 /*
00050  * Names are identical, so that this 'plays nicely with' linux
00051  * documentation and other associated code.
00052  */
00053 
00054 
00055 
00056 #define PTRACE_R0_idx        0
00057 #define PTRACE_R1_idx        1
00058 #define PTRACE_R2_idx        2
00059 #define PTRACE_R3_idx        3
00060 #define PTRACE_R4_idx        4
00061 #define PTRACE_R5_idx        5
00062 #define PTRACE_R6_idx        6
00063 #define PTRACE_R7_idx        7
00064 #define PTRACE_R8_idx        8
00065 #define PTRACE_R9_idx        9
00066 #define PTRACE_R10_idx       10
00067 #define PTRACE_R11_idx       11
00068 #define PTRACE_R12_idx       12
00069 #define PTRACE_R13_idx       13
00070 #define PTRACE_SP_idx        PTRACE_R13_idx
00071 #define PTRACE_R14_idx       14
00072 #define PTRACE_LR_idx        PTRACE_R14_idx
00073 #define PTRACE_R15_idx       15
00074 #define PTRACE_PC_idx        PTRACE_R15_idx
00075 #define PTRACE_CPSR_idx      16
00076 #define PTRACE_R0_retval_idx 17
00077 #define PTRACE_FRAMETYPE_idx 18
00078 #define PTRACE_SWICODE_idx   19
00079 #define PTRACE_FRAME_size    20 /* in bytes */
00080 
00081 #define ARM_CPSR_V_BIT   (1<<28)
00082 #define ARM_CPSR_C_BIT   (1<<29)
00083 #define ARM_CPSR_Z_BIT   (1<<30)
00084 #define ARM_CPSR_N_BIT   (1<<31)
00085 #define ARM_USR_MODE     (0x10) 
00086 #define ARM_FIQ_MODE     (0x11) 
00087 #define ARM_IRQ_MODE     (0x12) 
00088 #define ARM_SVC_MODE     (0x13) 
00089 #define ARM_ABT_MODE     (0x17) 
00090 #define ARM_UND_MODE     (0x1b) 
00091 #define ARM_SYS_MODE     (0x1f) 
00092 #ifndef ARM_MODE_MASK
00093 #define ARM_MODE_MASK    (0x1f)
00094 #endif
00095 
00096 
00097 
00098 #define PTRACE_FRAME_isirq(X)   ( (X)->uregs[ PTRACE_FRAMETYPE ] < 32 )
00099 #define PTRACE_FRAMETYPE_reset   32 /* in vector order */
00100 #define PTRACE_FRAMETYPE_udf     33
00101 #define PTRACE_FRAMETYPE_swi     34
00102 #define PTRACE_FRAMETYPE_pfa     35
00103 #define PTRACE_FRAMETYPE_da      36
00104 #define PTRACE_FRAMETYPE_notused 37
00105 /* #define PTRACE_FRAMETYPE_irq is above, ie: 0..32 for each irq vector */
00106 #define PTRACE_FRAMETYPE_fiq     38
00107 #define PTRACE_FRAMETYPE_thread  39 /* thread saved state */
00108 
00109 #if __ASSEMBLER__
00110 /* nothing here */
00111 #else 
00112 
00113 #if __cplusplus
00114 extern "C" {
00115 #endif
00116 
00117 
00118 struct pt_regs {
00119   long uregs[ 20 ];
00120 };
00121 
00122 void ARM_UDF_Handler( struct pt_regs  *p );
00123 void ARM_SWI_Handler( struct pt_regs  *p );
00124 void ARM_PFA_Handler( struct pt_regs  *p );
00125 void ARM_DA_Handler ( struct pt_regs  *p );
00126 void ARM_IRQ_Handler( struct pt_regs  *p );
00127 void ARM_FIQ_Handler( struct pt_regs  *p );
00128 void ARM_NOTUSED_Handler( struct pt_regs  *p );
00129 void ARM_COMMON_Handler_crash( struct pt_regs  *p, const char *name );
00130 
00131 #if __cplusplus
00132 }
00133 #endif
00134 
00135 #endif /* __ASSEMBLER__ */
00136 
00137 #endif /* CPU_ARM_PTRACE_H */