plan9fox/sys/src/9/boot/boot.c
cinap_lenrek 6c2e983d32 kernel: apply uintptr for ulong when a pointer is stored
this change is in preparation for amd64. the systab calling
convention was also changed to return uintptr (as segattach
returns a pointer) and the arguments are now passed as
va_list which handles amd64 arguments properly (all arguments
are passed in 64bit quantities on the stack, tho the upper
part will not be initialized when the element is smaller
than 8 bytes).

this is partial. xalloc needs to be converted in the future.
2014-01-20 00:47:55 +01:00

50 lines
1.1 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include <u.h>
#include <libc.h>
#include <auth.h>
#include <fcall.h>
#include "../boot/boot.h"
void
boot(int argc, char *argv[])
{
char cputype[64];
char buf[32];
fmtinstall('r', errfmt);
bind("#c", "/dev", MBEFORE);
open("/dev/cons", OREAD);
open("/dev/cons", OWRITE);
open("/dev/cons", OWRITE);
/*
* init will reinitialize its namespace.
* #ec gets us plan9.ini settings (*var variables).
*/
bind("#ec", "/env", MREPL);
bind("#e", "/env", MBEFORE|MCREATE);
bind("#s", "/srv", MREPL|MCREATE);
bind("#σ", "/shr", MREPL);
if(Debug){
int i;
print("argc=%d\n", argc);
for(i = 0; i < argc; i++)
print("%p %s ", argv[i], argv[i]);
print("\n");
}
USED(argc);
readfile("#e/cputype", cputype, sizeof(cputype));
setenv("bootdisk", bootdisk, 0);
/* setup the boot namespace */
bind("/boot", "/bin", MAFTER);
run("/bin/paqfs", "-q", "-c", "8", "-m" "/root", "/boot/bootfs.paq", nil);
bind("/root", "/", MAFTER);
snprint(buf, sizeof(buf), "/%s/bin", cputype);
bind(buf, "/bin", MAFTER);
bind("/rc/bin", "/bin", MAFTER);
exec("/bin/bootrc", argv);
}