changeset 231:61aa721a6b7f trunk

[svn r247] fixed accessing global symbols from inline asm.
author lindquist
date Sun, 08 Jun 2008 01:07:58 +0200
parents 79d8f6b3fbaf
children 092468448d25
files gen/asmstmt.cpp gen/d-asm-i386.h
diffstat 2 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/gen/asmstmt.cpp	Sat Jun 07 21:38:14 2008 +0200
+++ b/gen/asmstmt.cpp	Sun Jun 08 01:07:58 2008 +0200
@@ -258,7 +258,7 @@
 	return;
 
     static std::string i_cns = "i";
-    static std::string p_cns = "m";
+    static std::string p_cns = "i";
     static std::string l_cns = "X";
     static std::string m_cns = "*m";
     static std::string mw_cns = "=*m";
--- a/gen/d-asm-i386.h	Sat Jun 07 21:38:14 2008 +0200
+++ b/gen/d-asm-i386.h	Sun Jun 08 01:07:58 2008 +0200
@@ -1411,6 +1411,12 @@
 	insnTemplate->printf("%d", asmcode->args.dim);
 	asmcode->args.push( new AsmArg(type, e, mode) );
     }
+    void addOperand2(const char * fmtpre, const char * fmtpost, AsmArgType type, Expression * e, AsmCode * asmcode, AsmArgMode mode = Mode_Input) {
+    insnTemplate->writestring((char*) fmtpre);
+    insnTemplate->printf("%d", asmcode->args.dim);
+    insnTemplate->writestring((char*) fmtpost);
+    asmcode->args.push( new AsmArg(type, e, mode) );
+    }
 
     void addLabel(unsigned n) {
     // No longer taking the address of the actual label -- doesn't seem like it would help.
@@ -1909,7 +1915,7 @@
                 addOperand("$", Arg_Pointer, e, asmcode);
 			} else if ((decl && decl->isCodeseg())) { // if function or label
 			    use_star = false;
-			    addOperand("*$", Arg_Pointer, e, asmcode);
+			    addOperand2("${", ":c}", Arg_Pointer, e, asmcode);
 			} else {
 			    if (use_star) {
 				insnTemplate->writebyte('*');