Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a few utility classes, cleaned up the include order of .h files…
…, and started to make the Rust kernel own domain message queues rather than the Rust domains themselves.
- Loading branch information
Showing
16 changed files
with
250 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#include "rust_internal.h" | ||
|
||
rust_kernel::rust_kernel(rust_srv *srv) : | ||
_region(srv->local_region), | ||
_log(srv, NULL), | ||
domains(srv->local_region), | ||
message_queues(srv->local_region) { | ||
// Nop. | ||
} | ||
|
||
rust_kernel::~rust_kernel() { | ||
// Nop. | ||
} | ||
|
||
void | ||
rust_kernel::register_domain(rust_dom *dom) { | ||
domains.append(dom); | ||
} | ||
|
||
void | ||
rust_kernel::deregister_domain(rust_dom *dom) { | ||
domains.remove(dom); | ||
} | ||
|
||
void | ||
rust_kernel::log_all_domain_state() { | ||
log(rust_log::KERN, "log_all_domain_state: %d domains", domains.length()); | ||
for (uint32_t i = 0; i < domains.length(); i++) { | ||
domains[i]->log_state(); | ||
} | ||
} | ||
|
||
void | ||
rust_kernel::log(uint32_t type_bits, char const *fmt, ...) { | ||
char buf[256]; | ||
if (_log.is_tracing(type_bits)) { | ||
va_list args; | ||
va_start(args, fmt); | ||
vsnprintf(buf, sizeof(buf), fmt, args); | ||
_log.trace_ln(NULL, type_bits, buf); | ||
va_end(args); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#ifndef RUST_KERNEL_H | ||
#define RUST_KERNEL_H | ||
|
||
/** | ||
* A global object shared by all domains. | ||
*/ | ||
class rust_kernel { | ||
memory_region &_region; | ||
rust_log _log; | ||
public: | ||
synchronized_indexed_list<rust_dom> domains; | ||
synchronized_indexed_list<lock_free_queue<rust_message*> > message_queues; | ||
rust_kernel(rust_srv *srv); | ||
void register_domain(rust_dom *dom); | ||
void deregister_domain(rust_dom *dom); | ||
void log_all_domain_state(); | ||
void log(uint32_t type_bits, char const *fmt, ...); | ||
virtual ~rust_kernel(); | ||
}; | ||
|
||
#endif /* RUST_KERNEL_H */ |
Oops, something went wrong.