Skip to content

Commit

Permalink
Fix: EL state
Browse files Browse the repository at this point in the history
  • Loading branch information
BugraEryilmaz committed Aug 13, 2024
1 parent 93bac2c commit d402bd4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
15 changes: 14 additions & 1 deletion components/MMU/pageWalk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ PageWalk::InitialTranslationSetup(TranslationTransport& aTranslation)
statefulPointer->requiredTableLookups = 4 - initialLevel;
statefulPointer->currentLookupLevel = initialLevel;
statefulPointer->granuleSize = theMMU->getGranuleSize(statefulPointer->isBR0);
statefulPointer->ELRegime = 1; /*currentEL();*/
statefulPointer->ELRegime = currentEL();

uint8_t EL = statefulPointer->ELRegime;
uint64_t initialTTBR;
Expand Down Expand Up @@ -406,6 +406,19 @@ PageWalk::hasMemoryRequest()
return !theMemoryTranslations.empty();
}


uint8_t
PageWalk::currentEL()
{
return extract32(currentPSTATE(), 2, 2);
}

uint32_t
PageWalk::currentPSTATE()
{
return Flexus::Qemu::API::qemu_api.read_register(theNode, Flexus::Qemu::API::PSTATE, 0);
}

// TODO??
// TTEDescriptor PageWalk::getNextTTDescriptor(TranslationTransport & aTr ) {
// DBG_Assert(false); }
Expand Down
3 changes: 3 additions & 0 deletions components/MMU/pageWalk.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ class PageWalk

TTEDescriptor getNextTTDescriptor(TranslationTransport& aTranslation);

uint8_t currentEL();
uint32_t currentPSTATE();

uint32_t theNode;
};

Expand Down

0 comments on commit d402bd4

Please sign in to comment.