2 #include "../port/lib.h"
6 #include "../port/error.h"
10 readn(Chan *c, void *vp, long n)
16 nn = devtab[c->type]->read(c, p, n, c->offset);
26 rebootcmd(int argc, char *argv[])
33 ulong magic, text, rtext, entry, data, size, align;
39 c = namec(argv[0], Aopen, OEXEC, 0);
45 readn(c, &ehdr, sizeof(Exec));
46 magic = beswal(ehdr.magic);
47 entry = beswal(ehdr.entry);
48 text = beswal(ehdr.text);
49 data = beswal(ehdr.data);
51 if(!(magic == AOUT_MAGIC)){
55 if((I_MAGIC == AOUT_MAGIC) || (S_MAGIC == AOUT_MAGIC))
62 readn(c, ehdr.hdr, sizeof(ehdr.hdr));
66 align = 0x10000; /* 64k segment alignment for arm64 */
73 /* round text out to page boundary */
74 rtext = ROUND(entry+text, align)-entry;
87 readn(c, p + rtext, data);
89 ksetenv("bootfile", argv[0], 1);
91 reboot((void*)entry, p, size);