changeset 110:fb502a0071f8

first binary run
author kono
date Wed, 19 Mar 2003 04:25:43 +0900
parents e09f9de6f5d3
children 7aa449aff3e6
files .gdbinit .gdbinit.ia32 Changes mc-code-powerpc.c mc.h
diffstat 5 files changed, 48 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/.gdbinit	Wed Mar 19 02:22:33 2003 +0900
+++ b/.gdbinit	Wed Mar 19 04:25:43 2003 +0900
@@ -1,16 +1,17 @@
 tb main
 define regs 
-call fprintf(stderr,"eax=%08x ebx=%08x ecx=%08x edx=%08x\nesi=%08x edi=%08x ebp=%08x esp=%08x eip=%08x\n",$eax,$ebx,$ecx,$edx,$esi,$edi,$ebp,$esp,$eip)
+printf "r0=%08x r1=%08x r2=%08x r3=%08x\n",$r0,$r1,$r2,$r3
+printf "lr=%08x pc=%08x r4=%08x r5=%08x\n",$lr,$pc,$r4,$r5
 end
 define si
 stepi
 regs
-x/1i $eip
+x/1i $pc
 end
 define ni
 nexti
 regs
-x/1i $eip
+x/1i $pc
 end
 b errmsg
-r -s test/basic.c
+r -s mc-code-powerpc.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.gdbinit.ia32	Wed Mar 19 04:25:43 2003 +0900
@@ -0,0 +1,16 @@
+tb main
+define regs 
+call fprintf(stderr,"eax=%08x ebx=%08x ecx=%08x edx=%08x\nesi=%08x edi=%08x ebp=%08x esp=%08x eip=%08x\n",$eax,$ebx,$ecx,$edx,$esi,$edi,$ebp,$esp,$eip)
+end
+define si
+stepi
+regs
+x/1i $eip
+end
+define ni
+nexti
+regs
+x/1i $eip
+end
+b errmsg
+r -s mc-code-powerpc.c
--- a/Changes	Wed Mar 19 02:22:33 2003 +0900
+++ b/Changes	Wed Mar 19 04:25:43 2003 +0900
@@ -2315,5 +2315,9 @@
 ませんでした。これも、どうすればいいんだ... まぁ、get_register_var
 するのが簡単だよね。
 
-
 save register が狂っているようだね。max_register_var あたり?
+
+Wed Mar 19 02:22:51 JST 2003
+
+なんだか、struct のtag listが、int a,b,c; のようになっているのを
+一つと数えているらしい。困ったものだ。
--- a/mc-code-powerpc.c	Wed Mar 19 02:22:33 2003 +0900
+++ b/mc-code-powerpc.c	Wed Mar 19 04:25:43 2003 +0900
@@ -388,7 +388,7 @@
 emit_init(void)
 {
     free_all_register();
-    max_reg_var=0; max_freg_var=0;
+    max_reg_var=-1; max_freg_var=-1;
     reg_sp = 0;
     text_mode();
 }
@@ -1569,6 +1569,7 @@
 }
 
 static int code_setup;
+static int func_disp_label;
 
 void
 enter(char *name)
@@ -1588,6 +1589,8 @@
     printf("\tbl L_%d\n",code_setup);
     code_base=fwdlabel();
     lvar_offset = fwdlabel();
+    func_disp_label = fwdlabel();
+    printf("\tstwu r1,lo16(L_%d)(r1)\n",func_disp_label);
     printf("\tmr r30,r1\n");
     printf("\tmflr r31\n");
 }
@@ -1603,7 +1606,7 @@
 reg_save_offset()
 {
     return -(
-	(REAL_MAX_REGISTER-(REG_VAR_BASE-max_reg_var))*size_of_int+
+	(REAL_MAX_REGISTER-(REG_VAR_BASE-max_reg_var))*size_of_int*2+
 	(REAL_MAX_FREGISTER-(FREG_VAR_BASE-max_freg_var))*size_of_double
 	);
 }
@@ -1617,9 +1620,8 @@
     if (retcont) fwddef(retcont);
     fwddef(retlabel);
     printf("\tlwz r1,0(r1)\n");
-    if (max_freg_var>0) {
-	if (max_reg_var>0)
-	    printf("\tlmw r%d,%d(r1)\n",
+    if (max_freg_var>=0) {
+	printf("\tlmw r%d,%d(r1)\n",
 			REG_VAR_BASE-max_reg_var,reg_save_offset());
 	printf("\tb restFP+%d ; restore f%d-f31\n",
 			68-(31-FREG_VAR_BASE-max_freg_var)*4,
@@ -1627,26 +1629,26 @@
     } else {
 	printf("\tlwz r0,8(r1)\n");
 	printf("\tmtlr r0\n");
-	if (max_reg_var>0)
-	    printf("\tlmw r%d,%d(r1)\n",
-			REG_VAR_BASE-max_reg_var,reg_save_offset());
+	printf("\tlmw r%d,%d(r1)\n",
+		    REG_VAR_BASE-max_reg_var,reg_save_offset());
 	printf("\tblr\n");
     }
 
     disp &= -size_of_int;
     fwddef(code_setup);
     fwddef(code_base);
-    if (max_reg_var>0)
-	printf("\tstmw r%d,%d(r1)\n",
-			REG_VAR_BASE-max_reg_var,reg_save_offset());
-    printf("\tstwu r1,%d(r1)\n",disp+disp_offset+reg_save_offset());
-    if (max_freg_var>0)
+    printf("\tstmw r%d,%d(r1)\n",
+		    REG_VAR_BASE-max_reg_var,reg_save_offset());
+    printf("\tstw r0,8(r1)\n");
+    if (max_freg_var>=0)
 	printf("\tb saveFP+%d ; save f%d-f31\n",
 			68-(31-FREG_VAR_BASE-max_freg_var)*4,
 			FREG_VAR_BASE-max_freg_var);
-    else
+    else {
 	printf("\tblr\n");
+    }
 
+    printf(".set L_%d,%d\n",func_disp_label,disp+disp_offset+reg_save_offset());
     printf(".set L_%d,%d\n",lvar_offset,
 	arg_offset+disp+disp_offset+reg_save_offset());
 /*
--- a/mc.h	Wed Mar 19 02:22:33 2003 +0900
+++ b/mc.h	Wed Mar 19 04:25:43 2003 +0900
@@ -253,9 +253,15 @@
 
 EXTERN FILE *obuf;
 
+#if 0
 typedef struct nametable {
 	char *nm;
 	int sc,ty,dsp; } NMTBL;
+#else
+typedef struct nametable {
+	char *nm;
+	int sc; int ty; int dsp; } NMTBL;
+#endif
 
 EXTERN NMTBL mtable[MSYMS];
 EXTERN NMTBL ntable[GSYMS+LSYMS];