00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047 #include "xlateincl.h"
00048
00049 #ifdef _LIBELF_XTND_EXPANDED_DATA
00050 #pragma weak xlate_get_info_xtnd = _xlate_get_info_xtnd
00051 #elif defined(BUILD_OS_DARWIN)
00052 #else
00053 #pragma weak xlate_get_info = _xlate_get_info
00054 #endif
00055
00056
00057 void
00058 _xlate_get_infov1(xlate_table_con tab,
00059 Elf64_Sxword * dataMoved,
00060 Elf64_Addr * startup_fwa,
00061 Elf64_Addr * startup_lwa,
00062 Elf64_Xword * number_of_ranges,
00063 int * old_text_exists,
00064 int * old_text_alloc)
00065 {
00066 xlate_header_v1 *tabhdrp;
00067 tabhdrp = (xlate_header_v1 *)tab->xc_section_data;
00068 if(dataMoved) {
00069 *dataMoved = tabhdrp->hd_data_moved;
00070 }
00071 if(startup_fwa) {
00072 *startup_fwa = tabhdrp->hd_startup_fwa;
00073 if(tab->xc_is64bit) {
00074 *startup_fwa |= ((Elf64_Addr)tabhdrp->hd_upper32_bits_new)<<32;
00075 }
00076 }
00077 if(startup_lwa) {
00078 *startup_lwa = tabhdrp->hd_startup_lwa;
00079 if(tab->xc_is64bit) {
00080 *startup_lwa |= ((Elf64_Addr)tabhdrp->hd_upper32_bits_new)<<32;
00081 }
00082 }
00083 if(number_of_ranges) {
00084 *number_of_ranges = tabhdrp->hd_num_entries;
00085 }
00086 if(old_text_exists) {
00087 *old_text_exists = (int)(0xff & (int)tabhdrp->hd_old_text_exists);
00088 }
00089 if(old_text_alloc) {
00090 *old_text_alloc = (int)(0xff & (int)tabhdrp->hd_old_text_alloc);
00091 }
00092 return;
00093 }
00094 void
00095 _xlate_get_infov2_32(xlate_table_con tab,
00096 Elf64_Sxword * dataMoved,
00097 Elf64_Addr * startup_fwa,
00098 Elf64_Addr * startup_lwa,
00099 Elf64_Xword * number_of_ranges,
00100 int * old_text_exists,
00101 int * old_text_alloc)
00102 {
00103 xlate_header32_v2 *tabhdrp;
00104 tabhdrp = (xlate_header32_v2 *)tab->xc_section_data;
00105 if(dataMoved) {
00106 *dataMoved = tabhdrp->hd_data_moved;
00107 }
00108 if(startup_fwa) {
00109 *startup_fwa = tabhdrp->hd_startup_fwa;
00110 }
00111 if(startup_lwa) {
00112 *startup_lwa = tabhdrp->hd_startup_lwa;
00113 }
00114 if(number_of_ranges) {
00115 *number_of_ranges = tabhdrp->hd_num_entries;
00116 }
00117 if(old_text_exists) {
00118 *old_text_exists = 0xff & tabhdrp->hd_old_text_exists;
00119 }
00120 if(old_text_alloc) {
00121 *old_text_alloc = 0xff & tabhdrp->hd_old_text_alloc;
00122 }
00123 return;
00124 }
00125 void
00126 _xlate_get_infov2_64(xlate_table_con tab,
00127 Elf64_Sxword * dataMoved,
00128 Elf64_Addr * startup_fwa,
00129 Elf64_Addr * startup_lwa,
00130 Elf64_Xword * number_of_ranges,
00131 int * old_text_exists,
00132 int * old_text_alloc)
00133 {
00134 xlate_header64_v2 *tabhdrp;
00135 tabhdrp = (xlate_header64_v2 *)tab->xc_section_data;
00136
00137 if(dataMoved) {
00138 *dataMoved = tabhdrp->hd_data_moved;
00139 }
00140 if(startup_fwa) {
00141 *startup_fwa = tabhdrp->hd_startup_fwa;
00142 }
00143 if(startup_lwa) {
00144 *startup_lwa = tabhdrp->hd_startup_lwa;
00145 }
00146 if(number_of_ranges) {
00147 *number_of_ranges = tabhdrp->hd_num_entries;
00148 }
00149 if(old_text_exists) {
00150 *old_text_exists = 0xff & tabhdrp->hd_old_text_exists;
00151 }
00152 if(old_text_alloc) {
00153 *old_text_alloc = 0xff & tabhdrp->hd_old_text_alloc;
00154 }
00155 }
00156
00157
00158 int
00159 xlate_get_info(xlate_table_con tab,
00160 Elf64_Sxword * dataMoved,
00161 Elf64_Addr * new_low_addr,
00162 Elf64_Addr * old_low_addr,
00163 Elf64_Addr * new_high_addr,
00164 Elf64_Addr * old_high_addr,
00165 Elf64_Addr * startup_fwa,
00166 Elf64_Addr * startup_lwa,
00167 Elf64_Xword * number_of_ranges,
00168 int * old_text_exists,
00169 int * old_text_alloc,
00170 int * is64bit ,
00171 xlate_tablekind * tablekind ,
00172 int * tableversion )
00173
00174 {
00175 int retstatus = XLATE_TB_STATUS_NO_ERROR;
00176
00177 if (tab->xc_valid_table != VALID_TABLE_MAGIC) {
00178 return XLATE_TB_STATUS_INVALID_TABLE;
00179 }
00180
00181 if(new_high_addr) {
00182 *new_high_addr = tab->xc_hdr.ich_new_addr_high;
00183 }
00184 if(new_low_addr) {
00185 *new_low_addr = tab->xc_hdr.ich_new_addr_low;
00186 }
00187 if(old_high_addr) {
00188 *old_high_addr = tab->xc_hdr.ich_old_addr_high;
00189 }
00190 if(old_low_addr) {
00191 *old_low_addr = tab->xc_hdr.ich_old_addr_low;
00192 }
00193 if(is64bit) {
00194 *is64bit = tab->xc_is64bit;
00195 }
00196 if(tablekind) {
00197 *tablekind = tab->xc_hdr.ich_tablekind;
00198 }
00199 if(tableversion) {
00200 *tableversion = tab->xc_hdr.ich_version;
00201 }
00202
00203 tab->xc_get_info_func(tab,dataMoved,startup_fwa,startup_lwa,
00204 number_of_ranges,
00205 old_text_exists,old_text_alloc);
00206
00207 return retstatus;
00208 }