blob: 3aac578d170009e4d1e9f6eabbb32d128c65d718 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
#include <u.h>
#include <libc.h>
#include <thread.h>
#include "dat.h"
#include "fns.h"
Process **PP;
static int nflag;
void
dump(void)
{
int i;
for(i = 0; i < 16; i++) {
print("R%2d %.8ux", i, P->R[i]);
if((i % 4) == 3) print("\n");
else print("\t");
}
}
static void
adjustns(void)
{
if(bind("/arm/bin", "/bin", MREPL) < 0)
sysfatal("bind: %r");
if(bind("/rc/bin", "/bin", MAFTER) < 0)
sysfatal("bind: %r");
putenv("cputype", "arm");
putenv("objtype", "arm");
}
void
cleanup(void)
{
if(P == nil)
return;
freesegs();
fddecref(P->fd);
free(P);
}
static void
usage(void)
{
fprint(2, "usage: 5e [ -n ] text [ args ]\n");
exits(nil);
}
void
main(int argc, char **argv)
{
ARGBEGIN {
case 'n': nflag++; break;
default: usage();
} ARGEND;
if(argc < 1)
usage();
if(_nprivates < 1)
sysfatal("we don't have privates");
if(rfork(RFREND | RFNAMEG | RFENVG) < 0)
sysfatal("rfork: %r");
atexit(cleanup);
if(nflag)
adjustns();
initproc();
if(loadtext(argv[0], argc, argv) < 0)
sysfatal("%r");
for(;;) {
if(ultraverbose)
dump();
step();
}
}
|