Mercurial > hg > CbC > old > device
comparison test/test1.c @ 748:c2c709727221
i64 continue... basic.s assembled.
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 13 Nov 2010 22:39:40 +0900 |
parents | 07dce42b67af |
children | 5313ed059cee |
comparison
equal
deleted
inserted
replaced
747:d4bc10fe7362 | 748:c2c709727221 |
---|---|
43 } | 43 } |
44 | 44 |
45 __code f(int i,void *sp) { | 45 __code f(int i,void *sp) { |
46 int k,j; | 46 int k,j; |
47 struct f_g0_save *c; | 47 struct f_g0_save *c; |
48 printf("#0042:f 0 sp: %x\n",sp-stack0); | 48 printf("#0047:f 0 sp: %x\n",sp-stack0); |
49 | 49 |
50 k = 3+i; | 50 k = 3+i; |
51 | 51 |
52 printf("#0046:f 1 sp: %x\n",sp-stack0); | 52 printf("#0051:f 1 sp: %x\n",sp-stack0); |
53 sp -= sizeof(struct f_g0_save); | 53 sp -= sizeof(struct f_g0_save); |
54 printf("#0048:f 2 sp: %x\n",sp-stack0); | 54 printf("#0053:f 2 sp: %x\n",sp-stack0); |
55 c = sp; | 55 c = sp; |
56 c->kk = k; | 56 c->kk = k; |
57 c->ii = i; | 57 c->ii = i; |
58 c->jj = j; | 58 c->jj = j; |
59 c->ret = f_g1; | 59 c->ret = f_g1; |
71 | 71 |
72 __code f1(int i,void *sp) ; | 72 __code f1(int i,void *sp) ; |
73 __code f0(int i,int j,__code(*exit2)(), void *exit2env,void *sp) | 73 __code f0(int i,int j,__code(*exit2)(), void *exit2env,void *sp) |
74 { | 74 { |
75 struct f0_save *c; | 75 struct f0_save *c; |
76 printf("#0070:f0 1 sp: %x\n",sp-stack0); | 76 printf("#0075:f0 1 sp: %x\n",sp-stack0); |
77 sp -= sizeof(struct f0_save); | 77 sp -= sizeof(struct f0_save); |
78 printf("#0072:f0 2 sp: %x\n",sp-stack0); | 78 printf("#0077:f0 2 sp: %x\n",sp-stack0); |
79 c = sp; | 79 c = sp; |
80 c->jj = j; | 80 c->jj = j; |
81 c->exit1 = exit2; | 81 c->exit1 = exit2; |
82 c->exit1env = exit2env; | 82 c->exit1env = exit2env; |
83 c->ret = f1; | 83 c->ret = f1; |
84 printf("#0078:f0 3 sp: %x\n",sp-stack0); | 84 printf("#0083:f0 3 sp: %x\n",sp-stack0); |
85 goto f(i,sp); | 85 goto f(i,sp); |
86 } | 86 } |
87 | 87 |
88 __code print(int i,int j,__code (*exit1)(),void*exit1env); | 88 __code print(int i,int j,__code (*exit1)(),void*exit1env); |
89 | 89 |
111 i = 1; | 111 i = 1; |
112 stack0 = ((char *)malloc(1024)+1024); | 112 stack0 = ((char *)malloc(1024)+1024); |
113 sp = stack0; | 113 sp = stack0; |
114 j = i; | 114 j = i; |
115 | 115 |
116 printf("#0108:sp: %x %x\n",sp-(int*)stack0,sizeof(*stack0)); | 116 printf("#0115:sp: %x %x\n",sp-(int*)stack0,sizeof(*stack0)); |
117 goto f0(i,j,__return,__environment,sp); | 117 goto f0(i,j,__return,__environment,sp); |
118 } | 118 } |
119 | 119 |
120 __code print(int i,int j,__code (*exit1)(),void*exit1env) | 120 __code print(int i,int j,__code (*exit1)(),void*exit1env) |
121 { | 121 { |
122 printf("#0114:%d %d\n",i,j); | 122 printf("#0121:%d %d\n",i,j); |
123 goto (*exit1)(0,exit1env); | 123 goto (*exit1)(0,exit1env); |
124 } | 124 } |
125 | 125 |