mescc: Tinycc support: lseek.
* mlibc/include/unistd.h (lseek): Declare. * stage0/x86.M1 (SYS_lseek): New define. * mlibc/libc-mes+tcc.c (lseek): New function.
This commit is contained in:
parent
a8f22ea993
commit
9f60904d1c
|
@ -29,6 +29,11 @@
|
||||||
|
|
||||||
#else // ! (__GNUC__ && POSIX)
|
#else // ! (__GNUC__ && POSIX)
|
||||||
|
|
||||||
|
#ifndef __MES_OFF_T
|
||||||
|
#define __MES_OFF_T
|
||||||
|
typedef unsigned long off_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef __MES_SIZE_T
|
#ifndef __MES_SIZE_T
|
||||||
#define __MES_SIZE_T
|
#define __MES_SIZE_T
|
||||||
typedef unsigned long size_t;
|
typedef unsigned long size_t;
|
||||||
|
@ -42,6 +47,7 @@ typedef long ssize_t;
|
||||||
int access (char const *s, int mode);
|
int access (char const *s, int mode);
|
||||||
int close (int fd);
|
int close (int fd);
|
||||||
char *getcwd (char *buf, size_t size);
|
char *getcwd (char *buf, size_t size);
|
||||||
|
off_t lseek (int fd, off_t offset, int whence);
|
||||||
int read (int fd, void* buf, size_t n);
|
int read (int fd, void* buf, size_t n);
|
||||||
int unlink (char const *file_name);
|
int unlink (char const *file_name);
|
||||||
int write (int fd, char const* s, int n);
|
int write (int fd, char const* s, int n);
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
void
|
void
|
||||||
close ()
|
close ()
|
||||||
|
@ -52,6 +53,17 @@ unlink (char const *file_name)
|
||||||
asm ("int____$0x80");
|
asm ("int____$0x80");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
off_t
|
||||||
|
lseek (int fd, off_t offset, int whence)
|
||||||
|
{
|
||||||
|
asm ("mov____0x8(%ebp),%ebx !8");
|
||||||
|
asm ("mov____0x8(%ebp),%ecx !12");
|
||||||
|
asm ("mov____0x8(%ebp),%edx !16");
|
||||||
|
|
||||||
|
asm ("mov____$i32,%eax SYS_lseek");
|
||||||
|
asm ("int____$0x80");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
fclose (FILE *stream)
|
fclose (FILE *stream)
|
||||||
|
|
|
@ -164,6 +164,7 @@ DEFINE SYS_write 04000000
|
||||||
DEFINE SYS_open 05000000
|
DEFINE SYS_open 05000000
|
||||||
DEFINE SYS_close 06000000
|
DEFINE SYS_close 06000000
|
||||||
DEFINE SYS_unlink 0a000000
|
DEFINE SYS_unlink 0a000000
|
||||||
|
DEFINE SYS_lseek 13000000
|
||||||
DEFINE SYS_access 21000000
|
DEFINE SYS_access 21000000
|
||||||
DEFINE SYS_brk 2d000000
|
DEFINE SYS_brk 2d000000
|
||||||
DEFINE SYS_fsync 76000000
|
DEFINE SYS_fsync 76000000
|
||||||
|
|
Loading…
Reference in a new issue