"Fossies" - the Fresh Open Source Software Archive

Member "reptyr-reptyr-0.8.0/platform/freebsd/arch/amd64.h" (29 Sep 2020, 2419 Bytes) of package /linux/privat/reptyr-reptyr-0.8.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 "amd64.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 
   23 #include "x86_common.h"
   24 
   25 #define ARCH_HAVE_MULTIPLE_PERSONALITIES
   26 
   27 static struct ptrace_personality arch_personality[2] = {
   28     {
   29         offsetof(struct reg, r_rax),
   30         offsetof(struct reg, r_rdi),
   31         offsetof(struct reg, r_rsi),
   32         offsetof(struct reg, r_rdx),
   33         offsetof(struct reg, r_rcx),
   34         //offsetof(struct reg, r_r10),
   35         offsetof(struct reg, r_r8),
   36         offsetof(struct reg, r_r9),
   37         offsetof(struct reg, r_rip),
   38     },
   39     {
   40         offsetof(struct reg, r_rax),
   41         offsetof(struct reg, r_rbx),
   42         offsetof(struct reg, r_rcx),
   43         offsetof(struct reg, r_rdx),
   44         offsetof(struct reg, r_rsi),
   45         offsetof(struct reg, r_rdi),
   46         offsetof(struct reg, r_rbp),
   47         offsetof(struct reg, r_rip),
   48     },
   49 };
   50 
   51 struct x86_personality x86_personality[2] = {
   52     {
   53         offsetof(struct reg, r_rax),
   54     },
   55     {
   56         offsetof(struct reg, r_rax),
   57     },
   58 };
   59 
   60 struct syscall_numbers arch_syscall_numbers[2] = {
   61 #include "default-syscalls.h"
   62 #include "default-syscalls.h"
   63 };
   64 
   65 int arch_get_personality(struct ptrace_child *child) {
   66     unsigned long cs;
   67 
   68     cs = arch_get_register(child,offsetof(struct reg, r_cs));
   69     if (child->error)
   70         return -1;
   71     if (cs == 0x23)
   72         child->personality = 1;
   73     return 0;
   74 }