]> Zhao Yanbai Git Server - minix.git/commitdiff
Split libsys in arch dependent parts
authorThomas Veerman <thomas@minix3.org>
Thu, 17 Jan 2013 13:50:01 +0000 (14:50 +0100)
committerThomas Veerman <thomas@minix3.org>
Fri, 25 Jan 2013 17:07:01 +0000 (17:07 +0000)
The ARM part is not finished yet and will be fixed in a later commit.

26 files changed:
lib/libsys/Makefile
lib/libsys/arch/earm/Makefile.inc [new file with mode: 0644]
lib/libsys/arch/earm/tsc_util.c [new file with mode: 0644]
lib/libsys/arch/i386/Makefile.inc [new file with mode: 0644]
lib/libsys/arch/i386/get_randomness.c [moved from lib/libsys/get_randomness.c with 100% similarity]
lib/libsys/arch/i386/getidle.c [moved from lib/libsys/getidle.c with 100% similarity]
lib/libsys/arch/i386/profile.c [moved from lib/libsys/profile.c with 100% similarity]
lib/libsys/arch/i386/profile_extern.c [moved from lib/libsys/profile_extern.c with 100% similarity]
lib/libsys/arch/i386/ser_putc.c [moved from lib/libsys/ser_putc.c with 100% similarity]
lib/libsys/arch/i386/spin.c [moved from lib/libsys/spin.c with 100% similarity]
lib/libsys/arch/i386/sys_eniop.c [moved from lib/libsys/sys_eniop.c with 100% similarity]
lib/libsys/arch/i386/sys_in.c [moved from lib/libsys/sys_in.c with 100% similarity]
lib/libsys/arch/i386/sys_int86.c [moved from lib/libsys/sys_int86.c with 100% similarity]
lib/libsys/arch/i386/sys_out.c [moved from lib/libsys/sys_out.c with 100% similarity]
lib/libsys/arch/i386/sys_readbios.c [moved from lib/libsys/sys_readbios.c with 100% similarity]
lib/libsys/arch/i386/sys_sdevio.c [moved from lib/libsys/sys_sdevio.c with 100% similarity]
lib/libsys/arch/i386/sys_umap_remote.c [moved from lib/libsys/sys_umap_remote.c with 100% similarity, mode: 0644]
lib/libsys/arch/i386/sys_vinb.c [moved from lib/libsys/sys_vinb.c with 100% similarity]
lib/libsys/arch/i386/sys_vinl.c [moved from lib/libsys/sys_vinl.c with 100% similarity]
lib/libsys/arch/i386/sys_vinw.c [moved from lib/libsys/sys_vinw.c with 100% similarity]
lib/libsys/arch/i386/sys_voutb.c [moved from lib/libsys/sys_voutb.c with 100% similarity]
lib/libsys/arch/i386/sys_voutl.c [moved from lib/libsys/sys_voutl.c with 100% similarity]
lib/libsys/arch/i386/sys_voutw.c [moved from lib/libsys/sys_voutw.c with 100% similarity]
lib/libsys/arch/i386/timing.c [moved from lib/libsys/timing.c with 100% similarity]
lib/libsys/arch/i386/tsc_util.c [moved from lib/libsys/tsc_util.c with 100% similarity]
lib/libsys/arch/i386/vbox.c [moved from lib/libsys/vbox.c with 100% similarity]

index be79967d4361758cfd6c3c2525cb39008432b224..47343cc72d6f236586d4cd4e15739969c52ad9df 100644 (file)
@@ -3,7 +3,9 @@
 
 LIB=           sys
 
-SRCS=  \
+.include "arch/${MACHINE_ARCH}/Makefile.inc"
+
+SRCS+=  \
        alloc_util.c \
        assert.c \
        asynsend.c \
@@ -75,7 +77,6 @@ SRCS=  \
        taskcall.c \
        tickdelay.c \
        timers.c \
-       tsc_util.c \
        vm_brk.c \
        vm_exit.c \
        vm_fork.c \
@@ -87,31 +88,6 @@ SRCS=  \
        vm_procctl.c \
        vprintf.c
 
