7 "this is initialized data",
14 sum(const char *s
, int n
)
17 for (i
= 0; i
< n
; i
++)
23 umain(int argc
, char **argv
)
27 cprintf("init: running\n");
30 if ((x
= sum((char*)&data
, sizeof data
)) != want
)
31 cprintf("init: data is not initialized: got sum %08x wanted %08x\n",
34 cprintf("init: data seems okay\n");
35 if ((x
= sum(bss
, sizeof bss
)) != 0)
36 cprintf("bss is not initialized: wanted sum 0 got %08x\n", x
);
38 cprintf("init: bss seems okay\n");
40 cprintf("init: args:");
41 for (i
= 0; i
< argc
; i
++)
42 cprintf(" '%s'", argv
[i
]);
45 cprintf("init: running sh\n");
47 // being run directly from kernel, so no file descriptors open yet
49 if ((r
= opencons()) < 0)
50 panic("opencons: %e", r
);
52 panic("first opencons used fd %d", r
);
53 if ((r
= dup(0, 1)) < 0)
56 cprintf("init: starting sh\n");
57 r
= spawnl("/sh", "sh", (char*)0);
59 cprintf("init: spawn sh: %e\n", r
);