| 2104 | } |
| 2105 | |
| 2106 | UINT32 LOADER_ENTRY::GetTextExec() |
| 2107 | { |
| 2108 | UINT32 ncmds, cmdsize; |
| 2109 | UINT32 binaryIndex; |
| 2110 | struct segment_command_64 *segCmd64; |
| 2111 | |
| 2112 | ncmds = MACH_GET_NCMDS(KernelData); |
| 2113 | binaryIndex = sizeof(struct mach_header_64); |
| 2114 | |
| 2115 | for (UINTN cnt = 0; cnt < ncmds; cnt++) { |
| 2116 | segCmd64 = (struct segment_command_64 *)(KernelData + binaryIndex); |
| 2117 | cmdsize = segCmd64->cmdsize; |
| 2118 | |
| 2119 | switch (segCmd64->cmd) { |
| 2120 | case LC_SEGMENT_64: //19 |
| 2121 | if (strcmp(segCmd64->segname, kTextExecSegment) == 0) { |
| 2122 | return (UINT32)(segCmd64->fileoff); |
| 2123 | } |
| 2124 | break; |
| 2125 | default: |
| 2126 | break; |
| 2127 | } |
| 2128 | binaryIndex += cmdsize; |
| 2129 | } |
| 2130 | |
| 2131 | return 0; |
| 2132 | } |
| 2133 | |
| 2134 | void LOADER_ENTRY::Get_PreLink() |
| 2135 | { |