From b377e3bdca89f988e6360756585a5850cda2a60d Mon Sep 17 00:00:00 2001 From: mintsuki Date: Sun, 29 Dec 2019 09:33:35 +0100 Subject: [PATCH] qword: Move mount to own header --- .gitignore | 1 + sysdeps/qword/generic/generic.cpp | 15 --------------- sysdeps/qword/generic/mount.cpp | 16 ++++++++++++++++ sysdeps/qword/include/qword/mount.h | 16 ++++++++++++++++ sysdeps/qword/meson.build | 4 +++- 5 files changed, 36 insertions(+), 16 deletions(-) create mode 100644 sysdeps/qword/generic/mount.cpp create mode 100644 sysdeps/qword/include/qword/mount.h diff --git a/.gitignore b/.gitignore index 9640772c..1701c907 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ +build subprojects/cxxshim subprojects/frigg diff --git a/sysdeps/qword/generic/generic.cpp b/sysdeps/qword/generic/generic.cpp index b153a996..b60a1248 100644 --- a/sysdeps/qword/generic/generic.cpp +++ b/sysdeps/qword/generic/generic.cpp @@ -650,21 +650,6 @@ int sys_setuid(uid_t uid) { return ret; } -int sys_mount(const char *source, const char *target, - const char *filesystemtype, unsigned long mountflags, - const void *data) { - - int ret; - register unsigned long arg4_reg asm("r10") = mountflags; - register const void *arg5_reg asm("r8") = data; - - asm volatile ("syscall" : "=a" (ret) - : "a"(41), "D"(source), "S"(target), - "d"(filesystemtype), "r"(arg4_reg), "r"(arg5_reg) - : "rcx", "r11"); - return ret; -} - #endif // MLIBC_BUILDING_RTDL } // namespace mlibc diff --git a/sysdeps/qword/generic/mount.cpp b/sysdeps/qword/generic/mount.cpp new file mode 100644 index 00000000..901b7f6c --- /dev/null +++ b/sysdeps/qword/generic/mount.cpp @@ -0,0 +1,16 @@ + +#include + +int mount(const char *source, const char *target, + const char *filesystemtype, unsigned long mountflags, + const void *data) { + + int ret; + register unsigned long arg4_reg asm("r10") = mountflags; + register const void *arg5_reg asm("r8") = data; + asm volatile ("syscall" : "=a" (ret) + : "a"(41), "D"(source), "S"(target), + "d"(filesystemtype), "r"(arg4_reg), "r"(arg5_reg) + : "rcx", "r11"); + return ret; +} diff --git a/sysdeps/qword/include/qword/mount.h b/sysdeps/qword/include/qword/mount.h new file mode 100644 index 00000000..3066f7e3 --- /dev/null +++ b/sysdeps/qword/include/qword/mount.h @@ -0,0 +1,16 @@ +#ifndef _QWORD_MOUNT_H +#define _QWORD_MOUNT_H + +#ifdef __cplusplus +extern "C" { +#endif + +int mount(const char *source, const char *target, + const char *filesystemtype, unsigned long mountflags, + const void *data); + +#ifdef __cplusplus +} +#endif + +#endif // _QWORD_MOUNT_H diff --git a/sysdeps/qword/meson.build b/sysdeps/qword/meson.build index e47e71af..14232986 100644 --- a/sysdeps/qword/meson.build +++ b/sysdeps/qword/meson.build @@ -6,7 +6,8 @@ rtdl_sources += files( libc_sources += files( 'generic/entry.cpp', 'generic/generic.cpp', - 'generic/memstats.cpp' + 'generic/memstats.cpp', + 'generic/mount.cpp' ) if not no_headers @@ -19,6 +20,7 @@ if not no_headers ) install_headers( 'include/qword/memstats.h', + 'include/qword/mount.h', subdir: 'qword' ) endif