From: Thomas Veerman Date: Thu, 17 Jan 2013 13:50:01 +0000 (+0100) Subject: Split libsys in arch dependent parts X-Git-Tag: v3.2.1~70 X-Git-Url: http://zhaoyanbai.com/repos/nslookup.html?a=commitdiff_plain;h=264c20159d443fc473a1bd91526d51eae8127bf9;p=minix.git Split libsys in arch dependent parts The ARM part is not finished yet and will be fixed in a later commit. --- diff --git a/lib/libsys/Makefile b/lib/libsys/Makefile index be79967d4..47343cc72 100644 --- a/lib/libsys/Makefile +++ b/lib/libsys/Makefile @@ -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 index 000000000..8a9981774 --- /dev/null +++ b/lib/libsys/arch/earm/Makefile.inc @@ -0,0 +1,12 @@ +# Makefile for arch-dependent libsys code +.include + +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 index 000000000..045d079cb --- /dev/null +++ b/lib/libsys/arch/earm/tsc_util.c @@ -0,0 +1,46 @@ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#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 index 000000000..d7bc2b22d --- /dev/null +++ b/lib/libsys/arch/i386/Makefile.inc @@ -0,0 +1,33 @@ +# Makefile for arch-dependent libsys code +.include + +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}/../../ + + diff --git a/lib/libsys/get_randomness.c b/lib/libsys/arch/i386/get_randomness.c similarity index 100% rename from lib/libsys/get_randomness.c rename to lib/libsys/arch/i386/get_randomness.c diff --git a/lib/libsys/getidle.c b/lib/libsys/arch/i386/getidle.c similarity index 100% rename from lib/libsys/getidle.c rename to lib/libsys/arch/i386/getidle.c diff --git a/lib/libsys/profile.c b/lib/libsys/arch/i386/profile.c similarity index 100% rename from lib/libsys/profile.c rename to lib/libsys/arch/i386/profile.c diff --git a/lib/libsys/profile_extern.c b/lib/libsys/arch/i386/profile_extern.c similarity index 100% rename from lib/libsys/profile_extern.c rename to lib/libsys/arch/i386/profile_extern.c diff --git a/lib/libsys/ser_putc.c b/lib/libsys/arch/i386/ser_putc.c similarity index 100% rename from lib/libsys/ser_putc.c rename to lib/libsys/arch/i386/ser_putc.c diff --git a/lib/libsys/spin.c b/lib/libsys/arch/i386/spin.c similarity index 100% rename from lib/libsys/spin.c rename to lib/libsys/arch/i386/spin.c diff --git a/lib/libsys/sys_eniop.c b/lib/libsys/arch/i386/sys_eniop.c similarity index 100% rename from lib/libsys/sys_eniop.c rename to lib/libsys/arch/i386/sys_eniop.c diff --git a/lib/libsys/sys_in.c b/lib/libsys/arch/i386/sys_in.c similarity index 100% rename from lib/libsys/sys_in.c rename to lib/libsys/arch/i386/sys_in.c diff --git a/lib/libsys/sys_int86.c b/lib/libsys/arch/i386/sys_int86.c similarity index 100% rename from lib/libsys/sys_int86.c rename to lib/libsys/arch/i386/sys_int86.c diff --git a/lib/libsys/sys_out.c b/lib/libsys/arch/i386/sys_out.c similarity index 100% rename from lib/libsys/sys_out.c rename to lib/libsys/arch/i386/sys_out.c diff --git a/lib/libsys/sys_readbios.c b/lib/libsys/arch/i386/sys_readbios.c similarity index 100% rename from lib/libsys/sys_readbios.c rename to lib/libsys/arch/i386/sys_readbios.c diff --git a/lib/libsys/sys_sdevio.c b/lib/libsys/arch/i386/sys_sdevio.c similarity index 100% rename from lib/libsys/sys_sdevio.c rename to lib/libsys/arch/i386/sys_sdevio.c diff --git a/lib/libsys/sys_umap_remote.c b/lib/libsys/arch/i386/sys_umap_remote.c old mode 100755 new mode 100644 similarity index 100% rename from lib/libsys/sys_umap_remote.c rename to lib/libsys/arch/i386/sys_umap_remote.c diff --git a/lib/libsys/sys_vinb.c b/lib/libsys/arch/i386/sys_vinb.c similarity index 100% rename from lib/libsys/sys_vinb.c rename to lib/libsys/arch/i386/sys_vinb.c diff --git a/lib/libsys/sys_vinl.c b/lib/libsys/arch/i386/sys_vinl.c similarity index 100% rename from lib/libsys/sys_vinl.c rename to lib/libsys/arch/i386/sys_vinl.c diff --git a/lib/libsys/sys_vinw.c b/lib/libsys/arch/i386/sys_vinw.c similarity index 100% rename from lib/libsys/sys_vinw.c rename to lib/libsys/arch/i386/sys_vinw.c diff --git a/lib/libsys/sys_voutb.c b/lib/libsys/arch/i386/sys_voutb.c similarity index 100% rename from lib/libsys/sys_voutb.c rename to lib/libsys/arch/i386/sys_voutb.c diff --git a/lib/libsys/sys_voutl.c b/lib/libsys/arch/i386/sys_voutl.c similarity index 100% rename from lib/libsys/sys_voutl.c rename to lib/libsys/arch/i386/sys_voutl.c diff --git a/lib/libsys/sys_voutw.c b/lib/libsys/arch/i386/sys_voutw.c similarity index 100% rename from lib/libsys/sys_voutw.c rename to lib/libsys/arch/i386/sys_voutw.c diff --git a/lib/libsys/timing.c b/lib/libsys/arch/i386/timing.c similarity index 100% rename from lib/libsys/timing.c rename to lib/libsys/arch/i386/timing.c diff --git a/lib/libsys/tsc_util.c b/lib/libsys/arch/i386/tsc_util.c similarity index 100% rename from lib/libsys/tsc_util.c rename to lib/libsys/arch/i386/tsc_util.c diff --git a/lib/libsys/vbox.c b/lib/libsys/arch/i386/vbox.c similarity index 100% rename from lib/libsys/vbox.c rename to lib/libsys/arch/i386/vbox.c