1 |
/* |
/* |
2 |
* Copyright (C) 2005 Anders Gavare. All rights reserved. |
* Copyright (C) 2005-2006 Anders Gavare. All rights reserved. |
3 |
* |
* |
4 |
* Redistribution and use in source and binary forms, with or without |
* Redistribution and use in source and binary forms, with or without |
5 |
* modification, are permitted provided that the following conditions are met: |
* modification, are permitted provided that the following conditions are met: |
25 |
* SUCH DAMAGE. |
* SUCH DAMAGE. |
26 |
* |
* |
27 |
* |
* |
28 |
* $Id: cpu_sparc_instr.c,v 1.2 2005/09/17 17:14:27 debug Exp $ |
* $Id: cpu_sparc_instr.c,v 1.5 2006/02/09 22:40:27 debug Exp $ |
29 |
* |
* |
30 |
* SPARC instructions. |
* SPARC instructions. |
31 |
* |
* |
67 |
|
|
68 |
|
|
69 |
/* |
/* |
|
* sparc_combine_instructions(): |
|
|
* |
|
|
* Combine two or more instructions, if possible, into a single function call. |
|
|
*/ |
|
|
void COMBINE_INSTRUCTIONS(struct cpu *cpu, struct sparc_instr_call *ic, |
|
|
uint32_t addr) |
|
|
{ |
|
|
int n_back; |
|
|
n_back = (addr >> SPARC_INSTR_ALIGNMENT_SHIFT) |
|
|
& (SPARC_IC_ENTRIES_PER_PAGE-1); |
|
|
|
|
|
if (n_back >= 1) { |
|
|
/* TODO */ |
|
|
} |
|
|
|
|
|
/* TODO: Combine forward as well */ |
|
|
} |
|
|
|
|
|
|
|
|
/*****************************************************************************/ |
|
|
|
|
|
|
|
|
/* |
|
70 |
* sparc_instr_to_be_translated(): |
* sparc_instr_to_be_translated(): |
71 |
* |
* |
72 |
* Translate an instruction word into an sparc_instr_call. ic is filled in with |
* Translate an instruction word into an sparc_instr_call. ic is filled in with |
76 |
*/ |
*/ |
77 |
X(to_be_translated) |
X(to_be_translated) |
78 |
{ |
{ |
79 |
uint64_t addr, low_pc, tmp_addr; |
uint64_t addr, low_pc; |
80 |
|
#ifdef DYNTRANS_BACKEND |
81 |
|
int simple = 0; |
82 |
|
#endif |
83 |
uint32_t iword; |
uint32_t iword; |
84 |
unsigned char *page; |
unsigned char *page; |
85 |
unsigned char ib[4]; |
unsigned char ib[4]; |
86 |
int main_opcode; |
int main_opcode; |
87 |
void (*samepage_function)(struct cpu *, struct sparc_instr_call *); |
/* void (*samepage_function)(struct cpu *, struct sparc_instr_call *);*/ |
88 |
|
|
89 |
/* Figure out the (virtual) address of the instruction: */ |
/* Figure out the (virtual) address of the instruction: */ |
90 |
low_pc = ((size_t)ic - (size_t)cpu->cd.sparc.cur_ic_page) |
low_pc = ((size_t)ic - (size_t)cpu->cd.sparc.cur_ic_page) |