summaryrefslogtreecommitdiff
path: root/sys/src/9/zynq
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2017-06-28 18:57:13 +0200
committercinap_lenrek <cinap_lenrek@felloff.net>2017-06-28 18:57:13 +0200
commitf58706f2cf09a338bd39153757d1db399ad73f9e (patch)
tree19dc1bc9135ec72a2468ff9d7165272ddecdca99 /sys/src/9/zynq
parentbefdd7d7559f95734976d0ae127ac234eeb5b7d3 (diff)
zynq: simplify initcode stack setup (just do it in init0 when the stack is mapped)
Diffstat (limited to 'sys/src/9/zynq')
-rw-r--r--sys/src/9/zynq/main.c43
1 files changed, 7 insertions, 36 deletions
diff --git a/sys/src/9/zynq/main.c b/sys/src/9/zynq/main.c
index d8100441c..b29c288bb 100644
--- a/sys/src/9/zynq/main.c
+++ b/sys/src/9/zynq/main.c
@@ -11,7 +11,6 @@
Conf conf;
int normalprint, delaylink;
-uchar *sp;
enum { MAXCONF = 64 };
@@ -191,42 +190,10 @@ confinit(void)
imagmem->maxsize = kmem - (kmem/10);
}
-static uchar *
-pusharg(char *p)
-{
- int n;
-
- n = strlen(p) + 1;
- sp -= n;
- memmove(sp, p, n);
- return sp;
-}
-
-static void
-bootargs(void *base)
-{
- int i, ac;
- uchar *av[32];
- uchar **lsp;
-
- sp = (uchar *) base + BY2PG - sizeof(Tos);
-
- ac = 0;
- av[ac++] = pusharg("boot");
- sp = (uchar *) ((ulong) sp & ~3);
- sp -= (ac + 1) * sizeof(sp);
- lsp = (uchar **) sp;
- for(i = 0; i < ac; i++)
- lsp[i] = av[i] + ((USTKTOP - BY2PG) - (ulong) base);
- lsp[i] = 0;
- sp += (USTKTOP - BY2PG) - (ulong) base;
- sp -= BY2WD;
-}
-
static void
init0(void)
{
- char buf[ERRMAX];
+ char buf[ERRMAX], **sp;
int i;
up->nerrlab = 0;
@@ -257,6 +224,11 @@ init0(void)
poperror();
}
kproc("alarm", alarmkproc, 0);
+
+ sp = (char**)(USTKTOP - sizeof(Tos) - 8 - sizeof(sp[0])*4);
+ sp[3] = sp[2] = nil;
+ strcpy(sp[1] = (char*)&sp[4], "boot");
+ sp[0] = nil;
touser(sp);
}
@@ -288,10 +260,9 @@ userinit(void)
s = newseg(SG_STACK, USTKTOP - USTKSIZE, USTKSIZE / BY2PG);
p->seg[SSEG] = s;
pg = newpage(0, 0, USTKTOP - BY2PG);
+ segpage(s, pg);
v = tmpmap(pg->pa);
memset(v, 0, BY2PG);
- segpage(s, pg);
- bootargs(v);
tmpunmap(v);
s = newseg(SG_TEXT, UTZERO, 1);