diff options
Diffstat (limited to 'kernel/include')
-rw-r--r-- | kernel/include/hilbert/kernel/application.hpp | 9 | ||||
-rw-r--r-- | kernel/include/hilbert/kernel/serial.hpp | 6 | ||||
-rw-r--r-- | kernel/include/hilbert/kernel/utility.hpp | 15 |
3 files changed, 27 insertions, 3 deletions
diff --git a/kernel/include/hilbert/kernel/application.hpp b/kernel/include/hilbert/kernel/application.hpp index a4b59ff..e7c7d2e 100644 --- a/kernel/include/hilbert/kernel/application.hpp +++ b/kernel/include/hilbert/kernel/application.hpp @@ -112,6 +112,8 @@ namespace hilbert::kernel::application { utility::list<string_pair> environment_variables; public: + utility::string name; + app_memory *memory; //set in get_framebuffer syscall @@ -121,13 +123,16 @@ namespace hilbert::kernel::application { uint64_t id; //this class takes ownership of memory - process(app_memory *memory); + process(app_memory *memory, const utility::string &name); ~process(); //arguments are utility::move'd void add_environment_variable( utility::string &&name, utility::string &&value); + //null if unset + utility::string *get_environment_variable(const utility::string &name); + void add_thread(thread *t); void notify_thread_ended(thread *t, int exit_code); void on_end_process(int exit_code); @@ -180,6 +185,8 @@ namespace hilbert::kernel::application { utility::maybe<unsigned> new_socket_stream_id; public: + utility::string name; + process *owner; //the cpu state is saved here when the thread is not running. diff --git a/kernel/include/hilbert/kernel/serial.hpp b/kernel/include/hilbert/kernel/serial.hpp index e7a44f2..7751fa0 100644 --- a/kernel/include/hilbert/kernel/serial.hpp +++ b/kernel/include/hilbert/kernel/serial.hpp @@ -1,5 +1,6 @@ #pragma once +#include <hilbert/kernel/utility.hpp> #include <stdint.h> namespace hilbert::kernel { @@ -15,6 +16,11 @@ namespace hilbert::kernel { } } + static inline void serial_putstr(const utility::string &str) { + for (unsigned i = 0; i < str.count; ++i) + serial_putchar(str.buffer[i]); + } + template <int digits, int dot_every = 4> static inline void serial_puthex(uint64_t n) { for (int d = digits - 1; d >= 0; --d) { diff --git a/kernel/include/hilbert/kernel/utility.hpp b/kernel/include/hilbert/kernel/utility.hpp index b7f1a1b..a21d3fe 100644 --- a/kernel/include/hilbert/kernel/utility.hpp +++ b/kernel/include/hilbert/kernel/utility.hpp @@ -107,6 +107,10 @@ namespace hilbert::kernel::utility { n->value = value; n->next = 0; n->prev = last; + if (last) + last->next = n; + else + first = n; last = n; } @@ -115,12 +119,19 @@ namespace hilbert::kernel::utility { n->value = value; n->next = 0; n->prev = last; + if (last) + last->next = n; + else + first = n; last = n; } void clear() { - for (node *n = first; n; n = n->next) - delete n; + if (first) { + for (node *n = first->next; n; n = n->next) + delete n->prev; + delete last; + } first = 0; last = 0; } |