- 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;
+
+ sectCONSTB = (vm_offset_t) sectDCONST->addr;
+ sectSizeConst = sectDCONST->size;
+ sconstdata = sectCONSTB;
+ econstdata = sectCONSTB + sectSizeConst;
+
+ if (sectSizeConst & PAGE_MASK) {
+ kernel_section_t *ns = nextsect(segDATA, sectDCONST);
+ if (ns && !(ns->addr & PAGE_MASK))
+ doconstro_override = TRUE;
+ } else
+ doconstro_override = TRUE;
+
+ 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("segPRELINKB = %p\n", (void *) segPRELINKB);
+ 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("sconstdata = %p\n", (void *) sconstdata);
+ DBG("econstdata = %p\n", (void *) econstdata);
+ 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 = segPRELINKB;
+ vm_prelink_etext = segPRELINKB + segSizePRELINK;
+ vm_prelink_sinfo = segPRELINKINFOB;
+ vm_prelink_einfo = segPRELINKINFOB + segSizePRELINKINFO;
+ vm_slinkedit = segLINKB;
+ vm_elinkedit = segLINKB + segSizePRELINK;