The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/libkern/kxld/kxld_reloc.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*
    2  * Copyright (c) 2007-2008 Apple Inc. All rights reserved.
    3  *
    4  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
    5  * 
    6  * This file contains Original Code and/or Modifications of Original Code
    7  * as defined in and that are subject to the Apple Public Source License
    8  * Version 2.0 (the 'License'). You may not use this file except in
    9  * compliance with the License. The rights granted to you under the License
   10  * may not be used to create, or enable the creation or redistribution of,
   11  * unlawful or unlicensed copies of an Apple operating system, or to
   12  * circumvent, violate, or enable the circumvention or violation of, any
   13  * terms of an Apple operating system software license agreement.
   14  * 
   15  * Please obtain a copy of the License at
   16  * http://www.opensource.apple.com/apsl/ and read it before using this file.
   17  * 
   18  * The Original Code and all software distributed under the License are
   19  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
   20  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
   21  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
   22  * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
   23  * Please see the License for the specific language governing rights and
   24  * limitations under the License.
   25  * 
   26  * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
   27  */
   28 #ifndef _KXLD_RELOC_H
   29 #define _KXLD_RELOC_H
   30 
   31 #include <mach/machine.h>
   32 #include <sys/types.h>
   33 #if KERNEL
   34     #include <libkern/kxld_types.h>
   35 #else
   36     #include "kxld_types.h"
   37 #endif
   38 
   39 struct kxld_array;
   40 struct kxld_sym;
   41 struct kxld_symtab;
   42 typedef struct kxld_relocator KXLDRelocator;
   43 typedef struct kxld_reloc KXLDReloc;
   44 
   45 typedef boolean_t (*RelocHasPair)(u_int r_type);
   46 typedef boolean_t (*RelocIsPair)(u_int r_type, u_int prev_r_type);
   47 typedef boolean_t (*RelocHasGot)(u_int r_type);
   48 typedef kern_return_t(*ProcessReloc)(u_char *instruction, u_int length, u_int pcrel, 
   49     kxld_addr_t base_pc, kxld_addr_t link_pc, kxld_addr_t link_disp, u_int type, 
   50     kxld_addr_t target, kxld_addr_t pair_target, boolean_t swap);
   51 
   52 struct kxld_relocator {
   53     RelocHasPair reloc_has_pair;
   54     RelocIsPair reloc_is_pair;
   55     RelocHasGot reloc_has_got;
   56     ProcessReloc process_reloc;
   57     boolean_t is_32_bit;
   58     boolean_t swap;
   59 };
   60 
   61 struct kxld_reloc {
   62     u_int address;
   63     u_int target;
   64     u_int pair_target;
   65     u_int target_type:3;
   66     u_int pair_target_type:3;
   67     u_int reloc_type:4;
   68     u_int length:2;
   69     u_int pcrel:1;
   70 };
   71 
   72 struct kxld_array;
   73 struct kxld_sect;
   74 struct kxld_seg;
   75 struct kxld_symtab;
   76 struct relocation_info;
   77 
   78 /*******************************************************************************
   79 * Constructors and Destructors
   80 *******************************************************************************/
   81 
   82 kern_return_t kxld_relocator_init(KXLDRelocator *relocator, cpu_type_t cputype,
   83     cpu_subtype_t cpusubtype, boolean_t swap)
   84     __attribute__((nonnull,visibility("hidden")));
   85 
   86 kern_return_t kxld_reloc_create_macho(struct kxld_array *relocarray,
   87     const KXLDRelocator *relocator, const struct relocation_info *srcs, 
   88     u_int nsrcs) __attribute__((nonnull, visibility("hidden")));
   89 
   90 void kxld_relocator_clear(KXLDRelocator *relocator)
   91     __attribute__((nonnull, visibility("hidden")));
   92 
   93 /*******************************************************************************
   94 * Accessors
   95 *******************************************************************************/
   96 
   97 boolean_t kxld_relocator_has_pair(const KXLDRelocator *relocator, u_int r_type)
   98     __attribute__((pure, nonnull,visibility("hidden")));
   99 
  100 boolean_t kxld_relocator_is_pair(const KXLDRelocator *relocator, u_int r_type, 
  101     u_int last_r_type)
  102     __attribute__((pure, nonnull,visibility("hidden")));
  103 
  104 boolean_t kxld_relocator_has_got(const KXLDRelocator *relocator, u_int r_type)
  105     __attribute__((pure, nonnull,visibility("hidden")));
  106 
  107 struct kxld_sym * kxld_reloc_get_symbol(const KXLDRelocator *relocator,
  108     const KXLDReloc *reloc, u_char *data, 
  109     const struct kxld_symtab *symtab)
  110     __attribute__((pure, nonnull(1,2,4), visibility("hidden")));
  111 
  112 kern_return_t kxld_reloc_get_reloc_index_by_offset(const struct kxld_array *relocs, 
  113     kxld_size_t offset, u_int *idx)
  114     __attribute__((nonnull, visibility("hidden")));
  115 
  116 KXLDReloc * kxld_reloc_get_reloc_by_offset(const struct kxld_array *relocs, 
  117     kxld_addr_t offset)
  118     __attribute__((pure, nonnull, visibility("hidden")));
  119 
  120 /*******************************************************************************
  121 * Modifiers
  122 *******************************************************************************/
  123 
  124 kern_return_t kxld_reloc_update_symindex(KXLDReloc *reloc, u_int symindex)
  125     __attribute__((nonnull,visibility("hidden")));
  126 
  127 kern_return_t kxld_relocator_process_sect_reloc(const KXLDRelocator *relocator,
  128     const KXLDReloc *reloc, const struct kxld_sect *sect,
  129     const struct kxld_array *sectarray, const struct kxld_symtab *symtab)
  130     __attribute__((nonnull,visibility("hidden")));
  131 
  132 kern_return_t kxld_relocator_process_table_reloc(const KXLDRelocator *relocator,
  133     const KXLDReloc *reloc, const struct kxld_seg *seg, u_char *file, 
  134     const struct kxld_array *sectarray, 
  135     const struct kxld_symtab *symtab)
  136     __attribute__((nonnull,visibility("hidden")));
  137 
  138 #endif /* _KXLD_RELOC_H */
  139 

Cache object: 19b77aaa220b4dc38ca2ae2d3b205557


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.