From 912dd003b081b628085e86bc151b8d91fbccb0c8 Mon Sep 17 00:00:00 2001 From: Kimplul Date: Tue, 30 Apr 2024 15:44:47 +0300 Subject: janitorial duties + Add doc and formatting tooling --- triscv/src/mmu.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'triscv/src/mmu.c') diff --git a/triscv/src/mmu.c b/triscv/src/mmu.c index 7549012..1b35961 100644 --- a/triscv/src/mmu.c +++ b/triscv/src/mmu.c @@ -76,7 +76,8 @@ struct tri_option { bool ok; }; -static struct tri_option __mmu_read3(struct cpu *cpu, struct mmu *mmu, vm_t addr) +static struct tri_option __mmu_read3(struct cpu *cpu, struct mmu *mmu, + vm_t addr) { struct dev_map *d = mmu_find_dev_map(mmu, addr); if (!d || !d->dev.read3) { @@ -85,8 +86,8 @@ static struct tri_option __mmu_read3(struct cpu *cpu, struct mmu *mmu, vm_t addr } return (struct tri_option){ - .value = d->dev.read3(cpu, d->dev.dev, addr - d->start), - .ok = true + .value = d->dev.read3(cpu, d->dev.dev, addr - d->start), + .ok = true }; } @@ -128,8 +129,9 @@ static bool __leaf_pte(tri_t pte) return !(x == 0 && rw == 0); } -static pm_t __process_pte(struct cpu *cpu, struct mmu *mmu, pm_t table, tri_t orig, size_t shift, - struct tlb_map *mapping) +static pm_t __process_pte(struct cpu *cpu, struct mmu *mmu, pm_t table, + tri_t orig, size_t shift, + struct tlb_map *mapping) { tri_t ppn = tri_mask(tri_sr(orig, shift), 6); pm_t i = tri_to(ppn); @@ -148,14 +150,16 @@ static pm_t __process_pte(struct cpu *cpu, struct mmu *mmu, pm_t table, tri_t or tri_t cur = tri_discard(orig, shift); tri_t off = tri_sub(orig, cur); - *mapping = __build_mapping(tri_to(orig), tri_to(base) + tri_to(off), tag); + *mapping = __build_mapping(tri_to(orig), + tri_to(base) + tri_to(off), tag); return 0; } return pte.value; } -static struct tlb_map __fetch_mapping(struct cpu *cpu, struct mmu *mmu, vm_t addr) +static struct tlb_map __fetch_mapping(struct cpu *cpu, struct mmu *mmu, + vm_t addr) { /* feels kind of silly to convert back to trinary, but I guess fine for * now. */ -- cgit v1.3