summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--Meta/Kernel.svg36
-rw-r--r--Private/CRT/__mpcc_defines.hxx9
-rw-r--r--Private/CRT/__mpcc_exception.hxx46
-rw-r--r--Private/CRT/__mpcc_malloc.hxx29
-rw-r--r--Private/NewKit/Macros.hpp4
-rw-r--r--Private/Source/Utils.cxx25
-rw-r--r--Private/makefile6
-rw-r--r--ReadMe.md1
8 files changed, 113 insertions, 43 deletions
diff --git a/Meta/Kernel.svg b/Meta/Kernel.svg
deleted file mode 100644
index fdfd1e73..00000000
--- a/Meta/Kernel.svg
+++ /dev/null
@@ -1,36 +0,0 @@
-<svg width="62" height="40" viewBox="0 0 62 40" fill="none" xmlns="http://www.w3.org/2000/svg">
-<g filter="url(#filter0_d_0_1)">
-<path d="M47.683 0.541415L18 12.5373V19.4721C18 19.9113 18.1446 20.3383 18.4114 20.6871L25.5341 30L55.7629 17.5254C56.5116 17.2165 57 16.4865 57 15.6767V9.40299L49.9575 1.10186C49.3995 0.444135 48.4827 0.218233 47.683 0.541415Z" fill="url(#paint0_linear_0_1)"/>
-<path d="M57 9.40299L25.5341 22.3881M57 9.40299L49.9575 1.10186C49.3995 0.444135 48.4827 0.218233 47.683 0.541415L18 12.5373M57 9.40299V15.6767C57 16.4865 56.5116 17.2165 55.7629 17.5254L25.5341 30M25.5341 22.3881L18 12.5373M25.5341 22.3881V30M18 12.5373V19.4721C18 19.9113 18.1446 20.3383 18.4114 20.6871L25.5341 30" stroke="#005999" stroke-width="0.5"/>
-</g>
-<g filter="url(#filter1_d_0_1)">
-<path d="M52.5856 21.3927C54.1308 20.2328 54.4606 18.0193 53.3235 16.4432C52.1863 14.8672 50.0161 14.5307 48.471 15.6906L38.0802 23.5H27.6114C26.8475 23.5 26.2225 22.8625 26.2225 22.0833C26.2225 21.3042 26.8475 20.6667 27.6114 20.6667H34.5559C36.0924 20.6667 37.3337 19.4005 37.3337 17.8333C37.3337 16.2661 36.0924 15 34.5559 15H20.8144C18.2883 15 15.8404 15.8766 13.8699 17.4792L9.97229 20.6667H6.77781C5.24133 20.6667 4 21.9328 4 23.5V29.1667C4 30.7339 5.24133 32 6.77781 32H34.5993C37.1167 32 39.5733 31.1766 41.6046 29.6536L52.5943 21.3927H52.5856ZM20.8057 20.6578C20.8099 20.6638 20.8125 20.6707 20.8134 20.6779C20.8143 20.6852 20.8134 20.6925 20.8108 20.6993C20.8082 20.7061 20.8041 20.7122 20.7986 20.717C20.7932 20.7217 20.7867 20.725 20.7797 20.7266C20.7728 20.7282 20.7655 20.728 20.7586 20.726C20.7517 20.7241 20.7454 20.7204 20.7402 20.7153C20.7351 20.7103 20.7312 20.704 20.729 20.697C20.7268 20.6901 20.7263 20.6827 20.7276 20.6755C20.7235 20.6696 20.7208 20.6627 20.72 20.6554C20.7191 20.6482 20.72 20.6408 20.7225 20.634C20.7251 20.6272 20.7293 20.6211 20.7347 20.6164C20.7401 20.6116 20.7466 20.6083 20.7536 20.6067C20.7606 20.6051 20.7679 20.6053 20.7748 20.6073C20.7816 20.6093 20.7879 20.613 20.7931 20.618C20.7983 20.6231 20.8021 20.6293 20.8043 20.6363C20.8065 20.6432 20.807 20.6506 20.8057 20.6578Z" fill="#FFE5D2"/>
-<path d="M51.0867 21.8927L52.2854 20.9928C53.6105 19.9982 53.8973 18.0931 52.918 16.7358C51.943 15.3845 50.0905 15.1003 48.7714 16.0903L51.0867 21.8927ZM51.0867 21.8927H51.097L41.3046 29.2536C39.359 30.7123 37.0074 31.5 34.5993 31.5H6.77781C5.52676 31.5 4.5 30.4671 4.5 29.1667V23.5C4.5 22.1996 5.52676 21.1667 6.77781 21.1667H9.97229H10.1507L10.2888 21.0537L14.1854 17.8671C14.1856 17.8669 14.1858 17.8667 14.186 17.8666C16.0682 16.336 18.4048 15.5 20.8144 15.5H34.5559C35.8069 15.5 36.8337 16.5329 36.8337 17.8333C36.8337 19.1338 35.8069 20.1667 34.5559 20.1667H27.6114C26.562 20.1667 25.7225 21.0374 25.7225 22.0833C25.7225 23.1293 26.562 24 27.6114 24H38.0802H38.2472L38.3806 23.8997L48.7711 16.0905L51.0867 21.8927ZM20.8057 20.6578L20.8358 20.6631L20.8759 20.6703L21.2125 20.73C21.2107 20.7402 21.2085 20.7503 21.206 20.7604C21.2017 20.7774 21.1965 20.7942 21.1903 20.8107C21.1867 20.8201 21.1829 20.8293 21.1788 20.8384C21.1523 20.8965 21.1136 20.9491 21.0646 20.9921C21.06 20.9961 21.0554 21.0001 21.0506 21.0039C20.9967 21.0476 20.933 21.0787 20.8641 21.0943C20.8638 21.0944 20.8635 21.0945 20.8631 21.0946C20.7941 21.1101 20.7224 21.1093 20.6538 21.0924C20.6482 21.0911 20.6427 21.0896 20.6372 21.088C20.5733 21.0697 20.5149 21.038 20.4655 20.9956C20.4578 20.989 20.4503 20.9822 20.4431 20.9751C20.4301 20.9623 20.418 20.9489 20.4067 20.9349C20.4005 20.9271 20.3944 20.9191 20.3887 20.9109L20.6694 20.716L20.7051 20.6912L20.7276 20.6755M20.8057 20.6578L20.8283 20.6422L20.864 20.6174L21.1446 20.4224C21.1389 20.4142 21.1329 20.4062 21.1266 20.3984C21.1154 20.3844 21.1032 20.371 21.0903 20.3583C21.083 20.3512 21.0756 20.3443 21.0679 20.3377C21.0185 20.2954 20.96 20.2636 20.8961 20.2453C20.8906 20.2437 20.8851 20.2423 20.8796 20.2409C20.8109 20.224 20.7393 20.2233 20.6702 20.2388C20.6699 20.2388 20.6695 20.2389 20.6692 20.239C20.6003 20.2546 20.5366 20.2858 20.4827 20.3294C20.478 20.3333 20.4733 20.3372 20.4687 20.3412C20.4197 20.3843 20.381 20.4368 20.3546 20.495C20.3505 20.504 20.3466 20.5133 20.3431 20.5226C20.3369 20.5391 20.3316 20.5559 20.3273 20.5729C20.3248 20.583 20.3226 20.5932 20.3208 20.6033L20.6574 20.6631L20.6975 20.6702L20.7276 20.6755M20.8057 20.6578C20.8063 20.6545 20.8065 20.6512 20.8064 20.6479C20.8063 20.6469 20.8063 20.6459 20.8061 20.6449C20.8058 20.642 20.8052 20.6391 20.8043 20.6363C20.8031 20.6325 20.8015 20.629 20.7994 20.6257C20.7976 20.6229 20.7955 20.6203 20.7931 20.618C20.7922 20.6171 20.7912 20.6163 20.7902 20.6154C20.7857 20.6117 20.7804 20.6089 20.7748 20.6073C20.7679 20.6053 20.7606 20.6051 20.7536 20.6067C20.7533 20.6068 20.7529 20.6069 20.7526 20.607C20.746 20.6086 20.7399 20.6118 20.7347 20.6164C20.73 20.6205 20.7262 20.6257 20.7236 20.6315C20.7232 20.6323 20.7229 20.6331 20.7225 20.634C20.7215 20.6368 20.7207 20.6397 20.7202 20.6426C20.7195 20.6468 20.7194 20.6512 20.72 20.6554C20.7203 20.6579 20.7208 20.6603 20.7214 20.6626C20.7218 20.6637 20.7222 20.6649 20.7226 20.666C20.7239 20.6693 20.7256 20.6726 20.7276 20.6755M20.8057 20.6578C20.8078 20.6608 20.8095 20.664 20.8108 20.6674C20.8112 20.6685 20.8116 20.6696 20.8119 20.6707C20.8126 20.6731 20.8131 20.6755 20.8134 20.6779C20.8139 20.6822 20.8138 20.6865 20.8131 20.6907C20.8127 20.6936 20.8119 20.6965 20.8108 20.6993C20.8105 20.7002 20.8101 20.701 20.8098 20.7019C20.8072 20.7076 20.8034 20.7128 20.7986 20.717C20.7935 20.7215 20.7873 20.7247 20.7807 20.7264C20.7804 20.7265 20.7801 20.7265 20.7797 20.7266C20.7728 20.7282 20.7655 20.728 20.7586 20.726C20.7529 20.7244 20.7477 20.7216 20.7431 20.7179C20.7421 20.7171 20.7412 20.7162 20.7402 20.7153C20.7379 20.713 20.7358 20.7104 20.734 20.7076C20.7319 20.7044 20.7302 20.7008 20.729 20.697C20.7281 20.6942 20.7275 20.6914 20.7272 20.6885C20.7271 20.6875 20.727 20.6865 20.727 20.6855C20.7268 20.6822 20.727 20.6788 20.7276 20.6755M20.2237 20.7162C20.2264 20.7386 20.2305 20.7608 20.236 20.7826C20.2401 20.8048 20.2456 20.8267 20.2525 20.8483C20.2792 20.9325 20.3262 21.0096 20.3902 21.0724C20.4543 21.1352 20.5334 21.1817 20.6211 21.2067C20.7088 21.2318 20.8014 21.2344 20.8903 21.2143C20.9792 21.1941 21.061 21.152 21.1286 21.0927C21.1961 21.0334 21.2473 20.9588 21.2785 20.8761C21.3098 20.7934 21.3204 20.7045 21.3097 20.6172C21.3069 20.5947 21.3028 20.5725 21.2973 20.5507C21.2932 20.5286 21.2877 20.5066 21.2809 20.485C21.2542 20.4008 21.2072 20.3237 21.1431 20.261C21.0791 20.1982 20.9999 20.1517 20.9123 20.1266C20.8246 20.1015 20.732 20.0989 20.6431 20.1191C20.5542 20.1392 20.4724 20.1813 20.4048 20.2407C20.3373 20.2999 20.2861 20.3745 20.2548 20.4573C20.2235 20.54 20.213 20.6289 20.2237 20.7162Z" stroke="#181818"/>
-</g>
-<defs>
-<filter id="filter0_d_0_1" x="13.75" y="0.145597" width="47.5" height="38.1587" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
-<feFlood flood-opacity="0" result="BackgroundImageFix"/>
-<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
-<feOffset dy="4"/>
-<feGaussianBlur stdDeviation="2"/>
-<feComposite in2="hardAlpha" operator="out"/>
-<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0"/>
-<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_0_1"/>
-<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_0_1" result="shape"/>
-</filter>
-<filter id="filter1_d_0_1" x="0" y="15" width="58" height="25" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
-<feFlood flood-opacity="0" result="BackgroundImageFix"/>
-<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
-<feOffset dy="4"/>
-<feGaussianBlur stdDeviation="2"/>
-<feComposite in2="hardAlpha" operator="out"/>
-<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0"/>
-<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_0_1"/>
-<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_0_1" result="shape"/>
-</filter>
-<linearGradient id="paint0_linear_0_1" x1="37.5" y1="0" x2="37.5" y2="30" gradientUnits="userSpaceOnUse">
-<stop stop-color="#0094FF"/>
-<stop offset="1" stop-color="#005999"/>
-</linearGradient>
-</defs>
-</svg>
diff --git a/Private/CRT/__mpcc_defines.hxx b/Private/CRT/__mpcc_defines.hxx
index 3992013c..0e295d25 100644
--- a/Private/CRT/__mpcc_defines.hxx
+++ b/Private/CRT/__mpcc_defines.hxx
@@ -86,4 +86,13 @@ typedef union double_cast {
#endif // ifndef __GNUC__
+/// Include these helpers as well.
+
+#ifdef __STD_CXX__
+
+#include <CRT/__mpcc_exception.hxx>
+#include <CRT/__mpcc_malloc.hxx>
+
+#endif // ifdef __STD_CXX__
+
#endif /* __MPCC_DEF__ */
diff --git a/Private/CRT/__mpcc_exception.hxx b/Private/CRT/__mpcc_exception.hxx
new file mode 100644
index 00000000..a41d1731
--- /dev/null
+++ b/Private/CRT/__mpcc_exception.hxx
@@ -0,0 +1,46 @@
+/* -------------------------------------------
+
+ Copyright Mahrouss Logic
+
+------------------------------------------- */
+
+#pragma once
+
+/// This file is an implementation of __throw* family of functions.
+
+#include <KernelKit/DebugOutput.hpp>
+
+namespace std
+{
+#ifdef __x86_64__
+#ifdef __KERNEL__
+ inline void __throw_general(void)
+ {
+ asm ("int $0xD");
+ }
+#else
+ inline void __throw_general(void)
+ {
+ __exit(33);
+ }
+#endif
+#else
+ inline void __throw_general(void)
+ {
+ __exit(33);
+ }
+#endif // if __x86_64__
+
+ inline void __throw_domain_error(const char* error)
+ {
+ NewOS::kcout << "MPCC C++: Domain error: " << error << "\r";
+ __throw_general();
+ CANT_REACH(); // prevent from continuing.
+ }
+}
+
+EXTERN_C void abort(void)
+{
+ std::__throw_general();
+ CANT_REACH();
+}
diff --git a/Private/CRT/__mpcc_malloc.hxx b/Private/CRT/__mpcc_malloc.hxx
new file mode 100644
index 00000000..35b0ffbc
--- /dev/null
+++ b/Private/CRT/__mpcc_malloc.hxx
@@ -0,0 +1,29 @@
+/* -------------------------------------------
+
+ Copyright Mahrouss Logic
+
+------------------------------------------- */
+
+#pragma once
+
+#include <KernelKit/KernelHeap.hpp>
+
+namespace stdx
+{
+/// @brief allocate a new class.
+/// @tparam KindClass the class type to allocate.
+template <typename KindClass, typename... Args>
+inline NewOS::VoidPtr allocate(Args&&... args)
+{
+ return new KindClass(NewOS::forward(args)...);
+}
+
+/// @brief free a class.
+/// @tparam KindClass the class type to allocate.
+template <typename KindClass>
+inline NewOS::Void release(KindClass ptr)
+{
+ if (!ptr) return;
+ delete ptr;
+}
+} // namespace stdx
diff --git a/Private/NewKit/Macros.hpp b/Private/NewKit/Macros.hpp
index 86060a02..9366fe5c 100644
--- a/Private/NewKit/Macros.hpp
+++ b/Private/NewKit/Macros.hpp
@@ -90,10 +90,6 @@
#define CONST const
-#ifndef self
-#define self this
-#endif
-
#define STRINGIFY(X) #X
#define NEWOS_UNUSED(X) ((void)X)
diff --git a/Private/Source/Utils.cxx b/Private/Source/Utils.cxx
index 868705bc..b0b3be8d 100644
--- a/Private/Source/Utils.cxx
+++ b/Private/Source/Utils.cxx
@@ -211,18 +211,43 @@ namespace NewOS
}
} // namespace NewOS
+////////////////////////////////////////////////////////////////////////////////////////
+/// Exported C functions
+////////////////////////////////////////////////////////////////////////////////////////
+
+/// @brief memset in C++
EXTERN_C void memset(void* dst, char src, size_t len)
{
NewOS::rt_set_memory(dst, src, len);
}
+/// @brief memcpy in C++
EXTERN_C void memcpy(void* dst, void* src, size_t len)
{
NewOS::rt_copy_memory(src, dst, len);
}
+/// @brief memmove in C++
+EXTERN_C void* memmove(void* dst, void* src, size_t len)
+{
+ NewOS::rt_copy_memory(src, dst, len);
+ return dst;
+}
+
/// @brief strlen definition in C++.
EXTERN_C size_t strlen(const char* whatToCheck)
{
return NewOS::rt_string_len(whatToCheck);
}
+
+/// @brief memcmp in C++
+EXTERN_C NewOS::SizeT memcmp(void* dst, void* src, size_t len)
+{
+ return NewOS::rt_string_cmp((char*)src, (char*)dst, len);
+}
+
+/// @brief strcmp in C++
+EXTERN_C NewOS::SizeT strcmp(char* dst, char* src, size_t len)
+{
+ return NewOS::rt_string_cmp(src, dst, len);
+}
diff --git a/Private/makefile b/Private/makefile
index 6a73c10d..d665c5fe 100644
--- a/Private/makefile
+++ b/Private/makefile
@@ -5,8 +5,10 @@
CC = x86_64-w64-mingw32-gcc
LD = x86_64-w64-mingw32-ld
-CCFLAGS = -c -ffreestanding -fPIC -D__NEWOS_AMD64__ -mno-red-zone -fno-rtti -fno-exceptions \
- -std=c++20 -D__FSKIT_NEWFS__ -D__KERNEL__ -D__HAVE_MAHROUSS_APIS__ -D__MAHROUSS__ -I../ -I./
+CCFLAGS = -c -fPIC -D__NEWOS_AMD64__ -mno-red-zone -fno-rtti -fno-exceptions \
+ -std=c++20 -D__FSKIT_NEWFS__ -D__KERNEL__ -D__HAVE_MAHROUSS_APIS__ -D__MAHROUSS__ -I../ -I./ \
+ -DBLEND2D_NO_STDCXX -DBLEND2D_NO_TLS -DBLEND2D_EMBED
+
ASM = nasm
ifneq ($(ATA_PIO_SUPPORT), )
diff --git a/ReadMe.md b/ReadMe.md
index c169c960..8046b066 100644
--- a/ReadMe.md
+++ b/ReadMe.md
@@ -1,5 +1,4 @@
<div align="center">
-<img src="../Meta/Kernel.svg" width="96" height="96"/>
<h1>NewOS</h1>
</div>