diff options
author | Andreas Kling <kling@serenityos.org> | 2020-05-16 12:00:04 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-05-16 12:00:04 +0200 |
commit | 21d5f4ada1a38cc90ff78a18d141e6477ccef333 (patch) | |
tree | 28cff77ef0ceb49a87ec973b30d76dc0628a1361 | |
parent | c12cfdea8799b24d2a8c57131e8563ce3dfd66cf (diff) | |
download | serenity-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.
75 files changed, 137 insertions, 200 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" { diff --git a/Kernel/ACPI/DMIDecoder.cpp b/Kernel/ACPI/DMIDecoder.cpp index 755e46a87b..775fcd32ae 100644 --- a/Kernel/ACPI/DMIDecoder.cpp +++ b/Kernel/ACPI/DMIDecoder.cpp @@ -27,7 +27,7 @@ #include <AK/StringView.h> #include <Kernel/ACPI/DMIDecoder.h> #include <Kernel/VM/MemoryManager.h> -#include <LibBareMetal/StdLib.h> +#include <Kernel/StdLib.h> namespace Kernel { diff --git a/Kernel/ACPI/DMIDecoder.h b/Kernel/ACPI/DMIDecoder.h index 675e2748cf..37866b80f9 100644 --- a/Kernel/ACPI/DMIDecoder.h +++ b/Kernel/ACPI/DMIDecoder.h @@ -30,8 +30,8 @@ #include <AK/Types.h> #include <AK/Vector.h> #include <Kernel/VM/Region.h> -#include <LibBareMetal/Memory/PhysicalAddress.h> -#include <LibBareMetal/Memory/VirtualAddress.h> +#include <Kernel/PhysicalAddress.h> +#include <Kernel/VirtualAddress.h> namespace Kernel { diff --git a/Kernel/ACPI/Definitions.h b/Kernel/ACPI/Definitions.h index aa4f5718c5..c269f19d22 100644 --- a/Kernel/ACPI/Definitions.h +++ b/Kernel/ACPI/Definitions.h @@ -29,7 +29,7 @@ #include <AK/RefCounted.h> #include <AK/Types.h> #include <AK/Vector.h> -#include <LibBareMetal/Memory/PhysicalAddress.h> +#include <Kernel/PhysicalAddress.h> namespace Kernel { diff --git a/Kernel/ACPI/DynamicParser.h b/Kernel/ACPI/DynamicParser.h index 168c606132..d3e1ec394f 100644 --- a/Kernel/ACPI/DynamicParser.h +++ b/Kernel/ACPI/DynamicParser.h @@ -31,7 +31,7 @@ #include <Kernel/Interrupts/IRQHandler.h> #include <Kernel/Lock.h> #include <Kernel/VM/PhysicalPage.h> -#include <LibBareMetal/Memory/PhysicalAddress.h> +#include <Kernel/PhysicalAddress.h> namespace Kernel { namespace ACPI { diff --git a/Kernel/ACPI/MultiProcessorParser.cpp b/Kernel/ACPI/MultiProcessorParser.cpp index 7add45be12..4178a961ea 100644 --- a/Kernel/ACPI/MultiProcessorParser.cpp +++ b/Kernel/ACPI/MultiProcessorParser.cpp @@ -28,7 +28,7 @@ #include <Kernel/ACPI/MultiProcessorParser.h> #include <Kernel/Interrupts/IOAPIC.h> #include <Kernel/VM/MemoryManager.h> -#include <LibBareMetal/StdLib.h> +#include <Kernel/StdLib.h> //#define MULTIPROCESSOR_DEBUG diff --git a/Kernel/ACPI/MultiProcessorParser.h b/Kernel/ACPI/MultiProcessorParser.h index cfaf60ac05..1cfff91951 100644 --- a/Kernel/ACPI/MultiProcessorParser.h +++ b/Kernel/ACPI/MultiProcessorParser.h @@ -28,8 +28,8 @@ #include <AK/Types.h> #include <Kernel/VM/Region.h> -#include <LibBareMetal/Memory/PhysicalAddress.h> -#include <LibBareMetal/Memory/VirtualAddress.h> +#include <Kernel/PhysicalAddress.h> +#include <Kernel/VirtualAddress.h> namespace Kernel { namespace MultiProcessor { diff --git a/Kernel/ACPI/Parser.cpp b/Kernel/ACPI/Parser.cpp index c870a2a6d1..7b7817d7d4 100644 --- a/Kernel/ACPI/Parser.cpp +++ b/Kernel/ACPI/Parser.cpp @@ -30,8 +30,8 @@ #include <Kernel/PCI/Access.h> #include <Kernel/VM/MemoryManager.h> #include <Kernel/VM/TypedMapping.h> -#include <LibBareMetal/IO.h> -#include <LibBareMetal/StdLib.h> +#include <Kernel/IO.h> +#include <Kernel/StdLib.h> namespace Kernel { namespace ACPI { diff --git a/Kernel/ACPI/Parser.h b/Kernel/ACPI/Parser.h index 18b1de19aa..9a4edd5a6d 100644 --- a/Kernel/ACPI/Parser.h +++ b/Kernel/ACPI/Parser.h @@ -31,8 +31,8 @@ #include <Kernel/ACPI/Initialize.h> #include <Kernel/FileSystem/File.h> #include <Kernel/VM/Region.h> -#include <LibBareMetal/Memory/PhysicalAddress.h> -#include <LibBareMetal/Memory/VirtualAddress.h> +#include <Kernel/PhysicalAddress.h> +#include <Kernel/VirtualAddress.h> namespace Kernel { namespace ACPI { diff --git a/Kernel/Arch/i386/CPU.cpp b/Kernel/Arch/i386/CPU.cpp index 7820c882a8..11909c4cfb 100644 --- a/Kernel/Arch/i386/CPU.cpp +++ b/Kernel/Arch/i386/CPU.cpp @@ -39,7 +39,7 @@ #include <Kernel/KSyms.h> #include <Kernel/Process.h> #include <Kernel/VM/MemoryManager.h> -#include <LibBareMetal/IO.h> +#include <Kernel/IO.h> #include <LibC/mallocdefs.h> //#define PAGE_FAULT_DEBUG diff --git a/Kernel/Arch/i386/CPU.h b/Kernel/Arch/i386/CPU.h index 5b3b532122..6cc85461b3 100644 --- a/Kernel/Arch/i386/CPU.h +++ b/Kernel/Arch/i386/CPU.h @@ -28,8 +28,8 @@ #include <AK/Badge.h> #include <AK/Noncopyable.h> -#include <LibBareMetal/Memory/PhysicalAddress.h> -#include <LibBareMetal/Memory/VirtualAddress.h> +#include <Kernel/PhysicalAddress.h> +#include <Kernel/VirtualAddress.h> #define PAGE_SIZE 4096 #define GENERIC_INTERRUPT_HANDLERS_COUNT 128 diff --git a/Kernel/CMOS.cpp b/Kernel/CMOS.cpp index 328d52dd81..621e77471d 100644 --- a/Kernel/CMOS.cpp +++ b/Kernel/CMOS.cpp @@ -25,7 +25,7 @@ */ #include <Kernel/CMOS.h> -#include <LibBareMetal/IO.h> +#include <Kernel/IO.h> namespace CMOS { diff --git a/Kernel/CMakeLists.txt b/Kernel/CMakeLists.txt index aeeda2fb45..7a48086503 100644 --- a/Kernel/CMakeLists.txt +++ b/Kernel/CMakeLists.txt @@ -7,8 +7,9 @@ set(KERNEL_SOURCES Arch/i386/CPU.cpp CMOS.cpp CommandLine.cpp - Devices/BlockDevice.cpp + Console.cpp Devices/BXVGADevice.cpp + Devices/BlockDevice.cpp Devices/CharacterDevice.cpp Devices/Device.cpp Devices/DiskPartition.cpp @@ -33,8 +34,8 @@ set(KERNEL_SOURCES FileSystem/DevPtsFS.cpp FileSystem/Ext2FileSystem.cpp FileSystem/FIFO.cpp - FileSystem/FileBackedFileSystem.cpp FileSystem/File.cpp + FileSystem/FileBackedFileSystem.cpp FileSystem/FileDescription.cpp FileSystem/FileSystem.cpp FileSystem/Inode.cpp @@ -43,14 +44,13 @@ set(KERNEL_SOURCES FileSystem/ProcFS.cpp FileSystem/TmpFS.cpp FileSystem/VirtualFileSystem.cpp - Heap/kmalloc.cpp Heap/SlabAllocator.cpp - init.cpp + Heap/kmalloc.cpp Interrupts/APIC.cpp Interrupts/GenericInterruptHandler.cpp - Interrupts/InterruptManagement.cpp Interrupts/IOAPIC.cpp Interrupts/IRQHandler.cpp + Interrupts/InterruptManagement.cpp Interrupts/PIC.cpp Interrupts/SharedIRQHandler.cpp Interrupts/SpuriousInterruptHandler.cpp @@ -64,41 +64,42 @@ set(KERNEL_SOURCES Net/LoopbackAdapter.cpp Net/NetworkAdapter.cpp Net/NetworkTask.cpp - Net/Routing.cpp Net/RTL8139NetworkAdapter.cpp + Net/Routing.cpp Net/Socket.cpp Net/TCPSocket.cpp Net/UDPSocket.cpp PCI/Access.cpp PCI/Device.cpp - PCI/Initializer.cpp PCI/IOAccess.cpp + PCI/Initializer.cpp PCI/MMIOAccess.cpp PerformanceEventBuffer.cpp Process.cpp Profiling.cpp Ptrace.cpp - Random.cpp RTC.cpp + Random.cpp Scheduler.cpp SharedBuffer.cpp + StdLib.cpp Syscall.cpp + TTY/MasterPTY.cpp + TTY/PTYMultiplexer.cpp + TTY/SlavePTY.cpp + TTY/TTY.cpp + TTY/VirtualConsole.cpp Tasks/FinalizerTask.cpp Tasks/SyncTask.cpp Thread.cpp ThreadTracer.cpp - Time/HardwareTimer.cpp - Time/HPETComparator.cpp Time/HPET.cpp + Time/HPETComparator.cpp + Time/HardwareTimer.cpp Time/PIT.cpp - TimerQueue.cpp Time/RTC.cpp Time/TimeManagement.cpp - TTY/MasterPTY.cpp - TTY/PTYMultiplexer.cpp - TTY/SlavePTY.cpp - TTY/TTY.cpp - TTY/VirtualConsole.cpp + TimerQueue.cpp VM/AnonymousVMObject.cpp VM/ContiguousVMObject.cpp VM/InodeVMObject.cpp @@ -114,6 +115,8 @@ set(KERNEL_SOURCES VM/SharedInodeVMObject.cpp VM/VMObject.cpp WaitQueue.cpp + init.cpp + kprintf.cpp ) set(AK_SOURCES @@ -135,17 +138,10 @@ set(ELF_SOURCES ../Libraries/LibELF/Validation.cpp ) -set(BARE_METAL_SOURCES - ../Libraries/LibBareMetal/Output/Console.cpp - ../Libraries/LibBareMetal/Output/kprintf.cpp - ../Libraries/LibBareMetal/StdLib.cpp -) - set(SOURCES ${KERNEL_SOURCES} ${AK_SOURCES} ${ELF_SOURCES} - ${BARE_METAL_SOURCES} ) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DKERNEL") diff --git a/Libraries/LibBareMetal/Output/Console.cpp b/Kernel/Console.cpp index 6b978758a6..fa58813fb5 100644 --- a/Libraries/LibBareMetal/Output/Console.cpp +++ b/Kernel/Console.cpp @@ -24,9 +24,9 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include <LibBareMetal/IO.h> -#include <LibBareMetal/Output/Console.h> -#include <LibBareMetal/Output/kstdio.h> +#include <Kernel/Console.h> +#include <Kernel/IO.h> +#include <Kernel/kstdio.h> // Bytes output to 0xE9 end up on the Bochs console. It's very handy. #define CONSOLE_OUT_TO_E9 @@ -45,9 +45,7 @@ bool Console::is_initialized() } Console::Console() -#if defined(KERNEL) : CharacterDevice(5, 1) -#endif { s_the = this; } @@ -56,7 +54,6 @@ Console::~Console() { } -#if defined(KERNEL) bool Console::can_read(const Kernel::FileDescription&, size_t) const { return false; @@ -79,7 +76,6 @@ ssize_t Console::write(Kernel::FileDescription&, size_t, const u8* data, ssize_t put_char(data[i]); return size; } -#endif void Console::put_char(char ch) { diff --git a/Libraries/LibBareMetal/Output/Console.h b/Kernel/Console.h index f01e130680..0e57be5e79 100644 --- a/Libraries/LibBareMetal/Output/Console.h +++ b/Kernel/Console.h @@ -28,9 +28,7 @@ #include <AK/CircularQueue.h> #include <AK/Vector.h> -#if defined(KERNEL) -# include <Kernel/Devices/CharacterDevice.h> -#endif +#include <Kernel/Devices/CharacterDevice.h> class ConsoleImplementation { public: @@ -38,31 +36,22 @@ public: virtual void on_sysconsole_receive(u8) = 0; }; -#if defined(KERNEL) class Console final : public Kernel::CharacterDevice { AK_MAKE_ETERNAL -#elif defined(BOOTSTRAPPER) -class Console { -#endif public: static Console& the(); static bool is_initialized(); Console(); -#if defined(KERNEL) virtual ~Console() override; -#elif defined(BOOTSTRAPPER) - virtual ~Console(); -#endif -#if defined(KERNEL) // ^CharacterDevice virtual bool can_read(const Kernel::FileDescription&, size_t) const override; virtual bool can_write(const Kernel::FileDescription&, size_t) const override { return true; } virtual ssize_t read(Kernel::FileDescription&, size_t, u8*, ssize_t) override; virtual ssize_t write(Kernel::FileDescription&, size_t, const u8*, ssize_t) override; virtual const char* class_name() const override { return "Console"; } -#endif + void set_implementation(ConsoleImplementation* implementation) { m_implementation = implementation; diff --git a/Kernel/Devices/BXVGADevice.cpp b/Kernel/Devices/BXVGADevice.cpp index 67490d95c9..88c0a6c91c 100644 --- a/Kernel/Devices/BXVGADevice.cpp +++ b/Kernel/Devices/BXVGADevice.cpp @@ -30,7 +30,7 @@ #include <Kernel/Process.h> #include <Kernel/VM/AnonymousVMObject.h> #include <Kernel/VM/MemoryManager.h> -#include <LibBareMetal/IO.h> +#include <Kernel/IO.h> #include <LibC/errno_numbers.h> #include <LibC/sys/ioctl_numbers.h> diff --git a/Kernel/Devices/BXVGADevice.h b/Kernel/Devices/BXVGADevice.h index 7e0a620ee5..ccda371376 100644 --- a/Kernel/Devices/BXVGADevice.h +++ b/Kernel/Devices/BXVGADevice.h @@ -29,7 +29,7 @@ #include <AK/String.h> #include <AK/Types.h> #include <Kernel/Devices/BlockDevice.h> -#include <LibBareMetal/Memory/PhysicalAddress.h> +#include <Kernel/PhysicalAddress.h> namespace Kernel { diff --git a/Kernel/Devices/KeyboardDevice.cpp b/Kernel/Devices/KeyboardDevice.cpp index d999c7ba09..7c15dc6749 100644 --- a/Kernel/Devices/KeyboardDevice.cpp +++ b/Kernel/Devices/KeyboardDevice.cpp @@ -31,7 +31,7 @@ #include <Kernel/Arch/i386/CPU.h> #include <Kernel/Devices/KeyboardDevice.h> #include <Kernel/TTY/VirtualConsole.h> -#include <LibBareMetal/IO.h> +#include <Kernel/IO.h> //#define KEYBOARD_DEBUG diff --git a/Kernel/Devices/MBVGADevice.h b/Kernel/Devices/MBVGADevice.h index 3afb118d5c..ca2254fe53 100644 --- a/Kernel/Devices/MBVGADevice.h +++ b/Kernel/Devices/MBVGADevice.h @@ -29,7 +29,7 @@ #include <AK/String.h> #include <AK/Types.h> #include <Kernel/Devices/BlockDevice.h> -#include <LibBareMetal/Memory/PhysicalAddress.h> +#include <Kernel/PhysicalAddress.h> namespace Kernel { diff --git a/Kernel/Devices/PATAChannel.cpp b/Kernel/Devices/PATAChannel.cpp index 8fbf4f2dad..06b88afb16 100644 --- a/Kernel/Devices/PATAChannel.cpp +++ b/Kernel/Devices/PATAChannel.cpp @@ -31,7 +31,7 @@ #include <Kernel/FileSystem/ProcFS.h> #include <Kernel/Process.h> #include <Kernel/VM/MemoryManager.h> -#include <LibBareMetal/IO.h> +#include <Kernel/IO.h> namespace Kernel { diff --git a/Kernel/Devices/PATAChannel.h b/Kernel/Devices/PATAChannel.h index 338bca6235..c7ac026edd 100644 --- a/Kernel/Devices/PATAChannel.h +++ b/Kernel/Devices/PATAChannel.h @@ -43,8 +43,8 @@ #include <Kernel/PCI/Device.h> #include <Kernel/VM/PhysicalPage.h> #include <Kernel/WaitQueue.h> -#include <LibBareMetal/IO.h> -#include <LibBareMetal/Memory/PhysicalAddress.h> +#include <Kernel/IO.h> +#include <Kernel/PhysicalAddress.h> namespace Kernel { diff --git a/Kernel/Devices/PCSpeaker.cpp b/Kernel/Devices/PCSpeaker.cpp index b14bf7f8d2..cd8ad3e8af 100644 --- a/Kernel/Devices/PCSpeaker.cpp +++ b/Kernel/Devices/PCSpeaker.cpp @@ -27,7 +27,7 @@ #include <Kernel/Arch/i386/CPU.h> #include <Kernel/Devices/PCSpeaker.h> #include <Kernel/Time/PIT.h> -#include <LibBareMetal/IO.h> +#include <Kernel/IO.h> void PCSpeaker::tone_on(int frequency) { diff --git a/Kernel/Devices/PS2MouseDevice.cpp b/Kernel/Devices/PS2MouseDevice.cpp index 5816c68bdf..e673c02fbd 100644 --- a/Kernel/Devices/PS2MouseDevice.cpp +++ b/Kernel/Devices/PS2MouseDevice.cpp @@ -27,7 +27,7 @@ #include <AK/Memory.h> #include <Kernel/Devices/PS2MouseDevice.h> #include <Kernel/Devices/VMWareBackdoor.h> -#include <LibBareMetal/IO.h> +#include <Kernel/IO.h> namespace Kernel { diff --git a/Kernel/Devices/SB16.cpp b/Kernel/Devices/SB16.cpp index 53964c4cc0..e2966da334 100644 --- a/Kernel/Devices/SB16.cpp +++ b/Kernel/Devices/SB16.cpp @@ -30,7 +30,7 @@ #include <Kernel/Thread.h> #include <Kernel/VM/AnonymousVMObject.h> #include <Kernel/VM/MemoryManager.h> -#include <LibBareMetal/IO.h> +#include <Kernel/IO.h> //#define SB16_DEBUG diff --git a/Kernel/Devices/SB16.h b/Kernel/Devices/SB16.h index 947d5627b8..2b9cf7acbe 100644 --- a/Kernel/Devices/SB16.h +++ b/Kernel/Devices/SB16.h @@ -30,7 +30,7 @@ #include <Kernel/Interrupts/IRQHandler.h> #include <Kernel/VM/PhysicalPage.h> #include <Kernel/WaitQueue.h> -#include <LibBareMetal/Memory/PhysicalAddress.h> +#include <Kernel/PhysicalAddress.h> namespace Kernel { diff --git a/Kernel/Devices/SerialDevice.cpp b/Kernel/Devices/SerialDevice.cpp index 5a599c07ea..3e6c3bb73b 100644 --- a/Kernel/Devices/SerialDevice.cpp +++ b/Kernel/Devices/SerialDevice.cpp @@ -25,7 +25,7 @@ */ #include <Kernel/Devices/SerialDevice.h> -#include <LibBareMetal/IO.h> +#include <Kernel/IO.h> namespace Kernel { diff --git a/Kernel/Devices/VMWareBackdoor.cpp b/Kernel/Devices/VMWareBackdoor.cpp index 20907e5da4..7eecb3fd5b 100644 --- a/Kernel/Devices/VMWareBackdoor.cpp +++ b/Kernel/Devices/VMWareBackdoor.cpp @@ -30,7 +30,7 @@ #include <Kernel/CommandLine.h> #include <Kernel/Devices/VMWareBackdoor.h> #include <Kernel/MousePacket.h> -#include <LibBareMetal/IO.h> +#include <Kernel/IO.h> namespace Kernel { diff --git a/Kernel/FileSystem/File.h b/Kernel/FileSystem/File.h index d646b53455..bcb54f6251 100644 --- a/Kernel/FileSystem/File.h +++ b/Kernel/FileSystem/File.h @@ -33,7 +33,7 @@ #include <Kernel/Forward.h> #include <Kernel/KResult.h> #include <Kernel/UnixTypes.h> -#include <LibBareMetal/Memory/VirtualAddress.h> +#include <Kernel/VirtualAddress.h> namespace Kernel { diff --git a/Kernel/FileSystem/FileDescription.h b/Kernel/FileSystem/FileDescription.h index fc240934cc..d0a3c7e998 100644 --- a/Kernel/FileSystem/FileDescription.h +++ b/Kernel/FileSystem/FileDescription.h @@ -34,7 +34,7 @@ #include <Kernel/FileSystem/InodeMetadata.h> #include <Kernel/FileSystem/VirtualFileSystem.h> #include <Kernel/KBuffer.h> -#include <LibBareMetal/Memory/VirtualAddress.h> +#include <Kernel/VirtualAddress.h> namespace Kernel { diff --git a/Kernel/FileSystem/ProcFS.cpp b/Kernel/FileSystem/ProcFS.cpp index 0204441842..0b15d7337a 100644 --- a/Kernel/FileSystem/ProcFS.cpp +++ b/Kernel/FileSystem/ProcFS.cpp @@ -54,8 +54,8 @@ #include <Kernel/TTY/TTY.h> #include <Kernel/VM/MemoryManager.h> #include <Kernel/VM/PurgeableVMObject.h> -#include <LibBareMetal/Output/Console.h> -#include <LibBareMetal/StdLib.h> +#include <Kernel/Console.h> +#include <Kernel/StdLib.h> #include <LibC/errno_numbers.h> namespace Kernel { diff --git a/Kernel/Heap/kmalloc.cpp b/Kernel/Heap/kmalloc.cpp index 53465cd4dd..b33136911a 100644 --- a/Kernel/Heap/kmalloc.cpp +++ b/Kernel/Heap/kmalloc.cpp @@ -38,7 +38,7 @@ #include <Kernel/KSyms.h> #include <Kernel/Process.h> #include <Kernel/Scheduler.h> -#include <LibBareMetal/StdLib.h> +#include <Kernel/StdLib.h> #define SANITIZE_KMALLOC diff --git a/Libraries/LibBareMetal/IO.h b/Kernel/IO.h index d287801a0d..4d22f43d5b 100644 --- a/Libraries/LibBareMetal/IO.h +++ b/Kernel/IO.h @@ -30,10 +30,7 @@ #include <AK/LogStream.h> #include <AK/String.h> #include <AK/Types.h> - -#if defined(KERNEL) -# include <Kernel/Arch/i386/CPU.h> -#endif +#include <Kernel/Arch/i386/CPU.h> namespace IO { @@ -104,7 +101,7 @@ inline void delay(size_t microseconds) class IOAddress { public: - IOAddress() {} + IOAddress() { } explicit IOAddress(u16 address) : m_address(address) { diff --git a/Kernel/Interrupts/APIC.cpp b/Kernel/Interrupts/APIC.cpp index 6400e24bc4..9cd1baf8d2 100644 --- a/Kernel/Interrupts/APIC.cpp +++ b/Kernel/Interrupts/APIC.cpp @@ -31,7 +31,7 @@ #include <Kernel/Interrupts/APIC.h> #include <Kernel/Interrupts/SpuriousInterruptHandler.h> #include <Kernel/VM/MemoryManager.h> -#include <LibBareMetal/IO.h> +#include <Kernel/IO.h> #define IRQ_APIC_SPURIOUS 0x7f diff --git a/Kernel/Interrupts/InterruptManagement.cpp b/Kernel/Interrupts/InterruptManagement.cpp index 80ac5288a0..445791a7d7 100644 --- a/Kernel/Interrupts/InterruptManagement.cpp +++ b/Kernel/Interrupts/InterruptManagement.cpp @@ -37,7 +37,7 @@ #include <Kernel/Interrupts/UnhandledInterruptHandler.h> #include <Kernel/Syscall.h> #include <Kernel/VM/MemoryManager.h> -#include <LibBareMetal/IO.h> +#include <Kernel/IO.h> #define PCAT_COMPAT_FLAG 0x1 diff --git a/Kernel/Interrupts/PIC.cpp b/Kernel/Interrupts/PIC.cpp index 3118bc93ca..d780f2990c 100644 --- a/Kernel/Interrupts/PIC.cpp +++ b/Kernel/Interrupts/PIC.cpp @@ -29,7 +29,7 @@ #include <Kernel/Arch/i386/CPU.h> #include <Kernel/Interrupts/GenericInterruptHandler.h> #include <Kernel/Interrupts/PIC.h> -#include <LibBareMetal/IO.h> +#include <Kernel/IO.h> namespace Kernel { diff --git a/Kernel/Net/E1000NetworkAdapter.cpp b/Kernel/Net/E1000NetworkAdapter.cpp index fa4e4c3208..e8619d6770 100644 --- a/Kernel/Net/E1000NetworkAdapter.cpp +++ b/Kernel/Net/E1000NetworkAdapter.cpp @@ -26,7 +26,7 @@ #include <Kernel/Net/E1000NetworkAdapter.h> #include <Kernel/Thread.h> -#include <LibBareMetal/IO.h> +#include <Kernel/IO.h> //#define E1000_DEBUG diff --git a/Kernel/Net/E1000NetworkAdapter.h b/Kernel/Net/E1000NetworkAdapter.h index 77b4de7931..96214e9d6d 100644 --- a/Kernel/Net/E1000NetworkAdapter.h +++ b/Kernel/Net/E1000NetworkAdapter.h @@ -32,7 +32,7 @@ #include <Kernel/Net/NetworkAdapter.h> #include <Kernel/PCI/Access.h> #include <Kernel/PCI/Device.h> -#include <LibBareMetal/IO.h> +#include <Kernel/IO.h> namespace Kernel { diff --git a/Kernel/Net/LocalSocket.cpp b/Kernel/Net/LocalSocket.cpp index fc550066eb..da4f330794 100644 --- a/Kernel/Net/LocalSocket.cpp +++ b/Kernel/Net/LocalSocket.cpp @@ -30,7 +30,7 @@ #include <Kernel/Net/LocalSocket.h> #include <Kernel/Process.h> #include <Kernel/UnixTypes.h> -#include <LibBareMetal/StdLib.h> +#include <Kernel/StdLib.h> #include <LibC/errno_numbers.h> //#define DEBUG_LOCAL_SOCKET diff --git a/Kernel/Net/NetworkAdapter.cpp b/Kernel/Net/NetworkAdapter.cpp index b040be9dcd..3e182ce461 100644 --- a/Kernel/Net/NetworkAdapter.cpp +++ b/Kernel/Net/NetworkAdapter.cpp @@ -33,7 +33,7 @@ #include <Kernel/Net/LoopbackAdapter.h> #include <Kernel/Net/NetworkAdapter.h> #include <Kernel/Random.h> -#include <LibBareMetal/StdLib.h> +#include <Kernel/StdLib.h> namespace Kernel { diff --git a/Kernel/Net/RTL8139NetworkAdapter.cpp b/Kernel/Net/RTL8139NetworkAdapter.cpp index 45a6812499..4b496fcfd0 100644 --- a/Kernel/Net/RTL8139NetworkAdapter.cpp +++ b/Kernel/Net/RTL8139NetworkAdapter.cpp @@ -25,7 +25,7 @@ */ #include <Kernel/Net/RTL8139NetworkAdapter.h> -#include <LibBareMetal/IO.h> +#include <Kernel/IO.h> //#define RTL8139_DEBUG diff --git a/Kernel/Net/RTL8139NetworkAdapter.h b/Kernel/Net/RTL8139NetworkAdapter.h index 20921c75d3..7db2f361e2 100644 --- a/Kernel/Net/RTL8139NetworkAdapter.h +++ b/Kernel/Net/RTL8139NetworkAdapter.h @@ -30,7 +30,7 @@ #include <Kernel/Net/NetworkAdapter.h> #include <Kernel/PCI/Access.h> #include <Kernel/PCI/Device.h> -#include <LibBareMetal/IO.h> +#include <Kernel/IO.h> namespace Kernel { diff --git a/Kernel/PCI/IOAccess.cpp b/Kernel/PCI/IOAccess.cpp index 0c6b993bd2..dd237eb27e 100644 --- a/Kernel/PCI/IOAccess.cpp +++ b/Kernel/PCI/IOAccess.cpp @@ -25,7 +25,7 @@ */ #include <Kernel/PCI/IOAccess.h> -#include <LibBareMetal/IO.h> +#include <Kernel/IO.h> namespace Kernel { namespace PCI { diff --git a/Kernel/PCI/Initializer.cpp b/Kernel/PCI/Initializer.cpp index d31fc61673..f9bf2675f3 100644 --- a/Kernel/PCI/Initializer.cpp +++ b/Kernel/PCI/Initializer.cpp @@ -31,7 +31,7 @@ #include <Kernel/PCI/IOAccess.h> #include <Kernel/PCI/Initializer.h> #include <Kernel/PCI/MMIOAccess.h> -#include <LibBareMetal/IO.h> +#include <Kernel/IO.h> namespace Kernel { namespace PCI { diff --git a/Libraries/LibBareMetal/Memory/PhysicalAddress.h b/Kernel/PhysicalAddress.h index eab960f349..eab960f349 100644 --- a/Libraries/LibBareMetal/Memory/PhysicalAddress.h +++ b/Kernel/PhysicalAddress.h diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp index 25421029e2..ce2c65a6d5 100644 --- a/Kernel/Process.cpp +++ b/Kernel/Process.cpp @@ -73,9 +73,9 @@ #include <Kernel/VM/ProcessPagingScope.h> #include <Kernel/VM/PurgeableVMObject.h> #include <Kernel/VM/SharedInodeVMObject.h> -#include <LibBareMetal/IO.h> -#include <LibBareMetal/Output/Console.h> -#include <LibBareMetal/StdLib.h> +#include <Kernel/IO.h> +#include <Kernel/Console.h> +#include <Kernel/StdLib.h> #include <LibC/errno_numbers.h> #include <LibC/limits.h> #include <LibC/signal_numbers.h> diff --git a/Kernel/Process.h b/Kernel/Process.h index 851b92b27f..620c8ef82c 100644 --- a/Kernel/Process.h +++ b/Kernel/Process.h @@ -39,7 +39,7 @@ #include <Kernel/Thread.h> #include <Kernel/UnixTypes.h> #include <Kernel/VM/RangeAllocator.h> -#include <LibBareMetal/StdLib.h> +#include <Kernel/StdLib.h> #include <LibC/signal_numbers.h> namespace ELF { diff --git a/Libraries/LibBareMetal/StdLib.cpp b/Kernel/StdLib.cpp index f487c5775d..d72b2af4f0 100644 --- a/Libraries/LibBareMetal/StdLib.cpp +++ b/Kernel/StdLib.cpp @@ -27,26 +27,20 @@ #include <AK/Assertions.h> #include <AK/String.h> #include <AK/Types.h> -#include <LibBareMetal/StdLib.h> +#include <Kernel/Arch/i386/CPU.h> +#include <Kernel/Heap/kmalloc.h> +#include <Kernel/StdLib.h> +#include <Kernel/VM/MemoryManager.h> -#ifdef KERNEL -# include <Kernel/Arch/i386/CPU.h> -# include <Kernel/Heap/kmalloc.h> -# include <Kernel/VM/MemoryManager.h> -#endif - -#ifdef KERNEL String copy_string_from_user(const char* user_str, size_t user_str_size) { Kernel::SmapDisabler disabler; size_t length = strnlen(user_str, user_str_size); return String(user_str, length); } -#endif extern "C" { -#ifdef KERNEL void copy_to_user(void* dest_ptr, const void* src_ptr, size_t n) { ASSERT(Kernel::is_user_range(VirtualAddress(dest_ptr), n)); @@ -62,7 +56,6 @@ void copy_from_user(void* dest_ptr, const void* src_ptr, size_t n) Kernel::SmapDisabler disabler; memcpy(dest_ptr, src_ptr, n); } -#endif void* memcpy(void* dest_ptr, const void* src_ptr, size_t n) { @@ -117,14 +110,12 @@ char* strncpy(char* dest, const char* src, size_t n) return dest; } -#ifdef KERNEL void memset_user(void* dest_ptr, int c, size_t n) { ASSERT(Kernel::is_user_range(VirtualAddress(dest_ptr), n)); Kernel::SmapDisabler disabler; memset(dest_ptr, c, n); } -#endif void* memset(void* dest_ptr, int c, size_t n) { @@ -243,12 +234,10 @@ char* strstr(const char* haystack, const char* needle) ASSERT_NOT_REACHED(); } -#ifdef KERNEL void* realloc(void* p, size_t s) { return krealloc(p, s); } -#endif void free(void* p) { diff --git a/Libraries/LibBareMetal/StdLib.h b/Kernel/StdLib.h index 280e5a73b7..1ede0bef31 100644 --- a/Libraries/LibBareMetal/StdLib.h +++ b/Kernel/StdLib.h @@ -26,31 +26,21 @@ #pragma once -#include <AK/Types.h> - -#if defined(KERNEL) - -namespace AK { -class String; -} +#include <AK/Forward.h> namespace Syscall { struct StringArgument; } -AK::String copy_string_from_user(const char*, size_t); - -#endif +String copy_string_from_user(const char*, size_t); extern "C" { static_assert(sizeof(size_t) == 4); -#if defined(KERNEL) void copy_to_user(void*, const void*, size_t); void copy_from_user(void*, const void*, size_t); void memset_user(void*, int, size_t); -#endif void* memcpy(void*, const void*, size_t); char* strcpy(char*, const char*); @@ -70,8 +60,6 @@ inline u16 ntohs(u16 w) { return (w & 0xff) << 8 | ((w >> 8) & 0xff); } inline u16 htons(u16 w) { return (w & 0xff) << 8 | ((w >> 8) & 0xff); } } -#if defined(KERNEL) - template<typename T> inline void copy_from_user(T* dest, const T* src) { @@ -83,5 +71,3 @@ inline void copy_to_user(T* dest, const T* src) { copy_to_user(dest, src, sizeof(T)); } - -#endif diff --git a/Kernel/TTY/VirtualConsole.cpp b/Kernel/TTY/VirtualConsole.cpp index 82b57320ed..731335b564 100644 --- a/Kernel/TTY/VirtualConsole.cpp +++ b/Kernel/TTY/VirtualConsole.cpp @@ -29,8 +29,8 @@ #include <Kernel/Arch/i386/CPU.h> #include <Kernel/Devices/KeyboardDevice.h> #include <Kernel/Heap/kmalloc.h> -#include <LibBareMetal/IO.h> -#include <LibBareMetal/StdLib.h> +#include <Kernel/IO.h> +#include <Kernel/StdLib.h> namespace Kernel { diff --git a/Kernel/TTY/VirtualConsole.h b/Kernel/TTY/VirtualConsole.h index 222b86d596..8f6745b81e 100644 --- a/Kernel/TTY/VirtualConsole.h +++ b/Kernel/TTY/VirtualConsole.h @@ -28,7 +28,7 @@ #include <Kernel/Devices/KeyboardDevice.h> #include <Kernel/TTY/TTY.h> -#include <LibBareMetal/Output/Console.h> +#include <Kernel/Console.h> namespace Kernel { diff --git a/Kernel/Time/HPET.h b/Kernel/Time/HPET.h index 2198e755c3..5fec10feb8 100644 --- a/Kernel/Time/HPET.h +++ b/Kernel/Time/HPET.h @@ -31,8 +31,8 @@ #include <AK/OwnPtr.h> #include <AK/Types.h> #include <AK/Vector.h> +#include <Kernel/PhysicalAddress.h> #include <Kernel/VM/Region.h> -#include <LibBareMetal/Memory/PhysicalAddress.h> namespace Kernel { diff --git a/Kernel/Time/PIT.cpp b/Kernel/Time/PIT.cpp index 7c38e1fb84..a105af6d46 100644 --- a/Kernel/Time/PIT.cpp +++ b/Kernel/Time/PIT.cpp @@ -30,7 +30,7 @@ #include <Kernel/Thread.h> #include <Kernel/Time/PIT.h> #include <Kernel/Time/TimeManagement.h> -#include <LibBareMetal/IO.h> +#include <Kernel/IO.h> #define IRQ_TIMER 0 namespace Kernel { diff --git a/Kernel/Time/RTC.cpp b/Kernel/Time/RTC.cpp index 5e74c802c9..7a3f85c987 100644 --- a/Kernel/Time/RTC.cpp +++ b/Kernel/Time/RTC.cpp @@ -28,7 +28,7 @@ #include <Kernel/CMOS.h> #include <Kernel/Time/RTC.h> #include <Kernel/Time/TimeManagement.h> -#include <LibBareMetal/IO.h> +#include <Kernel/IO.h> namespace Kernel { #define IRQ_TIMER 8 diff --git a/Kernel/VM/AnonymousVMObject.h b/Kernel/VM/AnonymousVMObject.h index 12da99df43..13b7222f80 100644 --- a/Kernel/VM/AnonymousVMObject.h +++ b/Kernel/VM/AnonymousVMObject.h @@ -27,7 +27,7 @@ #pragma once #include <Kernel/VM/VMObject.h> -#include <LibBareMetal/Memory/PhysicalAddress.h> +#include <Kernel/PhysicalAddress.h> namespace Kernel { diff --git a/Kernel/VM/ContiguousVMObject.h b/Kernel/VM/ContiguousVMObject.h index 58de60c944..84f54ef4dc 100644 --- a/Kernel/VM/ContiguousVMObject.h +++ b/Kernel/VM/ContiguousVMObject.h @@ -27,7 +27,7 @@ #pragma once #include <Kernel/VM/VMObject.h> -#include <LibBareMetal/Memory/PhysicalAddress.h> +#include <Kernel/PhysicalAddress.h> namespace Kernel { diff --git a/Kernel/VM/MemoryManager.cpp b/Kernel/VM/MemoryManager.cpp index 2816dd9888..d6b1e48f7c 100644 --- a/Kernel/VM/MemoryManager.cpp +++ b/Kernel/VM/MemoryManager.cpp @@ -39,7 +39,7 @@ #include <Kernel/VM/PhysicalRegion.h> #include <Kernel/VM/PurgeableVMObject.h> #include <Kernel/VM/SharedInodeVMObject.h> -#include <LibBareMetal/StdLib.h> +#include <Kernel/StdLib.h> //#define MM_DEBUG //#define PAGE_FAULT_DEBUG diff --git a/Kernel/VM/PhysicalPage.h b/Kernel/VM/PhysicalPage.h index fe74ed6aff..1e9b573947 100644 --- a/Kernel/VM/PhysicalPage.h +++ b/Kernel/VM/PhysicalPage.h @@ -29,7 +29,7 @@ #include <AK/NonnullRefPtr.h> #include <Kernel/Assertions.h> #include <Kernel/Heap/SlabAllocator.h> -#include <LibBareMetal/Memory/PhysicalAddress.h> +#include <Kernel/PhysicalAddress.h> namespace Kernel { diff --git a/Kernel/VM/RangeAllocator.h b/Kernel/VM/RangeAllocator.h index 6db5783e10..c6fb3f9931 100644 --- a/Kernel/VM/RangeAllocator.h +++ b/Kernel/VM/RangeAllocator.h @@ -29,7 +29,7 @@ #include <AK/String.h> #include <AK/Traits.h> #include <AK/Vector.h> -#include <LibBareMetal/Memory/VirtualAddress.h> +#include <Kernel/VirtualAddress.h> namespace Kernel { diff --git a/Libraries/LibBareMetal/Memory/VirtualAddress.h b/Kernel/VirtualAddress.h index 2c82cb0d40..2c82cb0d40 100644 --- a/Libraries/LibBareMetal/Memory/VirtualAddress.h +++ b/Kernel/VirtualAddress.h diff --git a/Libraries/LibBareMetal/Output/kprintf.cpp b/Kernel/kprintf.cpp index 282b4afb31..3a0a4a439a 100644 --- a/Libraries/LibBareMetal/Output/kprintf.cpp +++ b/Kernel/kprintf.cpp @@ -26,16 +26,13 @@ #include <AK/PrintfImplementation.h> #include <AK/Types.h> -#include <LibBareMetal/IO.h> -#include <LibBareMetal/Output/Console.h> -#include <LibBareMetal/Output/kstdio.h> +#include <Kernel/Console.h> +#include <Kernel/IO.h> +#include <Kernel/Process.h> +#include <Kernel/kstdio.h> #include <LibC/stdarg.h> -#if defined(KERNEL) -# include <Kernel/Process.h> -#endif - static bool serial_debug; void set_serial_debug(bool on_or_off) diff --git a/Libraries/LibBareMetal/Output/kstdio.h b/Kernel/kstdio.h index 2aa8355029..daf00c6a10 100644 --- a/Libraries/LibBareMetal/Output/kstdio.h +++ b/Kernel/kstdio.h @@ -38,13 +38,7 @@ void set_serial_debug(bool on_or_off); int get_serial_debug(); } -#if defined(KERNEL) || defined(BOOTSTRAPPER) -# define printf dbgprintf -#endif - -#ifndef __serenity__ -# define dbgprintf printf -#endif +#define printf dbgprintf #ifdef __cplusplus diff --git a/Libraries/LibC/stdarg.h b/Libraries/LibC/stdarg.h index e2b0c48a41..5725ead619 100644 --- a/Libraries/LibC/stdarg.h +++ b/Libraries/LibC/stdarg.h @@ -26,7 +26,7 @@ #pragma once -#if defined(KERNEL) || defined(BOOTSTRAPPER) +#if defined(KERNEL) # define __BEGIN_DECLS # define __END_DECLS #else diff --git a/Libraries/LibELF/DynamicObject.h b/Libraries/LibELF/DynamicObject.h index cbfe2acfeb..5e251a56f9 100644 --- a/Libraries/LibELF/DynamicObject.h +++ b/Libraries/LibELF/DynamicObject.h @@ -27,7 +27,7 @@ #pragma once #include <AK/Assertions.h> -#include <LibBareMetal/Memory/VirtualAddress.h> +#include <Kernel/VirtualAddress.h> #include <LibELF/exec_elf.h> namespace ELF { diff --git a/Libraries/LibELF/Image.h b/Libraries/LibELF/Image.h index 1f210544f4..1291bea571 100644 --- a/Libraries/LibELF/Image.h +++ b/Libraries/LibELF/Image.h @@ -30,7 +30,7 @@ #include <AK/HashMap.h> #include <AK/OwnPtr.h> #include <AK/String.h> -#include <LibBareMetal/Memory/VirtualAddress.h> +#include <Kernel/VirtualAddress.h> #include <LibELF/exec_elf.h> namespace ELF { diff --git a/Libraries/LibELF/Loader.h b/Libraries/LibELF/Loader.h index e585d0f976..9c0f16567d 100644 --- a/Libraries/LibELF/Loader.h +++ b/Libraries/LibELF/Loader.h @@ -35,7 +35,7 @@ #include <LibELF/Image.h> #ifdef KERNEL -# include <LibBareMetal/Memory/VirtualAddress.h> +# include <Kernel/VirtualAddress.h> namespace Kernel { class Region; } diff --git a/Userland/crash.cpp b/Userland/crash.cpp index cc46b2618e..886b687017 100644 --- a/Userland/crash.cpp +++ b/Userland/crash.cpp @@ -28,7 +28,7 @@ #include <AK/Function.h> #include <AK/String.h> #include <Kernel/Syscall.h> -#include <LibBareMetal/IO.h> +#include <Kernel/IO.h> #include <LibCore/ArgsParser.h> #include <stdio.h> #include <stdlib.h> |