[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Minios-devel] [UNIKRAFT/ZYDIS PATCH 3/3] libzydis: Disassembler library port



Introduces a port of ZyDis to Unikraft

Signed-off-by: Simon Kuenzer <simon.kuenzer@xxxxxxxxx>
---
 Config.uk                   | 10 +++++++++
 Makefile.uk                 | 34 ++++++++++++++++++++++++++++++
 include/ZydisExportConfig.h | 42 +++++++++++++++++++++++++++++++++++++
 3 files changed, 86 insertions(+)
 create mode 100644 include/ZydisExportConfig.h

diff --git a/Config.uk b/Config.uk
index 508b8f2..6a7ebc7 100644
--- a/Config.uk
+++ b/Config.uk
@@ -5,3 +5,13 @@ config LIBZYCOREC
        depends on ARCH_X86_32 || ARCH_X86_64
        select LIBNOLIBC if !HAVE_LIBC
        select LIBUKTIME if !HAVE_LIBC
+
+config LIBZYDIS
+       bool "libzydis: x86/x86-64 disassembler"
+       default n
+       depends on ARCH_X86_32 || ARCH_X86_64
+       select LIBNOLIBC if !HAVE_LIBC
+       select LIBUKTIME if !HAVE_LIBC
+       select LIBZYCOREC
+       help
+               Fast and lightweight open-source x86/x86-64 disassembler 
library: https://zydis.re/
diff --git a/Makefile.uk b/Makefile.uk
index caa3d09..f0d4403 100644
--- a/Makefile.uk
+++ b/Makefile.uk
@@ -33,3 +33,37 @@ CINCLUDES-$(CONFIG_LIBZYCOREC)       += 
-I$(LIBZYCOREC_INCLUDES)
 #LIBZYCOREC_SRCS-$(CONFIG_LIBPTHREAD_EMBEDDED) += 
$(LIBZYCOREC_SOURCES)/API/Synchronization.c
 #LIBZYCOREC_SRCS-$(CONFIG_LIBPTHREAD_EMBEDDED) += 
$(LIBZYCOREC_SOURCES)/API/Thread.c
 #LIBZYCOREC_SRCS-$(CONFIG_LIBVFSCORE) += $(LIBZYCOREC_SOURCES)/API/Terminal.c
+
+# -------------------------------------------------------
+#  ZyDis
+# -------------------------------------------------------
+
+$(eval $(call addlib_s,libzydis,$(CONFIG_LIBZYDIS)))
+
+LIBZYDIS_VERSION=3.0.0
+LIBZYDIS_URL=https://github.com/zyantific/zydis/archive/v$(LIBZYDIS_VERSION).tar.gz
+
+$(eval $(call fetch,libzydis,$(LIBZYDIS_URL)))
+
+LIBZYDIS_EXTRACTED=$(LIBZYDIS_ORIGIN)/zydis-$(LIBZYDIS_VERSION)
+LIBZYDIS_SOURCES=$(LIBZYDIS_EXTRACTED)/src
+LIBZYDIS_INCLUDES=$(LIBZYDIS_EXTRACTED)/include
+LIBZYDIS_COMPFLAGS-y=-Wno-implicit-fallthrough
+
+CINCLUDES-$(CONFIG_LIBZYDIS)   += -I$(LIBZYDIS_INCLUDES)
+LIBZYDIS_CINCLUDES             += -I$(LIBZYDIS_SOURCES)
+
+LIBZYDIS_SRCS-y += $(LIBZYDIS_SOURCES)/Decoder.c
+LIBZYDIS_SRCS-y += $(LIBZYDIS_SOURCES)/DecoderData.c
+LIBZYDIS_SRCS-y += $(LIBZYDIS_SOURCES)/Formatter.c
+LIBZYDIS_SRCS-y += $(LIBZYDIS_SOURCES)/FormatterATT.c
+LIBZYDIS_SRCS-y += $(LIBZYDIS_SOURCES)/FormatterBase.c
+LIBZYDIS_SRCS-y += $(LIBZYDIS_SOURCES)/FormatterBuffer.c
+LIBZYDIS_SRCS-y += $(LIBZYDIS_SOURCES)/FormatterIntel.c
+LIBZYDIS_SRCS-y += $(LIBZYDIS_SOURCES)/MetaInfo.c
+LIBZYDIS_SRCS-y += $(LIBZYDIS_SOURCES)/Mnemonic.c
+LIBZYDIS_SRCS-y += $(LIBZYDIS_SOURCES)/Register.c
+LIBZYDIS_SRCS-y += $(LIBZYDIS_SOURCES)/SharedData.c
+LIBZYDIS_SRCS-y += $(LIBZYDIS_SOURCES)/String.c
+LIBZYDIS_SRCS-y += $(LIBZYDIS_SOURCES)/Utils.c
+LIBZYDIS_SRCS-y += $(LIBZYDIS_SOURCES)/Zydis.c
diff --git a/include/ZydisExportConfig.h b/include/ZydisExportConfig.h
new file mode 100644
index 0000000..2e75243
--- /dev/null
+++ b/include/ZydisExportConfig.h
@@ -0,0 +1,42 @@
+
+#ifndef ZYDIS_EXPORT_H
+#define ZYDIS_EXPORT_H
+
+#ifdef ZYDIS_STATIC_DEFINE
+#  define ZYDIS_EXPORT
+#  define ZYDIS_NO_EXPORT
+#else
+#  ifndef ZYDIS_EXPORT
+#    ifdef Zydis_EXPORTS
+        /* We are building this library */
+#      define ZYDIS_EXPORT 
+#    else
+        /* We are using this library */
+#      define ZYDIS_EXPORT 
+#    endif
+#  endif
+
+#  ifndef ZYDIS_NO_EXPORT
+#    define ZYDIS_NO_EXPORT 
+#  endif
+#endif
+
+#ifndef ZYDIS_DEPRECATED
+#  define ZYDIS_DEPRECATED __attribute__ ((__deprecated__))
+#endif
+
+#ifndef ZYDIS_DEPRECATED_EXPORT
+#  define ZYDIS_DEPRECATED_EXPORT ZYDIS_EXPORT ZYDIS_DEPRECATED
+#endif
+
+#ifndef ZYDIS_DEPRECATED_NO_EXPORT
+#  define ZYDIS_DEPRECATED_NO_EXPORT ZYDIS_NO_EXPORT ZYDIS_DEPRECATED
+#endif
+
+#if 0 /* DEFINE_NO_DEPRECATED */
+#  ifndef ZYDIS_NO_DEPRECATED
+#    define ZYDIS_NO_DEPRECATED
+#  endif
+#endif
+
+#endif /* ZYDIS_EXPORT_H */
-- 
2.20.1


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.