summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2016-01-22 03:39:07 +0000
committerRich Felker <dalias@aerifal.cx>2016-01-22 03:39:07 +0000
commit66215afc2e09f0153a63d58d3baec25cf0122b7b (patch)
tree13a9fe809bedd0c09191fcc14af64ef37a434b85 /arch
parent513c043694f500a01bd8d899ff73441aa7457a1f (diff)
downloadmusl-66215afc2e09f0153a63d58d3baec25cf0122b7b.tar.gz
move x32 sysinfo impl and syscall fixup code out of arch/x32/src
all such arch-specific translation units are being moved to appropriate arch dirs under the main src tree.
Diffstat (limited to 'arch')
-rw-r--r--arch/x32/src/syscall_cp_fixup.c38
-rw-r--r--arch/x32/src/sysinfo.c50
2 files changed, 0 insertions, 88 deletions
diff --git a/arch/x32/src/syscall_cp_fixup.c b/arch/x32/src/syscall_cp_fixup.c
deleted file mode 100644
index b1f3a382..00000000
--- a/arch/x32/src/syscall_cp_fixup.c
+++ /dev/null
@@ -1,38 +0,0 @@
-#include <sys/syscall.h>
-
-__attribute__((__visibility__("hidden")))
-long __syscall_cp_internal(volatile void*, long long, long long, long long, long long,
- long long, long long, long long);
-
-struct __timespec { long long tv_sec; long tv_nsec; };
-struct __timespec_kernel { long long tv_sec; long long tv_nsec; };
-#define __tsc(X) ((struct __timespec*)(unsigned long)(X))
-#define __fixup(X) do { if(X) { \
- ts->tv_sec = __tsc(X)->tv_sec; \
- ts->tv_nsec = __tsc(X)->tv_nsec; \
- (X) = (unsigned long)ts; } } while(0)
-
-__attribute__((__visibility__("hidden")))
-long __syscall_cp_asm (volatile void * foo, long long n, long long a1, long long a2, long long a3,
- long long a4, long long a5, long long a6)
-{
- struct __timespec_kernel ts[1];
- switch (n) {
- case SYS_mq_timedsend: case SYS_mq_timedreceive: case SYS_pselect6:
- __fixup(a5);
- break;
- case SYS_futex:
- if((a2 & (~128 /* FUTEX_PRIVATE_FLAG */)) == 0 /* FUTEX_WAIT */)
- __fixup(a4);
- break;
- case SYS_clock_nanosleep:
- case SYS_rt_sigtimedwait: case SYS_ppoll:
- __fixup(a3);
- break;
- case SYS_nanosleep:
- __fixup(a1);
- break;
- }
- return __syscall_cp_internal(foo, n, a1, a2, a3, a4, a5, a6);
-}
-
diff --git a/arch/x32/src/sysinfo.c b/arch/x32/src/sysinfo.c
deleted file mode 100644
index d1c1b148..00000000
--- a/arch/x32/src/sysinfo.c
+++ /dev/null
@@ -1,50 +0,0 @@
-#include <sys/sysinfo.h>
-#include "syscall.h"
-#include "libc.h"
-
-#define klong long long
-#define kulong unsigned long long
-
-struct kernel_sysinfo {
- klong uptime;
- kulong loads[3];
- kulong totalram;
- kulong freeram;
- kulong sharedram;
- kulong bufferram;
- kulong totalswap;
- kulong freeswap;
- short procs;
- short pad;
- kulong totalhigh;
- kulong freehigh;
- unsigned mem_unit;
-};
-
-int __lsysinfo(struct sysinfo *info)
-{
- struct kernel_sysinfo tmp;
- int ret = syscall(SYS_sysinfo, &tmp);
- if(ret == -1) return ret;
- info->uptime = tmp.uptime;
- info->loads[0] = tmp.loads[0];
- info->loads[1] = tmp.loads[1];
- info->loads[2] = tmp.loads[2];
- kulong shifts;
- kulong max = tmp.totalram | tmp.totalswap;
- __asm__("bsr %1,%0" : "=r"(shifts) : "r"(max));
- shifts = shifts >= 32 ? shifts - 31 : 0;
- info->totalram = tmp.totalram >> shifts;
- info->freeram = tmp.freeram >> shifts;
- info->sharedram = tmp.sharedram >> shifts;
- info->bufferram = tmp.bufferram >> shifts;
- info->totalswap = tmp.totalswap >> shifts;
- info->freeswap = tmp.freeswap >> shifts;
- info->procs = tmp.procs ;
- info->totalhigh = tmp.totalhigh >> shifts;
- info->freehigh = tmp.freehigh >> shifts;
- info->mem_unit = (tmp.mem_unit ? tmp.mem_unit : 1) << shifts;
- return ret;
-}
-
-weak_alias(__lsysinfo, sysinfo);