Commit 6d5f237a592706773733e71e6da81dcd625fbb24

Authored by blueswir1
1 parent bc4edd79

CPU specific boot mode (Robert Reif)


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3542 c046a42c-6fe2-441c-8c8c-71466251a162
cpu-exec.c
@@ -181,10 +181,8 @@ static inline TranslationBlock *tb_find_fast(void) @@ -181,10 +181,8 @@ static inline TranslationBlock *tb_find_fast(void)
181 flags = (((env->pstate & PS_PEF) >> 1) | ((env->fprs & FPRS_FEF) << 2)) 181 flags = (((env->pstate & PS_PEF) >> 1) | ((env->fprs & FPRS_FEF) << 2))
182 | (env->pstate & PS_PRIV) | ((env->lsu & (DMMU_E | IMMU_E)) >> 2); 182 | (env->pstate & PS_PRIV) | ((env->lsu & (DMMU_E | IMMU_E)) >> 2);
183 #else 183 #else
184 - // FPU enable . MMU Boot . MMU enabled . MMU no-fault . Supervisor  
185 - flags = (env->psref << 4) | (((env->mmuregs[0] & MMU_BM) >> 14) << 3)  
186 - | ((env->mmuregs[0] & (MMU_E | MMU_NF)) << 1)  
187 - | env->psrs; 184 + // FPU enable . Supervisor
  185 + flags = (env->psref << 4) | env->psrs;
