mescc: Mes C Library: Add x86_64 libc+gnu support.
* include/linux/x86/syscall.h: Move SYS_ defines from gnu.c. * include/linux/x86_64/syscall.h: Add SYS_ defines for gnu. * lib/linux/gnu.c: Update. * lib/linux/gnu.c (signal)[__x86_64__]: Implement using rt_sigaction. * lib/stdlib/abort.c: Support x86_64.
This commit is contained in:
parent
50dff52c99
commit
fe055ba344
|
@ -53,11 +53,11 @@ ARCHDIR=1 NOLINK=1 sh ${srcdest}build-aux/cc64-mes.sh lib/linux/x86_64-mes-gcc/c
|
|||
# ARCHDIR=1 NOLINK=1 sh ${srcdest}build-aux/cc64-mes.sh lib/linux/x86_64/crtn
|
||||
ARCHDIR=1 NOLINK=1 sh ${srcdest}build-aux/cc64-mes.sh lib/libc-mini
|
||||
ARCHDIR=1 NOLINK=1 sh ${srcdest}build-aux/cc64-mes.sh lib/libc
|
||||
# ARCHDIR=1 NOLINK=1 sh ${srcdest}build-aux/cc64-mes.sh lib/libc+gnu
|
||||
# ARCHDIR=1 NOLINK=1 sh ${srcdest}build-aux/cc64-mes.sh lib/libg
|
||||
ARCHDIR=1 NOLINK=1 sh ${srcdest}build-aux/cc64-mes.sh lib/libgetopt
|
||||
ARCHDIR=1 NOLINK=1 sh ${srcdest}build-aux/cc64-mes.sh lib/libc+tcc
|
||||
ARCHDIR=1 NOLINK=1 sh ${srcdest}build-aux/cc64-mes.sh lib/libtcc1
|
||||
ARCHDIR=1 NOLINK=1 sh ${srcdest}build-aux/cc64-mes.sh lib/libc+gnu
|
||||
ARCHDIR=1 NOLINK=1 sh ${srcdest}build-aux/cc64-mes.sh lib/libg
|
||||
|
||||
sh ${srcdest}build-aux/cc64-mes.sh scaffold/main
|
||||
sh ${srcdest}build-aux/cc64-mes.sh scaffold/hello
|
||||
|
|
|
@ -45,4 +45,26 @@
|
|||
#define SYS_stat 0x6a
|
||||
#define SYS_getcwd 0xb7
|
||||
|
||||
// libc+gnu
|
||||
#define SYS_link 0x09
|
||||
#define SYS_getpid 0x14
|
||||
#define SYS_getuid 0x18
|
||||
#define SYS_kill 0x25
|
||||
#define SYS_rename 0x26
|
||||
#define SYS_mkdir 0x27
|
||||
#define SYS_dup 0x29
|
||||
#define SYS_pipe 0x2a
|
||||
#define SYS_getgid 0x2f
|
||||
#define SYS_signal 0x30
|
||||
#define SYS_sigaction 0x43
|
||||
#define SYS_rt_sigaction 0xae
|
||||
#define SYS_signal 0x30
|
||||
#define SYS_fcntl 0x37
|
||||
#define SYS_dup2 0x3f
|
||||
#define SYS_getrusage 0x4d
|
||||
#define SYS_lstat 0x6b
|
||||
#define SYS_setitimer 0x68
|
||||
#define SYS_fstat 0x6c
|
||||
#define SYS_nanosleep 0xa2
|
||||
|
||||
#endif // __MES_LINUX_X86_SYSCALL_H
|
||||
|
|
|
@ -45,4 +45,23 @@
|
|||
#define SYS_stat 0x04
|
||||
#define SYS_getcwd 0x4f
|
||||
|
||||
// libc+gnu
|
||||
#define SYS_link 0x56
|
||||
#define SYS_getpid 0x27
|
||||
#define SYS_getuid 0x66
|
||||
#define SYS_kill 0x3e
|
||||
#define SYS_rename 0x52
|
||||
#define SYS_mkdir 0x53
|
||||
#define SYS_dup 0x20
|
||||
#define SYS_pipe 0x16
|
||||
#define SYS_getgid 0x68
|
||||
#define SYS_rt_sigaction 0x0d
|
||||
#define SYS_fcntl 0x48
|
||||
#define SYS_dup2 0x21
|
||||
#define SYS_getrusage 0x62
|
||||
#define SYS_lstat 0x06
|
||||
#define SYS_setitimer 0x26
|
||||
#define SYS_fstat 0x05
|
||||
#define SYS_nanosleep 0x33
|
||||
|
||||
#endif // __MES_LINUX_X86_64_SYSCALL_H
|
||||
|
|
|
@ -18,24 +18,6 @@
|
|||
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#define SYS_link 0x09
|
||||
#define SYS_getpid 0x14
|
||||
#define SYS_getuid 0x18
|
||||
#define SYS_kill 0x25
|
||||
#define SYS_rename 0x26
|
||||
#define SYS_mkdir 0x27
|
||||
#define SYS_dup 0x29
|
||||
#define SYS_pipe 0x2a
|
||||
#define SYS_getgid 0x2f
|
||||
#define SYS_signal 0x30
|
||||
#define SYS_fcntl 0x37
|
||||
#define SYS_dup2 0x3f
|
||||
#define SYS_getrusage 0x4d
|
||||
#define SYS_lstat 0x6b
|
||||
#define SYS_setitimer 0x68
|
||||
#define SYS_fstat 0x6c
|
||||
#define SYS_nanosleep 0xa2
|
||||
|
||||
#include <sys/resource.h>
|
||||
|
||||
int
|
||||
|
@ -86,6 +68,7 @@ getgid ()
|
|||
return _sys_call (SYS_getgid);
|
||||
}
|
||||
|
||||
#if __i386__
|
||||
#if __MESC__
|
||||
void *
|
||||
signal (int signum, void * action)
|
||||
|
@ -96,6 +79,17 @@ signal (int signum, sighandler_t action)
|
|||
{
|
||||
return _sys_call2 (SYS_signal, signum, action);
|
||||
}
|
||||
#elif __x86_64__
|
||||
sighandler_t
|
||||
signal (int signum, sighandler_t action)
|
||||
{
|
||||
sighandler_t old;
|
||||
_sys_call3 (SYS_rt_sigaction, signum, action, &old);
|
||||
return old;
|
||||
}
|
||||
#else
|
||||
#error arch not supported
|
||||
#endif
|
||||
|
||||
int
|
||||
fcntl (int filedes, int command, ...)
|
||||
|
|
|
@ -21,9 +21,5 @@
|
|||
void
|
||||
abort (void)
|
||||
{
|
||||
#if __i386__
|
||||
asm ("hlt");
|
||||
#else
|
||||
asm ("break 0");
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue