Preparing the API for more flexible code deassembly

This commit is contained in:
Pierre Pronchery 2011-10-18 20:02:59 +00:00
parent c9fe4919cb
commit 14ca806803
6 changed files with 60 additions and 26 deletions

View File

@ -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 \

View File

@ -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"

View File

@ -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

View File

@ -18,7 +18,7 @@
#ifndef DEVEL_ASM_ASM_H
# define DEVEL_ASM_ASM_H
# include <sys/types.h>
# 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;

50
include/Asm/common.h Normal file
View File

@ -0,0 +1,50 @@
/* $Id$ */
/* Copyright (c) 2011 Pierre Pronchery <khorben@defora.org> */
/* 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 <http://www.gnu.org/licenses/>. */
#ifndef DEVEL_ASM_COMMON_H
# define DEVEL_ASM_COMMON_H
# include <sys/types.h>
/* 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 */

View File

@ -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