mescc: Tinycc support: close.
* stage0/x86.M1 (SYS_close): New define. * mlibc/include/unistd.h (close): Declare. * mlibc/libc-mes+tcc.c: New file. * make.scm: Build and install it.
This commit is contained in:
parent
ee4471058f
commit
ba6edad975
4
make.scm
4
make.scm
|
@ -160,6 +160,8 @@ exec ${GUILE-guile} --no-auto-compile -L . -L guile -C . -C guile -s "$0" ${1+"$
|
|||
|
||||
(add-target (group "check-scaffold-tests" #:dependencies (filter (target-prefix? "check-scaffold/tests") %targets)))
|
||||
|
||||
(add-target (cpp.mescc "mlibc/libc-mes+tcc.c"))
|
||||
(add-target (compile.mescc "mlibc/libc-mes+tcc.c"))
|
||||
|
||||
(define* (add-tcc-test name)
|
||||
(add-target (bin.gcc (string-append "scaffold/tinycc/" name ".c") #:libc #f #:includes '("scaffold/tinycc")))
|
||||
|
@ -477,6 +479,8 @@ exec ${GUILE-guile} --no-auto-compile -L . -L guile -C . -C guile -s "$0" ${1+"$
|
|||
|
||||
(add-target (install "mlibc/libc-mes.E" #:dir "lib"))
|
||||
(add-target (install "mlibc/libc-mes.M1" #:dir "lib"))
|
||||
(add-target (install "mlibc/libc-mes+tcc.E" #:dir "lib"))
|
||||
(add-target (install "mlibc/libc-mes+tcc.M1" #:dir "lib"))
|
||||
(add-target (install "mlibc/mini-libc-mes.E" #:dir "lib"))
|
||||
(add-target (install "mlibc/mini-libc-mes.M1" #:dir "lib"))
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@ typedef long ssize_t;
|
|||
#endif
|
||||
|
||||
int access (char const *s, int mode);
|
||||
int close (int fd);
|
||||
int read (int fd, void* buf, size_t n);
|
||||
int write (int fd, char const* s, int n);
|
||||
#endif // ! (__GNUC__ && POSIX)
|
||||
|
|
30
mlibc/libc-mes+tcc.c
Normal file
30
mlibc/libc-mes+tcc.c
Normal file
|
@ -0,0 +1,30 @@
|
|||
/* -*-comment-start: "//";comment-end:""-*-
|
||||
* Mes --- Maxwell Equations of Software
|
||||
* Copyright © 2017 Jan Nieuwenhuizen <janneke@gnu.org>
|
||||
*
|
||||
* This file is part of Mes.
|
||||
*
|
||||
* Mes is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* Mes is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Mes. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <libc-mes.c>
|
||||
|
||||
void
|
||||
close ()
|
||||
{
|
||||
asm ("mov____0x8(%ebp),%ebx !8");
|
||||
|
||||
asm ("mov____$i32,%eax SYS_close");
|
||||
asm ("int____$0x80");
|
||||
}
|
|
@ -162,6 +162,7 @@ DEFINE SYS_exit 01000000
|
|||
DEFINE SYS_read 03000000
|
||||
DEFINE SYS_write 04000000
|
||||
DEFINE SYS_open 05000000
|
||||
DEFINE SYS_close 06000000
|
||||
DEFINE SYS_access 21000000
|
||||
DEFINE SYS_brk 2d000000
|
||||
DEFINE SYS_fsync 76000000
|
||||
|
|
Loading…
Reference in a new issue