table_walker.cc (14088:8de55a7aa53b) table_walker.cc (14093:5fbd7d00b58e)
1/*
2 * Copyright (c) 2010, 2012-2018 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

--- 1522 unchanged lines hidden (view full) ---

1531
1532 return;
1533 }
1534 default:
1535 panic("A new type in a 2 bit field?\n");
1536 }
1537}
1538
1/*
2 * Copyright (c) 2010, 2012-2018 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

--- 1522 unchanged lines hidden (view full) ---

1531
1532 return;
1533 }
1534 default:
1535 panic("A new type in a 2 bit field?\n");
1536 }
1537}
1538
1539Fault
1540TableWalker::generateLongDescFault(ArmFault::FaultSource src)
1541{
1542 if (currState->isFetch) {
1543 return std::make_shared<PrefetchAbort>(
1544 currState->vaddr_tainted,
1545 src + currState->longDesc.lookupLevel,
1546 isStage2,
1547 ArmFault::LpaeTran);
1548 } else {
1549 return std::make_shared<DataAbort>(
1550 currState->vaddr_tainted,
1551 TlbEntry::DomainType::NoAccess,
1552 currState->isWrite,
1553 src + currState->longDesc.lookupLevel,
1554 isStage2,
1555 ArmFault::LpaeTran);
1556 }
1557}
1558
1539void
1540TableWalker::doLongDescriptor()
1541{
1542 if (currState->fault != NoFault) {
1543 return;
1544 }
1545
1546 currState->longDesc.data = htog(currState->longDesc.data,

--- 29 unchanged lines hidden (view full) ---

1576 if (!currState->timing) {
1577 currState->tc = NULL;
1578 currState->req = NULL;
1579 }
1580
1581 DPRINTF(TLB, "L%d descriptor Invalid, causing fault type %d\n",
1582 currState->longDesc.lookupLevel,
1583 ArmFault::TranslationLL + currState->longDesc.lookupLevel);
1559void
1560TableWalker::doLongDescriptor()
1561{
1562 if (currState->fault != NoFault) {
1563 return;
1564 }
1565
1566 currState->longDesc.data = htog(currState->longDesc.data,

--- 29 unchanged lines hidden (view full) ---

1596 if (!currState->timing) {
1597 currState->tc = NULL;
1598 currState->req = NULL;
1599 }
1600
1601 DPRINTF(TLB, "L%d descriptor Invalid, causing fault type %d\n",
1602 currState->longDesc.lookupLevel,
1603 ArmFault::TranslationLL + currState->longDesc.lookupLevel);
1584 if (currState->isFetch)
1585 currState->fault = std::make_shared<PrefetchAbort>(
1586 currState->vaddr_tainted,
1587 ArmFault::TranslationLL + currState->longDesc.lookupLevel,
1588 isStage2,
1589 ArmFault::LpaeTran);
1590 else
1591 currState->fault = std::make_shared<DataAbort>(
1592 currState->vaddr_tainted,
1593 TlbEntry::DomainType::NoAccess,
1594 currState->isWrite,
1595 ArmFault::TranslationLL + currState->longDesc.lookupLevel,
1596 isStage2,
1597 ArmFault::LpaeTran);
1604
1605 currState->fault = generateLongDescFault(ArmFault::TranslationLL);
1598 return;
1606 return;
1607
1599 case LongDescriptor::Block:
1600 case LongDescriptor::Page:
1601 {
1608 case LongDescriptor::Block:
1609 case LongDescriptor::Page:
1610 {
1602 bool fault = false;
1603 bool aff = false;
1611 auto fault_source = ArmFault::FaultSourceInvalid;
1604 // Check for address size fault
1605 if (checkAddrSizeFaultAArch64(
1606 mbits(currState->longDesc.data, MaxPhysAddrRange - 1,
1607 currState->longDesc.offsetBits()),
1608 currState->physAddrRange)) {
1612 // Check for address size fault
1613 if (checkAddrSizeFaultAArch64(
1614 mbits(currState->longDesc.data, MaxPhysAddrRange - 1,
1615 currState->longDesc.offsetBits()),
1616 currState->physAddrRange)) {
1609 fault = true;
1617
1610 DPRINTF(TLB, "L%d descriptor causing Address Size Fault\n",
1611 currState->longDesc.lookupLevel);
1618 DPRINTF(TLB, "L%d descriptor causing Address Size Fault\n",
1619 currState->longDesc.lookupLevel);
1620 fault_source = ArmFault::AddressSizeLL;
1621
1612 // Check for access fault
1613 } else if (currState->longDesc.af() == 0) {
1622 // Check for access fault
1623 } else if (currState->longDesc.af() == 0) {
1614 fault = true;
1624
1615 DPRINTF(TLB, "L%d descriptor causing Access Fault\n",
1616 currState->longDesc.lookupLevel);
1625 DPRINTF(TLB, "L%d descriptor causing Access Fault\n",
1626 currState->longDesc.lookupLevel);
1617 aff = true;
1627 fault_source = ArmFault::AccessFlagLL;
1618 }
1628 }
1619 if (fault) {
1620 if (currState->isFetch)
1621 currState->fault = std::make_shared<PrefetchAbort>(
1622 currState->vaddr_tainted,
1623 (aff ? ArmFault::AccessFlagLL : ArmFault::AddressSizeLL) +
1624 currState->longDesc.lookupLevel,
1625 isStage2,
1626 ArmFault::LpaeTran);
1627 else
1628 currState->fault = std::make_shared<DataAbort>(
1629 currState->vaddr_tainted,
1630 TlbEntry::DomainType::NoAccess, currState->isWrite,
1631 (aff ? ArmFault::AccessFlagLL : ArmFault::AddressSizeLL) +
1632 currState->longDesc.lookupLevel,
1633 isStage2,
1634 ArmFault::LpaeTran);
1629
1630 if (fault_source != ArmFault::FaultSourceInvalid) {
1631 currState->fault = generateLongDescFault(fault_source);
1635 } else {
1636 insertTableEntry(currState->longDesc, true);
1637 }
1638 }
1639 return;
1640 case LongDescriptor::Table:
1641 {
1642 // Set hierarchical permission flags

--- 18 unchanged lines hidden (view full) ---

1661 next_desc_addr,
1662 currState->secureLookup ? "s" : "ns");
1663
1664 // Check for address size fault
1665 if (currState->aarch64 && checkAddrSizeFaultAArch64(
1666 next_desc_addr, currState->physAddrRange)) {
1667 DPRINTF(TLB, "L%d descriptor causing Address Size Fault\n",
1668 currState->longDesc.lookupLevel);
1632 } else {
1633 insertTableEntry(currState->longDesc, true);
1634 }
1635 }
1636 return;
1637 case LongDescriptor::Table:
1638 {
1639 // Set hierarchical permission flags

--- 18 unchanged lines hidden (view full) ---

1658 next_desc_addr,
1659 currState->secureLookup ? "s" : "ns");
1660
1661 // Check for address size fault
1662 if (currState->aarch64 && checkAddrSizeFaultAArch64(
1663 next_desc_addr, currState->physAddrRange)) {
1664 DPRINTF(TLB, "L%d descriptor causing Address Size Fault\n",
1665 currState->longDesc.lookupLevel);
1669 if (currState->isFetch)
1670 currState->fault = std::make_shared<PrefetchAbort>(
1671 currState->vaddr_tainted,
1672 ArmFault::AddressSizeLL
1673 + currState->longDesc.lookupLevel,
1674 isStage2,
1675 ArmFault::LpaeTran);
1676 else
1677 currState->fault = std::make_shared<DataAbort>(
1678 currState->vaddr_tainted,
1679 TlbEntry::DomainType::NoAccess, currState->isWrite,
1680 ArmFault::AddressSizeLL
1681 + currState->longDesc.lookupLevel,
1682 isStage2,
1683 ArmFault::LpaeTran);
1666
1667 currState->fault = generateLongDescFault(
1668 ArmFault::AddressSizeLL);
1684 return;
1685 }
1686
1687 // Trickbox address check
1688 currState->fault = testWalk(
1689 next_desc_addr, sizeof(uint64_t), TlbEntry::DomainType::Client,
1690 toLookupLevel(currState->longDesc.lookupLevel +1));
1691

--- 599 unchanged lines hidden ---
1669 return;
1670 }
1671
1672 // Trickbox address check
1673 currState->fault = testWalk(
1674 next_desc_addr, sizeof(uint64_t), TlbEntry::DomainType::Client,
1675 toLookupLevel(currState->longDesc.lookupLevel +1));
1676

--- 599 unchanged lines hidden ---