Line 45... |
Line 45... |
"\n";
|
"\n";
|
|
|
static const char *gen_code_proto =
|
static const char *gen_code_proto =
|
"void gen_code(struct op_queue *opq, struct dyn_page *dp);\n"
|
"void gen_code(struct op_queue *opq, struct dyn_page *dp);\n"
|
"void patch_relocs(struct op_queue *opq, void *host_page);\n"
|
"void patch_relocs(struct op_queue *opq, void *host_page);\n"
|
|
"\n"
|
|
"#define op_mark_loc_indx 0\n"
|
"\n";
|
"\n";
|
|
|
static const char *c_sw_file_head =
|
static const char *c_sw_file_head =
|
"#include <stdlib.h>\n"
|
"#include <stdlib.h>\n"
|
"#include <string.h>\n"
|
"#include <string.h>\n"
|
Line 69... |
Line 71... |
"{\n"
|
"{\n"
|
" unsigned int *ops, i;\n"
|
" unsigned int *ops, i;\n"
|
" unsigned int host_len = dp->host_len;\n"
|
" unsigned int host_len = dp->host_len;\n"
|
" void *host_cur = dp->host_page;\n"
|
" void *host_cur = dp->host_page;\n"
|
" oraddr_t pc = dp->or_page;\n"
|
" oraddr_t pc = dp->or_page;\n"
|
" struct x_ref *next_x_ref = dp->xrefs;\n"
|
" void **loc = dp->locs;\n"
|
"\n"
|
"\n"
|
" while(opq) {\n"
|
" while(opq) {\n"
|
" /* For now, only store offsets in the x-ref table */\n"
|
" if(opq->next)\n"
|
" if(next_x_ref && (next_x_ref->or_addr == pc)) {\n"
|
" *loc++ = (void *)(host_cur - dp->host_page);"
|
" next_x_ref->dyn_addr = (void *)(host_cur - dp->host_page);\n"
|
|
" next_x_ref = next_x_ref->next;\n"
|
|
" }\n"
|
|
"\n"
|
|
" /* Patch the dyn_addr of the xrefs for infinite loops */\n"
|
|
" if(opq->jump_local == 2)\n"
|
|
" opq->xref->dyn_addr = (void *)(host_cur - dp->host_page);\n"
|
|
"\n"
|
"\n"
|
" for(i = 0, ops = opq->ops; i < opq->num_ops; i++, ops++) {\n"
|
" for(i = 0, ops = opq->ops; i < opq->num_ops; i++, ops++) {\n"
|
" switch(*ops) {\n";
|
" switch(*ops) {\n"
|
|
" case op_mark_loc_indx:\n"
|
|
" opq->ops_param[0] = host_cur - dp->host_page;\n"
|
|
" break;\n";
|
|
|
static const char *c_sw_file_tail =
|
static const char *c_sw_file_tail =
|
" }\n"
|
" }\n"
|
" }\n"
|
" }\n"
|
" opq = opq->next;\n"
|
" opq = opq->next;\n"
|
Line 117... |
Line 115... |
"#include \"dyn_rec.h\"\n"
|
"#include \"dyn_rec.h\"\n"
|
"#include \"op_support.h\"\n"
|
"#include \"op_support.h\"\n"
|
"#include \"%s\"\n"
|
"#include \"%s\"\n"
|
"\n"
|
"\n"
|
"void do_scheduler(void); /* FIXME: Remove */\n"
|
"void do_scheduler(void); /* FIXME: Remove */\n"
|
"void analysis(struct iqueue_entry *current); /* FIXME: Remove */\n"
|
|
"void do_sched_wrap(void); /* FIXME: Remove */\n"
|
"void do_sched_wrap(void); /* FIXME: Remove */\n"
|
|
"void do_sched_wrap_delay(void); /* FIXME: Remove */\n"
|
"void simprintf(oraddr_t stackaddr, unsigned long regparam); /* FIXME: Remove */\n"
|
"void simprintf(oraddr_t stackaddr, unsigned long regparam); /* FIXME: Remove */\n"
|
"\n"
|
"\n"
|
"void patch_relocs(struct op_queue *opq, void *host_page)\n"
|
"void patch_relocs(struct op_queue *opq, void *host_page)\n"
|
"{\n"
|
"{\n"
|
" unsigned int *ops, *ops_param, i;\n"
|
" unsigned int *ops, *ops_param, i;\n"
|