Skip to content

Commit 4b999b5

Browse files
josecmdanielRep
authored andcommitted
fix(aarch32): use lvl 1 as the shared level for vm install
The level of page table where entries are shared for aarch32 is lvl 1. By resharing the lvl 0 pte, this was causing erroneous mappings on secondary cores. Signed-off-by: Jose Martins <[email protected]>
1 parent 26c01a3 commit 4b999b5

File tree

4 files changed

+21
-18
lines changed

4 files changed

+21
-18
lines changed

src/arch/armv8/armv8-a/aarch32/inc/arch/bao.h

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@
66
#ifndef __ARCH_BAO_H__
77
#define __ARCH_BAO_H__
88

9-
#define BAO_VAS_BASE (0x40000000)
10-
#define BAO_CPU_BASE (0x50000000)
11-
#define BAO_VM_BASE (0x60000000)
12-
#define BAO_VAS_TOP (0x80000000)
13-
#define PAGE_SIZE (0x1000)
14-
#define STACK_SIZE (PAGE_SIZE)
9+
#define BAO_VAS_BASE (0x40000000)
10+
#define BAO_CPU_BASE (0x50000000)
11+
#define BAO_VM_BASE (0x60000000)
12+
#define BAO_VAS_TOP (0x80000000)
13+
#define PAGE_SIZE (0x1000)
14+
#define STACK_SIZE (PAGE_SIZE)
15+
#define VM_SHARED_PT_LVL (1)
1516

16-
#define GPR(N) "r" #N
17+
#define GPR(N) "r" #N
1718

1819
#ifndef __ASSEMBLER__
1920

src/arch/armv8/armv8-a/aarch64/inc/arch/bao.h

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@
66
#ifndef __ARCH_BAO_H__
77
#define __ARCH_BAO_H__
88

9-
#define BAO_VAS_BASE (0xfd8000000000)
10-
#define BAO_CPU_BASE (0xfe0000000000)
11-
#define BAO_VM_BASE (0xfe8000000000)
12-
#define BAO_VAS_TOP (0xff0000000000)
13-
#define PAGE_SIZE (0x1000)
14-
#define STACK_SIZE (PAGE_SIZE)
9+
#define BAO_VAS_BASE (0xfd8000000000)
10+
#define BAO_CPU_BASE (0xfe0000000000)
11+
#define BAO_VM_BASE (0xfe8000000000)
12+
#define BAO_VAS_TOP (0xff0000000000)
13+
#define PAGE_SIZE (0x1000)
14+
#define STACK_SIZE (PAGE_SIZE)
15+
#define VM_SHARED_PT_LVL (0)
1516

16-
#define GPR(N) "x" #N
17+
#define GPR(N) "x" #N
1718

1819
#ifndef __ASSEMBLER__
1920

src/arch/riscv/inc/arch/bao.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,9 @@
3939
#define BAO_VAS_TOP (0xffffffff)
4040
#endif
4141

42-
#define PAGE_SIZE (0x1000)
43-
#define STACK_SIZE (PAGE_SIZE)
42+
#define PAGE_SIZE (0x1000)
43+
#define STACK_SIZE (PAGE_SIZE)
44+
#define VM_SHARED_PT_LVL (0)
4445

4546
#ifndef __ASSEMBLER__
4647

src/core/mmu/vmm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ struct vm_install_info vmm_get_vm_install_info(struct vm_allocation* vm_alloc)
1616
{
1717
struct vm_install_info info = {
1818
.base = vm_alloc->base,
19-
.vm_section_pte = *pt_get_pte(&cpu()->as.pt, 0, vm_alloc->base),
19+
.vm_section_pte = *pt_get_pte(&cpu()->as.pt, VM_SHARED_PT_LVL, vm_alloc->base),
2020
};
2121
return info;
2222
}
2323

2424
void vmm_vm_install(struct vm_install_info* install_info)
2525
{
26-
pte_t* pte = pt_get_pte(&cpu()->as.pt, 0, (vaddr_t)install_info->base);
26+
pte_t* pte = pt_get_pte(&cpu()->as.pt, VM_SHARED_PT_LVL, (vaddr_t)install_info->base);
2727
*pte = install_info->vm_section_pte;
2828
// We don't invalidate the TLB as we know there was no previous mapping or accesses to the
2929
// addresses in the VM section. Just make sure the write commited before leaving.

0 commit comments

Comments
 (0)