Start framework for separating architecture-dependent functions and data

structures from the rest of the assembler.  We're not trying to write GAS
here (yet :), but doing this will make large parts of the codebase a lot
clearer.

svn path=/trunk/yasm/; revision=314
0.3
Peter Johnson 24 years ago
parent a7ac50c918
commit c9d92847b6
  1. 5
      configure.ac
  2. 5
      configure.in
  3. 36
      libyasm/arch.h
  4. 2
      libyasm/coretype.h
  5. 3
      modules/arch/Makefile.am
  6. 16
      modules/arch/x86/Makefile.am
  7. 2
      modules/arch/x86/README
  8. 32
      modules/arch/x86/arch.c
  9. 0
      modules/arch/x86/instrs.dat
  10. 32
      modules/arch/x86/x86arch.c
  11. 2
      modules/parsers/nasm/Makefile.am
  12. 6
      src/Makefile.am
  13. 36
      src/arch.h
  14. 3
      src/arch/Makefile.am
  15. 16
      src/arch/x86/Makefile.am
  16. 2
      src/arch/x86/README
  17. 32
      src/arch/x86/arch.c
  18. 1208
      src/arch/x86/instrs.dat
  19. 32
      src/arch/x86/x86arch.c
  20. 2
      src/coretype.h
  21. 2
      src/parsers/nasm/Makefile.am

