- sectTEXTB = (void *) getsegdatafromheader(
- &_mh_execute_header, "__TEXT", §SizeTEXT);
- sectDATAB = (void *) getsegdatafromheader(
- &_mh_execute_header, "__DATA", §SizeDATA);
- sectOBJCB = (void *) getsegdatafromheader(
- &_mh_execute_header, "__OBJC", §SizeOBJC);
- sectLINKB = (void *) getsegdatafromheader(
- &_mh_execute_header, "__LINKEDIT", §SizeLINK);
- sectHIBB = (void *)getsegdatafromheader(
- &_mh_execute_header, "__HIB", §SizeHIB);
- sectPRELINKB = (void *) getsegdatafromheader(
- &_mh_execute_header, "__PRELINK", §SizePRELINK);
-
- etext = (vm_offset_t) sectTEXTB + sectSizeTEXT;
- edata = (vm_offset_t) sectDATAB + sectSizeDATA;
+ sHIB = segHIBB;
+ eHIB = segHIBB + segSizeHIB;
+ vm_hib_base = sHIB;
+ /* Zero-padded from ehib to stext if text is 2M-aligned */
+ stext = segTEXTB;
+ lowGlo.lgStext = stext;
+ etext = (vm_offset_t) round_page_64(lastsectTEXT->addr + lastsectTEXT->size);
+ /* Zero-padded from etext to sdata if text is 2M-aligned */
+ sdata = segDATAB;
+ edata = segDATAB + segSizeDATA;
+
+ sconst = segCONST->vmaddr;
+ segSizeConst = segCONST->vmsize;
+ econst = sconst + segSizeConst;
+
+ assert(((sconst|econst) & PAGE_MASK) == 0);
+
+ DBG("segTEXTB = %p\n", (void *) segTEXTB);
+ DBG("segDATAB = %p\n", (void *) segDATAB);
+ DBG("segLINKB = %p\n", (void *) segLINKB);
+ DBG("segHIBB = %p\n", (void *) segHIBB);
+ DBG("segPRELINKTEXTB = %p\n", (void *) segPRELINKTEXTB);
+ DBG("segPRELINKINFOB = %p\n", (void *) segPRELINKINFOB);
+ DBG("sHIB = %p\n", (void *) sHIB);
+ DBG("eHIB = %p\n", (void *) eHIB);
+ DBG("stext = %p\n", (void *) stext);
+ DBG("etext = %p\n", (void *) etext);
+ DBG("sdata = %p\n", (void *) sdata);
+ DBG("edata = %p\n", (void *) edata);
+ DBG("sconst = %p\n", (void *) sconst);
+ DBG("econst = %p\n", (void *) econst);
+ DBG("kernel_top = %p\n", (void *) &last_kernel_symbol);
+
+ vm_kernel_base = sHIB;
+ vm_kernel_top = (vm_offset_t) &last_kernel_symbol;
+ vm_kernel_stext = stext;
+ vm_kernel_etext = etext;
+ vm_prelink_stext = segPRELINKTEXTB;
+ vm_prelink_etext = segPRELINKTEXTB + segSizePRELINKTEXT;
+ vm_prelink_sinfo = segPRELINKINFOB;
+ vm_prelink_einfo = segPRELINKINFOB + segSizePRELINKINFO;
+ vm_slinkedit = segLINKB;
+ vm_elinkedit = segLINKB + segSizePRELINKTEXT;
+ vm_kernel_slid_base = vm_kext_base;
+ vm_kernel_slid_top = vm_elinkedit;