1/* 2 * Copyright (c) 2003-2005 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 21 unchanged lines hidden (view full) --- 30 */ 31 32#include "arch/sparc/faults.hh" 33 34#include <algorithm> 35 36#include "arch/sparc/isa_traits.hh" 37#include "arch/sparc/process.hh" |
38#include "arch/sparc/tlb.hh" |
39#include "arch/sparc/types.hh" 40#include "base/bitfield.hh" 41#include "base/trace.hh" 42#include "cpu/base.hh" 43#include "cpu/thread_context.hh" 44#include "mem/page_table.hh" 45#include "sim/full_system.hh" 46#include "sim/process.hh" --- 578 unchanged lines hidden (view full) --- 625 const StaticInstPtr &inst) 626{ 627 if (FullSystem) { 628 SparcFaultBase::invoke(tc, inst); 629 return; 630 } 631 632 Process *p = tc->getProcessPtr(); |
633 const EmulationPageTable::Entry *pte = p->pTable->lookup(vaddr); 634 panic_if(!pte, "Tried to execute unmapped address %#x.\n", vaddr); |
635 636 Addr alignedvaddr = p->pTable->pageAlign(vaddr); 637 638 // Grab fields used during instruction translation to figure out 639 // which context to use. 640 uint64_t tlbdata = tc->readMiscRegNoEffect(MISCREG_TLB_DATA); 641 642 // Inside a VM, a real address is the address that guest OS would --- 15 unchanged lines hidden (view full) --- 658 659 // The partition id distinguishes between virtualized environments. 660 int const partition_id = 0; 661 662 // Given the assumptions in the translateInst code in the SPARC ITLB, 663 // the logic works out to the following for the context. 664 int context_id = (is_real_address || trapped) ? 0 : primary_context; 665 |
666 TlbEntry entry(p->pTable->pid(), alignedvaddr, pte->paddr, 667 pte->flags & EmulationPageTable::Uncacheable, 668 pte->flags & EmulationPageTable::ReadOnly); 669 |
670 // Insert the TLB entry. 671 // The entry specifying whether the address is "real" is set to 672 // false for syscall emulation mode regardless of whether the 673 // address is real in preceding code. Not sure sure that this is 674 // correct, but also not sure if it matters at all. 675 dynamic_cast<TLB *>(tc->getITBPtr())-> |
676 insert(alignedvaddr, partition_id, context_id, false, entry.pte); |
677} 678 679void 680FastDataAccessMMUMiss::invoke(ThreadContext *tc, const StaticInstPtr &inst) 681{ 682 if (FullSystem) { 683 SparcFaultBase::invoke(tc, inst); 684 return; 685 } 686 687 Process *p = tc->getProcessPtr(); |
688 const EmulationPageTable::Entry *pte = p->pTable->lookup(vaddr); 689 if (!pte && p->fixupStackFault(vaddr)) 690 pte = p->pTable->lookup(vaddr); 691 panic_if(!pte, "Tried to access unmapped address %#x.\n", vaddr); |
692 693 Addr alignedvaddr = p->pTable->pageAlign(vaddr); 694 695 // Grab fields used during data translation to figure out 696 // which context to use. 697 uint64_t tlbdata = tc->readMiscRegNoEffect(MISCREG_TLB_DATA); 698 699 // The primary context acts as a PASID. It allows the MMU to --- 45 unchanged lines hidden (view full) --- 745 int context_id = ((!hpriv && !red && is_real_address) || 746 asiIsReal(asi) || 747 (trapped && asi == ASI_IMPLICIT)) 748 ? 0 : primary_context; 749 750 // The partition id distinguishes between virtualized environments. 751 int const partition_id = 0; 752 |
753 TlbEntry entry(p->pTable->pid(), alignedvaddr, pte->paddr, 754 pte->flags & EmulationPageTable::Uncacheable, 755 pte->flags & EmulationPageTable::ReadOnly); 756 |
757 // Insert the TLB entry. 758 // The entry specifying whether the address is "real" is set to 759 // false for syscall emulation mode regardless of whether the 760 // address is real in preceding code. Not sure sure that this is 761 // correct, but also not sure if it matters at all. 762 dynamic_cast<TLB *>(tc->getDTBPtr())-> |
763 insert(alignedvaddr, partition_id, context_id, false, entry.pte); |
764} 765 766void 767SpillNNormal::invoke(ThreadContext *tc, const StaticInstPtr &inst) 768{ 769 if (FullSystem) { 770 SparcFaultBase::invoke(tc, inst); 771 return; --- 61 unchanged lines hidden --- |