"Fossies" - the Fresh Open Source Software Archive

Member "reptyr-reptyr-0.9.0/platform/linux/arch/arm.h" (12 Jun 2022, 2331 Bytes) of package /linux/privat/reptyr-reptyr-0.9.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "arm.h" see the Fossies "Dox" file reference documentation.

    1 /*
    2  * Copyright (C) 2011 by Nelson Elhage
    3  *
    4  * Permission is hereby granted, free of charge, to any person obtaining a copy
    5  * of this software and associated documentation files (the "Software"), to deal
    6  * in the Software without restriction, including without limitation the rights
    7  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    8  * copies of the Software, and to permit persons to whom the Software is
    9  * furnished to do so, subject to the following conditions:
   10  *
   11  * The above copyright notice and this permission notice shall be included in
   12  * all copies or substantial portions of the Software.
   13  *
   14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
   17  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
   18  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
   19  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
   20  * THE SOFTWARE.
   21  */
   22 static struct ptrace_personality arch_personality[1] = {
   23     {
   24         offsetof(struct user_regs, uregs[0]),
   25         offsetof(struct user_regs, uregs[0]),
   26         offsetof(struct user_regs, uregs[1]),
   27         offsetof(struct user_regs, uregs[2]),
   28         offsetof(struct user_regs, uregs[3]),
   29         offsetof(struct user_regs, uregs[4]),
   30         offsetof(struct user_regs, uregs[5]),
   31         offsetof(struct user_regs, ARM_pc),
   32     }
   33 };
   34 
   35 static inline void arch_fixup_regs(struct ptrace_child *child) {
   36     child->regs.ARM_pc -= 4;
   37 }
   38 
   39 static inline int arch_set_syscall(struct ptrace_child *child,
   40                                    unsigned long sysno) {
   41     return ptrace_command(child, PTRACE_SET_SYSCALL, 0, sysno);
   42 }
   43 
   44 static inline int arch_save_syscall(struct ptrace_child *child) {
   45     unsigned long swi;
   46     swi = ptrace_command(child, PTRACE_PEEKTEXT, child->regs.ARM_pc);
   47     if (child->error)
   48         return -1;
   49     if (swi == 0xef000000)
   50         child->saved_syscall = child->regs.uregs[7];
   51     else
   52         child->saved_syscall = (swi & 0x000fffff);
   53     return 0;
   54 }
   55 
   56 static inline int arch_restore_syscall(struct ptrace_child *child) {
   57     return arch_set_syscall(child, child->saved_syscall);
   58 }