Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RISC-V MMU Rework #113

Open
wants to merge 77 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
6038586
manually added code to update the mmu when csrr-instructions are exec…
js97nMH Jan 11, 2022
203eba3
improved pagefault exceptions being handed through to exception handler
js97nMH Jan 20, 2022
4a65266
todo: sfence.vma needs to flush cash
js97nMH Jan 20, 2022
53f1d4d
added riscv64 specific version of SignalMMU()
js97nMH Jan 20, 2022
2932086
added function to flush tlb in sfence.vma
js97nMH Feb 1, 2022
d2e46ae
modiefied instructions to update mmu
js97nMH Feb 1, 2022
3299084
modified trap handling to signal context switches
js97nMH Feb 1, 2022
225e566
check if hart has privilege to access page
js97nMH Feb 1, 2022
d0c0c82
getter that returns tlb of mmu
js97nMH Feb 1, 2022
07aaf13
Merge pull request #1 from js97nMH/manual_csrrs_to_mmu
js97nMH Feb 1, 2022
9659d06
reload blocks after arch-exceptionhandler
js97nMH Feb 9, 2022
26f8d22
Bugfix, correct parenthesis to propagate errorcode
js97nMH Feb 11, 2022
0cd09fa
Naming changes
js97nMH Feb 11, 2022
1437bf5
remove context-switches handled by s-traphandler
js97nMH Feb 12, 2022
748808d
csr-ins return RELOADBLOCKS after change to SATP
js97nMH Feb 12, 2022
17a0a64
added return value in if statement
js97nMH Feb 12, 2022
b8cf4cd
removed RELOADBLOCKS where not necessary
js97nMH Feb 12, 2022
667ac1b
handler set stval to PC for software handler
js97nMH Feb 26, 2022
5e6a1d9
test unloadblocks
js97nMH Mar 1, 2022
86dc13a
test unloadblocks 2
js97nMH Mar 1, 2022
0cfd629
std::remove list manipulation
js97nMH Mar 1, 2022
69aa68a
change lambda to remove_if
js97nMH Mar 1, 2022
58dbfb2
fallthrough compiler optimization
js97nMH Mar 7, 2022
d363bd9
set sepc/mepc correctly after i-fetch-exception
js97nMH Mar 7, 2022
7be97cc
adding extern fn to RISCV64.h
js97nMH Mar 25, 2022
42b2b1a
store + load ins set stval + mtval
js97nMH Mar 28, 2022
32e0000
remove xtval=pc if cause=load/store-page-fault
js97nMH Mar 28, 2022
75ad480
fix pointer syntax in load+store instructions
js97nMH Mar 28, 2022
380b636
Revert "remove xtval=pc if cause=load/store-page-fault"
js97nMH Mar 28, 2022
3edcc95
Revert "fix pointer syntax in load+store instructions"
js97nMH Mar 28, 2022
beddb34
pointer test
js97nMH Mar 29, 2022
9fa6d88
pointer test 2
js97nMH Mar 29, 2022
647c4fc
change x to csr for stval assignment
js97nMH Mar 30, 2022
14ef424
CSR-STVAL assignment for all load+store insns
js97nMH Mar 30, 2022
7f78108
Merge pull request #2 from js97nMH/lb-insns-test
js97nMH Mar 30, 2022
8ce237b
check 'D' flag instead of 'A' for w_access
js97nMH Apr 1, 2022
db190fd
remove erronious setting of tval-regs
js97nMH Apr 1, 2022
3ff4ad3
cleaning up comments
js97nMH Apr 1, 2022
19d9d5d
Merge pull request #3 from js97nMH/pte-flag-test
js97nMH Apr 1, 2022
9c8fa81
Mmu core dsl integration (#4)
js97nMH Apr 13, 2022
8e807f5
test: setting mtval+stval in page-table-walker
js97nMH Apr 14, 2022
fac18c3
test: lb-ins. doesn't set stval+mtval anymore
js97nMH Apr 14, 2022
7361fb9
removal of all xtval assignments in load/store
js97nMH Apr 14, 2022
3bbfe07
Merge pull request #5 from js97nMH/mmu-fetch-over-boundary
js97nMH Apr 14, 2022
d696959
first test of CheckPageOverlap()
js97nMH Apr 14, 2022
718f01c
fix return value of CheckPageOverlap()
js97nMH Apr 14, 2022
a50dcb2
CheckProtection() before CheckPageOverlap()
js97nMH Apr 14, 2022
e717be3
use pte_lvl_ to determine pagesize in CheckPageOverlap()
js97nMH Apr 14, 2022
b3b4548
update pte_lvl_ only when passed as argument
js97nMH Apr 14, 2022
97becec
add level-info to the right pte
js97nMH Apr 14, 2022
fc9db82
check misaligned access after overlap check
js97nMH Apr 14, 2022
16cb026
remove clutter
js97nMH Apr 14, 2022
d8693cf
pass length to MMU::Translate()
js97nMH Apr 14, 2022
9d88887
fix bitwise invert of offset_mask
js97nMH Apr 14, 2022
2db13eb
fix next_page_vma calculation
js97nMH Apr 14, 2022
21e801e
hotfix: avoid wrong instruction width from mainba
js97nMH Apr 14, 2022
6a6d2f0
hotfix: constant length for instruction fetch
js97nMH Apr 15, 2022
1ebc6be
update pte after access
js97nMH Apr 17, 2022
7c71eae
change return type
js97nMH Apr 17, 2022
c56d19e
removing pte update from page-table-walker
js97nMH Apr 17, 2022
3019290
fetch-over-boundary version 2
js97nMH Apr 20, 2022
1d1c7ee
fix seg-fault in mmu->translate
js97nMH Apr 20, 2022
d9b21ff
fix reading from wrong address
js97nMH Apr 20, 2022
1ce2538
page overflow mitigation vor all mem-accesses
js97nMH Apr 20, 2022
1fc46ed
Merge pull request #6 from js97nMH/mmu-fetch-over-boundary
js97nMH Apr 20, 2022
3e5c29a
test new sfence to evict addresses from tlb
js97nMH Apr 21, 2022
ec40250
pass pte pointer to updatePTEFlags()
js97nMH Apr 21, 2022
8de1865
remove tlb-flush from signalMMU
js97nMH Apr 21, 2022
68de143
fix wrong getter in UpdatePTEFlags()
js97nMH Apr 21, 2022
547f8d3
UpdatePTEFlags() now updates pte in tlb
js97nMH Apr 21, 2022
13a2527
sfence evict vma from tlb
js97nMH Apr 22, 2022
ff3b51b
Merge pull request #7 from js97nMH/mmu-pte-update
js97nMH Apr 22, 2022
058f3a0
exit lh-insn before assigning value to rd-reg
js97nMH Apr 22, 2022
e8e1d2f
exit all ld-insns before xrd assignment
js97nMH Apr 22, 2022
6e88cba
fix positioning of return statement
js97nMH Apr 22, 2022
baa3e8d
fix position of pointer incrementation
js97nMH Apr 22, 2022
b88cde5
Merge branch 'tum-ei-eda:master' into riscv-mmu-rework
js97nMH Apr 26, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
update pte_lvl_ only when passed as argument
js97nMH committed Apr 14, 2022
commit b3b4548285a00576bea5aedfc9ee3a59df97041c
11 changes: 9 additions & 2 deletions include/etiss/mm/PTE.h
Original file line number Diff line number Diff line change
@@ -70,7 +70,7 @@ class PTE
public:
PTE(){};

PTE(uint64_t pte) { Update(pte); }
PTE(uint64_t pte) { Update(pte, 0); }

// PTE(const PTE & pte_cp_){
// Update(pte_cp_.pte_val_);
@@ -88,7 +88,14 @@ class PTE
* @brief Update the PTE with a new value.
*
*/
void Update(uint64_t new_pte, uint32_t level = 0);
void Update(uint64_t new_pte);

/**
* @brief Update the PTE with a new value
* and a page table level.
*
*/
void Update(uint64_t new_pte, uint32_t level);

/**
* @brief Get the bit field value with its name
24 changes: 24 additions & 0 deletions src/mm/PTE.cpp
Original file line number Diff line number Diff line change
@@ -59,6 +59,30 @@ namespace etiss
namespace mm
{

void PTE::Update(uint64_t new_pte)
{

if (PTEFormat::Instance().GetFormatMap().find(std::string("PPN")) == PTEFormat::Instance().GetFormatMap().end())
{
PTEFormat::Instance().Dump();
PTEFormat::Instance().Dump();
etiss::log(etiss::FATALERROR, "PPN not defined in PTE format");
}

std::pair<uint32_t, uint32_t> bit_field = PTEFormat::Instance().GetFormatMap().find(std::string("PPN"))->second;
if (new_pte & (~GenerateMask(PTEFormat::Instance().GetPTELength())))
{
std::stringstream msg;
msg << "PTE value: [0x" << std::hex << new_pte << "] exceed the format length " << std::dec
<< PTEFormat::Instance().GetPTELength() << "." << std::endl;
PTEFormat::Instance().Dump();
etiss::log(etiss::FATALERROR, msg.str());
}

ppn_val_ = new_pte >> bit_field.second;
pte_val_ = new_pte;
}

void PTE::Update(uint64_t new_pte, uint32_t level)
{