mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-26 08:51:08 +00:00
parent
b76bd57ed1
commit
8cc48d5688
@ -17,7 +17,7 @@ SRC_CC += spec/arm/platform_support.cc
|
|||||||
|
|
||||||
# add assembly sources
|
# add assembly sources
|
||||||
SRC_S += spec/arm/crt0.s
|
SRC_S += spec/arm/crt0.s
|
||||||
SRC_S += spec/arm/exception_vector.s
|
SRC_S += spec/arm/exception_vector.S
|
||||||
|
|
||||||
vpath spec/32bit/memory_map.cc $(BASE_DIR)/../base-hw/src/lib/hw
|
vpath spec/32bit/memory_map.cc $(BASE_DIR)/../base-hw/src/lib/hw
|
||||||
|
|
||||||
|
@ -175,6 +175,7 @@ unsigned Bootstrap::Platform::enable_mmu()
|
|||||||
/* wait for other cores' coherency activation */
|
/* wait for other cores' coherency activation */
|
||||||
smp_coherency_enabled.wait_for(NR_OF_CPUS);
|
smp_coherency_enabled.wait_for(NR_OF_CPUS);
|
||||||
|
|
||||||
Cpu::synchronization_barrier();
|
asm volatile("dsb sy\n"
|
||||||
|
"isb sy\n" ::: "memory");
|
||||||
return Cpu::Mpidr::Aff_0::get(Cpu::Mpidr::read());
|
return Cpu::Mpidr::Aff_0::get(Cpu::Mpidr::read());
|
||||||
}
|
}
|
||||||
|
@ -83,3 +83,24 @@ void Arm_cpu::mmu_fault_status(Fsr::access_t fsr, Thread_fault & fault)
|
|||||||
default: fault.type = Thread_fault::UNKNOWN;
|
default: fault.type = Thread_fault::UNKNOWN;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Arm_cpu::switch_to(Arm_cpu::Context&, Arm_cpu::Mmu_context & o)
|
||||||
|
{
|
||||||
|
if (o.cidr == 0) return;
|
||||||
|
|
||||||
|
Cidr::access_t cidr = Cidr::read();
|
||||||
|
if (cidr != o.cidr) {
|
||||||
|
/**
|
||||||
|
* First switch to global mappings only to prevent
|
||||||
|
* that wrong branch predicts result due to ASID
|
||||||
|
* and Page-Table not being in sync (see ARM RM B 3.10.4)
|
||||||
|
*/
|
||||||
|
Cidr::write(0);
|
||||||
|
Cpu::synchronization_barrier();
|
||||||
|
Ttbr0::write(o.ttbr0);
|
||||||
|
Cpu::synchronization_barrier();
|
||||||
|
Cidr::write(o.cidr);
|
||||||
|
Cpu::synchronization_barrier();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -110,16 +110,7 @@ struct Genode::Arm_cpu : public Hw::Arm_cpu
|
|||||||
else Tlbiall::write(0);
|
else Tlbiall::write(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void switch_to(Context&, Mmu_context & o)
|
void switch_to(Context&, Mmu_context & o);
|
||||||
{
|
|
||||||
if (o.cidr == 0) return;
|
|
||||||
|
|
||||||
Cidr::access_t cidr = Cidr::read();
|
|
||||||
if (cidr != o.cidr) {
|
|
||||||
Cidr::write(o.cidr);
|
|
||||||
Ttbr0::write(o.ttbr0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void mmu_fault(Context & c, Kernel::Thread_fault & fault);
|
static void mmu_fault(Context & c, Kernel::Thread_fault & fault);
|
||||||
static void mmu_fault_status(Fsr::access_t fsr,
|
static void mmu_fault_status(Fsr::access_t fsr,
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
* under the terms of the GNU Affero General Public License version 3.
|
* under the terms of the GNU Affero General Public License version 3.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <synchronize.s>
|
||||||
|
|
||||||
/*********************
|
/*********************
|
||||||
** Constant values **
|
** Constant values **
|
||||||
@ -123,6 +124,8 @@
|
|||||||
ldr r1, [r1]
|
ldr r1, [r1]
|
||||||
blx r1
|
blx r1
|
||||||
|
|
||||||
|
SYSTEM_REGISTER_SYNC_BARRIER /* synchronize after the context switch */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Go to kernel entry code
|
* Go to kernel entry code
|
||||||
*/
|
*/
|
||||||
@ -164,4 +167,5 @@
|
|||||||
ldr r1, [sp, #16*4]
|
ldr r1, [sp, #16*4]
|
||||||
msr spsr_cxsf, r1
|
msr spsr_cxsf, r1
|
||||||
ldm sp, {r0-r14}^
|
ldm sp, {r0-r14}^
|
||||||
|
SYSTEM_REGISTER_SYNC_BARRIER /* synchronize after the context switch */
|
||||||
subs pc, lr, #0
|
subs pc, lr, #0
|
@ -18,6 +18,11 @@
|
|||||||
/* core includes */
|
/* core includes */
|
||||||
#include <spec/arm/cpu_support.h>
|
#include <spec/arm/cpu_support.h>
|
||||||
|
|
||||||
namespace Genode { using Cpu = Arm_cpu; }
|
namespace Genode { struct Cpu; }
|
||||||
|
|
||||||
|
struct Genode::Cpu : Arm_cpu
|
||||||
|
{
|
||||||
|
static inline void synchronization_barrier() {}
|
||||||
|
};
|
||||||
|
|
||||||
#endif /* _CORE__SPEC__ARM_V6__CPU_H_ */
|
#endif /* _CORE__SPEC__ARM_V6__CPU_H_ */
|
||||||
|
15
repos/base-hw/src/core/spec/arm_v6/synchronize.s
Normal file
15
repos/base-hw/src/core/spec/arm_v6/synchronize.s
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
/*
|
||||||
|
* \brief Assembler macros for ARMv6
|
||||||
|
* \author Stefan Kalkowski
|
||||||
|
* \date 2020-02-16
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2020 Genode Labs GmbH
|
||||||
|
*
|
||||||
|
* This file is part of the Genode OS framework, which is distributed
|
||||||
|
* under the terms of the GNU Affero General Public License version 3.
|
||||||
|
*/
|
||||||
|
|
||||||
|
.macro SYSTEM_REGISTER_SYNC_BARRIER
|
||||||
|
.endm
|
@ -41,6 +41,12 @@ struct Genode::Arm_v7_cpu : Arm_cpu
|
|||||||
else Tlbiallis::write(0);
|
else Tlbiallis::write(0);
|
||||||
} else Arm_cpu::invalidate_tlb(asid);
|
} else Arm_cpu::invalidate_tlb(asid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void synchronization_barrier()
|
||||||
|
{
|
||||||
|
asm volatile("dsb sy\n"
|
||||||
|
"isb sy\n" ::: "memory");
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* _CORE__SPEC__ARM_V7__CPU_SUPPORT_H_ */
|
#endif /* _CORE__SPEC__ARM_V7__CPU_SUPPORT_H_ */
|
||||||
|
17
repos/base-hw/src/core/spec/arm_v7/synchronize.s
Normal file
17
repos/base-hw/src/core/spec/arm_v7/synchronize.s
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
/*
|
||||||
|
* \brief Assembler macros for ARMv7
|
||||||
|
* \author Stefan Kalkowski
|
||||||
|
* \date 2020-02-16
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2020 Genode Labs GmbH
|
||||||
|
*
|
||||||
|
* This file is part of the Genode OS framework, which is distributed
|
||||||
|
* under the terms of the GNU Affero General Public License version 3.
|
||||||
|
*/
|
||||||
|
|
||||||
|
.macro SYSTEM_REGISTER_SYNC_BARRIER
|
||||||
|
dsb sy
|
||||||
|
isb sy
|
||||||
|
.endm
|
@ -286,12 +286,6 @@ struct Hw::Arm_cpu
|
|||||||
** Cache maintainance functions **
|
** Cache maintainance functions **
|
||||||
**********************************/
|
**********************************/
|
||||||
|
|
||||||
static inline void synchronization_barrier()
|
|
||||||
{
|
|
||||||
asm volatile("dsb\n"
|
|
||||||
"isb\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void wait_for_xchg(volatile void * addr,
|
static inline void wait_for_xchg(volatile void * addr,
|
||||||
unsigned long new_value,
|
unsigned long new_value,
|
||||||
unsigned long expected_value)
|
unsigned long expected_value)
|
||||||
|
Loading…
Reference in New Issue
Block a user