mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-18 15:18:20 +00:00
hw: run core threads in privileged mode
* introduce new syscall (core-only) to create privileged threads * take the privilege level of the thread into account when doing a context switch * map kernel segment as accessable for privileged code only Ref #2091
This commit is contained in:
committed by
Christian Helmuth
parent
7e47fa58b3
commit
ca60e24ad9
@ -120,9 +120,9 @@ Mapping Platform::_load_elf()
|
||||
phys = dst;
|
||||
}
|
||||
|
||||
//FIXME: set read-only, privileged and global accordingly
|
||||
//FIXME: set read-only accordingly
|
||||
Page_flags flags{RW, segment.flags().x ? EXEC : NO_EXEC,
|
||||
USER, GLOBAL, RAM, CACHED};
|
||||
KERN, GLOBAL, RAM, CACHED};
|
||||
Mapping m((addr_t)phys, (addr_t)segment.start(), size, flags);
|
||||
|
||||
/*
|
||||
|
@ -24,16 +24,17 @@ void Bootstrap::Cpu::enable_mmu_and_caches(Genode::addr_t table)
|
||||
/* do not use domains, but permission bits in table */
|
||||
Dacr::write(Dacr::D0::bits(1));
|
||||
|
||||
Ttbcr::write(0);
|
||||
Ttbcr::write(1);
|
||||
|
||||
Ttbr::access_t ttbr0 = Ttbr::Ba::masked(table);
|
||||
Ttbr::Rgn::set(ttbr0, Ttbr::CACHEABLE);
|
||||
Ttbr::access_t ttbr = Ttbr::Ba::masked(table);
|
||||
Ttbr::Rgn::set(ttbr, Ttbr::CACHEABLE);
|
||||
if (Mpidr::read()) { /* check for SMP system */
|
||||
Ttbr::Irgn::set(ttbr0, Ttbr::CACHEABLE);
|
||||
Ttbr::S::set(ttbr0, 1);
|
||||
Ttbr::Irgn::set(ttbr, Ttbr::CACHEABLE);
|
||||
Ttbr::S::set(ttbr, 1);
|
||||
} else
|
||||
Ttbr::C::set(ttbr0, 1);
|
||||
Ttbr0::write(ttbr0);
|
||||
Ttbr::C::set(ttbr, 1);
|
||||
Ttbr0::write(ttbr);
|
||||
Ttbr1::write(ttbr);
|
||||
|
||||
Sctlr::access_t sctlr = Sctlr::read();
|
||||
Sctlr::C::set(sctlr, 1);
|
||||
|
@ -12,6 +12,7 @@
|
||||
* under the terms of the GNU Affero General Public License version 3.
|
||||
*/
|
||||
#include <platform.h>
|
||||
#include <hw/spec/riscv/cpu.h>
|
||||
|
||||
using namespace Board;
|
||||
|
||||
@ -21,8 +22,6 @@ Bootstrap::Platform::Board::Board()
|
||||
|
||||
void Bootstrap::Platform::enable_mmu()
|
||||
{
|
||||
asm volatile ("csrw sptbr, %0\n" /* set asid | page table */
|
||||
:
|
||||
: "r" ((addr_t)core_pd->table_base >> 12)
|
||||
: "memory");
|
||||
using Sptbr = Hw::Riscv_cpu::Sptbr;
|
||||
Sptbr::write(Sptbr::Ppn::masked((addr_t)core_pd->table_base >> 12));
|
||||
}
|
||||
|
Reference in New Issue
Block a user