mescc: Tinycc support: refactor _start.
* mlibc/libc-mes.c (_start): Refactor. (_env): Remove. * stage0/x86.M1:
This commit is contained in:
parent
9aa8d8bd9d
commit
29acdfa2a7
|
@ -23,42 +23,36 @@
|
||||||
|
|
||||||
int g_stdin = 0;
|
int g_stdin = 0;
|
||||||
char **g_environment;
|
char **g_environment;
|
||||||
int _env ();
|
int main (int,char*[]);
|
||||||
int exit ();
|
|
||||||
int main(int,char*[]);
|
|
||||||
|
|
||||||
int
|
int
|
||||||
_start ()
|
_start ()
|
||||||
{
|
{
|
||||||
asm ("mov____%ebp,%eax"); // mov %ebp,%eax
|
asm ("mov____%ebp,%eax");
|
||||||
asm ("add____$i8,%eax !8"); // add $0x8,%eax
|
asm ("add____$i8,%eax !4");
|
||||||
asm ("push___%eax"); // push %eax
|
|
||||||
|
|
||||||
asm ("mov____%ebp,%eax"); // mov %ebp,%eax
|
asm ("movzbl_(%eax),%eax");
|
||||||
asm ("add____$i8,%eax !4"); // add $0x4,%eax
|
asm ("add____$i8,%eax !3");
|
||||||
asm ("movzbl_(%eax),%eax"); // movzbl (%eax),%eax
|
|
||||||
asm ("push___%eax"); // push %eax
|
|
||||||
|
|
||||||
asm ("mov____%ebp,%eax"); // mov %ebp,%eax
|
asm ("shl____$i8,%eax !0x02");
|
||||||
asm ("add____$i8,%eax !4"); // add $0x4,%eax
|
asm ("add____%ebp,%eax");
|
||||||
|
asm ("mov____%eax,0x32 &g_environment");
|
||||||
|
|
||||||
asm ("movzbl_(%eax),%eax"); // movzbl (%eax),%eax
|
asm ("mov____%ebp,%eax");
|
||||||
asm ("add____$i8,%eax !3"); // add $0x3,%eax
|
asm ("add____$i8,%eax !8");
|
||||||
|
asm ("push___%eax");
|
||||||
|
|
||||||
asm ("shl____$i8,%eax !0x02"); // shl $0x2,%eax
|
asm ("mov____%ebp,%eax");
|
||||||
asm ("add____%ebp,%eax"); // add %ebp,%eax
|
asm ("add____$i8,%eax !4");
|
||||||
asm ("push___%eax"); // push %eax
|
asm ("movzbl_(%eax),%eax");
|
||||||
|
asm ("push___%eax");
|
||||||
|
|
||||||
g_environment = _env ();
|
main ();
|
||||||
asm ("pop____%eax"); // pop %eax
|
|
||||||
int r = main ();
|
|
||||||
exit (r);
|
|
||||||
}
|
|
||||||
|
|
||||||
char **
|
asm ("mov____%eax,%ebx");
|
||||||
_env (char **e)
|
asm ("mov____$i32,%eax %1");
|
||||||
{
|
asm ("int____$0x80");
|
||||||
return e;
|
asm ("hlt");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -49,6 +49,7 @@ DEFINE cmp____$i8,0x32(%ebp) 83bd
|
||||||
DEFINE cmp____$i8,0x8(%ebp) 837d
|
DEFINE cmp____$i8,0x8(%ebp) 837d
|
||||||
DEFINE cmp____%al,%dl 38c2
|
DEFINE cmp____%al,%dl 38c2
|
||||||
DEFINE cmp____%edx,%eax 39d0
|
DEFINE cmp____%edx,%eax 39d0
|
||||||
|
DEFINE hlt f4
|
||||||
DEFINE idiv___%ebx f7fb
|
DEFINE idiv___%ebx f7fb
|
||||||
DEFINE int____$0x80 cd80
|
DEFINE int____$0x80 cd80
|
||||||
DEFINE je32 0f84
|
DEFINE je32 0f84
|
||||||
|
|
Loading…
Reference in New Issue