4 |
#include <sys/time.h> |
#include <sys/time.h> |
5 |
#include <sys/resource.h> |
#include <sys/resource.h> |
6 |
|
|
7 |
#define N_CALLS_PER_PAGE 1024 |
/* #define N_CALLS_PER_PAGE 1024 */ |
8 |
|
#define N_CALLS_PER_PAGE 128 |
9 |
|
|
10 |
#define MHZ 533 |
#define MHZ 533 |
11 |
|
|
13 |
|
|
14 |
struct instr_call { |
struct instr_call { |
15 |
void (*f)(struct cpu *cpu, struct instr_call *ic); |
void (*f)(struct cpu *cpu, struct instr_call *ic); |
16 |
int instr_len; |
/* int instr_len; */ |
17 |
void *arg[3]; |
void *arg[3]; |
18 |
}; |
}; |
19 |
|
|
59 |
|
|
60 |
void f_add(struct cpu *cpu, struct instr_call *ic) |
void f_add(struct cpu *cpu, struct instr_call *ic) |
61 |
{ |
{ |
62 |
|
#if 0 |
63 |
|
#if 0 |
64 |
int *a = (int *) ic->arg[0]; |
int *a = (int *) ic->arg[0]; |
65 |
int *b = (int *) ic->arg[1]; |
int *b = (int *) ic->arg[1]; |
66 |
int *c = (int *) ic->arg[2]; |
int *c = (int *) ic->arg[2]; |
67 |
|
|
68 |
*a = (*b) + (*c); |
*a = (*b) + (*c); |
69 |
|
#else |
70 |
|
int *a = (int *) ic->arg[0]; |
71 |
|
int *b = (int *) ic->arg[1]; |
72 |
|
int *c = (int *) ic->arg[2]; |
73 |
|
int *d, *e, *f; |
74 |
|
|
|
#if 0 |
|
75 |
ic = cpu->next_instr_call++; |
ic = cpu->next_instr_call++; |
76 |
|
d = (int *) ic->arg[0]; |
77 |
a = (int *) ic->arg[0]; |
e = (int *) ic->arg[1]; |
78 |
b = (int *) ic->arg[1]; |
f = (int *) ic->arg[2]; |
|
c = (int *) ic->arg[2]; |
|
79 |
|
|
80 |
*a = (*b) + (*c); |
*a = (*b) + (*c); |
81 |
|
*d = (*e) + (*f); |
82 |
|
#endif |
83 |
#endif |
#endif |
84 |
} |
} |
85 |
|
|
158 |
if (i == ncalls-1) { |
if (i == ncalls-1) { |
159 |
call_array[i].f = f_end; |
call_array[i].f = f_end; |
160 |
} else { |
} else { |
161 |
|
#if 0 |
162 |
switch (i & 3) { |
switch (i & 3) { |
163 |
case 0: call_array[i].f = f_add; |
case 0: call_array[i].f = f_add; |
164 |
case 1: call_array[i].f = f_sub; |
case 1: call_array[i].f = f_sub; |
165 |
case 2: call_array[i].f = f_and; |
case 2: call_array[i].f = f_and; |
166 |
case 3: call_array[i].f = f_or; |
case 3: call_array[i].f = f_or; |
167 |
} |
} |
168 |
|
#else |
169 |
|
call_array[i].f = f_add; |
170 |
|
#endif |
171 |
|
|
172 |
call_array[i].arg[0] = &tmp_a; |
call_array[i].arg[0] = &tmp_a; |
173 |
call_array[i].arg[1] = &tmp_b; |
call_array[i].arg[1] = &tmp_b; |