Genode platform fixes (#17521)

* Genode: move dyncall failures to runtime

Do not use the "error" pragma to warn that dynamic library loading is
not implemented, print a message at runtime and exit.

* Genode: use stricter dataspace type in page allocator

* Genode: remove compiler configuration from nim.cfg

Self-hosting Nim is not supported on Genode and defining the
cross-compilation environment can be done externally.

* Genode: use new mutex API

* Genode: call nim_component_construct as a C procedure

* Genode: implement echo for NimStringV2
This commit is contained in:
Emery Hemingway
2021-04-09 16:29:10 +02:00
committed by GitHub
parent 86a1dcf928
commit 8aa5991bea
7 changed files with 60 additions and 53 deletions

View File

@@ -13,7 +13,7 @@
/* Genode includes */
#include <base/semaphore.h>
#include <base/lock.h>
#include <base/mutex.h>
namespace Nim {
struct SysLock;
@@ -22,15 +22,14 @@ namespace Nim {
struct Nim::SysLock
{
Genode::Lock _lock_a, _lock_b;
Genode::Mutex _mutex_a, _mutex_b;
bool _locked;
void acquireSys()
{
_lock_a.lock();
Genode::Mutex::Guard guard(_mutex_a);
_locked = true;
_lock_a.unlock();
_lock_b.lock();
_mutex_b.acquire();
}
bool tryAcquireSys()
@@ -38,23 +37,22 @@ struct Nim::SysLock
if (_locked)
return false;
_lock_a.lock();
Genode::Mutex::Guard guard(_mutex_a);
if (_locked) {
_lock_a.unlock();
return false;
} else {
_locked = true;
_lock_b.lock();
_lock_a.unlock();
_mutex_b.acquire();
return true;
}
}
void releaseSys()
{
Genode::Mutex::Guard guard(_mutex_a);
_locked = false;
_lock_a.unlock();
_lock_b.unlock();
_mutex_b.release();
}
};