The First PC Utility: boot.exe
main() {
int fi;
struct exec hdr;
fi = open ("pgm", O_RDONLY);
read (fi, &hdr, sizeof (hdr));
read (fi, (char *) 0, hdr.a_text + hdr.a_data);
(* (void * () 0) ();
/* NOTREACHED */
}
Example 1: Mock code that loads a GCC executable into memory
There are some niggling little gotchas, however:
Bill Gates thought 640KB would be big enough for anyone - well, its not for us.
Now we can implement the utility:
|