mescc: Mes C Library: Fixes for x86_64 crt1.c

* lib/linux/x86_64-mes/crt1.c (_start): Write only 4 bytes to int
variables __stdin, __stdout, __stderr.
This commit is contained in:
Jan Nieuwenhuizen 2019-05-26 09:36:57 +02:00
parent 27d771e6ab
commit 198d4a652d
No known key found for this signature in database
GPG Key ID: F3C1A0D9C1D65273
2 changed files with 9 additions and 9 deletions

View File

@ -29,22 +29,22 @@ void
_start ()
{
asm (
"mov $0,%%rax\n\t"
"mov %%rax,%0\n"
"mov $0,%%eax\n\t"
"mov %%eax,%0\n"
: "=r" (__stdin)
: //no inputs ""
);
asm (
"mov $1,%%rax\n\t"
"mov %%rax,%0\n"
"mov $1,%%eax\n\t"
"mov %%eax,%0\n"
: "=r" (__stdout)
: //no inputs ""
);
asm (
"mov $2,%%rax\n\t"
"mov %%rax,%0\n"
"mov $2,%%eax\n\t"
"mov %%eax,%0\n"
: "=r" (__stderr)
: //no inputs ""
);

View File

@ -25,13 +25,13 @@ int
_start ()
{
asm ("mov____$i8,%rax !0");
asm ("mov____%rax,0x32 &__stdin");
asm ("movl___%eax,0x32 &__stdin");
asm ("mov____$i8,%rax !1");
asm ("mov____%rax,0x32 &__stdout");
asm ("movl___%eax,0x32 &__stdout");
asm ("mov____$i8,%rax !2");
asm ("mov____%rax,0x32 &__stderr");
asm ("movl___%eax,0x32 &__stderr");
#if 0 //MES_CCAMD64
asm ("add____$i32,%rbp %0x80"); // FIXME: corresponds to x86_64/as.scm function-preamble-fu