diff options
author | Benji Dial <benji@benjidial.net> | 2024-07-29 11:27:22 -0400 |
---|---|---|
committer | Benji Dial <benji@benjidial.net> | 2024-07-29 11:27:22 -0400 |
commit | be691582ee12613278af24cb5a824eeb357f6324 (patch) | |
tree | 5982ca3aad5257f515c93f62735ff3d630aa3ab3 /euler/source | |
parent | 3636fd21e079c47bd8d62e773e178f68fe9c2052 (diff) | |
download | hilbert-os-be691582ee12613278af24cb5a824eeb357f6324.tar.gz |
some work on compositor
Diffstat (limited to 'euler/source')
-rw-r--r-- | euler/source/entry.cpp | 2 | ||||
-rw-r--r-- | euler/source/std/cstdio.cpp | 1 | ||||
-rw-r--r-- | euler/source/std/string.cpp | 6 | ||||
-rw-r--r-- | euler/source/stream.cpp | 1 | ||||
-rw-r--r-- | euler/source/syscall.cpp | 13 |
5 files changed, 21 insertions, 2 deletions
diff --git a/euler/source/entry.cpp b/euler/source/entry.cpp index e79209c..ab721f1 100644 --- a/euler/source/entry.cpp +++ b/euler/source/entry.cpp @@ -6,6 +6,8 @@ int main(int argc, char **argv); extern "C" [[noreturn]] void _start() { + //TODO: call static initializers + auto argc_raw = euler::syscall::try_get_environment_variable("ARGC"); int argc = argc_raw.has_value() ? std::stoi(argc_raw.value()) : 0; diff --git a/euler/source/std/cstdio.cpp b/euler/source/std/cstdio.cpp index 8c12a7c..485efc3 100644 --- a/euler/source/std/cstdio.cpp +++ b/euler/source/std/cstdio.cpp @@ -1,4 +1,5 @@ #include <cstdio> +#include <string> extern "C" FILE *fopen(const char *filename, const char *mode) { diff --git a/euler/source/std/string.cpp b/euler/source/std/string.cpp index 31c47a5..ae397b1 100644 --- a/euler/source/std/string.cpp +++ b/euler/source/std/string.cpp @@ -44,6 +44,7 @@ namespace std { value = value * base + c - 'A' + 10; else break; + ++i; } if (pos != 0) @@ -75,10 +76,11 @@ namespace std { } std::string operator +(std::string &&lhs, std::string &&rhs) { + size_t og_lhs_s = lhs.size(); std::string s = std::move(lhs); - s.resize(lhs.size() + rhs.size()); + s.resize(og_lhs_s + rhs.size()); for (size_t i = 0; i < rhs.size(); ++i) - s[lhs.size() + i] = rhs[i]; + s[og_lhs_s + i] = rhs[i]; rhs.clear(); return s; } diff --git a/euler/source/stream.cpp b/euler/source/stream.cpp index faf2907..da973ba 100644 --- a/euler/source/stream.cpp +++ b/euler/source/stream.cpp @@ -1,4 +1,5 @@ #include <euler/stream.hpp> +#include <algorithm> #include <cstring> namespace euler { diff --git a/euler/source/syscall.cpp b/euler/source/syscall.cpp index b3ed3a8..0d30c4a 100644 --- a/euler/source/syscall.cpp +++ b/euler/source/syscall.cpp @@ -1,4 +1,6 @@ #include <euler/syscall.hpp> +#include <string> +#include <vector> extern "C" void __euler_do_syscall( uint64_t &rax, uint64_t &rdi, uint64_t &rsi, uint64_t &rdx); @@ -394,4 +396,15 @@ namespace euler::syscall { } + void set_thread_name(const std::string &name) { + + uint64_t rax = 24; + uint64_t rdi = (uint64_t)name.data(); + uint64_t rsi = name.size(); + uint64_t rdx; + + __euler_do_syscall(rax, rdi, rsi, rdx); + + } + } |