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 () _start ()
{ {
asm ( asm (
"mov $0,%%rax\n\t" "mov $0,%%eax\n\t"
"mov %%rax,%0\n" "mov %%eax,%0\n"
: "=r" (__stdin) : "=r" (__stdin)
: //no inputs "" : //no inputs ""
); );
asm ( asm (
"mov $1,%%rax\n\t" "mov $1,%%eax\n\t"
"mov %%rax,%0\n" "mov %%eax,%0\n"
: "=r" (__stdout) : "=r" (__stdout)
: //no inputs "" : //no inputs ""
); );
asm ( asm (
"mov $2,%%rax\n\t" "mov $2,%%eax\n\t"
"mov %%rax,%0\n" "mov %%eax,%0\n"
: "=r" (__stderr) : "=r" (__stderr)
: //no inputs "" : //no inputs ""
); );

View file

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