188 #endif 186 #endif
189 cs_base = env->npc; 187 cs_base = env->npc;
190 pc = env->pc; 188 pc = env->pc;
target-sparc/cpu.h
@@ -147,7 +147,6 @@ @@ -147,7 +147,6 @@
147 /* MMU */ 147 /* MMU */
148 #define MMU_E (1<<0) 148 #define MMU_E (1<<0)
149 #define MMU_NF (1<<1) 149 #define MMU_NF (1<<1)
150 -#define MMU_BM (1<<14)  
151 150
152 #define PTE_ENTRYTYPE_MASK 3 151 #define PTE_ENTRYTYPE_MASK 3
153 #define PTE_ACCESS_MASK 0x1c 152 #define PTE_ACCESS_MASK 0x1c
@@ -200,6 +199,7 @@ typedef struct CPUSPARCState { @@ -200,6 +199,7 @@ typedef struct CPUSPARCState {
200 int interrupt_index; 199 int interrupt_index;
201 int interrupt_request; 200 int interrupt_request;
202 int halted; 201 int halted;
  202 + uint32_t mmu_bm;
203 /* NOTE: we allow 8 more registers to handle wrapping */ 203 /* NOTE: we allow 8 more registers to handle wrapping */
204 target_ulong regbase[NWINDOWS * 16 + 8]; 204 target_ulong regbase[NWINDOWS * 16 + 8];
205 205
target-sparc/helper.c
@@ -114,7 +114,7 @@ int get_physical_address (CPUState *env, target_phys_addr_t *physical, int *prot @@ -114,7 +114,7 @@ int get_physical_address (CPUState *env, target_phys_addr_t *physical, int *prot
114 114
115 if ((env->mmuregs[0] & MMU_E) == 0) { /* MMU disabled */ 115 if ((env->mmuregs[0] & MMU_E) == 0) { /* MMU disabled */
116 // Boot mode: instruction fetches are taken from PROM 116 // Boot mode: instruction fetches are taken from PROM
117 - if (rw == 2 && (env->mmuregs[0] & MMU_BM)) { 117 + if (rw == 2 && (env->mmuregs[0] & env->mmu_bm)) {
118 *physical = 0xff0000000ULL | (address & 0x3ffffULL); 118 *physical = 0xff0000000ULL | (address & 0x3ffffULL);
119 *prot = PAGE_READ | PAGE_EXEC; 119 *prot = PAGE_READ | PAGE_EXEC;
120 return 0; 120 return 0;
target-sparc/op_helper.c
@@ -493,8 +493,8 @@ void helper_st_asi(int asi, int size) @@ -493,8 +493,8 @@ void helper_st_asi(int asi, int size)
493 oldreg = env->mmuregs[reg]; 493 oldreg = env->mmuregs[reg];
494 switch(reg) { 494 switch(reg) {
495 case 0: 495 case 0:
496 - env->mmuregs[reg] &= ~(MMU_E | MMU_NF | MMU_BM);  
497 - env->mmuregs[reg] |= T1 & (MMU_E | MMU_NF | MMU_BM); 496 + env->mmuregs[reg] &= ~(MMU_E | MMU_NF | env->mmu_bm);
  497 + env->mmuregs[reg] |= T1 & (MMU_E | MMU_NF | env->mmu_bm);
498 // Mappings generated during no-fault mode or MMU 498 // Mappings generated during no-fault mode or MMU
499 // disabled mode are invalid in normal mode 499 // disabled mode are invalid in normal mode
500 if (oldreg != env->mmuregs[reg]) 500 if (oldreg != env->mmuregs[reg])
target-sparc/translate.c
@@ -59,6 +59,7 @@ struct sparc_def_t { @@ -59,6 +59,7 @@ struct sparc_def_t {
59 target_ulong iu_version; 59 target_ulong iu_version;
60 uint32_t fpu_version; 60 uint32_t fpu_version;
61 uint32_t mmu_version; 61 uint32_t mmu_version;
  62 + uint32_t mmu_bm;
62 }; 63 };
63 64
64 static uint16_t *gen_opc_ptr; 65 static uint16_t *gen_opc_ptr;
@@ -3482,7 +3483,7 @@ void cpu_reset(CPUSPARCState *env) @@ -3482,7 +3483,7 @@ void cpu_reset(CPUSPARCState *env)
3482 #else 3483 #else
3483 env->pc = 0; 3484 env->pc = 0;
3484 env->mmuregs[0] &= ~(MMU_E | MMU_NF); 3485 env->mmuregs[0] &= ~(MMU_E | MMU_NF);
3485 - env->mmuregs[0] |= MMU_BM; 3486 + env->mmuregs[0] |= env->mmu_bm;
3486 #endif 3487 #endif
3487 env->npc = env->pc + 4; 3488 env->npc = env->pc + 4;
3488 #endif 3489 #endif
@@ -3496,7 +3497,6 @@ CPUSPARCState *cpu_sparc_init(void) @@ -3496,7 +3497,6 @@ CPUSPARCState *cpu_sparc_init(void)
3496 if (!env) 3497 if (!env)
3497 return NULL; 3498 return NULL;
3498 cpu_exec_init(env); 3499 cpu_exec_init(env);
3499 - cpu_reset(env);  
3500 return (env); 3500 return (env);
3501 } 3501 }
3502 3502
@@ -3515,30 +3515,35 @@ static const sparc_def_t sparc_defs[] = { @@ -3515,30 +3515,35 @@ static const sparc_def_t sparc_defs[] = {
3515 .iu_version = 0x04 << 24, /* Impl 0, ver 4 */ 3515 .iu_version = 0x04 << 24, /* Impl 0, ver 4 */
3516 .fpu_version = 4 << 17, /* FPU version 4 (Meiko) */ 3516 .fpu_version = 4 << 17, /* FPU version 4 (Meiko) */
3517 .mmu_version = 0x04 << 24, /* Impl 0, ver 4 */ 3517 .mmu_version = 0x04 << 24, /* Impl 0, ver 4 */
  3518 + .mmu_bm = 0x00004000,
3518 }, 3519 },
3519 { 3520 {
3520 .name = "Fujitsu MB86907", 3521 .name = "Fujitsu MB86907",
3521 .iu_version = 0x05 << 24, /* Impl 0, ver 5 */ 3522 .iu_version = 0x05 << 24, /* Impl 0, ver 5 */
3522 .fpu_version = 4 << 17, /* FPU version 4 (Meiko) */ 3523 .fpu_version = 4 << 17, /* FPU version 4 (Meiko) */
3523 .mmu_version = 0x05 << 24, /* Impl 0, ver 5 */ 3524 .mmu_version = 0x05 << 24, /* Impl 0, ver 5 */
  3525 + .mmu_bm = 0x00004000,
3524 }, 3526 },
3525 { 3527 {
3526 .name = "TI MicroSparc I", 3528 .name = "TI MicroSparc I",
3527 .iu_version = 0x41000000, 3529 .iu_version = 0x41000000,
3528 .fpu_version = 4 << 17, 3530 .fpu_version = 4 << 17,
3529 .mmu_version = 0x41000000, 3531 .mmu_version = 0x41000000,
  3532 + .mmu_bm = 0x00004000,
3530 }, 3533 },
3531 { 3534 {
3532 .name = "TI SuperSparc II", 3535 .name = "TI SuperSparc II",
3533 .iu_version = 0x40000000, 3536 .iu_version = 0x40000000,
3534 .fpu_version = 0 << 17, 3537 .fpu_version = 0 << 17,
3535 .mmu_version = 0x04000000, 3538 .mmu_version = 0x04000000,
  3539 + .mmu_bm = 0x00002000,
3536 }, 3540 },
3537 { 3541 {
3538 .name = "Ross RT620", 3542 .name = "Ross RT620",
3539 .iu_version = 0x1e000000, 3543 .iu_version = 0x1e000000,
3540 .fpu_version = 1 << 17, 3544 .fpu_version = 1 << 17,
3541 .mmu_version = 0x17000000, 3545 .mmu_version = 0x17000000,
  3546 + .mmu_bm = 0x00004000,
3542 }, 3547 },
3543 #endif 3548 #endif
3544 }; 3549 };
@@ -3579,9 +3584,11 @@ int cpu_sparc_register (CPUSPARCState *env, const sparc_def_t *def, unsigned int @@ -3579,9 +3584,11 @@ int cpu_sparc_register (CPUSPARCState *env, const sparc_def_t *def, unsigned int
3579 env->version = def->iu_version; 3584 env->version = def->iu_version;
3580 env->fsr = def->fpu_version; 3585 env->fsr = def->fpu_version;
3581 #if !defined(TARGET_SPARC64) 3586 #if !defined(TARGET_SPARC64)
  3587 + env->mmu_bm = def->mmu_bm;
3582 env->mmuregs[0] |= def->mmu_version; 3588 env->mmuregs[0] |= def->mmu_version;
3583 env->mxccregs[7] = ((cpu + 8) & 0xf) << 24; 3589 env->mxccregs[7] = ((cpu + 8) & 0xf) << 24;
3584 #endif 3590 #endif
  3591 + cpu_reset(env);
3585 return 0; 3592 return 0;
3586 } 3593 }
3587 3594