Fix sign-extension of VPN field in TLB, by Herve Poussineau.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2433 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
		
							parent
							
								
									70705261e1
								
							
						
					
					
						commit
						925fd0f202
					
				| 
						 | 
					@ -41,12 +41,12 @@ enum {
 | 
				
			||||||
static int map_address (CPUState *env, target_ulong *physical, int *prot,
 | 
					static int map_address (CPUState *env, target_ulong *physical, int *prot,
 | 
				
			||||||
                        target_ulong address, int rw, int access_type)
 | 
					                        target_ulong address, int rw, int access_type)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    uint8_t ASID = env->CP0_EntryHi & 0xFF;
 | 
				
			||||||
    int i;
 | 
					    int i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for (i = 0; i < env->tlb_in_use; i++) {
 | 
					    for (i = 0; i < env->tlb_in_use; i++) {
 | 
				
			||||||
        tlb_t *tlb = &env->tlb[i];
 | 
					        tlb_t *tlb = &env->tlb[i];
 | 
				
			||||||
        /* 1k pages are not supported. */
 | 
					        /* 1k pages are not supported. */
 | 
				
			||||||
        uint8_t ASID = env->CP0_EntryHi & 0xFF;
 | 
					 | 
				
			||||||
        target_ulong mask = tlb->PageMask | 0x1FFF;
 | 
					        target_ulong mask = tlb->PageMask | 0x1FFF;
 | 
				
			||||||
        target_ulong tag = address & ~mask;
 | 
					        target_ulong tag = address & ~mask;
 | 
				
			||||||
        int n;
 | 
					        int n;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1340,7 +1340,7 @@ void op_mtc0_entryhi (void)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* 1k pages not implemented */
 | 
					    /* 1k pages not implemented */
 | 
				
			||||||
    /* Ignore MIPS64 TLB for now */
 | 
					    /* Ignore MIPS64 TLB for now */
 | 
				
			||||||
    val = (int32_t)T0 & 0xFFFFE0FF;
 | 
					    val = (target_ulong)(int32_t)T0 & ~(target_ulong)0x1F00;
 | 
				
			||||||
    old = env->CP0_EntryHi;
 | 
					    old = env->CP0_EntryHi;
 | 
				
			||||||
    env->CP0_EntryHi = val;
 | 
					    env->CP0_EntryHi = val;
 | 
				
			||||||
    /* If the ASID changes, flush qemu's TLB.  */
 | 
					    /* If the ASID changes, flush qemu's TLB.  */
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -395,7 +395,7 @@ static void fill_tlb (int idx)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* XXX: detect conflicting TLBs and raise a MCHECK exception when needed */
 | 
					    /* XXX: detect conflicting TLBs and raise a MCHECK exception when needed */
 | 
				
			||||||
    tlb = &env->tlb[idx];
 | 
					    tlb = &env->tlb[idx];
 | 
				
			||||||
    tlb->VPN = env->CP0_EntryHi & (int32_t)0xFFFFE000;
 | 
					    tlb->VPN = env->CP0_EntryHi & ~(target_ulong)0x1FFF;
 | 
				
			||||||
    tlb->ASID = env->CP0_EntryHi & 0xFF;
 | 
					    tlb->ASID = env->CP0_EntryHi & 0xFF;
 | 
				
			||||||
    tlb->PageMask = env->CP0_PageMask;
 | 
					    tlb->PageMask = env->CP0_PageMask;
 | 
				
			||||||
    tlb->G = env->CP0_EntryLo0 & env->CP0_EntryLo1 & 1;
 | 
					    tlb->G = env->CP0_EntryLo0 & env->CP0_EntryLo1 & 1;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue