15 |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND |
16 |
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
17 |
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
18 |
* ARE DISCLAIMED. IN NO EVENT HPPAALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |
19 |
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
20 |
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
21 |
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
25 |
* SUCH DAMAGE. |
* SUCH DAMAGE. |
26 |
* |
* |
27 |
* |
* |
28 |
* $Id: cpu_hppa_instr.c,v 1.2 2005/09/17 17:14:27 debug Exp $ |
* $Id: cpu_hppa_instr.c,v 1.4 2005/11/13 22:34:22 debug Exp $ |
29 |
* |
* |
30 |
* HPPA instructions. |
* HPPA instructions. |
31 |
* |
* |
32 |
* Individual functions hppaould keep track of cpu->n_translated_instrs. |
* Individual functions should keep track of cpu->n_translated_instrs. |
33 |
* (If no instruction was executed, then it hppaould be decreased. If, say, 4 |
* (If no instruction was executed, then it should be decreased. If, say, 4 |
34 |
* instructions were combined into one function and executed, then it hppaould |
* instructions were combined into one function and executed, then it should |
35 |
* be increased by 3.) |
* be increased by 3.) |
36 |
*/ |
*/ |
37 |
|
|
66 |
|
|
67 |
|
|
68 |
/* |
/* |
|
* hppa_combine_instructions(): |
|
|
* |
|
|
* Combine two or more instructions, if possible, into a single function call. |
|
|
*/ |
|
|
void COMBINE_INSTRUCTIONS(struct cpu *cpu, struct hppa_instr_call *ic, |
|
|
uint32_t addr) |
|
|
{ |
|
|
int n_back; |
|
|
n_back = (addr >> HPPA_INSTR_ALIGNMENT_SHIFT) |
|
|
& (HPPA_IC_ENTRIES_PER_PAGE-1); |
|
|
|
|
|
if (n_back >= 1) { |
|
|
/* TODO */ |
|
|
} |
|
|
|
|
|
/* TODO: Combine forward as well */ |
|
|
} |
|
|
|
|
|
|
|
|
/*****************************************************************************/ |
|
|
|
|
|
|
|
|
/* |
|
69 |
* hppa_instr_to_be_translated(): |
* hppa_instr_to_be_translated(): |
70 |
* |
* |
71 |
* Translate an instruction word into an hppa_instr_call. ic is filled in with |
* Translate an instruction word into an hppa_instr_call. ic is filled in with |
75 |
*/ |
*/ |
76 |
X(to_be_translated) |
X(to_be_translated) |
77 |
{ |
{ |
78 |
uint64_t addr, low_pc, tmp_addr; |
uint64_t addr, low_pc; |
79 |
uint32_t iword; |
uint32_t iword; |
80 |
unsigned char *page; |
unsigned char *page; |
81 |
unsigned char ib[4]; |
unsigned char ib[4]; |
82 |
int main_opcode; |
int main_opcode; |
83 |
void (*samepage_function)(struct cpu *, struct hppa_instr_call *); |
/* void (*samepage_function)(struct cpu *, struct hppa_instr_call *);*/ |
84 |
|
|
85 |
/* Figure out the (virtual) address of the instruction: */ |
/* Figure out the (virtual) address of the instruction: */ |
86 |
low_pc = ((size_t)ic - (size_t)cpu->cd.hppa.cur_ic_page) |
low_pc = ((size_t)ic - (size_t)cpu->cd.hppa.cur_ic_page) |