parent
4dd5e6b266
commit
9655ebbefe
|
@ -1,6 +1,6 @@
|
||||||
--- src/kernel/sel4/libsel4/arch_include/arm/sel4/arch/types.h
|
--- src/kernel/sel4/libsel4/arch_include/arm/sel4/arch/types.h
|
||||||
+++ src/kernel/sel4/libsel4/arch_include/arm/sel4/arch/types.h
|
+++ src/kernel/sel4/libsel4/arch_include/arm/sel4/arch/types.h
|
||||||
@@ -24,6 +24,7 @@
|
@@ -26,10 +26,12 @@
|
||||||
typedef seL4_CPtr seL4_ARM_IOPageTable;
|
typedef seL4_CPtr seL4_ARM_IOPageTable;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
@ -8,3 +8,8 @@
|
||||||
seL4_ARM_PageCacheable = 0x01,
|
seL4_ARM_PageCacheable = 0x01,
|
||||||
seL4_ARM_ParityEnabled = 0x02,
|
seL4_ARM_ParityEnabled = 0x02,
|
||||||
seL4_ARM_Default_VMAttributes = 0x03,
|
seL4_ARM_Default_VMAttributes = 0x03,
|
||||||
|
seL4_ARM_ExecuteNever = 0x04,
|
||||||
|
+ seL4_ARM_Default_VMAttributes_NoExecute = 0x07,
|
||||||
|
/* seL4_ARM_PageCacheable | seL4_ARM_ParityEnabled */
|
||||||
|
SEL4_FORCE_LONG_ENUM(seL4_ARM_VMAttributes),
|
||||||
|
} seL4_ARM_VMAttributes;
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
b00bc949a62cc71b45191b19c966f3a542b25c20
|
fac219549e9515349e61deae22a199ae3196e67a
|
||||||
|
|
|
@ -18,11 +18,13 @@
|
||||||
#include <base/ipc.h>
|
#include <base/ipc.h>
|
||||||
#include <base/stdint.h>
|
#include <base/stdint.h>
|
||||||
|
|
||||||
namespace Genode { class Ipc_pager; }
|
|
||||||
|
|
||||||
namespace Genode {
|
namespace Genode {
|
||||||
|
class Mapping;
|
||||||
|
class Ipc_pager;
|
||||||
|
}
|
||||||
|
|
||||||
class Mapping
|
|
||||||
|
class Genode::Mapping
|
||||||
{
|
{
|
||||||
friend class Ipc_pager;
|
friend class Ipc_pager;
|
||||||
|
|
||||||
|
@ -32,8 +34,9 @@ namespace Genode {
|
||||||
addr_t _to_virt_addr;
|
addr_t _to_virt_addr;
|
||||||
Cache_attribute _attr;
|
Cache_attribute _attr;
|
||||||
size_t _num_pages;
|
size_t _num_pages;
|
||||||
bool _writeable;
|
|
||||||
addr_t _fault_type = { 0 };
|
addr_t _fault_type = { 0 };
|
||||||
|
bool _writeable = { false };
|
||||||
|
bool _executable = { false };
|
||||||
|
|
||||||
enum { PAGE_SIZE_LOG2 = 12 };
|
enum { PAGE_SIZE_LOG2 = 12 };
|
||||||
|
|
||||||
|
@ -50,7 +53,7 @@ namespace Genode {
|
||||||
_to_virt_addr(dst_addr),
|
_to_virt_addr(dst_addr),
|
||||||
_attr(cacheability),
|
_attr(cacheability),
|
||||||
_num_pages(1 << (l2size - PAGE_SIZE_LOG2)),
|
_num_pages(1 << (l2size - PAGE_SIZE_LOG2)),
|
||||||
_writeable(rw)
|
_writeable(rw), _executable(executable)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -70,6 +73,7 @@ namespace Genode {
|
||||||
addr_t to_virt() const { return _to_virt_addr; }
|
addr_t to_virt() const { return _to_virt_addr; }
|
||||||
size_t num_pages() const { return _num_pages; }
|
size_t num_pages() const { return _num_pages; }
|
||||||
bool writeable() const { return _writeable; }
|
bool writeable() const { return _writeable; }
|
||||||
|
bool executable() const { return _executable; }
|
||||||
Cache_attribute cacheability() const { return _attr; }
|
Cache_attribute cacheability() const { return _attr; }
|
||||||
addr_t fault_type() const { return _fault_type; }
|
addr_t fault_type() const { return _fault_type; }
|
||||||
};
|
};
|
||||||
|
@ -78,7 +82,7 @@ namespace Genode {
|
||||||
/**
|
/**
|
||||||
* Special paging server class
|
* Special paging server class
|
||||||
*/
|
*/
|
||||||
class Ipc_pager : public Native_capability
|
class Genode::Ipc_pager : public Native_capability
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -86,8 +90,9 @@ namespace Genode {
|
||||||
addr_t _reply_sel; /* selector to save reply cap */
|
addr_t _reply_sel; /* selector to save reply cap */
|
||||||
addr_t _pf_addr; /* page-fault address */
|
addr_t _pf_addr; /* page-fault address */
|
||||||
addr_t _pf_ip; /* instruction pointer of faulter */
|
addr_t _pf_ip; /* instruction pointer of faulter */
|
||||||
bool _pf_write; /* true on write fault */
|
|
||||||
addr_t _fault_type; /* type of fault */
|
addr_t _fault_type; /* type of fault */
|
||||||
|
bool _pf_write; /* true on write fault */
|
||||||
|
bool _pf_exec; /* true on exec fault */
|
||||||
|
|
||||||
Mapping _reply_mapping;
|
Mapping _reply_mapping;
|
||||||
|
|
||||||
|
@ -145,8 +150,7 @@ namespace Genode {
|
||||||
/**
|
/**
|
||||||
* Return true if page fault was on non-executable memory
|
* Return true if page fault was on non-executable memory
|
||||||
*/
|
*/
|
||||||
bool exec_fault() const { return false; }
|
bool exec_fault() const { return _pf_exec; }
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* _CORE__INCLUDE__IPC_PAGER_H_ */
|
#endif /* _CORE__INCLUDE__IPC_PAGER_H_ */
|
||||||
|
|
|
@ -36,12 +36,13 @@ namespace Genode {
|
||||||
inline bool map_local(addr_t from_phys, addr_t to_virt, size_t num_pages,
|
inline bool map_local(addr_t from_phys, addr_t to_virt, size_t num_pages,
|
||||||
Platform * platform = nullptr)
|
Platform * platform = nullptr)
|
||||||
{
|
{
|
||||||
enum { DONT_FLUSH = false, WRITEABLE = true };
|
enum { DONT_FLUSH = false, WRITEABLE = true, NON_EXECUTABLE = false };
|
||||||
try {
|
try {
|
||||||
platform = platform ? platform : platform_specific();
|
platform = platform ? platform : platform_specific();
|
||||||
platform->core_vm_space().map(from_phys, to_virt, num_pages,
|
platform->core_vm_space().map(from_phys, to_virt, num_pages,
|
||||||
Cache_attribute::CACHED,
|
Cache_attribute::CACHED,
|
||||||
WRITEABLE, DONT_FLUSH);
|
WRITEABLE, NON_EXECUTABLE,
|
||||||
|
DONT_FLUSH);
|
||||||
} catch (Page_table_registry::Mapping_cache_full) {
|
} catch (Page_table_registry::Mapping_cache_full) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -157,7 +157,8 @@ class Genode::Vm_space
|
||||||
|
|
||||||
bool _map_frame(addr_t const from_phys, addr_t const to_virt,
|
bool _map_frame(addr_t const from_phys, addr_t const to_virt,
|
||||||
Cache_attribute const cacheability,
|
Cache_attribute const cacheability,
|
||||||
bool const writable, bool const flush_support)
|
bool const writable, bool const executable,
|
||||||
|
bool const flush_support)
|
||||||
{
|
{
|
||||||
if (_page_table_registry.page_frame_at(to_virt)) {
|
if (_page_table_registry.page_frame_at(to_virt)) {
|
||||||
/*
|
/*
|
||||||
|
@ -228,7 +229,7 @@ class Genode::Vm_space
|
||||||
* Insert copy of page-frame selector into page table
|
* Insert copy of page-frame selector into page table
|
||||||
*/
|
*/
|
||||||
long ret = _map_page(Cap_sel(pte_idx), to_virt, cacheability,
|
long ret = _map_page(Cap_sel(pte_idx), to_virt, cacheability,
|
||||||
writable);
|
writable, executable);
|
||||||
if (ret != seL4_NoError) {
|
if (ret != seL4_NoError) {
|
||||||
error("seL4_*_Page_Map ", Hex(from_phys), "->",
|
error("seL4_*_Page_Map ", Hex(from_phys), "->",
|
||||||
Hex(to_virt), " returned ", ret);
|
Hex(to_virt), " returned ", ret);
|
||||||
|
@ -241,7 +242,8 @@ class Genode::Vm_space
|
||||||
* Platform specific map/unmap of a page frame
|
* Platform specific map/unmap of a page frame
|
||||||
*/
|
*/
|
||||||
long _map_page(Genode::Cap_sel const &idx, Genode::addr_t const virt,
|
long _map_page(Genode::Cap_sel const &idx, Genode::addr_t const virt,
|
||||||
Cache_attribute const cacheability, bool const write);
|
Cache_attribute const cacheability, bool const write,
|
||||||
|
bool const writable);
|
||||||
long _unmap_page(Genode::Cap_sel const &idx);
|
long _unmap_page(Genode::Cap_sel const &idx);
|
||||||
|
|
||||||
class Alloc_page_table_failed : Exception { };
|
class Alloc_page_table_failed : Exception { };
|
||||||
|
@ -374,7 +376,7 @@ class Genode::Vm_space
|
||||||
|
|
||||||
void map(addr_t const from_phys, addr_t const to_virt,
|
void map(addr_t const from_phys, addr_t const to_virt,
|
||||||
size_t const num_pages, Cache_attribute const cacheability,
|
size_t const num_pages, Cache_attribute const cacheability,
|
||||||
bool const writable, bool flush_support)
|
bool const writable, bool const executable, bool flush_support)
|
||||||
{
|
{
|
||||||
Lock::Guard guard(_lock);
|
Lock::Guard guard(_lock);
|
||||||
|
|
||||||
|
@ -382,7 +384,8 @@ class Genode::Vm_space
|
||||||
off_t const offset = i << get_page_size_log2();
|
off_t const offset = i << get_page_size_log2();
|
||||||
|
|
||||||
if (!_map_frame(from_phys + offset, to_virt + offset,
|
if (!_map_frame(from_phys + offset, to_virt + offset,
|
||||||
cacheability, writable, flush_support))
|
cacheability, writable, executable,
|
||||||
|
flush_support))
|
||||||
error("mapping failed ", Hex(from_phys + offset),
|
error("mapping failed ", Hex(from_phys + offset),
|
||||||
" -> ", Hex(to_virt + offset));
|
" -> ", Hex(to_virt + offset));
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,6 +74,7 @@ void Ipc_pager::reply_and_wait_for_fault()
|
||||||
_pf_ip = fault_info.ip;
|
_pf_ip = fault_info.ip;
|
||||||
_pf_addr = fault_info.pf;
|
_pf_addr = fault_info.pf;
|
||||||
_pf_write = fault_info.write;
|
_pf_write = fault_info.write;
|
||||||
|
_pf_exec = fault_info.exec_fault();
|
||||||
_fault_type = seL4_MessageInfo_get_label(page_fault_msg_info);
|
_fault_type = seL4_MessageInfo_get_label(page_fault_msg_info);
|
||||||
|
|
||||||
_badge = badge;
|
_badge = badge;
|
||||||
|
|
|
@ -89,10 +89,10 @@ bool Platform_pd::bind_thread(Platform_thread *thread)
|
||||||
*/
|
*/
|
||||||
addr_t const utcb = (thread->_utcb) ? thread->_utcb : thread->INITIAL_IPC_BUFFER_VIRT;
|
addr_t const utcb = (thread->_utcb) ? thread->_utcb : thread->INITIAL_IPC_BUFFER_VIRT;
|
||||||
|
|
||||||
enum { WRITABLE = true, ONE_PAGE = 1, FLUSHABLE = true };
|
enum { WRITABLE = true, ONE_PAGE = 1, FLUSHABLE = true, NON_EXECUTABLE = false };
|
||||||
_vm_space.alloc_page_tables(utcb, get_page_size());
|
_vm_space.alloc_page_tables(utcb, get_page_size());
|
||||||
_vm_space.map(thread->_info.ipc_buffer_phys, utcb, ONE_PAGE,
|
_vm_space.map(thread->_info.ipc_buffer_phys, utcb, ONE_PAGE,
|
||||||
Cache_attribute::CACHED, WRITABLE, FLUSHABLE);
|
Cache_attribute::CACHED, WRITABLE, NON_EXECUTABLE, FLUSHABLE);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,7 +161,7 @@ bool Platform_pd::install_mapping(Mapping const &mapping,
|
||||||
|
|
||||||
_vm_space.map(mapping.from_phys(), mapping.to_virt(),
|
_vm_space.map(mapping.from_phys(), mapping.to_virt(),
|
||||||
mapping.num_pages(), mapping.cacheability(),
|
mapping.num_pages(), mapping.cacheability(),
|
||||||
mapping.writeable(), FLUSHABLE);
|
mapping.writeable(), mapping.executable(), FLUSHABLE);
|
||||||
return true;
|
return true;
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
char const * fault_name = "unknown";
|
char const * fault_name = "unknown";
|
||||||
|
|
|
@ -18,12 +18,23 @@ struct Fault_info
|
||||||
bool data_abort = 0;
|
bool data_abort = 0;
|
||||||
bool write = 0;
|
bool write = 0;
|
||||||
|
|
||||||
|
enum {
|
||||||
|
IFSR_FAULT = 1,
|
||||||
|
IFSR_FAULT_PERMISSION = 0xf,
|
||||||
|
DFSR_WRITE_FAULT = 1UL << 11
|
||||||
|
};
|
||||||
|
|
||||||
Fault_info(seL4_MessageInfo_t msg_info)
|
Fault_info(seL4_MessageInfo_t msg_info)
|
||||||
:
|
:
|
||||||
ip(seL4_GetMR(0)),
|
ip(seL4_GetMR(0)),
|
||||||
pf(seL4_GetMR(1)),
|
pf(seL4_GetMR(1)),
|
||||||
data_abort(seL4_GetMR(2) != 1),
|
data_abort(seL4_GetMR(2) != IFSR_FAULT),
|
||||||
/* Instruction Fault Status Register (IFSR) resp. Data FSR (DFSR) */
|
/* Instruction Fault Status Register (IFSR) resp. Data FSR (DFSR) */
|
||||||
write(data_abort && (seL4_GetMR(3) & (1 << 11)))
|
write(data_abort && (seL4_GetMR(3) & DFSR_WRITE_FAULT))
|
||||||
{ }
|
{
|
||||||
|
if (!data_abort && seL4_GetMR(3) != IFSR_FAULT_PERMISSION)
|
||||||
|
data_abort = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool exec_fault() const { return !data_abort; }
|
||||||
};
|
};
|
||||||
|
|
|
@ -27,12 +27,13 @@ static long map_page_table(Genode::Cap_sel const pagetable,
|
||||||
long Genode::Vm_space::_map_page(Genode::Cap_sel const &idx,
|
long Genode::Vm_space::_map_page(Genode::Cap_sel const &idx,
|
||||||
Genode::addr_t const virt,
|
Genode::addr_t const virt,
|
||||||
Cache_attribute const cacheability,
|
Cache_attribute const cacheability,
|
||||||
bool const writable)
|
bool const writable,
|
||||||
|
bool const executable)
|
||||||
{
|
{
|
||||||
seL4_ARM_Page const service = _idx_to_sel(idx.value());
|
seL4_ARM_Page const service = _idx_to_sel(idx.value());
|
||||||
seL4_ARM_PageDirectory const pd = _pd_sel.value();
|
seL4_ARM_PageDirectory const pd = _pd_sel.value();
|
||||||
seL4_CapRights_t const rights = writable ? seL4_ReadWrite : seL4_CanRead;
|
seL4_CapRights_t const rights = writable ? seL4_ReadWrite : seL4_CanRead;
|
||||||
seL4_ARM_VMAttributes attr = seL4_ARM_Default_VMAttributes;
|
seL4_ARM_VMAttributes attr = executable ? seL4_ARM_Default_VMAttributes : seL4_ARM_Default_VMAttributes_NoExecute;
|
||||||
|
|
||||||
if (cacheability == UNCACHED)
|
if (cacheability == UNCACHED)
|
||||||
attr = seL4_ARM_Uncacheable;
|
attr = seL4_ARM_Uncacheable;
|
||||||
|
|
|
@ -35,4 +35,6 @@ struct Fault_info
|
||||||
pf(seL4_GetMR(1)),
|
pf(seL4_GetMR(1)),
|
||||||
write(seL4_GetMR(3) & ERR_W)
|
write(seL4_GetMR(3) & ERR_W)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
bool exec_fault() const { return false; }
|
||||||
};
|
};
|
||||||
|
|
|
@ -17,7 +17,8 @@
|
||||||
long Genode::Vm_space::_map_page(Genode::Cap_sel const &idx,
|
long Genode::Vm_space::_map_page(Genode::Cap_sel const &idx,
|
||||||
Genode::addr_t const virt,
|
Genode::addr_t const virt,
|
||||||
Cache_attribute const cacheability,
|
Cache_attribute const cacheability,
|
||||||
bool const writable)
|
bool const writable,
|
||||||
|
bool const executable)
|
||||||
{
|
{
|
||||||
seL4_X86_Page const service = _idx_to_sel(idx.value());
|
seL4_X86_Page const service = _idx_to_sel(idx.value());
|
||||||
seL4_X86_PageDirectory const pd = _pd_sel.value();
|
seL4_X86_PageDirectory const pd = _pd_sel.value();
|
||||||
|
|
|
@ -12,6 +12,7 @@ proc non_executable_supported { } {
|
||||||
if {[have_spec nova] && [have_spec x86_64]} { return true }
|
if {[have_spec nova] && [have_spec x86_64]} { return true }
|
||||||
if {[have_spec foc] && [have_spec x86_64]} { return true }
|
if {[have_spec foc] && [have_spec x86_64]} { return true }
|
||||||
if {[have_spec foc] && [have_spec arm]} { return true }
|
if {[have_spec foc] && [have_spec arm]} { return true }
|
||||||
|
if {[have_spec sel4] && [have_spec arm]} { return true }
|
||||||
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user