parent
f2c3225ab6
commit
8ea584b1d2
|
@ -34,17 +34,18 @@ namespace Fiasco {
|
|||
}
|
||||
|
||||
namespace Genode {
|
||||
class Mapping;
|
||||
class Ipc_pager;
|
||||
}
|
||||
|
||||
class Mapping
|
||||
{
|
||||
class Genode::Mapping
|
||||
{
|
||||
private:
|
||||
|
||||
addr_t _dst_addr;
|
||||
addr_t _src_addr;
|
||||
Fiasco::l4_fpage_t _fpage;
|
||||
Cache_attribute _cacheability;
|
||||
bool _iomem;
|
||||
unsigned _log2size;
|
||||
bool _rw;
|
||||
|
||||
public:
|
||||
|
||||
|
@ -53,42 +54,42 @@ namespace Genode {
|
|||
*/
|
||||
Mapping(addr_t dst_addr, addr_t src_addr,
|
||||
Cache_attribute c, bool io_mem,
|
||||
unsigned l2size,
|
||||
bool rw, bool executable)
|
||||
: _dst_addr(dst_addr), _src_addr(src_addr),
|
||||
_cacheability(c), _iomem(io_mem), _log2size(l2size),
|
||||
_rw(rw) { }
|
||||
unsigned log2size, bool write, bool executable)
|
||||
: _dst_addr(dst_addr), _cacheability(c), _iomem(io_mem)
|
||||
{
|
||||
typedef Fiasco::L4_fpage_rights Rights;
|
||||
Rights rights = (write && executable) ? Fiasco::L4_FPAGE_RWX :
|
||||
(write && !executable) ? Fiasco::L4_FPAGE_RW :
|
||||
(!write && !executable) ? Fiasco::L4_FPAGE_RO :
|
||||
Fiasco::L4_FPAGE_RX;
|
||||
|
||||
_fpage = Fiasco::l4_fpage(src_addr, log2size, rights);
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct invalid flexpage
|
||||
*/
|
||||
Mapping() : _dst_addr(0), _src_addr(0), _cacheability(UNCACHED),
|
||||
_iomem(false), _log2size(0), _rw(false) { }
|
||||
Mapping() : _dst_addr(0), _fpage(Fiasco::l4_fpage_invalid()),
|
||||
_cacheability(UNCACHED), _iomem(false) { }
|
||||
|
||||
Fiasco::l4_umword_t dst_addr() const { return _dst_addr; }
|
||||
bool grant() const { return false; }
|
||||
|
||||
Fiasco::l4_fpage_t fpage() const
|
||||
{
|
||||
unsigned char rights = _rw ? Fiasco::L4_FPAGE_RWX : Fiasco::L4_FPAGE_RX;
|
||||
return Fiasco::l4_fpage(_src_addr, _log2size, rights);
|
||||
}
|
||||
|
||||
Fiasco::l4_fpage_t fpage() const { return _fpage; }
|
||||
Cache_attribute cacheability() const { return _cacheability; }
|
||||
bool iomem() { return _iomem; }
|
||||
bool iomem() const { return _iomem; }
|
||||
/**
|
||||
* Prepare map operation is not needed on Fiasco.OC, since we clear the
|
||||
* dataspace before this function is called.
|
||||
*/
|
||||
void prepare_map_operation() { }
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* Special paging server class
|
||||
*/
|
||||
class Ipc_pager : public Native_capability
|
||||
{
|
||||
class Genode::Ipc_pager : public Native_capability
|
||||
{
|
||||
public:
|
||||
|
||||
enum Msg_type { PAGEFAULT, WAKE_UP, PAUSE, EXCEPTION };
|
||||
|
@ -135,9 +136,10 @@ namespace Genode {
|
|||
addr_t fault_ip() { return _pf_ip; }
|
||||
|
||||
/**
|
||||
* Request fault address of current page fault
|
||||
* Request fault address of current page fault. Lower 3 bits are used
|
||||
* to encode error codes.
|
||||
*/
|
||||
addr_t fault_addr() { return _pf_addr & ~3; }
|
||||
addr_t fault_addr() { return _pf_addr & ~7UL; }
|
||||
|
||||
/**
|
||||
* Set parameters for next reply
|
||||
|
@ -147,8 +149,7 @@ namespace Genode {
|
|||
/**
|
||||
* Set destination for next reply
|
||||
*/
|
||||
void set_reply_dst(Native_thread t) {
|
||||
_last = t; }
|
||||
void set_reply_dst(Native_thread t) { _last = t; }
|
||||
|
||||
/**
|
||||
* Answer call without sending a flex-page mapping
|
||||
|
@ -173,13 +174,20 @@ namespace Genode {
|
|||
*/
|
||||
unsigned long badge() { return _badge; }
|
||||
|
||||
/**
|
||||
* Return true if fault was a write fault
|
||||
*/
|
||||
bool write_fault() const { return (_pf_addr & 2); }
|
||||
|
||||
bool exec_fault() const { return false; }
|
||||
/**
|
||||
* Return true if fault was caused by execution on non executable memory
|
||||
*/
|
||||
bool exec_fault() const;
|
||||
|
||||
/**
|
||||
* Return true if last fault was an exception
|
||||
*/
|
||||
|
||||
bool exception() const
|
||||
{
|
||||
return _type == Ipc_pager::EXCEPTION;
|
||||
|
@ -201,7 +209,6 @@ namespace Genode {
|
|||
* Thread_state object
|
||||
*/
|
||||
void set_regs(Foc_thread_state state);
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
#endif /* _CORE__INCLUDE__IPC_PAGER_H_ */
|
||||
|
|
|
@ -75,3 +75,7 @@ void Genode::Ipc_pager::set_regs(Foc_thread_state state)
|
|||
_regs.cpsr = state.cpsr;
|
||||
}
|
||||
|
||||
bool Genode::Ipc_pager::exec_fault() const
|
||||
{
|
||||
return (_pf_addr & 4) && !(_pf_addr & 1);
|
||||
}
|
||||
|
|
|
@ -28,3 +28,6 @@ void Genode::Ipc_pager::_parse_exception()
|
|||
else
|
||||
_type = EXCEPTION;
|
||||
}
|
||||
|
||||
bool Genode::Ipc_pager::exec_fault() const {
|
||||
return ((_pf_addr & 1) && !write_fault()); }
|
||||
|
|
|
@ -7,6 +7,8 @@ if {[have_spec linux]} {
|
|||
#
|
||||
proc non_executable_supported { } {
|
||||
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 arm]} { return true }
|
||||
|
||||
return false
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user