2 |
#define CPU_HPPA_H |
#define CPU_HPPA_H |
3 |
|
|
4 |
/* |
/* |
5 |
* Copyright (C) 2005 Anders Gavare. All rights reserved. |
* Copyright (C) 2005-2006 Anders Gavare. All rights reserved. |
6 |
* |
* |
7 |
* Redistribution and use in source and binary forms, with or without |
* Redistribution and use in source and binary forms, with or without |
8 |
* modification, are permitted provided that the following conditions are met: |
* modification, are permitted provided that the following conditions are met: |
28 |
* SUCH DAMAGE. |
* SUCH DAMAGE. |
29 |
* |
* |
30 |
* |
* |
31 |
* $Id: cpu_hppa.h,v 1.12 2005/11/16 21:15:19 debug Exp $ |
* $Id: cpu_hppa.h,v 1.15 2006/02/13 04:23:25 debug Exp $ |
32 |
*/ |
*/ |
33 |
|
|
34 |
#include "misc.h" |
#include "misc.h" |
40 |
#define HPPA_N_IC_ARGS 3 |
#define HPPA_N_IC_ARGS 3 |
41 |
#define HPPA_INSTR_ALIGNMENT_SHIFT 2 |
#define HPPA_INSTR_ALIGNMENT_SHIFT 2 |
42 |
#define HPPA_IC_ENTRIES_SHIFT 10 |
#define HPPA_IC_ENTRIES_SHIFT 10 |
43 |
#define HPPA_IC_ENTRIES_PER_PAGE (1 << HPPA_IC_ENTRIES_SHIFT) |
#define HPPA_IC_ENTRIES_PER_PAGE (1 << HPPA_IC_ENTRIES_SHIFT) |
44 |
#define HPPA_PC_TO_IC_ENTRY(a) (((a)>>HPPA_INSTR_ALIGNMENT_SHIFT) \ |
#define HPPA_PC_TO_IC_ENTRY(a) (((a)>>HPPA_INSTR_ALIGNMENT_SHIFT) \ |
45 |
& (HPPA_IC_ENTRIES_PER_PAGE-1)) |
& (HPPA_IC_ENTRIES_PER_PAGE-1)) |
46 |
#define HPPA_ADDR_TO_PAGENR(a) ((a) >> (HPPA_IC_ENTRIES_SHIFT \ |
#define HPPA_ADDR_TO_PAGENR(a) ((a) >> (HPPA_IC_ENTRIES_SHIFT \ |
47 |
+ HPPA_INSTR_ALIGNMENT_SHIFT)) |
+ HPPA_INSTR_ALIGNMENT_SHIFT)) |
48 |
|
|
49 |
struct hppa_instr_call { |
DYNTRANS_MISC_DECLARATIONS(hppa,HPPA,uint64_t) |
|
void (*f)(struct cpu *, struct hppa_instr_call *); |
|
|
size_t arg[HPPA_N_IC_ARGS]; |
|
|
}; |
|
50 |
|
|
51 |
/* Translation cache struct for each physical page: */ |
#define HPPA_MAX_VPH_TLB_ENTRIES 128 |
|
struct hppa_tc_physpage { |
|
|
struct hppa_instr_call ics[HPPA_IC_ENTRIES_PER_PAGE + 1]; |
|
|
uint32_t next_ofs; /* or 0 for end of chain */ |
|
|
int flags; |
|
|
uint64_t physaddr; |
|
|
}; |
|
52 |
|
|
|
#define HPPA_N_VPH_ENTRIES 1048576 |
|
53 |
|
|
54 |
#define HPPA_MAX_VPH_TLB_ENTRIES 256 |
#define HPPA_NREGS 32 |
|
struct hppa_vpg_tlb_entry { |
|
|
unsigned char valid; |
|
|
unsigned char writeflag; |
|
|
int64_t timestamp; |
|
|
uint64_t vaddr_page; |
|
|
uint64_t paddr_page; |
|
|
unsigned char *host_page; |
|
|
}; |
|
55 |
|
|
56 |
struct hppa_cpu { |
struct hppa_cpu { |
57 |
int bits; /* 32 or 64 */ |
int bits; /* 32 or 64 */ |
58 |
|
|
59 |
uint64_t r[32]; |
uint64_t r[HPPA_NREGS]; |
|
|
|
|
|
|
|
/* |
|
|
* Instruction translation cache: |
|
|
*/ |
|
|
|
|
|
/* cur_ic_page is a pointer to an array of HPPA_IC_ENTRIES_PER_PAGE |
|
|
instruction call entries. next_ic points to the next such |
|
|
call to be executed. */ |
|
|
struct hppa_tc_physpage *cur_physpage; |
|
|
struct hppa_instr_call *cur_ic_page; |
|
|
struct hppa_instr_call *next_ic; |
|
60 |
|
|
|
void (*combination_check)(struct cpu *, |
|
|
struct hppa_instr_call *, int low_addr); |
|
61 |
|
|
62 |
/* |
/* |
63 |
* Virtual -> physical -> host address translation: |
* Instruction translation cache and Virtual->Physical->Host |
64 |
* |
* address translation: |
|
* host_load and host_store point to arrays of HPPA_N_VPH_ENTRIES |
|
|
* pointers (to host pages); phys_addr points to an array of |
|
|
* HPPA_N_VPH_ENTRIES uint32_t. |
|
65 |
*/ |
*/ |
66 |
|
DYNTRANS_ITC(hppa) |
67 |
struct hppa_vpg_tlb_entry vph_tlb_entry[HPPA_MAX_VPH_TLB_ENTRIES]; |
VPH_TLBS(hppa,HPPA) |
68 |
unsigned char *host_load[HPPA_N_VPH_ENTRIES]; |
VPH32(hppa,HPPA,uint64_t,uint8_t) |
69 |
unsigned char *host_store[HPPA_N_VPH_ENTRIES]; |
VPH64(hppa,HPPA,uint8_t) |
|
uint32_t phys_addr[HPPA_N_VPH_ENTRIES]; |
|
|
struct hppa_tc_physpage *phys_page[HPPA_N_VPH_ENTRIES]; |
|
|
|
|
|
uint32_t phystranslation[HPPA_N_VPH_ENTRIES/32]; |
|
|
uint8_t vaddr_to_tlbindex[HPPA_N_VPH_ENTRIES]; |
|
70 |
}; |
}; |
71 |
|
|
72 |
|
|