@ -8,6 +8,9 @@ AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(yasm, 0.0.1)
ARCH=x86
AC_SUBST(ARCH)
AC_ARG_ENABLE(dev,
[ --enable-dev Enable full development build capability],
[case "${enableval}" in
@ -200,6 +203,8 @@ AC_OUTPUT(Makefile
intl/Makefile
po/Makefile.in
src/Makefile
src/arch/Makefile
src/arch/x86/Makefile
src/parsers/Makefile
src/parsers/nasm/Makefile
src/preprocs/Makefile

@ -8,6 +8,9 @@ AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(yasm, 0.0.1)
ARCH=x86
AC_SUBST(ARCH)
AC_ARG_ENABLE(dev,
[ --enable-dev Enable full development build capability],
[case "${enableval}" in
@ -200,6 +203,8 @@ AC_OUTPUT(Makefile
intl/Makefile
po/Makefile.in
src/Makefile
src/arch/Makefile
src/arch/x86/Makefile
src/parsers/Makefile
src/parsers/nasm/Makefile
src/preprocs/Makefile

@ -0,0 +1,36 @@
/* $IdPath$
* Architecture header file
*
* Copyright (C) 2001 Peter Johnson
*
* This file is part of YASM.
*
* YASM 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; either version 2 of the License, or
* (at your option) any later version.
*
* YASM 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, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef YASM_ARCH_H
#define YASM_ARCH_H
struct arch {
/* one-line description of the architecture */
const char *name;
/* keyword used to select architecture */
const char *keyword;
};
/* Available architectures */
extern arch x86_arch;
#endif

@ -22,6 +22,8 @@
#ifndef YASM_CORETYPE_H
#define YASM_CORETYPE_H
typedef struct arch arch;
typedef struct preproc preproc;
typedef struct parser parser;
typedef struct optimizer optimizer;

@ -0,0 +1,3 @@
# $IdPath$
SUBDIRS = x86

@ -0,0 +1,16 @@
# $IdPath$
noinst_LIBRARIES = libarch.a
libarch_a_SOURCES = \
arch.c
INCLUDES = \
-I$(top_srcdir)/src \
-I$(top_builddir)/intl
CFLAGS = @ANSI_CFLAGS@
EXTRA_DIST = \
README \
instrs.dat

@ -0,0 +1,2 @@
Architecture to support Intel IA-32, AMD x86-64, and other extensions and
derivatives of the x86 instruction set.

@ -0,0 +1,32 @@
/*
* x86 architecture description
*
* Copyright (C) 2001 Peter Johnson
*
* This file is part of YASM.
*
* YASM 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; either version 2 of the License, or
* (at your option) any later version.
*
* YASM 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, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "util.h"
RCSID("$IdPath$");
#include "arch.h"
/* Define arch structure -- see arch.h for details */
arch x86_arch = {
"x86 (IA-32, x86-64)",
"x86"
};

@ -0,0 +1,32 @@
/*
* x86 architecture description
*
* Copyright (C) 2001 Peter Johnson
*
* This file is part of YASM.
*
* YASM 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; either version 2 of the License, or
* (at your option) any later version.
*
* YASM 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, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "util.h"
RCSID("$IdPath$");
#include "arch.h"
/* Define arch structure -- see arch.h for details */
arch x86_arch = {
"x86 (IA-32, x86-64)",
"x86"
};

@ -33,7 +33,7 @@ INCLUDES = \
CFLAGS = @ANSI_CFLAGS@
token.l bison.y: $(top_srcdir)/src/instrs.dat token.l.in bison.y.in gen_instr.pl
token.l bison.y: $(top_srcdir)/src/arch/@ARCH@/instrs.dat token.l.in bison.y.in gen_instr.pl
if DEV
$(PERL) gen_instr.pl -i $(top_srcdir)/src/instrs.dat -t token.l -g bison.y
else

@ -1,6 +1,6 @@
# $IdPath$
SUBDIRS = parsers preprocs optimizers objfmts . tests
SUBDIRS = arch parsers preprocs optimizers objfmts . tests
INCLUDES = -I$(top_builddir)/intl
@ -12,6 +12,7 @@ yasm_SOURCES = \
errwarn.h
yasm_LDADD = \
arch/@ARCH@/libarch.a \
parsers/nasm/libparser.a \
preprocs/raw/libpreproc.a \
optimizers/dbg/liboptimizer.a \
@ -31,10 +32,12 @@ libyasm_a_SOURCES = \
globals.c \
globals.h \
util.h \
coretype.h \
file.c \
file.h \
section.c \
section.h \
arch.h \
objfmt.h \
options.h \
options.c \
@ -57,5 +60,4 @@ libyasm_a_SOURCES = \
CFLAGS = @ANSI_CFLAGS@
EXTRA_DIST = \
instrs.dat \
compat-queue.h

@ -0,0 +1,36 @@
/* $IdPath$
* Architecture header file
*
* Copyright (C) 2001 Peter Johnson
*
* This file is part of YASM.
*
* YASM 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; either version 2 of the License, or
* (at your option) any later version.
*
* YASM 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, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef YASM_ARCH_H
#define YASM_ARCH_H
struct arch {
/* one-line description of the architecture */
const char *name;
/* keyword used to select architecture */
const char *keyword;
};
/* Available architectures */
extern arch x86_arch;
#endif

@ -0,0 +1,3 @@
# $IdPath$
SUBDIRS = x86

@ -0,0 +1,16 @@
# $IdPath$
noinst_LIBRARIES = libarch.a
libarch_a_SOURCES = \
arch.c
INCLUDES = \
-I$(top_srcdir)/src \
-I$(top_builddir)/intl
CFLAGS = @ANSI_CFLAGS@
EXTRA_DIST = \
README \
instrs.dat

@ -0,0 +1,2 @@
Architecture to support Intel IA-32, AMD x86-64, and other extensions and
derivatives of the x86 instruction set.

@ -0,0 +1,32 @@
/*
* x86 architecture description
*
* Copyright (C) 2001 Peter Johnson
*
* This file is part of YASM.
*
* YASM 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; either version 2 of the License, or
* (at your option) any later version.
*
* YASM 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, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "util.h"
RCSID("$IdPath$");
#include "arch.h"
/* Define arch structure -- see arch.h for details */
arch x86_arch = {
"x86 (IA-32, x86-64)",
"x86"
};

File diff suppressed because it is too large Load Diff

@ -0,0 +1,32 @@
/*
* x86 architecture description
*
* Copyright (C) 2001 Peter Johnson
*
* This file is part of YASM.
*
* YASM 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; either version 2 of the License, or
* (at your option) any later version.
*
* YASM 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, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "util.h"
RCSID("$IdPath$");
#include "arch.h"
/* Define arch structure -- see arch.h for details */
arch x86_arch = {
"x86 (IA-32, x86-64)",
"x86"
};

@ -22,6 +22,8 @@
#ifndef YASM_CORETYPE_H
#define YASM_CORETYPE_H
typedef struct arch arch;
typedef struct preproc preproc;
typedef struct parser parser;
typedef struct optimizer optimizer;

@ -33,7 +33,7 @@ INCLUDES = \
CFLAGS = @ANSI_CFLAGS@
token.l bison.y: $(top_srcdir)/src/instrs.dat token.l.in bison.y.in gen_instr.pl
token.l bison.y: $(top_srcdir)/src/arch/@ARCH@/instrs.dat token.l.in bison.y.in gen_instr.pl
if DEV
$(PERL) gen_instr.pl -i $(top_srcdir)/src/instrs.dat -t token.l -g bison.y
else

Loading…
Cancel
Save