static int commonllp64(int, Fhdr *fp, ExecHdr *hp) { long pgsize; uvlong entry; hswal(&hp->e, sizeof(Exec)/sizeof(long), beswal); if(!(hp->e.magic & HDR_MAGIC)) return 0; /* * There can be more magic here if the * header ever needs more expansion. * For now just catch use of any of the * unused bits. */ if((hp->e.magic & ~DYN_MAGIC)>>16) return 0; entry = beswav(hp->e.hdr[0]); pgsize = mach->pgsize; settext(fp, entry, pgsize+fp->hdrsz, hp->e.text, fp->hdrsz); setdata(fp, _round(pgsize+fp->txtsz+fp->hdrsz, pgsize), hp->e.data, fp->txtsz+fp->hdrsz, hp->e.bss); setsym(fp, hp->e.syms, hp->e.spsz, hp->e.pcsz, fp->datoff+fp->datsz); if(hp->e.magic & DYN_MAGIC) { fp->txtaddr = 0; fp->dataddr = fp->txtsz; return 1; } commonboot(fp); return 1; }
/* * _MAGIC() style headers and * alpha plan9-style bootable images for axp "headerless" boot * */ static int common(int fd, Fhdr *fp, ExecHdr *hp) { adotout(fd, fp, hp); if(hp->e.magic & DYN_MAGIC) { fp->txtaddr = 0; fp->dataddr = fp->txtsz; return 1; } commonboot(fp); return 1; }
static int commonllp64(int unused, Fhdr *fp, ExecHdr *hp) { int32 pgsize; uvlong entry; USED(unused); hswal(&hp->e, sizeof(Exec)/sizeof(int32), beswal); if(!(hp->e.exechdr.magic & HDR_MAGIC)) return 0; /* * There can be more magic here if the * header ever needs more expansion. * For now just catch use of any of the * unused bits. */ if((hp->e.exechdr.magic & ~DYN_MAGIC)>>16) return 0; union { char *p; uvlong *v; } u; u.p = (char*)&hp->e.exechdr; entry = beswav(*u.v); pgsize = mach->pgsize; settext(fp, entry, pgsize+fp->hdrsz, hp->e.exechdr.text, fp->hdrsz); setdata(fp, _round(pgsize+fp->txtsz+fp->hdrsz, pgsize), hp->e.exechdr.data, fp->txtsz+fp->hdrsz, hp->e.exechdr.bss); setsym(fp, fp->datoff+fp->datsz, hp->e.exechdr.syms, 0, hp->e.exechdr.spsz, 0, hp->e.exechdr.pcsz); if(hp->e.exechdr.magic & DYN_MAGIC) { fp->txtaddr = 0; fp->dataddr = fp->txtsz; return 1; } commonboot(fp); return 1; }