summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrank Kotler <fbk@Reltok1.comcast.net>2007-09-19 01:34:55 -0400
committerFrank Kotler <fbk@Reltok1.comcast.net>2007-09-19 01:34:55 -0400
commit577f5ea592f7def077dac2398221dbf7023dfe1a (patch)
treeff39cf0a6ca85400d562f9b66a57e165bfa930e2
parent24196047b52a410c281248796164187c275cf768 (diff)
parent9b0d41ddd440bc040db8515f27e0ebe828449eca (diff)
downloadnasm-577f5ea592f7def077dac2398221dbf7023dfe1a.tar.gz
nasm-577f5ea592f7def077dac2398221dbf7023dfe1a.tar.bz2
nasm-577f5ea592f7def077dac2398221dbf7023dfe1a.zip
Merge branch 'master' of git+ssh://fbkotler@repo.or.cz/srv/git/nasm
-rw-r--r--Makefile.in116
-rw-r--r--Mkfiles/msvc.mak118
-rw-r--r--compiler.h10
-rw-r--r--configure.in26
-rw-r--r--doc/nasmdoc.src56
-rw-r--r--insns.dat5
-rwxr-xr-xmkdep.pl2
-rw-r--r--nasm.h6
-rw-r--r--nasmlib.h1
-rw-r--r--output/outelf64.c8
-rw-r--r--test/r13.asm13
11 files changed, 220 insertions, 141 deletions
diff --git a/Makefile.in b/Makefile.in
index 6b1dd7e..0dc6aed 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -207,67 +207,71 @@ alldeps: perlreq
# @object-ending: ".$(O)"
# @path-separator: "/"
#-- Everything below is generated by mkdep.pl - do not edit --#
-assemble.$(O): assemble.c preproc.h insns.h pptok.h regs.h regflags.c \
- config.h version.h nasmlib.h nasm.h regvals.c insnsi.h assemble.h
+assemble.$(O): assemble.c assemble.h compiler.h config.h insns.h insnsi.h \
+ nasm.h nasmlib.h pptok.h preproc.h regflags.c regs.h regvals.c version.h
crc64.$(O): crc64.c
-disasm.$(O): disasm.c insns.h sync.h regdis.c regs.h config.h regs.c \
- version.h nasm.h insnsn.c names.c insnsi.h disasm.h
-eval.$(O): eval.c labels.h eval.h regs.h config.h version.h nasmlib.h nasm.h \
- insnsi.h
-float.$(O): float.c regs.h config.h version.h nasm.h insnsi.h
-hashtbl.$(O): hashtbl.c regs.h config.h version.h nasmlib.h hashtbl.h nasm.h \
- insnsi.h
-insnsa.$(O): insnsa.c insns.h regs.h config.h version.h nasm.h insnsi.h
-insnsd.$(O): insnsd.c insns.h regs.h config.h version.h nasm.h insnsi.h
+disasm.$(O): disasm.c compiler.h config.h disasm.h insns.h insnsi.h insnsn.c \
+ names.c nasm.h regdis.c regs.c regs.h sync.h version.h
+eval.$(O): eval.c compiler.h config.h eval.h insnsi.h labels.h nasm.h \
+ nasmlib.h regs.h version.h
+float.$(O): float.c compiler.h config.h insnsi.h nasm.h regs.h version.h
+hashtbl.$(O): hashtbl.c compiler.h config.h hashtbl.h insnsi.h nasm.h \
+ nasmlib.h regs.h version.h
+insnsa.$(O): insnsa.c compiler.h config.h insns.h insnsi.h nasm.h regs.h \
+ version.h
+insnsd.$(O): insnsd.c compiler.h config.h insns.h insnsi.h nasm.h regs.h \
+ version.h
insnsn.$(O): insnsn.c
-labels.$(O): labels.c regs.h config.h version.h hashtbl.h nasmlib.h nasm.h \
- insnsi.h
-listing.$(O): listing.c regs.h config.h version.h nasmlib.h nasm.h insnsi.h \
- listing.h
+labels.$(O): labels.c compiler.h config.h hashtbl.h insnsi.h nasm.h \
+ nasmlib.h regs.h version.h
+listing.$(O): listing.c compiler.h config.h insnsi.h listing.h nasm.h \
+ nasmlib.h regs.h version.h
macros.$(O): macros.c
-names.$(O): names.c regs.c insnsn.c
-nasm.$(O): nasm.c labels.h preproc.h insns.h parser.h eval.h pptok.h regs.h \
- outform.h config.h version.h nasmlib.h nasm.h stdscan.h assemble.h insnsi.h \
- listing.h
-nasmlib.$(O): nasmlib.c insns.h regs.h config.h version.h nasmlib.h nasm.h \
- insnsi.h
-ndisasm.$(O): ndisasm.c insns.h sync.h regs.h config.h version.h nasmlib.h \
- nasm.h insnsi.h disasm.h
-outform.$(O): outform.c regs.h config.h outform.h version.h nasm.h insnsi.h
-output/outaout.$(O): output/outaout.c regs.h outform.h config.h version.h \
- nasmlib.h nasm.h stdscan.h insnsi.h
-output/outas86.$(O): output/outas86.c regs.h outform.h config.h version.h \
- nasmlib.h nasm.h insnsi.h
-output/outbin.$(O): output/outbin.c labels.h eval.h regs.h outform.h \
- config.h version.h nasmlib.h nasm.h stdscan.h insnsi.h
-output/outcoff.$(O): output/outcoff.c regs.h outform.h config.h version.h \
- nasmlib.h nasm.h insnsi.h
-output/outdbg.$(O): output/outdbg.c regs.h outform.h config.h version.h \
- nasmlib.h nasm.h insnsi.h
-output/outelf32.$(O): output/outelf32.c regs.h outform.h config.h version.h \
- nasmlib.h nasm.h stdscan.h insnsi.h
-output/outelf64.$(O): output/outelf64.c regs.h outform.h config.h version.h \
- nasmlib.h nasm.h stdscan.h insnsi.h
-output/outieee.$(O): output/outieee.c regs.h outform.h config.h version.h \
- nasmlib.h nasm.h insnsi.h
-output/outmacho.$(O): output/outmacho.c compiler.h regs.h outform.h config.h \
- version.h nasmlib.h nasm.h insnsi.h
-output/outobj.$(O): output/outobj.c regs.h outform.h config.h version.h \
- nasmlib.h nasm.h stdscan.h insnsi.h
-output/outrdf.$(O): output/outrdf.c regs.h outform.h config.h version.h \
- nasmlib.h nasm.h insnsi.h
-output/outrdf2.$(O): output/outrdf2.c rdoff/rdoff.h regs.h outform.h \
- config.h version.h nasmlib.h nasm.h insnsi.h
-parser.$(O): parser.c insns.h parser.h float.h regs.h regflags.c config.h \
- version.h nasmlib.h nasm.h stdscan.h insnsi.h
-pptok.$(O): pptok.c preproc.h pptok.h nasmlib.h
-preproc.$(O): preproc.c preproc.h macros.c pptok.h regs.h config.h version.h \
- hashtbl.h nasmlib.h nasm.h insnsi.h
+names.$(O): names.c insnsn.c regs.c
+nasm.$(O): nasm.c assemble.h compiler.h config.h eval.h insns.h insnsi.h \
+ labels.h listing.h nasm.h nasmlib.h outform.h parser.h pptok.h preproc.h \
+ regs.h stdscan.h version.h
+nasmlib.$(O): nasmlib.c compiler.h config.h insns.h insnsi.h nasm.h \
+ nasmlib.h regs.h version.h
+ndisasm.$(O): ndisasm.c compiler.h config.h disasm.h insns.h insnsi.h nasm.h \
+ nasmlib.h regs.h sync.h version.h
+outform.$(O): outform.c compiler.h config.h insnsi.h nasm.h outform.h regs.h \
+ version.h
+output/outaout.$(O): output/outaout.c compiler.h config.h insnsi.h nasm.h \
+ nasmlib.h outform.h regs.h stdscan.h version.h
+output/outas86.$(O): output/outas86.c compiler.h config.h insnsi.h nasm.h \
+ nasmlib.h outform.h regs.h version.h
+output/outbin.$(O): output/outbin.c compiler.h config.h eval.h insnsi.h \
+ labels.h nasm.h nasmlib.h outform.h regs.h stdscan.h version.h
+output/outcoff.$(O): output/outcoff.c compiler.h config.h insnsi.h nasm.h \
+ nasmlib.h outform.h regs.h version.h
+output/outdbg.$(O): output/outdbg.c compiler.h config.h insnsi.h nasm.h \
+ nasmlib.h outform.h regs.h version.h
+output/outelf32.$(O): output/outelf32.c compiler.h config.h insnsi.h nasm.h \
+ nasmlib.h outform.h regs.h stdscan.h version.h
+output/outelf64.$(O): output/outelf64.c compiler.h config.h insnsi.h nasm.h \
+ nasmlib.h outform.h regs.h stdscan.h version.h
+output/outieee.$(O): output/outieee.c compiler.h config.h insnsi.h nasm.h \
+ nasmlib.h outform.h regs.h version.h
+output/outmacho.$(O): output/outmacho.c compiler.h config.h insnsi.h nasm.h \
+ nasmlib.h outform.h regs.h version.h
+output/outobj.$(O): output/outobj.c compiler.h config.h insnsi.h nasm.h \
+ nasmlib.h outform.h regs.h stdscan.h version.h
+output/outrdf.$(O): output/outrdf.c compiler.h config.h insnsi.h nasm.h \
+ nasmlib.h outform.h regs.h version.h
+output/outrdf2.$(O): output/outrdf2.c compiler.h config.h insnsi.h nasm.h \
+ nasmlib.h outform.h rdoff/rdoff.h regs.h version.h
+parser.$(O): parser.c compiler.h config.h float.h insns.h insnsi.h nasm.h \
+ nasmlib.h parser.h regflags.c regs.h stdscan.h version.h
+pptok.$(O): pptok.c compiler.h config.h nasmlib.h pptok.h preproc.h
+preproc.$(O): preproc.c compiler.h config.h hashtbl.h insnsi.h macros.c \
+ nasm.h nasmlib.h pptok.h preproc.h regs.h version.h
regdis.$(O): regdis.c
regflags.$(O): regflags.c
regs.$(O): regs.c
regvals.$(O): regvals.c
-stdscan.$(O): stdscan.c insns.h regs.h config.h version.h nasmlib.h nasm.h \
- stdscan.h insnsi.h
+stdscan.$(O): stdscan.c compiler.h config.h insns.h insnsi.h nasm.h \
+ nasmlib.h regs.h stdscan.h version.h
sync.$(O): sync.c sync.h
-tokhash.$(O): tokhash.c insns.h regs.h config.h version.h nasm.h insnsi.h
+tokhash.$(O): tokhash.c compiler.h config.h insns.h insnsi.h nasm.h regs.h \
+ version.h
diff --git a/Mkfiles/msvc.mak b/Mkfiles/msvc.mak
index 66fe7f2..d70973d 100644
--- a/Mkfiles/msvc.mak
+++ b/Mkfiles/msvc.mak
@@ -15,7 +15,7 @@ mandir = $(prefix)/man
CC = cl
CFLAGS = /O2 /Ox /Oy /W2
BUILD_CFLAGS = $(CFLAGS) /I$(srcdir)/inttypes
-INTERNAL_CFLAGS = /I$(srcdir) /I. /Dsnprintf=sprintf_s
+INTERNAL_CFLAGS = /I$(srcdir) /I. /DHAVE__SNPRINTF /DHAVE__VSNPRINTF
ALL_CFLAGS = $(BUILD_CFLAGS) $(INTERNAL_CFLAGS)
LDFLAGS =
LIBS =
@@ -165,67 +165,71 @@ everything: all doc rdf
# @object-ending: ".$(O)"
# @path-separator: "/"
#-- Everything below is generated by mkdep.pl - do not edit --#
-assemble.$(O): assemble.c preproc.h insns.h pptok.h regs.h regflags.c \
- config.h version.h nasmlib.h nasm.h regvals.c insnsi.h assemble.h
+assemble.$(O): assemble.c assemble.h compiler.h config.h insns.h insnsi.h \
+ nasm.h nasmlib.h pptok.h preproc.h regflags.c regs.h regvals.c version.h
crc64.$(O): crc64.c
-disasm.$(O): disasm.c insns.h sync.h regdis.c regs.h config.h regs.c \
- version.h nasm.h insnsn.c names.c insnsi.h disasm.h
-eval.$(O): eval.c labels.h eval.h regs.h config.h version.h nasmlib.h nasm.h \
- insnsi.h
-float.$(O): float.c regs.h config.h version.h nasm.h insnsi.h
-hashtbl.$(O): hashtbl.c regs.h config.h version.h nasmlib.h hashtbl.h nasm.h \
- insnsi.h
-insnsa.$(O): insnsa.c insns.h regs.h config.h version.h nasm.h insnsi.h
-insnsd.$(O): insnsd.c insns.h regs.h config.h version.h nasm.h insnsi.h
+disasm.$(O): disasm.c compiler.h config.h disasm.h insns.h insnsi.h insnsn.c \
+ names.c nasm.h regdis.c regs.c regs.h sync.h version.h
+eval.$(O): eval.c compiler.h config.h eval.h insnsi.h labels.h nasm.h \
+ nasmlib.h regs.h version.h
+float.$(O): float.c compiler.h config.h insnsi.h nasm.h regs.h version.h
+hashtbl.$(O): hashtbl.c compiler.h config.h hashtbl.h insnsi.h nasm.h \
+ nasmlib.h regs.h version.h
+insnsa.$(O): insnsa.c compiler.h config.h insns.h insnsi.h nasm.h regs.h \
+ version.h
+insnsd.$(O): insnsd.c compiler.h config.h insns.h insnsi.h nasm.h regs.h \
+ version.h
insnsn.$(O): insnsn.c
-labels.$(O): labels.c regs.h config.h version.h hashtbl.h nasmlib.h nasm.h \
- insnsi.h
-listing.$(O): listing.c regs.h config.h version.h nasmlib.h nasm.h insnsi.h \
- listing.h
+labels.$(O): labels.c compiler.h config.h hashtbl.h insnsi.h nasm.h \
+ nasmlib.h regs.h version.h
+listing.$(O): listing.c compiler.h config.h insnsi.h listing.h nasm.h \
+ nasmlib.h regs.h version.h
macros.$(O): macros.c
-names.$(O): names.c regs.c insnsn.c
-nasm.$(O): nasm.c labels.h preproc.h insns.h parser.h eval.h pptok.h regs.h \
- outform.h config.h version.h nasmlib.h nasm.h stdscan.h assemble.h insnsi.h \
- listing.h
-nasmlib.$(O): nasmlib.c insns.h regs.h config.h version.h nasmlib.h nasm.h \
- insnsi.h
-ndisasm.$(O): ndisasm.c insns.h sync.h regs.h config.h version.h nasmlib.h \
- nasm.h insnsi.h disasm.h
-outform.$(O): outform.c regs.h config.h outform.h version.h nasm.h insnsi.h
-output/outaout.$(O): output/outaout.c regs.h outform.h config.h version.h \
- nasmlib.h nasm.h stdscan.h insnsi.h
-output/outas86.$(O): output/outas86.c regs.h outform.h config.h version.h \
- nasmlib.h nasm.h insnsi.h
-output/outbin.$(O): output/outbin.c labels.h eval.h regs.h outform.h \
- config.h version.h nasmlib.h nasm.h stdscan.h insnsi.h
-output/outcoff.$(O): output/outcoff.c regs.h outform.h config.h version.h \
- nasmlib.h nasm.h insnsi.h
-output/outdbg.$(O): output/outdbg.c regs.h outform.h config.h version.h \
- nasmlib.h nasm.h insnsi.h
-output/outelf32.$(O): output/outelf32.c regs.h outform.h config.h version.h \
- nasmlib.h nasm.h stdscan.h insnsi.h
-output/outelf64.$(O): output/outelf64.c regs.h outform.h config.h version.h \
- nasmlib.h nasm.h stdscan.h insnsi.h
-output/outieee.$(O): output/outieee.c regs.h outform.h config.h version.h \
- nasmlib.h nasm.h insnsi.h
-output/outmacho.$(O): output/outmacho.c compiler.h regs.h outform.h config.h \
- version.h nasmlib.h nasm.h insnsi.h
-output/outobj.$(O): output/outobj.c regs.h outform.h config.h version.h \
- nasmlib.h nasm.h stdscan.h insnsi.h
-output/outrdf.$(O): output/outrdf.c regs.h outform.h config.h version.h \
- nasmlib.h nasm.h insnsi.h
-output/outrdf2.$(O): output/outrdf2.c rdoff/rdoff.h regs.h outform.h \
- config.h version.h nasmlib.h nasm.h insnsi.h
-parser.$(O): parser.c insns.h parser.h float.h regs.h regflags.c config.h \
- version.h nasmlib.h nasm.h stdscan.h insnsi.h
-pptok.$(O): pptok.c preproc.h pptok.h nasmlib.h
-preproc.$(O): preproc.c preproc.h macros.c pptok.h regs.h config.h version.h \
- hashtbl.h nasmlib.h nasm.h insnsi.h
+names.$(O): names.c insnsn.c regs.c
+nasm.$(O): nasm.c assemble.h compiler.h config.h eval.h insns.h insnsi.h \
+ labels.h listing.h nasm.h nasmlib.h outform.h parser.h pptok.h preproc.h \
+ regs.h stdscan.h version.h
+nasmlib.$(O): nasmlib.c compiler.h config.h insns.h insnsi.h nasm.h \
+ nasmlib.h regs.h version.h
+ndisasm.$(O): ndisasm.c compiler.h config.h disasm.h insns.h insnsi.h nasm.h \
+ nasmlib.h regs.h sync.h version.h
+outform.$(O): outform.c compiler.h config.h insnsi.h nasm.h outform.h regs.h \
+ version.h
+output/outaout.$(O): output/outaout.c compiler.h config.h insnsi.h nasm.h \
+ nasmlib.h outform.h regs.h stdscan.h version.h
+output/outas86.$(O): output/outas86.c compiler.h config.h insnsi.h nasm.h \
+ nasmlib.h outform.h regs.h version.h
+output/outbin.$(O): output/outbin.c compiler.h config.h eval.h insnsi.h \
+ labels.h nasm.h nasmlib.h outform.h regs.h stdscan.h version.h
+output/outcoff.$(O): output/outcoff.c compiler.h config.h insnsi.h nasm.h \
+ nasmlib.h outform.h regs.h version.h
+output/outdbg.$(O): output/outdbg.c compiler.h config.h insnsi.h nasm.h \
+ nasmlib.h outform.h regs.h version.h
+output/outelf32.$(O): output/outelf32.c compiler.h config.h insnsi.h nasm.h \
+ nasmlib.h outform.h regs.h stdscan.h version.h
+output/outelf64.$(O): output/outelf64.c compiler.h config.h insnsi.h nasm.h \
+ nasmlib.h outform.h regs.h stdscan.h version.h
+output/outieee.$(O): output/outieee.c compiler.h config.h insnsi.h nasm.h \
+ nasmlib.h outform.h regs.h version.h
+output/outmacho.$(O): output/outmacho.c compiler.h config.h insnsi.h nasm.h \
+ nasmlib.h outform.h regs.h version.h
+output/outobj.$(O): output/outobj.c compiler.h config.h insnsi.h nasm.h \
+ nasmlib.h outform.h regs.h stdscan.h version.h
+output/outrdf.$(O): output/outrdf.c compiler.h config.h insnsi.h nasm.h \
+ nasmlib.h outform.h regs.h version.h
+output/outrdf2.$(O): output/outrdf2.c compiler.h config.h insnsi.h nasm.h \
+ nasmlib.h outform.h rdoff/rdoff.h regs.h version.h
+parser.$(O): parser.c compiler.h config.h float.h insns.h insnsi.h nasm.h \
+ nasmlib.h parser.h regflags.c regs.h stdscan.h version.h
+pptok.$(O): pptok.c compiler.h config.h nasmlib.h pptok.h preproc.h
+preproc.$(O): preproc.c compiler.h config.h hashtbl.h insnsi.h macros.c \
+ nasm.h nasmlib.h pptok.h preproc.h regs.h version.h
regdis.$(O): regdis.c
regflags.$(O): regflags.c
regs.$(O): regs.c
regvals.$(O): regvals.c
-stdscan.$(O): stdscan.c insns.h regs.h config.h version.h nasmlib.h nasm.h \
- stdscan.h insnsi.h
+stdscan.$(O): stdscan.c compiler.h config.h insns.h insnsi.h nasm.h \
+ nasmlib.h regs.h stdscan.h version.h
sync.$(O): sync.c sync.h
-tokhash.$(O): tokhash.c insns.h regs.h config.h version.h nasm.h insnsi.h
+tokhash.$(O): tokhash.c compiler.h config.h insns.h insnsi.h nasm.h regs.h \
+ version.h
diff --git a/compiler.h b/compiler.h
index b3f77c9..8ceb9ee 100644
--- a/compiler.h
+++ b/compiler.h
@@ -37,4 +37,14 @@
# define _unused
#endif
+/* Some versions of MSVC have these only with underscores in front */
+
+#if !defined(HAVE_SNPRINTF) && defined(HAVE__SNPRINTF)
+# define snprintf _snprintf
+#endif
+
+#if !defined(HAVE_VSNPRINTF) && defined(HAVE__VSNPRINTF)
+# define vsnprintf _vsnprintf
+#endif
+
#endif /* COMPILER_H */
diff --git a/configure.in b/configure.in
index b45d754..a52b620 100644
--- a/configure.in
+++ b/configure.in
@@ -87,28 +87,22 @@ AC_C_CONST
AC_TYPE_SIZE_T
dnl Checks for library functions.
-AC_FUNC_VPRINTF
-if test $ac_cv_func_vprintf = no; then
- AC_MSG_ERROR([NASM requires ANSI C (specifically, "vprintf" and friends)])
-fi
-AC_CHECK_FUNCS(strcspn)
-if test $ac_cv_func_strcspn = no; then
- AC_MSG_ERROR([NASM requires ANSI C (specifically, "strcspn")])
-fi
+AC_CHECK_FUNCS(strcspn, ,
+ AC_MSG_ERROR([NASM requires ANSI C (specifically, "strcspn")]))
-AC_CHECK_FUNCS(strspn)
-if test $ac_cv_func_strspn = no; then
- AC_MSG_ERROR([NASM requires ANSI C (specifically, "strspn")])
-fi
+AC_CHECK_FUNCS(strspn, ,
+ AC_MSG_ERROR([NASM requires ANSI C (specifically, "strspn")]))
-AC_CHECK_FUNCS(snprintf)
-if test $ac_cv_func_snprintf = no; then
+missing=true
+AC_CHECK_FUNCS([snprintf _snprintf], missing=false)
+if $missing; then
AC_MSG_ERROR([NASM requires ISO C99 (specifically, "snprintf")])
fi
-AC_CHECK_FUNCS(vsnprintf)
-if test $ac_cv_func_snprintf = no; then
+missing=true
+AC_CHECK_FUNCS([vsnprintf _vsnprintf], missing=false)
+if $missing; then
AC_MSG_ERROR([NASM requires ISO C99 (specifically, "vsnprintf")])
fi
diff --git a/doc/nasmdoc.src b/doc/nasmdoc.src
index b7544f4..13ae013 100644
--- a/doc/nasmdoc.src
+++ b/doc/nasmdoc.src
@@ -6215,7 +6215,9 @@ registers, which still add their bases.
Position independence in 64-bit mode is significantly simpler, since
the processor supports \c{RIP}-relative addressing directly; see the
-\c{REL} keyword (\k{effaddr}).
+\c{REL} keyword (\k{effaddr}). On most 64-bit platforms, it is
+probably desirable to make that the default, using the directive
+\c{DEFAULT REL} (\k{default}).
64-bit programming is relatively similar to 32-bit programming, but
of course pointers are 64 bits long; additionally, all existing
@@ -6223,6 +6225,58 @@ platforms pass arguments in registers rather than on the stack.
Furthermore, 64-bit platforms use SSE2 by default for floating point.
Please see the ABI documentation for your platform.
+64-bit platforms differ in the sizes of the fundamental datatypes, not
+just from 32-bit platforms but from each other. If a specific size
+data type is desired, it is probably best to use the types defined in
+the Standard C header \c{<inttypes.h>}.
+
+\H{unix64} Interfacing to 64-bit C Programs (Unix)
+
+On Unix, the 64-bit ABI is defined by the document:
+
+\W{http://www.x86-64.org/documentation/abi.pdf}\c{http://www.x86-64.org/documentation/abi.pdf}
+
+Although written for AT&T-syntax assembly, the concepts apply equally
+well for NASM-style assembly. What follows is a simplified summary.
+
+The first six integer arguments (from the left) are passed in \c{RDI},
+\c{RSI}, \c{RDX}, \c{RCX}, \c{R8}, and \c{R9}, in that order.
+Additional integer arguments are passed on the stack. These
+registers, plus \c{RAX}, \c{R10} and \c{R11} are destroyed by function
+calls, and thus are available for use by the function without saving.
+
+Integer return values are passed in \c{RAX} and \c{RDX}, in that order.
+
+Floating point is done using SSE registers, except for \c{long
+double}. Floating-point arguments are passed in \c{XMM0} to \c{XMM7};
+return is \c{XMM0} and \c{XMM1}. \c{long double} are passed on the
+stack, and returned in \c{ST(0)} and \c{ST(1)}.
+
+All SSE and x87 registers are destroyed by function calls.
+
+On 64-bit Unix, \c{long} is 64 bits.
+
+\H{win64} Interfacing to 64-bit C Programs (Win64)
+
+The Win64 ABI is described at:
+
+\W{http://msdn2.microsoft.com/en-gb/library/ms794533.aspx}\c{http://msdn2.microsoft.com/en-gb/library/ms794533.aspx}
+
+What follows is a simplified summary.
+
+The first four integer arguments are passwd in \c{RCX}, \c{RDX},
+\c{R8} and \c{R9}, in that order. Additional integer arguments are
+passed on the stack. These registers, plus \c{RAX}, \c{R10} and
+\c{R11} are destroyed by function calls, and thus are available for
+use by the function without saving.
+
+Integer return values are passed in \c{RAX} only.
+
+Floating point is done using SSE registers, except for \c{long
+double}. Floating-point arguments are passed in \c{XMM0} to \c{XMM3};
+return is \c{XMM0} only.
+
+On Win64, \c{long} is 32 bits; \c{long long} or \c{_int64} is 64 bits.
\C{trouble} Troubleshooting
diff --git a/insns.dat b/insns.dat
index 422109e..5043b0b 100644
--- a/insns.dat
+++ b/insns.dat
@@ -206,7 +206,7 @@ CDQ void \321\1\x99 386
CDQE void \324\1\x98 X64
CLC void \1\xF8 8086
CLD void \1\xFC 8086
-CLFLUSH mem8 \300\2\x0F\x80\207 X64,AMD,SM
+CLFLUSH mem \300\2\x0F\x80\207 KATMAI
CLGI void \3\x0F\x01\xDD X64,AMD
CLI void \1\xFA 8086
CLTS void \2\x0F\x06 286,PRIV
@@ -757,6 +757,9 @@ NEG rm16 \320\300\1\xF7\203 8086
NEG rm32 \321\300\1\xF7\203 386
NEG rm64 \324\300\1\xF7\203 X64
NOP void \1\x90 8086
+NOP rm16 \320\300\2\x0F\x1F\200 P6
+NOP rm32 \321\300\2\x0F\x1F\200 P6
+NOP rm64 \324\300\2\x0F\x1F\200 X64
NOT rm8 \300\1\xF6\202 8086
NOT rm16 \320\300\1\xF7\202 8086
NOT rm32 \321\300\1\xF7\202 386
diff --git a/mkdep.pl b/mkdep.pl
index 65a6d10..31eb88d 100755
--- a/mkdep.pl
+++ b/mkdep.pl
@@ -54,7 +54,7 @@ sub alldeps($) {
$adeps{$idep} = 1;
}
}
- return keys(%adeps);
+ return sort(keys(%adeps));
}
# This converts a filename from host syntax to target syntax
diff --git a/nasm.h b/nasm.h
index 6e231b6..4ae93b6 100644
--- a/nasm.h
+++ b/nasm.h
@@ -14,11 +14,7 @@
#include <stdio.h>
#include <inttypes.h>
#include "version.h" /* generated NASM version macros */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
+#include "compiler.h"
#include "insnsi.h" /* For enum opcode */
#ifndef NULL
diff --git a/nasmlib.h b/nasmlib.h
index cf7040c..82a35e3 100644
--- a/nasmlib.h
+++ b/nasmlib.h
@@ -11,6 +11,7 @@
#include <inttypes.h>
#include <stdio.h>
+#include "compiler.h"
/*
* If this is defined, the wrappers around malloc et al will
diff --git a/output/outelf64.c b/output/outelf64.c
index 4424d81..e87d8bd 100644
--- a/output/outelf64.c
+++ b/output/outelf64.c
@@ -74,7 +74,7 @@ struct Symbol {
int32_t section; /* section ID of the symbol */
int type; /* symbol type */
int other; /* symbol visibility */
- int32_t value; /* address, or COMMON variable align */
+ int64_t value; /* address, or COMMON variable align */
int32_t size; /* size of symbol */
int32_t globnum; /* symbol table offset if global */
struct Symbol *next; /* list of globals in each section */
@@ -709,7 +709,7 @@ static void elf_add_reloc(struct Section *sect, int32_t segment, int type)
* isn't even necessarily sorted.
*/
static int32_t elf_add_gsym_reloc(struct Section *sect,
- int32_t segment, int32_t offset,
+ int32_t segment, int64_t offset,
int type, int exact)
{
struct Reloc *r;
@@ -779,7 +779,7 @@ static void elf_out(int32_t segto, const void *data, uint32_t type,
{
struct Section *s;
int32_t realbytes = type & OUT_SIZMASK;
- int32_t addr;
+ int64_t addr;
uint8_t mydata[16], *p;
int i;
static struct symlininfo sinfo;
@@ -851,7 +851,7 @@ static void elf_out(int32_t segto, const void *data, uint32_t type,
elf_sect_write(s, data, realbytes);
} else if (type == OUT_ADDRESS) {
int gnu16 = 0;
- addr = *(int32_t *)data;
+ addr = *(int64_t *)data;
if (segment != NO_SEG) {
if (segment % 2) {
error(ERR_NONFATAL, "ELF format does not support"
diff --git a/test/r13.asm b/test/r13.asm
new file mode 100644
index 0000000..7748aa6
--- /dev/null
+++ b/test/r13.asm
@@ -0,0 +1,13 @@
+ bits 64
+ mov rax,[rbx]
+ mov rax,[rbx*4]
+ mov rax,[rbx+rbx*2]
+ mov rax,[r13+rbx*2]
+ mov rax,[rbp]
+ mov rax,[rbp*4]
+ mov rax,[rbp+rbp*2]
+ mov rax,[rbp+r13*2]
+ mov rax,[r13]
+ mov rax,[r13*4]
+ mov rax,[r13+rbp*2]
+ mov rax,[r13+r13*2]