mirror of
https://github.com/EnderIce2/Fennix.git
synced 2025-07-01 18:39:16 +00:00
kernel: add arm architecture support
Some checks failed
Build OS / Deploy Documentation to GitHub Pages (push) Failing after 5m35s
Build OS / Analyze (${{ matrix.language }}) (manual, c-cpp) (push) Has been cancelled
Build OS / Build Cross-Compiler & Toolchain (push) Has been cancelled
Build OS / Build amd64 (push) Has been cancelled
Build OS / Build i386 (push) Has been cancelled
Build OS / Build aarch64 (push) Has been cancelled
Build OS / Build arm (push) Has been cancelled
Some checks failed
Build OS / Deploy Documentation to GitHub Pages (push) Failing after 5m35s
Build OS / Analyze (${{ matrix.language }}) (manual, c-cpp) (push) Has been cancelled
Build OS / Build Cross-Compiler & Toolchain (push) Has been cancelled
Build OS / Build amd64 (push) Has been cancelled
Build OS / Build i386 (push) Has been cancelled
Build OS / Build aarch64 (push) Has been cancelled
Build OS / Build arm (push) Has been cancelled
Signed-off-by: EnderIce2 <enderice2@protonmail.com>
This commit is contained in:
@ -62,7 +62,7 @@ EXTERNC int strncmp(const char *s1, const char *s2, size_t n)
|
||||
return 0;
|
||||
}
|
||||
|
||||
EXTERNC long unsigned strlen(const char s[])
|
||||
EXTERNC size_t strlen(const char s[])
|
||||
{
|
||||
if (Config.SIMD)
|
||||
{
|
||||
|
@ -192,7 +192,9 @@ extern "C" __noreturn void __cxa_throw(void *thrown_object,
|
||||
Exception->terminateHandler = &terminate_header_stub;
|
||||
Exception->unwindHeader.exception_cleanup = &exception_cleanup_stub;
|
||||
INIT_EXCEPTION_CLASS(&Exception->unwindHeader.exception_class);
|
||||
#ifndef __arm__
|
||||
Exception->adjustedPtr = thrown_object;
|
||||
#endif
|
||||
|
||||
_Unwind_RaiseException(&Exception->unwindHeader);
|
||||
__cxa_begin_catch(&Exception->unwindHeader);
|
||||
|
@ -134,7 +134,7 @@ void md5Finalize(MD5Context *ctx)
|
||||
(uint32_t)(ctx->input[(j * 4)]);
|
||||
}
|
||||
input[14] = (uint32_t)(ctx->size * 8);
|
||||
#ifdef __i386__
|
||||
#if defined(__i386__) || defined(__arm__)
|
||||
input[15] = (uint32_t)((uint64_t)(((uint64_t)ctx->size >> 32) | ((uint64_t)ctx->size << 32)) >> 32);
|
||||
#else
|
||||
input[15] = (uint32_t)((ctx->size * 8) >> 32);
|
||||
|
@ -42,8 +42,37 @@ void *operator new[](std::size_t count)
|
||||
throw std::bad_alloc{};
|
||||
}
|
||||
|
||||
// void *operator new(std::size_t count, std::align_val_t al)
|
||||
// void *operator new[](std::size_t count, std::align_val_t al)
|
||||
void *operator new(std::size_t count, std::align_val_t al)
|
||||
{
|
||||
if (count == 0)
|
||||
++count;
|
||||
|
||||
std::size_t alignment = static_cast<std::size_t>(al);
|
||||
void *ptr = kmalloc(count + alignment - 1 + sizeof(void *));
|
||||
if (!ptr)
|
||||
throw std::bad_alloc{};
|
||||
|
||||
void *aligned_ptr = reinterpret_cast<void *>(
|
||||
(reinterpret_cast<std::size_t>(ptr) + sizeof(void *) + alignment - 1) & ~(alignment - 1));
|
||||
reinterpret_cast<void **>(aligned_ptr)[-1] = ptr;
|
||||
return aligned_ptr;
|
||||
}
|
||||
|
||||
void *operator new[](std::size_t count, std::align_val_t al)
|
||||
{
|
||||
if (count == 0)
|
||||
++count;
|
||||
|
||||
std::size_t alignment = static_cast<std::size_t>(al);
|
||||
void *ptr = kmalloc(count + alignment - 1 + sizeof(void *));
|
||||
if (!ptr)
|
||||
throw std::bad_alloc{};
|
||||
|
||||
void *aligned_ptr = reinterpret_cast<void *>(
|
||||
(reinterpret_cast<std::size_t>(ptr) + sizeof(void *) + alignment - 1) & ~(alignment - 1));
|
||||
reinterpret_cast<void **>(aligned_ptr)[-1] = ptr;
|
||||
return aligned_ptr;
|
||||
}
|
||||
|
||||
// void *operator new(std::size_t count, const std::nothrow_t &tag)
|
||||
// void *operator new[](std::size_t count, const std::nothrow_t &tag)
|
||||
@ -62,8 +91,24 @@ void operator delete(void *ptr) noexcept { kfree(ptr); }
|
||||
|
||||
void operator delete[](void *ptr) noexcept { kfree(ptr); }
|
||||
|
||||
// void operator delete(void *ptr, std::align_val_t al) noexcept
|
||||
// void operator delete[](void *ptr, std::align_val_t al) noexcept
|
||||
void operator delete(void *ptr, std::align_val_t al) noexcept
|
||||
{
|
||||
if (!ptr)
|
||||
return;
|
||||
|
||||
void *original_ptr = reinterpret_cast<void **>(ptr)[-1];
|
||||
kfree(original_ptr);
|
||||
}
|
||||
|
||||
void operator delete[](void *ptr, std::align_val_t al) noexcept
|
||||
{
|
||||
if (!ptr)
|
||||
return;
|
||||
|
||||
void *original_ptr = reinterpret_cast<void **>(ptr)[-1];
|
||||
kfree(original_ptr);
|
||||
}
|
||||
|
||||
void operator delete(void *ptr, std::size_t) noexcept { kfree(ptr); }
|
||||
|
||||
void operator delete[](void *ptr, std::size_t sz) noexcept { kfree(ptr); }
|
||||
|
Reference in New Issue
Block a user