Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

We’re showing branches in this repository, but you can also compare across forks.

base fork: fallen/milkymist-mmu
base: 582617f830bd
...
head fork: fallen/milkymist-mmu
compare: 2b79691a1126
  • 2 commits
  • 4 files changed
  • 0 commit comments
  • 1 contributor
3  cores/lm32/rtl/lm32_dcache.v
View
@@ -799,7 +799,8 @@ begin
`LM32_TLB_CTRL_INVALIDATE_ENTRY:
begin
dtlb_flushing <= 1;
- dtlb_flush_set <= dtlb_update_vaddr_csr_reg[`LM32_DTLB_IDX_RNG];
+// dtlb_flush_set <= dtlb_update_vaddr_csr_reg[`LM32_DTLB_IDX_RNG];
+ dtlb_flush_set <= csr_write_data[`LM32_DTLB_IDX_RNG];
dtlb_updating <= 0;
dtlb_state <= `LM32_TLB_STATE_CHECK;
end
3  cores/lm32/rtl/lm32_icache.v
View
@@ -888,7 +888,8 @@ begin
$display("it's an INVALIDATE ENTRY at %t", $time);
`endif
itlb_flushing <= 1;
- itlb_flush_set <= itlb_update_vaddr_csr_reg[`LM32_ITLB_IDX_RNG];
+// itlb_flush_set <= itlb_update_vaddr_csr_reg[`LM32_ITLB_IDX_RNG];
+ itlb_flush_set <= csr_write_data[`LM32_ITLB_IDX_RNG];
itlb_updating <= 0;
itlb_state <= `LM32_TLB_STATE_CHECK;
end
14 software/libbase/mmu.c
View
@@ -47,18 +47,18 @@ unsigned int mmu_map(unsigned int vaddr, unsigned int paddr, char metadata) {
{
puts("Already mapped, updating metadata !");
mappings[i].metadata |= metadata;
-// if (mappings[i].metadata & ITLB_MAPPING)
-// mmu_itlb_map(vaddr, paddr);
+ if (mappings[i].metadata & ITLB_MAPPING)
+ mmu_itlb_map(vaddr, paddr);
if (mappings[i].metadata & DTLB_MAPPING)
mmu_dtlb_map(vaddr, paddr);
return 1;
} else if ((vaddr == mappings[i].vaddr) && (paddr != mappings[i].paddr) && (mappings[i].metadata & MAPPING_IS_VALID))
{
- puts("Vaddr already mapped to another Paddr (0x%08X), overwritting...\n", mappings[i].paddr);
+ printf("Vaddr already mapped to another Paddr (0x%08X), overwritting...\n", mappings[i].paddr);
mappings[i].paddr = paddr;
mappings[i].metadata = (metadata | MAPPING_IS_VALID);
-// if (mappings[i].metadata & ITLB_MAPPING)
-// mmu_itlb_map(vaddr, paddr);
+ if (mappings[i].metadata & ITLB_MAPPING)
+ mmu_itlb_map(vaddr, paddr);
if (mappings[i].metadata & DTLB_MAPPING)
mmu_dtlb_map(vaddr, paddr);
return 1;
@@ -75,8 +75,8 @@ unsigned int mmu_map(unsigned int vaddr, unsigned int paddr, char metadata) {
mappings[empty_slot].paddr = paddr;
mappings[empty_slot].metadata = (metadata | MAPPING_IS_VALID);
-// if (metadata & ITLB_MAPPING)
-// mmu_itlb_map(vaddr, paddr);
+ if (metadata & ITLB_MAPPING)
+ mmu_itlb_map(vaddr, paddr);
if (metadata & DTLB_MAPPING)
mmu_dtlb_map(vaddr, paddr);
18 software/libhal/mmu.c
View
@@ -56,27 +56,33 @@ inline void mmu_itlb_map(unsigned int vpfn, unsigned int pfn)
inline void mmu_dtlb_invalidate_line(unsigned int vaddr)
{
- asm volatile ("ori %0, %0, 0x21\n\t"
- "wcsr tlbvaddr, %0" :: "r"(vaddr) : );
+ vaddr |= 0x21;
+ asm volatile ("wcsr tlbvaddr, %0" :: "r"(vaddr) : );
}
inline void mmu_itlb_invalidate_line(unsigned int vaddr)
{
- asm volatile ("ori %0, %0, 0x20\n\t"
- "wcsr tlbvaddr, %0" :: "r"(vaddr) : );
+ vaddr |= 0x20;
+ asm volatile ("wcsr tlbvaddr, %0" :: "r"(vaddr) : );
}
inline void mmu_dtlb_invalidate(void)
{
- register unsigned int cmd = DTLB_CTRL_FLUSH_CMD;
+// register unsigned int cmd = DTLB_CTRL_FLUSH_CMD;
// asm volatile("wcsr tlbctrl, %0" :: "r"(cmd) : );
+ asm volatile("xor r11, r11, r11\n\t"
+ "ori r11, r11, 0x3\n\t"
+ "wcsr tlbvaddr, r11" ::: "r11");
}
inline void mmu_itlb_invalidate(void)
{
- register unsigned int cmd = ITLB_CTRL_FLUSH_CMD;
+// register unsigned int cmd = ITLB_CTRL_FLUSH_CMD;
// asm volatile("wcsr tlbctrl, %0" :: "r"(cmd) : );
+ asm volatile("xor r11, r11, r11\n\t"
+ "ori r11, r11, 0x2\n\t"
+ "wcsr tlbvaddr, r11" ::: "r11");
}

No commit comments for this range

Something went wrong with that request. Please try again.