From 14ca8068031646b2ab0c4d5b7a9125a1aba122a4 Mon Sep 17 00:00:00 2001 From: Pierre Pronchery Date: Tue, 18 Oct 2011 20:02:59 +0000 Subject: [PATCH] Preparing the API for more flexible code deassembly --- Makefile | 1 + include/Asm.h | 1 + include/Asm/Makefile | 3 +++ include/Asm/asm.h | 26 +-------------------- include/Asm/common.h | 50 ++++++++++++++++++++++++++++++++++++++++ include/Asm/project.conf | 5 +++- 6 files changed, 60 insertions(+), 26 deletions(-) create mode 100644 include/Asm/common.h diff --git a/Makefile b/Makefile index 064512c..a79ef3f 100644 --- a/Makefile +++ b/Makefile @@ -33,6 +33,7 @@ dist: $(PACKAGE)-$(VERSION)/include/project.conf \ $(PACKAGE)-$(VERSION)/include/Asm/arch.h \ $(PACKAGE)-$(VERSION)/include/Asm/asm.h \ + $(PACKAGE)-$(VERSION)/include/Asm/common.h \ $(PACKAGE)-$(VERSION)/include/Asm/format.h \ $(PACKAGE)-$(VERSION)/include/Asm/Makefile \ $(PACKAGE)-$(VERSION)/include/Asm/project.conf \ diff --git a/include/Asm.h b/include/Asm.h index 0c09461..4cdd93d 100644 --- a/include/Asm.h +++ b/include/Asm.h @@ -27,6 +27,7 @@ # define _LITTLE_ENDIAN __LITTLE_ENDIAN # endif +# include "Asm/common.h" # include "Asm/arch.h" # include "Asm/asm.h" # include "Asm/format.h" diff --git a/include/Asm/Makefile b/include/Asm/Makefile index 818c707..73a8fff 100644 --- a/include/Asm/Makefile +++ b/include/Asm/Makefile @@ -19,11 +19,14 @@ install: $(MKDIR) $(DESTDIR)$(PREFIX)/include/Devel/Asm $(INSTALL) -m 0644 -- asm.h $(DESTDIR)$(PREFIX)/include/Devel/Asm/asm.h $(MKDIR) $(DESTDIR)$(PREFIX)/include/Devel/Asm + $(INSTALL) -m 0644 -- common.h $(DESTDIR)$(PREFIX)/include/Devel/Asm/common.h + $(MKDIR) $(DESTDIR)$(PREFIX)/include/Devel/Asm $(INSTALL) -m 0644 -- format.h $(DESTDIR)$(PREFIX)/include/Devel/Asm/format.h uninstall: $(RM) -- $(DESTDIR)$(PREFIX)/include/Devel/Asm/arch.h $(RM) -- $(DESTDIR)$(PREFIX)/include/Devel/Asm/asm.h + $(RM) -- $(DESTDIR)$(PREFIX)/include/Devel/Asm/common.h $(RM) -- $(DESTDIR)$(PREFIX)/include/Devel/Asm/format.h .PHONY: all clean distclean install uninstall diff --git a/include/Asm/asm.h b/include/Asm/asm.h index ca76cf4..702d662 100644 --- a/include/Asm/asm.h +++ b/include/Asm/asm.h @@ -18,7 +18,7 @@ #ifndef DEVEL_ASM_ASM_H # define DEVEL_ASM_ASM_H -# include +# include "common.h" /* Asm */ @@ -31,30 +31,6 @@ typedef struct _AsmPrefs size_t defines_cnt; } AsmPrefs; -typedef unsigned int AsmId; - -typedef struct _AsmFunction -{ - AsmId id; - char const * name; - off_t offset; - ssize_t size; -} AsmFunction; - -typedef struct _AsmLabel -{ - char const * name; - off_t offset; -} AsmLabel; - -typedef struct _AsmString -{ - int id; - char const * name; - off_t offset; - ssize_t length; -} AsmString; - typedef enum _AsmPluginType { APT_ARCH = 0, APT_FORMAT } AsmPluginType; diff --git a/include/Asm/common.h b/include/Asm/common.h new file mode 100644 index 0000000..88cfe45 --- /dev/null +++ b/include/Asm/common.h @@ -0,0 +1,50 @@ +/* $Id$ */ +/* Copyright (c) 2011 Pierre Pronchery */ +/* This file is part of DeforaOS Devel asm */ +/* This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, version 3 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ + + + +#ifndef DEVEL_ASM_COMMON_H +# define DEVEL_ASM_COMMON_H + +# include + + +/* common */ +/* types */ +typedef unsigned int AsmId; + +typedef struct _AsmFunction +{ + AsmId id; + char const * name; + off_t offset; + ssize_t size; +} AsmFunction; + +typedef struct _AsmLabel +{ + char const * name; + off_t offset; +} AsmLabel; + +typedef struct _AsmString +{ + int id; + char const * name; + off_t offset; + ssize_t length; +} AsmString; + +#endif /* !DEVEL_ASM_AS_H */ diff --git a/include/Asm/project.conf b/include/Asm/project.conf index a2f93cc..dee8b44 100644 --- a/include/Asm/project.conf +++ b/include/Asm/project.conf @@ -1,4 +1,4 @@ -includes=arch.h,asm.h,format.h +includes=arch.h,asm.h,common.h,format.h dist=Makefile [arch.h] @@ -7,5 +7,8 @@ install=$(PREFIX)/include/Devel/Asm [asm.h] install=$(PREFIX)/include/Devel/Asm +[common.h] +install=$(PREFIX)/include/Devel/Asm + [format.h] install=$(PREFIX)/include/Devel/Asm