nova: enable nx bit handling for x86_64

Issue #1723
This commit is contained in:
Alexander Boettcher 2017-10-13 14:18:29 +02:00 committed by Christian Helmuth
parent db329b02b5
commit f2c3225ab6
8 changed files with 130 additions and 143 deletions

View File

@ -1 +1 @@
af1667f52b0d8da04bfe7b808974fb290f3e213f
4d8b81a60e34ee62ad9b6f24bfc5e0bf670a4f21

View File

@ -4,7 +4,7 @@ DOWNLOADS := nova.git
# r9 branch - use r9_debug for more verbose kernel messages
URL(nova) := https://github.com/alex-ab/NOVA.git
REV(nova) := 190605f8723a2714f90f42b94bbd0757604bee06
REV(nova) := baed84d2ebf122f112035d280170fa24abe00aaa
DIR(nova) := src/kernel/nova
PATCHES := $(wildcard $(REP_DIR)/patches/*.patch)
PATCHES := $(sort $(wildcard $(REP_DIR)/patches/*.patch))

View File

@ -23,16 +23,17 @@
#include <nova/syscalls.h>
namespace Genode {
class Mapping;
class Ipc_pager;
}
class Mapping
class Genode::Mapping
{
private:
addr_t _dst_addr;
addr_t _core_local_addr;
Cache_attribute _attr;
size_t _size_log2;
bool _rw;
addr_t const _dst_addr;
Cache_attribute const _attr;
Nova::Mem_crd const _mem_crd;
enum { PAGE_SIZE_LOG2 = 12 };
@ -41,28 +42,21 @@ namespace Genode {
/**
* Constructor
*/
Mapping(addr_t dst_addr, addr_t map_addr,
Mapping(addr_t dst_addr, addr_t source_addr,
Cache_attribute c, bool io_mem,
unsigned size_log2,
bool rw, bool executable)
bool writeable, bool executable)
:
_dst_addr(dst_addr), _core_local_addr(map_addr),
_attr(c), _size_log2(size_log2), _rw(rw)
_dst_addr(dst_addr),
_attr(c),
_mem_crd(source_addr >> PAGE_SIZE_LOG2,
size_log2 - PAGE_SIZE_LOG2,
Nova::Rights(true, writeable, executable))
{ }
/**
* Construct invalid mapping
*/
Mapping() : _size_log2(0) { }
void prepare_map_operation() { }
Nova::Mem_crd mem_crd()
{
return Nova::Mem_crd(_core_local_addr >> PAGE_SIZE_LOG2,
_size_log2 - PAGE_SIZE_LOG2,
Nova::Rights(true, _rw, true));
}
Nova::Mem_crd mem_crd() const { return _mem_crd; }
bool dma() { return _attr != CACHED; };
bool write_combined() { return _attr == WRITE_COMBINED; };
@ -71,7 +65,7 @@ namespace Genode {
};
class Ipc_pager
class Genode::Ipc_pager
{
private:
@ -128,18 +122,8 @@ namespace Genode {
/**
* Return true if fault was a non-executable fault
*/
bool exec_fault() const { return false; }
/**
* Return true if last fault was an exception
*/
bool exception() const
{
/*
* Reflection of exceptions is not supported on this platform.
*/
return false;
}
bool exec_fault() const {
return _fault_type & ERR_P && _fault_type & ERR_I; }
/**
* Return result of delegate syscall
@ -158,6 +142,5 @@ namespace Genode {
*/
addr_t sp() { return _sp; }
};
}
#endif /* _CORE__INCLUDE__IPC_PAGER_H_ */

View File

@ -55,7 +55,9 @@ void Ipc_pager::set_reply_mapping(Mapping m)
/* receive window in destination pd */
Nova::Mem_crd crd_mem(m.dst_addr() >> 12, m.mem_crd().order(),
Nova::Rights(true, true, true));
Nova::Rights(m.mem_crd().rights().readable(),
m.mem_crd().rights().writeable(),
m.mem_crd().rights().executable()));
/* asynchronously map memory */
_syscall_res = Nova::delegate(_pd_core, _pd_dst, crd_mem);
}

View File

@ -67,7 +67,7 @@ void Pd_session_component::map(addr_t virt, addr_t size)
/* receive window in destination pd */
Nova::Mem_crd crd_mem(mapping.dst_addr() >> 12,
mapping.mem_crd().order(),
Nova::Rights(true, dsc->writable(), true));
Nova::Rights(true, dsc->writable(), region->executable()));
err = Nova::delegate(pd_core, pd_dst, crd_mem);
} while (err == Nova::NOVA_PD_OOM &&

View File

@ -83,7 +83,7 @@ addr_t Platform::_map_pages(addr_t phys_page, addr_t const pages)
addr_t const core_local_addr = reinterpret_cast<addr_t>(core_local_ptr);
int res = map_local(__main_thread_utcb, phys_addr, core_local_addr, pages,
Nova::Rights(true, true, true), true);
Nova::Rights(true, true, false), true);
return res ? 0 : core_local_addr;
}
@ -814,7 +814,7 @@ bool Mapped_mem_allocator::_map_local(addr_t virt_addr, addr_t phys_addr,
{
map_local((Utcb *)Thread::myself()->utcb(), phys_addr,
virt_addr, size / get_page_size(),
Rights(true, true, true), true);
Rights(true, true, false), true);
return true;
}

View File

@ -29,7 +29,7 @@ CC_OPT += -mpreferred-stack-boundary=2 -mregparm=3
else
ifeq ($(filter-out $(SPECS),64bit),)
override CC_MARCH = -m64
CC_WARN += -Wframe-larger-than=240
CC_WARN += -Wframe-larger-than=256
CC_OPT += -mpreferred-stack-boundary=4 -mcmodel=kernel -mno-red-zone
else
$(error Unsupported environment)

View File

@ -6,6 +6,8 @@ if {[have_spec linux]} {
# is not supported.
#
proc non_executable_supported { } {
if {[have_spec nova] && [have_spec x86_64]} { return true }
return false
}