summaryrefslogtreecommitdiff
path: root/AK
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-05-16 12:00:04 +0200
committerAndreas Kling <kling@serenityos.org>2020-05-16 12:00:04 +0200
commit21d5f4ada1a38cc90ff78a18d141e6477ccef333 (patch)
tree28cff77ef0ceb49a87ec973b30d76dc0628a1361 /AK
parentc12cfdea8799b24d2a8c57131e8563ce3dfd66cf (diff)
downloadserenity-21d5f4ada1a38cc90ff78a18d141e6477ccef333.zip
Kernel: Absorb LibBareMetal back into the kernel
This was supposed to be the foundation for some kind of pre-kernel environment, but nobody is working on it right now, so let's move everything back into the kernel and remove all the confusion.
Diffstat (limited to 'AK')
-rw-r--r--AK/Assertions.h2
-rw-r--r--AK/JsonObject.h2
-rw-r--r--AK/JsonValue.cpp4
-rw-r--r--AK/JsonValue.h14
-rw-r--r--AK/LogStream.cpp21
-rw-r--r--AK/LogStream.h18
-rw-r--r--AK/Memory.h8
-rw-r--r--AK/PrintfImplementation.h2
-rw-r--r--AK/kmalloc.h2
-rw-r--r--AK/kstdio.h4
10 files changed, 35 insertions, 42 deletions
diff --git a/AK/Assertions.h b/AK/Assertions.h
index 76a2a3d843..02dd366bd8 100644
--- a/AK/Assertions.h
+++ b/AK/Assertions.h
@@ -30,8 +30,6 @@
# if defined(KERNEL)
# include <Kernel/Assertions.h>
-# elif defined(BOOTSTRAPPER)
-# include <Bootstrapper/Output/Assertions.h>
# else
# include <assert.h>
# ifndef __serenity__
diff --git a/AK/JsonObject.h b/AK/JsonObject.h
index 4c50d09c48..a61ab44ed3 100644
--- a/AK/JsonObject.h
+++ b/AK/JsonObject.h
@@ -148,7 +148,7 @@ inline void JsonValue::serialize(Builder& builder) const
case Type::Bool:
builder.append(m_value.as_bool ? "true" : "false");
break;
-#if !defined(KERNEL) && !defined(BOOTSTRAPPER)
+#if !defined(KERNEL)
case Type::Double:
builder.appendf("%g", m_value.as_double);
break;
diff --git a/AK/JsonValue.cpp b/AK/JsonValue.cpp
index 88b57c9879..7bf3ccb542 100644
--- a/AK/JsonValue.cpp
+++ b/AK/JsonValue.cpp
@@ -100,7 +100,7 @@ bool JsonValue::equals(const JsonValue& other) const
if (is_string() && other.is_string() && as_string() == other.as_string())
return true;
-#if !defined(KERNEL) && !defined(BOOTSTRAPPER)
+#if !defined(KERNEL)
if (is_number() && other.is_number() && to_number<double>() == other.to_number<double>()) {
return true;
}
@@ -158,7 +158,7 @@ JsonValue::JsonValue(const char* cstring)
{
}
-#if !defined(BOOTSTRAPPER) && !defined(KERNEL)
+#if !defined(KERNEL)
JsonValue::JsonValue(double value)
: m_type(Type::Double)
{
diff --git a/AK/JsonValue.h b/AK/JsonValue.h
index 681f1fdcc6..ca596ce912 100644
--- a/AK/JsonValue.h
+++ b/AK/JsonValue.h
@@ -43,7 +43,7 @@ public:
UnsignedInt32,
Int64,
UnsignedInt64,
-#if !defined(KERNEL) && !defined(BOOTSTRAPPER)
+#if !defined(KERNEL)
Double,
#endif
Bool,
@@ -68,7 +68,7 @@ public:
JsonValue(i64);
JsonValue(u64);
-#if !defined(KERNEL) && !defined(BOOTSTRAPPER)
+#if !defined(KERNEL)
JsonValue(double);
#endif
JsonValue(bool);
@@ -172,7 +172,7 @@ public:
return *m_value.as_array;
}
-#if !defined(KERNEL) && !defined(BOOTSTRAPPER)
+#if !defined(KERNEL)
double as_double() const
{
ASSERT(is_double());
@@ -193,7 +193,7 @@ public:
bool is_u32() const { return m_type == Type::UnsignedInt32; }
bool is_i64() const { return m_type == Type::Int64; }
bool is_u64() const { return m_type == Type::UnsignedInt64; }
-#if !defined(KERNEL) && !defined(BOOTSTRAPPER)
+#if !defined(KERNEL)
bool is_double() const
{
return m_type == Type::Double;
@@ -211,7 +211,7 @@ public:
case Type::UnsignedInt32:
case Type::Int64:
case Type::UnsignedInt64:
-#if !defined(KERNEL) && !defined(BOOTSTRAPPER)
+#if !defined(KERNEL)
case Type::Double:
#endif
return true;
@@ -223,7 +223,7 @@ public:
template<typename T>
T to_number(T default_value = 0) const
{
-#if !defined(KERNEL) && !defined(BOOTSTRAPPER)
+#if !defined(KERNEL)
if (is_double())
return (T)as_double();
#endif
@@ -250,7 +250,7 @@ private:
StringImpl* as_string { nullptr };
JsonArray* as_array;
JsonObject* as_object;
-#if !defined(KERNEL) && !defined(BOOTSTRAPPER)
+#if !defined(KERNEL)
double as_double;
#endif
i32 as_i32;
diff --git a/AK/LogStream.cpp b/AK/LogStream.cpp
index 09342ce0ee..adb74c4c0c 100644
--- a/AK/LogStream.cpp
+++ b/AK/LogStream.cpp
@@ -34,8 +34,8 @@
# include <Kernel/Thread.h>
#endif
-#if !defined(KERNEL) && !defined(BOOTSTRAPPER)
-#include <stdio.h>
+#if !defined(KERNEL)
+# include <stdio.h>
#endif
namespace AK {
@@ -106,7 +106,7 @@ const LogStream& operator<<(const LogStream& stream, const void* value)
return stream << buffer;
}
-#if defined(__serenity__) && !defined(KERNEL) && !defined(BOOTSTRAPPER)
+#if defined(__serenity__) && !defined(KERNEL)
static TriState got_process_name = TriState::Unknown;
static char process_name_buffer[256];
#endif
@@ -114,7 +114,7 @@ static char process_name_buffer[256];
DebugLogStream dbg()
{
DebugLogStream stream;
-#if defined(__serenity__) && !defined(KERNEL) && !defined(BOOTSTRAPPER)
+#if defined(__serenity__) && !defined(KERNEL)
if (got_process_name == TriState::Unknown) {
if (get_process_name(process_name_buffer, sizeof(process_name_buffer)) == 0)
got_process_name = TriState::True;
@@ -124,19 +124,16 @@ DebugLogStream dbg()
if (got_process_name == TriState::True)
stream << "\033[33;1m" << process_name_buffer << '(' << getpid() << ")\033[0m: ";
#endif
-#if defined(__serenity__) && defined(KERNEL) && !defined(BOOTSTRAPPER)
+#if defined(__serenity__) && defined(KERNEL)
if (Kernel::Thread::current)
stream << "\033[34;1m[" << *Kernel::Thread::current << "]\033[0m: ";
else
stream << "\033[36;1m[Kernel]\033[0m: ";
#endif
-#if defined(BOOTSTRAPPER) && !defined(__serenity__) && !defined(KERNEL)
- stream << "\033[36;1m[Bootstrapper]\033[0m: ";
-#endif
return stream;
}
-#if defined(KERNEL)
+#ifdef KERNEL
KernelLogStream klog()
{
KernelLogStream stream;
@@ -146,14 +143,14 @@ KernelLogStream klog()
stream << "\033[36;1m[Kernel]\033[0m: ";
return stream;
}
-#elif !defined(BOOTSTRAPPER)
+#else
DebugLogStream klog()
{
return dbg();
}
#endif
-#if defined(KERNEL)
+#ifdef KERNEL
KernelLogStream::~KernelLogStream()
{
char newline = '\n';
@@ -167,7 +164,7 @@ DebugLogStream::~DebugLogStream()
write(&newline, 1);
}
-#if !defined(KERNEL) && !defined(BOOTSTRAPPER)
+#ifndef KERNEL
StdLogStream::~StdLogStream()
{
char newline = '\n';
diff --git a/AK/LogStream.h b/AK/LogStream.h
index ff8be765c3..e51556d351 100644
--- a/AK/LogStream.h
+++ b/AK/LogStream.h
@@ -30,7 +30,7 @@
#include <AK/Types.h>
#include <AK/kstdio.h>
-#if !defined(KERNEL) && !defined(BOOTSTRAPPER)
+#if !defined(KERNEL)
# include <AK/ScopedValueRollback.h>
# include <AK/StringView.h>
# include <errno.h>
@@ -42,7 +42,7 @@ namespace AK {
class LogStream {
public:
LogStream()
-#if !defined(KERNEL) && !defined(BOOTSTRAPPER)
+#if !defined(KERNEL)
: m_errno_restorer(errno)
#endif
{
@@ -52,7 +52,7 @@ public:
virtual void write(const char*, int) const = 0;
private:
-#if !defined(KERNEL) && !defined(BOOTSTRAPPER)
+#if !defined(KERNEL)
ScopedValueRollback<int> m_errno_restorer;
#endif
};
@@ -68,7 +68,7 @@ public:
}
};
-#if !defined(KERNEL) && !defined(BOOTSTRAPPER)
+#if !defined(KERNEL)
class StdLogStream final : public LogStream {
public:
StdLogStream(int fd)
@@ -86,7 +86,7 @@ inline StdLogStream out() { return StdLogStream(STDOUT_FILENO); }
inline StdLogStream warn() { return StdLogStream(STDERR_FILENO); }
#endif
-#if !defined(BOOTSTRAPPER) && defined(KERNEL)
+#ifdef KERNEL
class KernelLogStream final : public LogStream {
public:
KernelLogStream() {}
@@ -121,7 +121,7 @@ const LogStream& operator<<(const LogStream&, long long);
const LogStream& operator<<(const LogStream&, unsigned long);
const LogStream& operator<<(const LogStream&, unsigned long long);
-#if !defined(KERNEL) && !defined(BOOTSTRAPPER)
+#if !defined(KERNEL)
const LogStream& operator<<(const LogStream&, double);
const LogStream& operator<<(const LogStream&, float);
#endif
@@ -141,9 +141,9 @@ inline const LogStream& operator<<(const LogStream& stream, bool value)
DebugLogStream dbg();
-#if defined(KERNEL)
+#ifdef KERNEL
KernelLogStream klog();
-#elif !defined(BOOTSTRAPPER)
+#else
DebugLogStream klog();
#endif
@@ -153,7 +153,7 @@ using AK::dbg;
using AK::klog;
using AK::LogStream;
-#if !defined(KERNEL) && !defined(BOOTSTRAPPER)
+#if !defined(KERNEL)
using AK::out;
using AK::warn;
#endif
diff --git a/AK/Memory.h b/AK/Memory.h
index 4d055ebe96..7bdd294099 100644
--- a/AK/Memory.h
+++ b/AK/Memory.h
@@ -28,20 +28,20 @@
#include <AK/Types.h>
-#if defined(KERNEL) || defined(BOOTSTRAPPER)
-# include <LibBareMetal/StdLib.h>
+#if defined(KERNEL)
+# include <Kernel/StdLib.h>
#else
# include <stdlib.h>
# include <string.h>
#endif
-#if defined(__serenity__) && !defined(KERNEL) && !defined(BOOTSTRAPPER)
+#if defined(__serenity__) && !defined(KERNEL)
extern "C" void* mmx_memcpy(void* to, const void* from, size_t);
#endif
ALWAYS_INLINE void fast_u32_copy(u32* dest, const u32* src, size_t count)
{
-#if defined(__serenity__) && !defined(KERNEL) && !defined(BOOTSTRAPPER)
+#if defined(__serenity__) && !defined(KERNEL)
if (count >= 256) {
mmx_memcpy(dest, src, count * sizeof(count));
return;
diff --git a/AK/PrintfImplementation.h b/AK/PrintfImplementation.h
index 523ac81b07..1f9966e22e 100644
--- a/AK/PrintfImplementation.h
+++ b/AK/PrintfImplementation.h
@@ -388,7 +388,7 @@ ALWAYS_INLINE int printf_internal(PutChFunc putch, char* buffer, const char*& fm
ret += print_hex(putch, bufptr, va_arg(ap, u64), false, false, left_pad, zero_pad, 16);
break;
-#if !defined(BOOTSTRAPPER) && !defined(KERNEL)
+#if !defined(KERNEL)
case 'g':
case 'f':
ret += print_double(putch, bufptr, va_arg(ap, double), left_pad, zero_pad, field_width, fraction_length);
diff --git a/AK/kmalloc.h b/AK/kmalloc.h
index 292872c2d1..6ef4caed0e 100644
--- a/AK/kmalloc.h
+++ b/AK/kmalloc.h
@@ -42,8 +42,6 @@
#if defined(KERNEL)
# include <Kernel/Heap/kmalloc.h>
-#elif defined(BOOTSTRAPPER)
-# include <Bootstrapper/Memory/malloc.h>
#else
# include <stdlib.h>
diff --git a/AK/kstdio.h b/AK/kstdio.h
index 7557af14b2..42f37fb1f3 100644
--- a/AK/kstdio.h
+++ b/AK/kstdio.h
@@ -27,8 +27,8 @@
#pragma once
#ifdef __serenity__
-# if defined(KERNEL) || defined(BOOTSTRAPPER)
-# include <LibBareMetal/Output/kstdio.h>
+# ifdef KERNEL
+# include <Kernel/kstdio.h>
# else
# include <AK/Types.h>
extern "C" {