8d51e7fa1a
replace machine specific userinit() by a portable implemntation that uses kproc() to create the first process. the initcode text is mapped using kmap(), so there is no need for machine specific tmpmap() functions. initcode stack preparation should be done in init0() where the stack is mapped and can be accessed directly. replacing the machine specific userinit() allows some big simplifications as sysrfork() and kproc() are now the only callers of newproc() and we can avoid initializing fields that we know are being initialized by these callers. rename autogenerated init.h and reboot.h headers. the initcode[] and rebootcode[] blobs are now in *.i files and hex generation was moved to portmkfile. the machine specific mkfile only needs to specify how to build rebootcode.out and initcode.out.
40 lines
817 B
C
40 lines
817 B
C
/*
|
|
* IMPORTANT! DO NOT ADD LIBRARY CALLS TO THIS FILE.
|
|
* The entire text image must fit on one page
|
|
* (and there's no data segment, so any read/write data must be on the stack).
|
|
*/
|
|
|
|
#include <u.h>
|
|
#include <libc.h>
|
|
|
|
char cons[] = "#c/cons";
|
|
char boot[] = "/boot/boot";
|
|
char dev[] = "/dev";
|
|
char c[] = "#c";
|
|
char e[] = "#e";
|
|
char ec[] = "#ec";
|
|
char s[] = "#s";
|
|
char srv[] = "/srv";
|
|
char env[] = "/env";
|
|
|
|
void
|
|
startboot(char*, char **argv)
|
|
{
|
|
char buf[200]; /* keep this fairly large to capture error details */
|
|
|
|
/* in case boot is a shell script */
|
|
open(cons, OREAD);
|
|
open(cons, OWRITE);
|
|
open(cons, OWRITE);
|
|
bind(c, dev, MAFTER);
|
|
bind(ec, env, MAFTER);
|
|
bind(e, env, MCREATE|MAFTER);
|
|
bind(s, srv, MREPL|MCREATE);
|
|
|
|
exec(boot, argv);
|
|
|
|
rerrstr(buf, sizeof buf);
|
|
buf[sizeof buf - 1] = '\0';
|
|
_exits(buf);
|
|
}
|