-.if ${MACHINE_ARCH} == "i386"
-SRCS+=  \
-       get_randomness.c \
-       getidle.c \
-       profile.c \
-       profile_extern.c \
-       ser_putc.c \
-       spin.c \
-       sys_eniop.c \
-       sys_in.c \
-       sys_int86.c \
-       sys_out.c \
-       sys_readbios.c \
-       sys_sdevio.c \
-       sys_umap_remote.c \
-       sys_vinb.c \
-       sys_vinl.c \
-       sys_vinw.c \
-       sys_voutb.c \
-       sys_voutl.c \
-       sys_voutw.c \
-       timing.c \
-       vbox.c
-.endif
-
 .if ${MKPCI} != "no"
 SRCS+= pci_attr_r16.c \
        pci_attr_r32.c \
diff --git a/lib/libsys/arch/earm/Makefile.inc b/lib/libsys/arch/earm/Makefile.inc
new file mode 100644 (file)
index 0000000..8a99817
--- /dev/null
@@ -0,0 +1,12 @@
+# Makefile for arch-dependent libsys code
+.include <bsd.own.mk>
+
+HERE=${.CURDIR}/arch/${MACHINE_ARCH}
+.PATH:  ${HERE}
+
+SRCS+=  \
+        tsc_util.c
+
+CPPFLAGS+=        -I${HERE}/../../
+
+
diff --git a/lib/libsys/arch/earm/tsc_util.c b/lib/libsys/arch/earm/tsc_util.c
new file mode 100644 (file)
index 0000000..045d079
--- /dev/null
@@ -0,0 +1,46 @@
+
+#include <stdio.h>
+#include <time.h>
+#include <sys/times.h>
+#include <sys/types.h>
+#include <minix/u64.h>
+#include <minix/config.h>
+#include <minix/const.h>
+#include <minix/minlib.h>
+#include <machine/archtypes.h>
+
+#include "sysutil.h"
+
+#ifndef CONFIG_MAX_CPUS
+#define CONFIG_MAX_CPUS 1
+#endif
+
+#define MICROHZ                1000000         /* number of micros per second */
+#define MICROSPERTICK(h)       (MICROHZ/(h))   /* number of micros per HZ tick */
+
+static u32_t calib_mhz = 1000, Hz = 1000;
+
+int
+micro_delay(u32_t micros)
+{
+       return OK;
+}
+
+u32_t tsc_64_to_micros(u64_t tsc)
+{
+       u64_t tmp;
+
+       tmp = div64u64(tsc, calib_mhz);
+       if (ex64hi(tmp)) {
+               printf("tsc_64_to_micros: more than 2^32ms\n");
+               return ~0UL;
+       } else {
+               return ex64lo(tmp);
+       }
+}
+
+u32_t tsc_to_micros(u32_t low, u32_t high)
+{
+       return tsc_64_to_micros(make64(low, high));
+}
+
diff --git a/lib/libsys/arch/i386/Makefile.inc b/lib/libsys/arch/i386/Makefile.inc
new file mode 100644 (file)
index 0000000..d7bc2b2
--- /dev/null
@@ -0,0 +1,33 @@
+# Makefile for arch-dependent libsys code
+.include <bsd.own.mk>
+
+HERE=${.CURDIR}/arch/${MACHINE_ARCH}
+.PATH:  ${HERE}
+
+SRCS+=  \
+        get_randomness.c \
+        getidle.c \
+        profile.c \
+        profile_extern.c \
+        ser_putc.c \
+        spin.c \
+        sys_eniop.c \
+        sys_in.c \
+        sys_int86.c \
+        sys_out.c \
+        sys_readbios.c \
+        sys_sdevio.c \
+        sys_umap_remote.c \
+        sys_vinb.c \
+        sys_vinl.c \
+        sys_vinw.c \
+        sys_voutb.c \
+        sys_voutl.c \
+        sys_voutw.c \
+        timing.c \
+        tsc_util.c \
+        vbox.c
+
+CPPFLAGS+=        -I${HERE}/../../
+
+
old mode 100755 (executable)
new mode 100644 (file)
similarity index 100%
rename from lib/libsys/sys_umap_remote.c
rename to lib/libsys/arch/i386/sys_umap_remote.c