summaryrefslogtreecommitdiffhomepage
path: root/Private/Source
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-01-30 08:05:00 +0100
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-01-30 08:05:00 +0100
commitf22e69b8837b84548f79e0b8ca7bef24605c6611 (patch)
treecda020af66538453cc3d8fb16a41e2e3eec7b01e /Private/Source
parenta8c17ccd6d97cc78830917dc6282b040b21ba16c (diff)
Kernel: Update TODO_LIST.txt, fix CRC32, add .vscode dir in root.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'Private/Source')
-rw-r--r--Private/Source/Crc32.cxx20
-rw-r--r--Private/Source/SMPManager.cxx6
-rw-r--r--Private/Source/ThreadLocalStorage.cxx5
3 files changed, 14 insertions, 17 deletions
diff --git a/Private/Source/Crc32.cxx b/Private/Source/Crc32.cxx
index e711626d..233d9847 100644
--- a/Private/Source/Crc32.cxx
+++ b/Private/Source/Crc32.cxx
@@ -58,21 +58,13 @@ UInt kCrcTbl[kCrcCnt] = {
0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94,
0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d};
-static Int crc_byte(Int crc, UChar byte) {
- crc = (crc >> 8) ^
- kCrcTbl[(byte) ^ (crc & 0x000000FF)]; // shift 8 bytes to the right
+/// @brief calculate CRC32 of series of byte.
+Int ke_calculate_crc32(const Char *p, Int len) noexcept {
+ UInt32 crc = 0xffffffff;
- // XOR polynomial XOR the crc
- // without the 2 highest bytes
- return crc;
-}
-
-Int ke_crc32(const Char *byte, Int len) noexcept {
- Int checksum = 0;
-
- for (UChar index = 1; index < len; ++index)
- checksum = crc_byte(checksum, byte[index]);
+ while (len-- != 0) crc = kCrcTbl[((UInt8)crc ^ *(p++))] ^ (crc >> 8);
- return checksum;
+ // return (~crc); also works
+ return (crc ^ 0xffffffff);
}
} // namespace hCore
diff --git a/Private/Source/SMPManager.cxx b/Private/Source/SMPManager.cxx
index 05e47ea8..c261e6b8 100644
--- a/Private/Source/SMPManager.cxx
+++ b/Private/Source/SMPManager.cxx
@@ -121,9 +121,9 @@ bool SMPManager::Switch(HAL::StackFrame* stack) {
}
/**
- * Index hart
- * @param idx
- * @return
+ * Index Hardware thread
+ * @param idx the index
+ * @return the reference to the hardware thread.
*/
Ref<ProcessorCore> SMPManager::operator[](const SizeT& idx) {
return m_ThreadList[idx].Leak();
diff --git a/Private/Source/ThreadLocalStorage.cxx b/Private/Source/ThreadLocalStorage.cxx
index 66ec69d6..4e322e81 100644
--- a/Private/Source/ThreadLocalStorage.cxx
+++ b/Private/Source/ThreadLocalStorage.cxx
@@ -10,6 +10,11 @@
#include <KernelKit/ProcessManager.hpp>
#include <KernelKit/ThreadLocalStorage.hxx>
+/***********************************************************************************/
+/// @file ThreadLocalStorage.cxx
+/// @brief TLS implementation in kernel.
+/***********************************************************************************/
+
using namespace hCore;
/**