diff options
| author | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-12-30 20:56:19 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-12-30 20:56:19 +0100 |
| commit | e02c25872a51595954da9eb33a321a7d7ed7e5d2 (patch) | |
| tree | d3fff54b2ff74a5916d0f1b270ec2e8dfa490b79 /dev/Kernel/src/Utils.cc | |
| parent | 224e747b04022a5b8f8577fd730e907febf90a75 (diff) | |
IMPL: Process scheduler and bit map mgr fixes.
- Finally got it working, at least before execution, need to fix
the VMMgr now.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'dev/Kernel/src/Utils.cc')
| -rw-r--r-- | dev/Kernel/src/Utils.cc | 35 |
1 files changed, 8 insertions, 27 deletions
diff --git a/dev/Kernel/src/Utils.cc b/dev/Kernel/src/Utils.cc index 448e17b7..9f4a8609 100644 --- a/dev/Kernel/src/Utils.cc +++ b/dev/Kernel/src/Utils.cc @@ -10,10 +10,6 @@ namespace Kernel { Int32 rt_string_cmp(const Char* src, const Char* cmp, Size size) { - if (!cmp || - !src) - return 1; - Int32 counter = 0; for (Size index = 0; index < size; ++index) @@ -51,19 +47,14 @@ namespace Kernel { SizeT cnt{0}; - do - { + while (ptr[cnt] != 0) ++cnt; - } while (ptr[cnt] != 0); return cnt; } voidPtr rt_set_memory(voidPtr src, UInt32 value, Size len) { - if (!src || len < 1) - return nullptr; - UInt32* start = reinterpret_cast<UInt32*>(src); while (len) @@ -78,12 +69,6 @@ namespace Kernel Int rt_move_memory(const voidPtr src, voidPtr dst, Size len) { - if (len < 1) - return 2; - - if (!src || !dst) - return 1; - Char* srcChr = reinterpret_cast<Char*>(src); Char* dstChar = reinterpret_cast<Char*>(dst); SizeT index = 0; @@ -101,9 +86,6 @@ namespace Kernel Int rt_copy_memory(const voidPtr src, voidPtr dst, Size len) { - if (len < 1) - return 0; - char* srcChr = reinterpret_cast<char*>(src); char* dstChar = reinterpret_cast<char*>(dst); Size index = 0; @@ -114,23 +96,22 @@ namespace Kernel ++index; } + dstChar[index] = 0; + return index; } - const Char* rt_alloc_string(const Char* text) + const Char* rt_alloc_string(const Char* src) { - if (!text[0]) - return nullptr; - - const Char* string = new Char[rt_string_len(text)]; + const Char* string = new Char[rt_string_len(src) + 1]; if (!string) return nullptr; - voidPtr vText = reinterpret_cast<voidPtr>(const_cast<char*>(text)); - voidPtr vStr = reinterpret_cast<voidPtr>(const_cast<char*>(string)); + voidPtr v_src = reinterpret_cast<voidPtr>(const_cast<char*>(src)); + voidPtr v_dst = reinterpret_cast<voidPtr>(const_cast<char*>(string)); - rt_copy_memory(vText, vStr, rt_string_len(text)); + rt_copy_memory(v_src, v_dst, rt_string_len(src) + 1); return string; } |
