nova: fix syscall bindings with GCC 6

Fixes #2377
This commit is contained in:
Alexander Boettcher 2017-04-12 11:55:08 +02:00 committed by Christian Helmuth
parent 8e7aa54493
commit 7005e54de2
12 changed files with 38 additions and 38 deletions

View File

@ -518,9 +518,6 @@ namespace Nova {
*/
union {
/* message payload */
mword_t msg[];
/* exception state */
struct {
mword_t mtd, instr_len, ip, flags;
@ -566,6 +563,9 @@ namespace Nova {
} __attribute__((packed));
};
/* message payload */
mword_t * msg() { return reinterpret_cast<mword_t *>(&mtd); }
struct Item {
mword_t crd;
mword_t hotspot;
@ -673,7 +673,7 @@ namespace Nova {
item += (PAGE_SIZE_BYTE / sizeof(struct Item)) - msg_items();
/* check that there is enough space left on UTCB */
if (msg + msg_words() >= reinterpret_cast<mword_t *>(item)) {
if (msg() + msg_words() >= reinterpret_cast<mword_t *>(item)) {
items -= 1 << 16;
return false;
}
@ -707,7 +707,7 @@ namespace Nova {
Item * get_item(const unsigned i) {
if (i > (PAGE_SIZE_BYTE / sizeof(struct Item))) return 0;
Item * item = reinterpret_cast<Item *>(this) + (PAGE_SIZE_BYTE / sizeof(struct Item)) - i - 1;
if (reinterpret_cast<mword_t *>(item) < this->msg) return 0;
if (reinterpret_cast<mword_t *>(item) < this->msg()) return 0;
return item;
}

View File

@ -40,7 +40,7 @@ inline void request_event_portal(Genode::addr_t const cap,
/* request event-handler portal */
utcb->crd_rcv = Nova::Obj_crd(sel, 0);
utcb->msg[0] = event;
utcb->msg()[0] = event;
utcb->set_msg_word(1);
Genode::uint8_t res = Nova::call(cap);
@ -85,7 +85,7 @@ inline void translate_remote_pager(Genode::addr_t const cap,
};
/* translate one item */
utcb->msg[0] = 0xaffe;
utcb->msg()[0] = 0xaffe;
utcb->set_msg_word(1);
Nova::Obj_crd obj_crd(sel, 0);

View File

@ -40,11 +40,11 @@ inline void *echo_stack_top()
static void echo_reply()
{
/* collect map information from calling thread, sent as 3 words */
Nova::Crd snd_rcv(echo()->utcb()->msg[0]);
Nova::mword_t offset = echo()->utcb()->msg[1];
bool kern_pd = echo()->utcb()->msg[2];
bool dma_mem = echo()->utcb()->msg[3];
bool write_combined = echo()->utcb()->msg[4];
Nova::Crd snd_rcv(echo()->utcb()->msg()[0]);
Nova::mword_t offset = echo()->utcb()->msg()[1];
bool kern_pd = echo()->utcb()->msg()[2];
bool dma_mem = echo()->utcb()->msg()[3];
bool write_combined = echo()->utcb()->msg()[4];
/* reset message transfer descriptor */
echo()->utcb()->set_msg_word(0);
@ -53,7 +53,7 @@ static void echo_reply()
false, dma_mem, write_combined);
/* set return code, 0 means failure */
echo()->utcb()->msg[0] = res;
echo()->utcb()->msg()[0] = res;
echo()->utcb()->items += 1;
/* during reply the mapping will be established */

View File

@ -69,16 +69,16 @@ static int map_local(Nova::Utcb *utcb, Nova::Crd src_crd, Nova::Crd dst_crd,
utcb->crd_rcv = dst_crd;
/* tell echo thread what to map */
utcb->msg[0] = src_crd.value();
utcb->msg[1] = 0;
utcb->msg[2] = kern_pd;
utcb->msg[3] = dma_mem;
utcb->msg[4] = write_combined;
utcb->msg()[0] = src_crd.value();
utcb->msg()[1] = 0;
utcb->msg()[2] = kern_pd;
utcb->msg()[3] = dma_mem;
utcb->msg()[4] = write_combined;
utcb->set_msg_word(5);
/* establish the mapping via a portal traversal during reply phase */
Nova::uint8_t res = Nova::call(echo()->pt_sel());
if (res != Nova::NOVA_OK || utcb->msg_words() != 1 || !utcb->msg[0] ||
if (res != Nova::NOVA_OK || utcb->msg_words() != 1 || !utcb->msg()[0] ||
utcb->msg_items() != 1) {
typedef Genode::Hex Hex;
@ -88,7 +88,7 @@ static int map_local(Nova::Utcb *utcb, Nova::Crd src_crd, Nova::Crd dst_crd,
"result=", Hex(res), " "
"msg=", Hex(utcb->msg_items()), ":",
Hex(utcb->msg_words()), ":",
Hex(utcb->msg[0]), " !!! "
Hex(utcb->msg()[0]), " !!! "
"utcb=", utcb, " "
"kern=", kern_pd);
return res > 0 ? res : -1;

View File

@ -32,7 +32,7 @@ Ipc_pager::Ipc_pager(Nova::Utcb * utcb, addr_t pd_dst, addr_t pd_core)
_sp(utcb->sp),
_fault_type(utcb->qual[0]),
_syscall_res(Nova::NOVA_OK),
_normal_ipc((((addr_t)&utcb->qual[2] - (addr_t)utcb->msg) / sizeof(addr_t))
_normal_ipc((((addr_t)&utcb->qual[2] - (addr_t)utcb->msg()) / sizeof(addr_t))
== utcb->msg_words())
{

View File

@ -311,7 +311,7 @@ void Pager_object::_invoke_handler(addr_t pager_obj)
reply(myself->stack_top());
}
addr_t const event = utcb->msg[0];
addr_t const event = utcb->msg()[0];
/* check for translated pager portals - required for vCPU in remote PDs */
if (utcb->msg_items() == 1 && utcb->msg_words() == 1 && event == 0xaffe) {

View File

@ -44,7 +44,7 @@ static inline Nova::mword_t copy_utcb_to_msgbuf(Nova::Utcb &utcb,
return 0;
/* the UTCB contains the protocol word followed by the message data */
mword_t const protocol_word = utcb.msg[0];
mword_t const protocol_word = utcb.msg()[0];
size_t num_data_words = num_msg_words - 1;
if (num_data_words*sizeof(mword_t) > rcv_msg.capacity()) {
@ -55,7 +55,7 @@ static inline Nova::mword_t copy_utcb_to_msgbuf(Nova::Utcb &utcb,
}
/* read message payload into destination message buffer */
mword_t *src = (mword_t *)(void *)(&utcb.msg[1]);
mword_t *src = (mword_t *)(void *)(&utcb.msg()[1]);
mword_t *dst = (mword_t *)rcv_msg.data();
for (unsigned i = 0; i < num_data_words; i++)
*dst++ = *src++;
@ -96,11 +96,11 @@ static inline bool copy_msgbuf_to_utcb(Nova::Utcb &utcb,
num_msg_words = NUM_MSG_REGS;
}
utcb.msg[0] = protocol_value;
utcb.msg()[0] = protocol_value;
/* store message into UTCB message registers */
mword_t *src = (mword_t *)&msg_buf[0];
mword_t *dst = (mword_t *)(void *)&utcb.msg[1];
mword_t *dst = (mword_t *)(void *)&utcb.msg()[1];
for (unsigned i = 0; i < num_data_words; i++)
*dst++ = *src++;

View File

@ -90,7 +90,7 @@ void Rpc_entrypoint::_dissolve(Rpc_object_base *obj)
_delay_start.unlock();
/* make a IPC to ensure that cap() identifier is not used anymore */
utcb->msg[0] = 0xdead;
utcb->msg()[0] = 0xdead;
utcb->set_msg_word(1);
if (uint8_t res = call(_cap.local_name()))
error(utcb, " - could not clean up entry point of thread ", this->utcb(), " - res ", res);

View File

@ -36,9 +36,9 @@ long Test::cap_void_manual(Genode::Native_capability dst,
/* don't open receive window */
utcb->crd_rcv = Nova::Obj_crd();
/* not used on base-nova */
utcb->msg[0] = 0;
utcb->msg()[0] = 0;
/* method number of RPC interface to be called on server side */
utcb->msg[1] = 0;
utcb->msg()[1] = 0;
utcb->set_msg_word(2);
Nova::Crd crd = Genode::Capability_space::crd(arg1);
@ -50,7 +50,7 @@ long Test::cap_void_manual(Genode::Native_capability dst,
/* restore original receive window */
utcb->crd_rcv = orig_crd;
local_reply = utcb->msg[1];
return (res == Nova::NOVA_OK && utcb->msg_words() == 3 && utcb->msg[2])
? utcb->msg[0] : Genode::Rpc_exception_code::INVALID_OBJECT;
local_reply = utcb->msg()[1];
return (res == Nova::NOVA_OK && utcb->msg_words() == 3 && utcb->msg()[2])
? utcb->msg()[0] : Genode::Rpc_exception_code::INVALID_OBJECT;
}

View File

@ -438,7 +438,7 @@ class Pager : private Genode::Thread {
while (1) { }
}
Genode::addr_t map_from = utcb->msg[0];
Genode::addr_t map_from = utcb->msg()[0];
// Genode::error("pager: got map request ", Genode::Hex(map_from));
utcb->set_msg_word(0);
@ -524,14 +524,14 @@ class Cause_mapping : public Genode::Thread {
// touch_read((unsigned char *)_mem_st);
nova_utcb->msg[0] = _mem_st;
nova_utcb->msg()[0] = _mem_st;
nova_utcb->set_msg_word(1);
nova_utcb->crd_rcv = Nova::Mem_crd(_mem_nd >> 12, 0,
_mapping_rwx);
Nova::call(_call_to_map.local_name());
//touch_read((unsigned char *)_mem_nd);
nova_utcb->msg[0] = _mem_nd;
nova_utcb->msg()[0] = _mem_nd;
nova_utcb->set_msg_word(1);
nova_utcb->crd_rcv = Nova::Mem_crd((_mem_nd + 0x1000) >> 12, 0,
_mapping_rwx);

View File

@ -82,7 +82,7 @@ static bool map_eager(Genode::addr_t const page, unsigned log2_order)
while (true) {
/* setup faked page fault information */
utcb->set_msg_word(((addr_t)&utcb->qual[2] - (addr_t)utcb->msg) /
utcb->set_msg_word(((addr_t)&utcb->qual[2] - (addr_t)utcb->msg()) /
sizeof(addr_t));
utcb->ip = reinterpret_cast<addr_t>(map_eager);
utcb->qual[1] = page;

View File

@ -45,7 +45,7 @@ class Vmm::Utcb_guard
Nova::Utcb *utcb =
reinterpret_cast<Nova::Utcb *>(Thread::myself()->utcb());
unsigned header_len = (char *)utcb->msg - (char *)utcb;
unsigned header_len = (char *)utcb->msg() - (char *)utcb;
unsigned len = header_len + utcb->msg_words() * sizeof(Nova::mword_t);
Genode::memcpy(&_backup_utcb, utcb, len);
@ -57,7 +57,7 @@ class Vmm::Utcb_guard
{
Nova::Utcb *utcb = reinterpret_cast<Nova::Utcb *>(&_backup_utcb);
unsigned header_len = (char *)utcb->msg - (char *)utcb;
unsigned header_len = (char *)utcb->msg() - (char *)utcb;
unsigned len = header_len + utcb->msg_words() * sizeof(Nova::mword_t);
Genode::memcpy(Thread::myself()->utcb(), utcb, len);
}