From 736092a0876b115c4131ea114fda81eb52bc3d2e Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Fri, 7 Jun 2019 20:02:01 +0200 Subject: [PATCH] Kernel: Move i386.{cpp,h} => Arch/i386/CPU.{cpp,h} There's a ton of work that would need to be done before we could spin up on another architecture, but let's at least try to separate things out a bit. --- Kernel/{i386.cpp => Arch/i386/CPU.cpp} | 2 +- Kernel/{i386.h => Arch/i386/CPU.h} | 0 Kernel/Assertions.h | 2 +- Kernel/Devices/KeyboardDevice.cpp | 2 +- Kernel/Devices/PCSpeaker.cpp | 2 +- Kernel/FileSystem/DiskBackedFileSystem.cpp | 2 +- Kernel/FileSystem/ProcFS.cpp | 2 +- Kernel/IRQHandler.cpp | 2 +- Kernel/Lock.h | 2 +- Kernel/Makefile | 2 +- Kernel/PIC.cpp | 2 +- Kernel/Process.cpp | 5 ++--- Kernel/Syscall.cpp | 2 +- Kernel/TTY/VirtualConsole.cpp | 2 +- Kernel/Thread.h | 2 +- Kernel/VM/MemoryManager.cpp | 2 +- Kernel/VM/MemoryManager.h | 2 +- Kernel/i8253.cpp | 2 +- Kernel/init.cpp | 2 +- Kernel/kmalloc.cpp | 2 +- 20 files changed, 20 insertions(+), 21 deletions(-) rename Kernel/{i386.cpp => Arch/i386/CPU.cpp} (99%) rename Kernel/{i386.h => Arch/i386/CPU.h} (100%) diff --git a/Kernel/i386.cpp b/Kernel/Arch/i386/CPU.cpp similarity index 99% rename from Kernel/i386.cpp rename to Kernel/Arch/i386/CPU.cpp index ebe30109eae..a1a7ec5177c 100644 --- a/Kernel/i386.cpp +++ b/Kernel/Arch/i386/CPU.cpp @@ -1,10 +1,10 @@ -#include "i386.h" #include "Assertions.h" #include "IRQHandler.h" #include "PIC.h" #include "Process.h" #include "Scheduler.h" #include +#include #include #include diff --git a/Kernel/i386.h b/Kernel/Arch/i386/CPU.h similarity index 100% rename from Kernel/i386.h rename to Kernel/Arch/i386/CPU.h diff --git a/Kernel/Assertions.h b/Kernel/Assertions.h index de744bf11f2..419e5bd7cda 100644 --- a/Kernel/Assertions.h +++ b/Kernel/Assertions.h @@ -1,6 +1,6 @@ #pragma once -#include +#include #include #ifdef DEBUG diff --git a/Kernel/Devices/KeyboardDevice.cpp b/Kernel/Devices/KeyboardDevice.cpp index 03fa1b25ec2..d939691a921 100644 --- a/Kernel/Devices/KeyboardDevice.cpp +++ b/Kernel/Devices/KeyboardDevice.cpp @@ -1,8 +1,8 @@ #include "IO.h" #include "PIC.h" -#include "i386.h" #include #include +#include #include #include diff --git a/Kernel/Devices/PCSpeaker.cpp b/Kernel/Devices/PCSpeaker.cpp index c8c8b883a47..5fa9bd83e1e 100644 --- a/Kernel/Devices/PCSpeaker.cpp +++ b/Kernel/Devices/PCSpeaker.cpp @@ -1,6 +1,6 @@ +#include #include #include -#include #include void PCSpeaker::tone_on(int frequency) diff --git a/Kernel/FileSystem/DiskBackedFileSystem.cpp b/Kernel/FileSystem/DiskBackedFileSystem.cpp index fe241e99d38..413e4931ede 100644 --- a/Kernel/FileSystem/DiskBackedFileSystem.cpp +++ b/Kernel/FileSystem/DiskBackedFileSystem.cpp @@ -1,6 +1,6 @@ #include "DiskBackedFileSystem.h" -#include "i386.h" #include +#include #include //#define DBFS_DEBUG diff --git a/Kernel/FileSystem/ProcFS.cpp b/Kernel/FileSystem/ProcFS.cpp index c7fdff4916e..286ebe81757 100644 --- a/Kernel/FileSystem/ProcFS.cpp +++ b/Kernel/FileSystem/ProcFS.cpp @@ -4,8 +4,8 @@ #include "Process.h" #include "Scheduler.h" #include "StdLib.h" -#include "i386.h" #include +#include #include #include #include diff --git a/Kernel/IRQHandler.cpp b/Kernel/IRQHandler.cpp index 69c8c40988c..400944289c2 100644 --- a/Kernel/IRQHandler.cpp +++ b/Kernel/IRQHandler.cpp @@ -1,6 +1,6 @@ #include "IRQHandler.h" #include "PIC.h" -#include "i386.h" +#include IRQHandler::IRQHandler(byte irq) : m_irq_number(irq) diff --git a/Kernel/Lock.h b/Kernel/Lock.h index fcd9a69a948..875dc84ae44 100644 --- a/Kernel/Lock.h +++ b/Kernel/Lock.h @@ -2,9 +2,9 @@ #include #include +#include #include #include -#include class Thread; extern Thread* current; diff --git a/Kernel/Makefile b/Kernel/Makefile index 8356f9526af..07a15011297 100644 --- a/Kernel/Makefile +++ b/Kernel/Makefile @@ -4,7 +4,7 @@ KERNEL_OBJS = \ init.o \ kmalloc.o \ StdLib.o \ - i386.o \ + Arch/i386/CPU.o \ Process.o \ Thread.o \ i8253.o \ diff --git a/Kernel/PIC.cpp b/Kernel/PIC.cpp index 11840dc0b08..3ce2a0bfe53 100644 --- a/Kernel/PIC.cpp +++ b/Kernel/PIC.cpp @@ -1,8 +1,8 @@ #include "PIC.h" #include "Assertions.h" #include "IO.h" -#include "i386.h" #include +#include // The slave 8259 is connected to the master's IRQ2 line. // This is really only to enhance clarity. diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp index 21af23e0882..5f9a3bbc5c9 100644 --- a/Kernel/Process.cpp +++ b/Kernel/Process.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include @@ -21,7 +22,6 @@ #include #include #include -#include #include #include #include @@ -1441,8 +1441,7 @@ pid_t Process::sys$waitpid(pid_t waitee, int* wstatus, int options) return current->m_waitee_pid; } -enum class KernelMemoryCheckResult -{ +enum class KernelMemoryCheckResult { NotInsideKernelMemory, AccessGranted, AccessDenied diff --git a/Kernel/Syscall.cpp b/Kernel/Syscall.cpp index fffe38ff521..95d14e44d77 100644 --- a/Kernel/Syscall.cpp +++ b/Kernel/Syscall.cpp @@ -1,9 +1,9 @@ +#include #include #include #include #include #include -#include extern "C" void syscall_trap_entry(RegisterDump&); extern "C" void syscall_trap_handler(); diff --git a/Kernel/TTY/VirtualConsole.cpp b/Kernel/TTY/VirtualConsole.cpp index a79cfeda4b8..84ee4c58bf5 100644 --- a/Kernel/TTY/VirtualConsole.cpp +++ b/Kernel/TTY/VirtualConsole.cpp @@ -1,9 +1,9 @@ #include "VirtualConsole.h" #include "IO.h" #include "StdLib.h" -#include "i386.h" #include "kmalloc.h" #include +#include static byte* s_vga_buffer; static VirtualConsole* s_consoles[6]; diff --git a/Kernel/Thread.h b/Kernel/Thread.h index d8281a90392..a76d264bcaf 100644 --- a/Kernel/Thread.h +++ b/Kernel/Thread.h @@ -5,11 +5,11 @@ #include #include #include +#include #include #include #include #include -#include class Alarm; class FileDescription; diff --git a/Kernel/VM/MemoryManager.cpp b/Kernel/VM/MemoryManager.cpp index 8d801df15df..9b80eaae570 100644 --- a/Kernel/VM/MemoryManager.cpp +++ b/Kernel/VM/MemoryManager.cpp @@ -1,9 +1,9 @@ #include "CMOS.h" #include "Process.h" #include "StdLib.h" -#include "i386.h" #include #include +#include #include #include diff --git a/Kernel/VM/MemoryManager.h b/Kernel/VM/MemoryManager.h index 7b101ba29fa..94f8576998f 100644 --- a/Kernel/VM/MemoryManager.h +++ b/Kernel/VM/MemoryManager.h @@ -1,6 +1,5 @@ #pragma once -#include "i386.h" #include #include #include @@ -11,6 +10,7 @@ #include #include #include +#include #include #include #include diff --git a/Kernel/i8253.cpp b/Kernel/i8253.cpp index a24168ad2c6..49818a30634 100644 --- a/Kernel/i8253.cpp +++ b/Kernel/i8253.cpp @@ -2,7 +2,7 @@ #include "IO.h" #include "PIC.h" #include "Scheduler.h" -#include "i386.h" +#include #define IRQ_TIMER 0 diff --git a/Kernel/init.cpp b/Kernel/init.cpp index d6e41972b99..429f7a84564 100644 --- a/Kernel/init.cpp +++ b/Kernel/init.cpp @@ -3,10 +3,10 @@ #include "Process.h" #include "RTC.h" #include "Scheduler.h" -#include "i386.h" #include "i8253.h" #include "kmalloc.h" #include +#include #include #include #include diff --git a/Kernel/kmalloc.cpp b/Kernel/kmalloc.cpp index c6543dafb3f..c5d8a76024a 100644 --- a/Kernel/kmalloc.cpp +++ b/Kernel/kmalloc.cpp @@ -5,11 +5,11 @@ #include #include +#include #include #include #include #include -#include #include #define SANITIZE_KMALLOC