mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 14:48:14 +00:00
Kernel: Run clang-format on everything.
This commit is contained in:
parent
98eeb8f22d
commit
bc951ca565
63 changed files with 974 additions and 856 deletions
|
@ -1,8 +1,8 @@
|
|||
#include <Kernel/Devices/BXVGADevice.h>
|
||||
#include <Kernel/IO.h>
|
||||
#include <Kernel/PCI.h>
|
||||
#include <Kernel/VM/MemoryManager.h>
|
||||
#include <Kernel/Process.h>
|
||||
#include <Kernel/VM/MemoryManager.h>
|
||||
#include <LibC/errno_numbers.h>
|
||||
|
||||
#define VBE_DISPI_IOPORT_INDEX 0x01CE
|
||||
|
@ -95,8 +95,7 @@ KResultOr<Region*> BXVGADevice::mmap(Process& process, FileDescription&, LinearA
|
|||
move(vmo),
|
||||
0,
|
||||
"BXVGA Framebuffer",
|
||||
prot
|
||||
);
|
||||
prot);
|
||||
kprintf("BXVGA: %s(%u) created Region{%p} with size %u for framebuffer P%x with laddr L%x\n",
|
||||
process.name().characters(), process.pid(),
|
||||
region, region->size(), framebuffer_address().as_ptr(), region->laddr().get());
|
||||
|
|
|
@ -25,4 +25,3 @@ ssize_t DebugLogDevice::write(FileDescription&, const byte* data, ssize_t data_s
|
|||
IO::out8(0xe9, data[i]);
|
||||
return data_size;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,4 +27,3 @@ bool DiskDevice::write(DiskOffset offset, unsigned length, const byte* in)
|
|||
ASSERT(end_block <= 0xffffffff);
|
||||
return write_blocks(first_block, end_block - first_block, in);
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,8 @@ Retained<DiskPartition> DiskPartition::create(Retained<DiskDevice>&& device, uns
|
|||
}
|
||||
|
||||
DiskPartition::DiskPartition(Retained<DiskDevice>&& device, unsigned block_offset)
|
||||
: m_device(move(device)), m_block_offset(block_offset)
|
||||
: m_device(move(device))
|
||||
, m_block_offset(block_offset)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -79,4 +79,3 @@ const char* FileBackedDiskDevice::class_name() const
|
|||
{
|
||||
return "FileBackedDiskDevice";
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "FullDevice.h"
|
||||
#include <LibC/errno_numbers.h>
|
||||
#include <AK/StdLibExtras.h>
|
||||
#include <AK/kstdio.h>
|
||||
#include <LibC/errno_numbers.h>
|
||||
|
||||
FullDevice::FullDevice()
|
||||
: CharacterDevice(1, 7)
|
||||
|
@ -30,4 +30,3 @@ ssize_t FullDevice::write(FileDescription&, const byte*, ssize_t size)
|
|||
return 0;
|
||||
return -ENOSPC;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
#include <Kernel/Devices/IDEDiskDevice.h>
|
||||
#include <Kernel/FileSystem/ProcFS.h>
|
||||
#include <Kernel/VM/MemoryManager.h>
|
||||
#include <Kernel/Process.h>
|
||||
#include <Kernel/StdLib.h>
|
||||
#include <Kernel/IO.h>
|
||||
#include <Kernel/PIC.h>
|
||||
#include <Kernel/Process.h>
|
||||
#include <Kernel/StdLib.h>
|
||||
#include <Kernel/VM/MemoryManager.h>
|
||||
|
||||
//#define DISK_DEBUG
|
||||
|
||||
|
@ -199,7 +199,8 @@ void IDEDiskDevice::initialize()
|
|||
|
||||
m_interrupted = false;
|
||||
|
||||
while (IO::in8(m_io_base + ATA_REG_STATUS) & ATA_SR_BSY);
|
||||
while (IO::in8(m_io_base + ATA_REG_STATUS) & ATA_SR_BSY)
|
||||
;
|
||||
|
||||
enable_irq();
|
||||
|
||||
|
@ -236,8 +237,7 @@ void IDEDiskDevice::initialize()
|
|||
bbuf.pointer() + 54,
|
||||
m_cylinders,
|
||||
m_heads,
|
||||
m_sectors_per_track
|
||||
);
|
||||
m_sectors_per_track);
|
||||
|
||||
// Let's try to set up DMA transfers.
|
||||
if (!m_pci_address.is_null()) {
|
||||
|
@ -286,7 +286,8 @@ bool IDEDiskDevice::read_sectors_with_dma(dword lba, word count, byte* outbuf)
|
|||
m_interrupted = false;
|
||||
enable_irq();
|
||||
|
||||
while (IO::in8(m_io_base + ATA_REG_STATUS) & ATA_SR_BSY);
|
||||
while (IO::in8(m_io_base + ATA_REG_STATUS) & ATA_SR_BSY)
|
||||
;
|
||||
|
||||
bool is_slave = false;
|
||||
|
||||
|
@ -343,7 +344,8 @@ bool IDEDiskDevice::read_sectors(dword start_sector, word count, byte* outbuf)
|
|||
#endif
|
||||
disable_irq();
|
||||
|
||||
while (IO::in8(m_io_base + ATA_REG_STATUS) & ATA_SR_BSY);
|
||||
while (IO::in8(m_io_base + ATA_REG_STATUS) & ATA_SR_BSY)
|
||||
;
|
||||
|
||||
#ifdef DISK_DEBUG
|
||||
kprintf("IDEDiskDevice: Reading %u sector(s) @ LBA %u\n", count, start_sector);
|
||||
|
@ -356,7 +358,8 @@ bool IDEDiskDevice::read_sectors(dword start_sector, word count, byte* outbuf)
|
|||
IO::out8(m_io_base + ATA_REG_HDDEVSEL, 0xe0 | ((start_sector >> 24) & 0xf)); // 0xf0 for 2nd device
|
||||
|
||||
IO::out8(0x3F6, 0x08);
|
||||
while (!(IO::in8(m_io_base + ATA_REG_STATUS) & ATA_SR_DRDY));
|
||||
while (!(IO::in8(m_io_base + ATA_REG_STATUS) & ATA_SR_DRDY))
|
||||
;
|
||||
|
||||
IO::out8(m_io_base + ATA_REG_COMMAND, ATA_CMD_READ_PIO);
|
||||
m_interrupted = false;
|
||||
|
@ -406,7 +409,8 @@ bool IDEDiskDevice::write_sectors_with_dma(dword lba, word count, const byte* in
|
|||
m_interrupted = false;
|
||||
enable_irq();
|
||||
|
||||
while (IO::in8(m_io_base + ATA_REG_STATUS) & ATA_SR_BSY);
|
||||
while (IO::in8(m_io_base + ATA_REG_STATUS) & ATA_SR_BSY)
|
||||
;
|
||||
|
||||
bool is_slave = false;
|
||||
|
||||
|
@ -462,7 +466,8 @@ bool IDEDiskDevice::write_sectors(dword start_sector, word count, const byte* da
|
|||
#endif
|
||||
disable_irq();
|
||||
|
||||
while (IO::in8(m_io_base + ATA_REG_STATUS) & ATA_SR_BSY);
|
||||
while (IO::in8(m_io_base + ATA_REG_STATUS) & ATA_SR_BSY)
|
||||
;
|
||||
|
||||
//dbgprintf("IDEDiskDevice: Writing %u sector(s) @ LBA %u\n", count, start_sector);
|
||||
|
||||
|
@ -476,7 +481,8 @@ bool IDEDiskDevice::write_sectors(dword start_sector, word count, const byte* da
|
|||
|
||||
IO::out8(m_io_base + ATA_REG_COMMAND, ATA_CMD_WRITE_PIO);
|
||||
|
||||
while (!(IO::in8(m_io_base + ATA_REG_STATUS) & ATA_SR_DRQ));
|
||||
while (!(IO::in8(m_io_base + ATA_REG_STATUS) & ATA_SR_DRQ))
|
||||
;
|
||||
|
||||
byte status = IO::in8(m_io_base + ATA_REG_STATUS);
|
||||
ASSERT(status & ATA_SR_DRQ);
|
||||
|
@ -488,7 +494,8 @@ bool IDEDiskDevice::write_sectors(dword start_sector, word count, const byte* da
|
|||
|
||||
disable_irq();
|
||||
IO::out8(m_io_base + ATA_REG_COMMAND, ATA_CMD_CACHE_FLUSH);
|
||||
while (IO::in8(m_io_base + ATA_REG_STATUS) & ATA_SR_BSY);
|
||||
while (IO::in8(m_io_base + ATA_REG_STATUS) & ATA_SR_BSY)
|
||||
;
|
||||
m_interrupted = false;
|
||||
enable_irq();
|
||||
wait_for_irq();
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
#include <AK/Types.h>
|
||||
#include "i386.h"
|
||||
#include "IO.h"
|
||||
#include "PIC.h"
|
||||
#include "i386.h"
|
||||
#include <AK/Assertions.h>
|
||||
#include <AK/Types.h>
|
||||
#include <Kernel/Devices/KeyboardDevice.h>
|
||||
#include <Kernel/TTY/VirtualConsole.h>
|
||||
#include <AK/Assertions.h>
|
||||
|
||||
//#define KEYBOARD_DEBUG
|
||||
|
||||
|
@ -17,8 +17,7 @@
|
|||
#define I8042_MOUSE_BUFFER 0x20
|
||||
#define I8042_KEYBOARD_BUFFER 0x00
|
||||
|
||||
static char map[0x80] =
|
||||
{
|
||||
static char map[0x80] = {
|
||||
0, '\033', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=', 0x08, '\t',
|
||||
'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', '[', ']', '\n', 0,
|
||||
'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', '\'', '`', 0, '\\',
|
||||
|
@ -26,8 +25,7 @@ static char map[0x80] =
|
|||
0, 0, 0, ' '
|
||||
};
|
||||
|
||||
static char shift_map[0x80] =
|
||||
{
|
||||
static char shift_map[0x80] = {
|
||||
0, '\033', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+', 0x08, '\t',
|
||||
'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', '{', '}', '\n', 0,
|
||||
'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', ':', '"', '~', 0, '|',
|
||||
|
@ -35,24 +33,76 @@ static char shift_map[0x80] =
|
|||
0, 0, 0, ' '
|
||||
};
|
||||
|
||||
static KeyCode unshifted_key_map[0x80] =
|
||||
{
|
||||
Key_Invalid, Key_Escape,
|
||||
Key_1, Key_2, Key_3, Key_4, Key_5, Key_6, Key_7, Key_8, Key_9, Key_0, Key_Minus, Key_Equal, Key_Backspace,
|
||||
static KeyCode unshifted_key_map[0x80] = {
|
||||
Key_Invalid,
|
||||
Key_Escape,
|
||||
Key_1,
|
||||
Key_2,
|
||||
Key_3,
|
||||
Key_4,
|
||||
Key_5,
|
||||
Key_6,
|
||||
Key_7,
|
||||
Key_8,
|
||||
Key_9,
|
||||
Key_0,
|
||||
Key_Minus,
|
||||
Key_Equal,
|
||||
Key_Backspace,
|
||||
Key_Tab, //15
|
||||
Key_Q, Key_W, Key_E, Key_R, Key_T, Key_Y, Key_U, Key_I, Key_O, Key_P, Key_LeftBracket, Key_RightBracket,
|
||||
Key_Q,
|
||||
Key_W,
|
||||
Key_E,
|
||||
Key_R,
|
||||
Key_T,
|
||||
Key_Y,
|
||||
Key_U,
|
||||
Key_I,
|
||||
Key_O,
|
||||
Key_P,
|
||||
Key_LeftBracket,
|
||||
Key_RightBracket,
|
||||
Key_Return, // 28
|
||||
Key_Control, // 29
|
||||
Key_A, Key_S, Key_D, Key_F, Key_G, Key_H, Key_J, Key_K, Key_L, Key_Semicolon, Key_Apostrophe, Key_Backtick,
|
||||
Key_A,
|
||||
Key_S,
|
||||
Key_D,
|
||||
Key_F,
|
||||
Key_G,
|
||||
Key_H,
|
||||
Key_J,
|
||||
Key_K,
|
||||
Key_L,
|
||||
Key_Semicolon,
|
||||
Key_Apostrophe,
|
||||
Key_Backtick,
|
||||
Key_LeftShift, // 42
|
||||
Key_Backslash,
|
||||
Key_Z, Key_X, Key_C, Key_V, Key_B, Key_N, Key_M, Key_Comma, Key_Period, Key_Slash,
|
||||
Key_Z,
|
||||
Key_X,
|
||||
Key_C,
|
||||
Key_V,
|
||||
Key_B,
|
||||
Key_N,
|
||||
Key_M,
|
||||
Key_Comma,
|
||||
Key_Period,
|
||||
Key_Slash,
|
||||
Key_RightShift, // 54
|
||||
Key_Invalid,
|
||||
Key_Alt, // 56
|
||||
Key_Space, // 57
|
||||
Key_Invalid, // 58
|
||||
Key_F1, Key_F2, Key_F3, Key_F4, Key_F5, Key_F6, Key_F7, Key_F8, Key_F9, Key_F10,
|
||||
Key_F1,
|
||||
Key_F2,
|
||||
Key_F3,
|
||||
Key_F4,
|
||||
Key_F5,
|
||||
Key_F6,
|
||||
Key_F7,
|
||||
Key_F8,
|
||||
Key_F9,
|
||||
Key_F10,
|
||||
Key_Invalid,
|
||||
Key_Invalid, // 70
|
||||
Key_Home,
|
||||
|
@ -78,24 +128,76 @@ static KeyCode unshifted_key_map[0x80] =
|
|||
Key_Logo,
|
||||
};
|
||||
|
||||
static KeyCode shifted_key_map[0x100] =
|
||||
{
|
||||
Key_Invalid, Key_Escape,
|
||||
Key_ExclamationPoint, Key_AtSign, Key_Hashtag, Key_Dollar, Key_Percent, Key_Circumflex, Key_Ampersand, Key_Asterisk, Key_LeftParen, Key_RightParen, Key_Underscore, Key_Plus, Key_Backspace,
|
||||
static KeyCode shifted_key_map[0x100] = {
|
||||
Key_Invalid,
|
||||
Key_Escape,
|
||||
Key_ExclamationPoint,
|
||||
Key_AtSign,
|
||||
Key_Hashtag,
|
||||
Key_Dollar,
|
||||
Key_Percent,
|
||||
Key_Circumflex,
|
||||
Key_Ampersand,
|
||||
Key_Asterisk,
|
||||
Key_LeftParen,
|
||||
Key_RightParen,
|
||||
Key_Underscore,
|
||||
Key_Plus,
|
||||
Key_Backspace,
|
||||
Key_Tab,
|
||||
Key_Q, Key_W, Key_E, Key_R, Key_T, Key_Y, Key_U, Key_I, Key_O, Key_P, Key_LeftBrace, Key_RightBrace,
|
||||
Key_Q,
|
||||
Key_W,
|
||||
Key_E,
|
||||
Key_R,
|
||||
Key_T,
|
||||
Key_Y,
|
||||
Key_U,
|
||||
Key_I,
|
||||
Key_O,
|
||||
Key_P,
|
||||
Key_LeftBrace,
|
||||
Key_RightBrace,
|
||||
Key_Return,
|
||||
Key_Control,
|
||||
Key_A, Key_S, Key_D, Key_F, Key_G, Key_H, Key_J, Key_K, Key_L, Key_Colon, Key_DoubleQuote, Key_Tilde,
|
||||
Key_A,
|
||||
Key_S,
|
||||
Key_D,
|
||||
Key_F,
|
||||
Key_G,
|
||||
Key_H,
|
||||
Key_J,
|
||||
Key_K,
|
||||
Key_L,
|
||||
Key_Colon,
|
||||
Key_DoubleQuote,
|
||||
Key_Tilde,
|
||||
Key_LeftShift, // 42
|
||||
Key_Pipe,
|
||||
Key_Z, Key_X, Key_C, Key_V, Key_B, Key_N, Key_M, Key_LessThan, Key_GreaterThan, Key_QuestionMark,
|
||||
Key_Z,
|
||||
Key_X,
|
||||
Key_C,
|
||||
Key_V,
|
||||
Key_B,
|
||||
Key_N,
|
||||
Key_M,
|
||||
Key_LessThan,
|
||||
Key_GreaterThan,
|
||||
Key_QuestionMark,
|
||||
Key_RightShift, // 54
|
||||
Key_Invalid,
|
||||
Key_Alt,
|
||||
Key_Space, // 57
|
||||
Key_Invalid, // 58
|
||||
Key_F1, Key_F2, Key_F3, Key_F4, Key_F5, Key_F6, Key_F7, Key_F8, Key_F9, Key_F10,
|
||||
Key_F1,
|
||||
Key_F2,
|
||||
Key_F3,
|
||||
Key_F4,
|
||||
Key_F5,
|
||||
Key_F6,
|
||||
Key_F7,
|
||||
Key_F8,
|
||||
Key_F9,
|
||||
Key_F10,
|
||||
Key_Invalid,
|
||||
Key_Invalid, // 70
|
||||
Key_Home,
|
||||
|
@ -163,7 +265,8 @@ void KeyboardDevice::handle_irq()
|
|||
break;
|
||||
}
|
||||
switch (ch) {
|
||||
case I8042_ACK: break;
|
||||
case I8042_ACK:
|
||||
break;
|
||||
default:
|
||||
if (m_modifiers & Mod_Alt) {
|
||||
switch (map[ch]) {
|
||||
|
|
|
@ -34,4 +34,3 @@ ssize_t NullDevice::write(FileDescription&, const byte*, ssize_t buffer_size)
|
|||
{
|
||||
return min(PAGE_SIZE, buffer_size);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <Kernel/Devices/PCSpeaker.h>
|
||||
#include <Kernel/i8253.h>
|
||||
#include <Kernel/IO.h>
|
||||
#include <Kernel/i386.h>
|
||||
#include <Kernel/i8253.h>
|
||||
|
||||
void PCSpeaker::tone_on(int frequency)
|
||||
{
|
||||
|
|
|
@ -54,8 +54,7 @@ void PS2MouseDevice::handle_irq()
|
|||
m_data[2],
|
||||
(m_data[0] & 1) ? "Left" : "",
|
||||
(m_data[0] & 2) ? "Right" : "",
|
||||
m_queue.size()
|
||||
);
|
||||
m_queue.size());
|
||||
#endif
|
||||
parse_data_packet();
|
||||
};
|
||||
|
|
|
@ -47,4 +47,3 @@ ssize_t RandomDevice::write(FileDescription&, const byte*, ssize_t size)
|
|||
// FIXME: Use input for entropy? I guess that could be a neat feature?
|
||||
return min(PAGE_SIZE, size);
|
||||
}
|
||||
|
||||
|
|
|
@ -27,4 +27,3 @@ ssize_t ZeroDevice::write(FileDescription&, const byte*, ssize_t size)
|
|||
{
|
||||
return min(PAGE_SIZE, size);
|
||||
}
|
||||
|
||||
|
|
|
@ -28,4 +28,3 @@ KResultOr<Region*> File::mmap(Process&, FileDescription&, LinearAddress, size_t,
|
|||
{
|
||||
return KResult(-ENODEV);
|
||||
}
|
||||
|
||||
|
|
|
@ -83,4 +83,3 @@ void Custody::did_rename(Badge<VFS>, const String& name)
|
|||
{
|
||||
m_name = name;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <Kernel/FileSystem/DevPtsFS.h>
|
||||
#include <Kernel/TTY/SlavePTY.h>
|
||||
#include <Kernel/FileSystem/VirtualFileSystem.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <Kernel/FileSystem/DevPtsFS.h>
|
||||
#include <Kernel/FileSystem/VirtualFileSystem.h>
|
||||
#include <Kernel/TTY/SlavePTY.h>
|
||||
|
||||
static DevPtsFS* s_the;
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
#include "Ext2FileSystem.h"
|
||||
#include "ext2_fs.h"
|
||||
#include "UnixTypes.h"
|
||||
#include "RTC.h"
|
||||
#include "UnixTypes.h"
|
||||
#include "ext2_fs.h"
|
||||
#include <AK/Bitmap.h>
|
||||
#include <AK/StdLibExtras.h>
|
||||
#include <AK/BufferStream.h>
|
||||
#include <LibC/errno_numbers.h>
|
||||
#include <AK/StdLibExtras.h>
|
||||
#include <Kernel/Process.h>
|
||||
#include <LibC/errno_numbers.h>
|
||||
|
||||
//#define EXT2_DEBUG
|
||||
|
||||
|
@ -842,7 +842,6 @@ unsigned Ext2FS::inodes_per_group() const
|
|||
unsigned Ext2FS::inode_size() const
|
||||
{
|
||||
return EXT2_INODE_SIZE(&super_block());
|
||||
|
||||
}
|
||||
unsigned Ext2FS::blocks_per_group() const
|
||||
{
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
#include <AK/HashTable.h>
|
||||
#include <AK/StdLibExtras.h>
|
||||
#include <Kernel/FileSystem/FIFO.h>
|
||||
#include <Kernel/FileSystem/FileDescription.h>
|
||||
#include <Kernel/Lock.h>
|
||||
#include <Kernel/Process.h>
|
||||
#include <Kernel/Thread.h>
|
||||
#include <AK/StdLibExtras.h>
|
||||
#include <AK/HashTable.h>
|
||||
|
||||
//#define FIFO_DEBUG
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
#include <AK/Assertions.h>
|
||||
#include <AK/HashMap.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <LibC/errno_numbers.h>
|
||||
#include <Kernel/FileSystem/FileSystem.h>
|
||||
#include <Kernel/FileSystem/Inode.h>
|
||||
#include <Kernel/VM/MemoryManager.h>
|
||||
#include <Kernel/Net/LocalSocket.h>
|
||||
#include <Kernel/VM/MemoryManager.h>
|
||||
#include <LibC/errno_numbers.h>
|
||||
|
||||
static dword s_lastFileSystemID;
|
||||
static HashMap<dword, FS*>* s_fs_map;
|
||||
|
@ -17,7 +17,6 @@ static HashMap<dword, FS*>& all_fses()
|
|||
return *s_fs_map;
|
||||
}
|
||||
|
||||
|
||||
FS::FS()
|
||||
: m_fsid(++s_lastFileSystemID)
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <Kernel/FileSystem/Inode.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <Kernel/VM/VMObject.h>
|
||||
#include <Kernel/FileSystem/Inode.h>
|
||||
#include <Kernel/Net/LocalSocket.h>
|
||||
#include <Kernel/VM/VMObject.h>
|
||||
|
||||
HashTable<Inode*>& all_inodes()
|
||||
{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include <Kernel/FileSystem/InodeFile.h>
|
||||
#include <Kernel/FileSystem/Inode.h>
|
||||
#include <Kernel/FileSystem/FileDescription.h>
|
||||
#include <Kernel/FileSystem/Inode.h>
|
||||
#include <Kernel/FileSystem/InodeFile.h>
|
||||
#include <Kernel/FileSystem/VirtualFileSystem.h>
|
||||
#include <Kernel/Process.h>
|
||||
|
||||
|
|
|
@ -1,20 +1,21 @@
|
|||
#include "ProcFS.h"
|
||||
#include "Console.h"
|
||||
#include "KSyms.h"
|
||||
#include "Process.h"
|
||||
#include "Scheduler.h"
|
||||
#include "StdLib.h"
|
||||
#include "i386.h"
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <Kernel/FileSystem/Custody.h>
|
||||
#include <Kernel/FileSystem/FileDescription.h>
|
||||
#include <Kernel/FileSystem/VirtualFileSystem.h>
|
||||
#include <Kernel/VM/MemoryManager.h>
|
||||
#include "StdLib.h"
|
||||
#include "i386.h"
|
||||
#include "KSyms.h"
|
||||
#include "Console.h"
|
||||
#include "Scheduler.h"
|
||||
#include <Kernel/PCI.h>
|
||||
#include <Kernel/VM/MemoryManager.h>
|
||||
#include <Kernel/kmalloc.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <LibC/errno_numbers.h>
|
||||
|
||||
enum ProcParentDirectory {
|
||||
enum ProcParentDirectory
|
||||
{
|
||||
PDI_AbstractRoot = 0,
|
||||
PDI_Root,
|
||||
PDI_Root_sys,
|
||||
|
@ -22,7 +23,8 @@ enum ProcParentDirectory {
|
|||
PDI_PID_fd,
|
||||
};
|
||||
|
||||
enum ProcFileType {
|
||||
enum ProcFileType
|
||||
{
|
||||
FI_Invalid = 0,
|
||||
|
||||
FI_Root = 1, // directory
|
||||
|
@ -275,8 +277,7 @@ ByteBuffer procfs$pid_vmo(InodeIdentifier identifier)
|
|||
builder.appendf("P%x%s(%u) ",
|
||||
physical_page ? physical_page->paddr().get() : 0,
|
||||
region->should_cow(i) ? "!" : "",
|
||||
physical_page ? physical_page->retain_count() : 0
|
||||
);
|
||||
physical_page ? physical_page->retain_count() : 0);
|
||||
}
|
||||
builder.appendf("\n");
|
||||
}
|
||||
|
@ -510,8 +511,7 @@ ByteBuffer procfs$kmalloc(InodeIdentifier)
|
|||
"free: %u\n",
|
||||
kmalloc_sum_eternal,
|
||||
sum_alloc,
|
||||
sum_free
|
||||
);
|
||||
sum_free);
|
||||
return builder.to_byte_buffer();
|
||||
}
|
||||
|
||||
|
@ -551,8 +551,7 @@ ByteBuffer procfs$memstat(InodeIdentifier)
|
|||
MM.super_physical_pages_in_existence() - MM.m_free_supervisor_physical_pages.size(),
|
||||
MM.m_free_supervisor_physical_pages.size(),
|
||||
g_kmalloc_call_count,
|
||||
g_kfree_call_count
|
||||
);
|
||||
g_kfree_call_count);
|
||||
return builder.to_byte_buffer();
|
||||
}
|
||||
|
||||
|
@ -580,8 +579,7 @@ ByteBuffer procfs$all(InodeIdentifier)
|
|||
process->amount_shared(),
|
||||
process->main_thread().ticks(), // FIXME(Thread): Bill all ticks to the process
|
||||
to_string(process->priority()),
|
||||
process->syscall_count()
|
||||
);
|
||||
process->syscall_count());
|
||||
};
|
||||
build_process_line(Scheduler::colonel());
|
||||
for (auto* process : processes)
|
||||
|
@ -603,7 +601,8 @@ ByteBuffer procfs$inodes(InodeIdentifier)
|
|||
struct SysVariableData final : public ProcFSInodeCustomData {
|
||||
virtual ~SysVariableData() override {}
|
||||
|
||||
enum Type {
|
||||
enum Type
|
||||
{
|
||||
Invalid,
|
||||
Boolean,
|
||||
String,
|
||||
|
@ -932,8 +931,7 @@ bool ProcFSInode::traverse_as_directory(Function<bool(const FS::DirectoryEntry&)
|
|||
callback({ entry.name, (int)strlen(entry.name), to_identifier(fsid(), PDI_PID, pid, (ProcFileType)entry.proc_file_type), 0 });
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
} break;
|
||||
|
||||
case FI_PID_fd: {
|
||||
auto handle = ProcessInspectionHandle::from_pid(pid);
|
||||
|
@ -948,8 +946,7 @@ bool ProcFSInode::traverse_as_directory(Function<bool(const FS::DirectoryEntry&)
|
|||
int name_length = ksprintf(name, "%u", i);
|
||||
callback({ name, name_length, to_identifier_with_fd(fsid(), pid, i), 0 });
|
||||
}
|
||||
}
|
||||
break;
|
||||
} break;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
|
@ -1028,7 +1025,6 @@ InodeIdentifier ProcFSInode::lookup(StringView name)
|
|||
InterruptDisabler disabler;
|
||||
if (auto* process = Process::from_pid(to_pid(identifier())))
|
||||
fd_exists = process->file_description(name_as_number);
|
||||
|
||||
}
|
||||
if (fd_exists)
|
||||
return to_identifier_with_fd(fsid(), to_pid(identifier()), name_as_number);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <Kernel/FileSystem/SyntheticFileSystem.h>
|
||||
#include <Kernel/FileSystem/FileDescription.h>
|
||||
#include <LibC/errno_numbers.h>
|
||||
#include <AK/StdLibExtras.h>
|
||||
#include <Kernel/FileSystem/FileDescription.h>
|
||||
#include <Kernel/FileSystem/SyntheticFileSystem.h>
|
||||
#include <LibC/errno_numbers.h>
|
||||
|
||||
//#define SYNTHFS_DEBUG
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
#include "VirtualFileSystem.h"
|
||||
#include <Kernel/FileSystem/FileDescription.h>
|
||||
#include "FileSystem.h"
|
||||
#include <AK/FileSystemPath.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <Kernel/Devices/CharacterDevice.h>
|
||||
#include <LibC/errno_numbers.h>
|
||||
#include <Kernel/Process.h>
|
||||
#include <Kernel/FileSystem/Custody.h>
|
||||
#include <Kernel/FileSystem/FileDescription.h>
|
||||
#include <Kernel/Process.h>
|
||||
#include <LibC/errno_numbers.h>
|
||||
|
||||
//#define VFS_DEBUG
|
||||
|
||||
|
@ -705,8 +705,7 @@ KResultOr<Retained<Custody>> VFS::resolve_path(StringView path, Custody& base, R
|
|||
symlink_contents.size()),
|
||||
*current_parent,
|
||||
parent_custody,
|
||||
options
|
||||
);
|
||||
options);
|
||||
}
|
||||
}
|
||||
return custody_chain.last();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "IRQHandler.h"
|
||||
#include "i386.h"
|
||||
#include "PIC.h"
|
||||
#include "i386.h"
|
||||
|
||||
IRQHandler::IRQHandler(byte irq)
|
||||
: m_irq_number(irq)
|
||||
|
@ -22,4 +22,3 @@ void IRQHandler::disable_irq()
|
|||
{
|
||||
PIC::disable(m_irq_number);
|
||||
}
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ public:
|
|||
const String& cmdline() const { return m_cmdline; }
|
||||
String get(const String& key) const;
|
||||
bool has(const String& key) const;
|
||||
|
||||
private:
|
||||
String m_cmdline;
|
||||
HashMap<String, String> m_params;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#include "KSyms.h"
|
||||
#include "Process.h"
|
||||
#include "Scheduler.h"
|
||||
#include <Kernel/FileSystem/FileDescription.h>
|
||||
#include <AK/ELF/ELFLoader.h>
|
||||
#include <AK/TemporaryChange.h>
|
||||
#include <Kernel/FileSystem/FileDescription.h>
|
||||
|
||||
static KSym* s_ksyms;
|
||||
dword ksym_lowest_address;
|
||||
|
@ -140,7 +140,8 @@ void dump_backtrace()
|
|||
}
|
||||
TemporaryChange change(in_dump_backtrace, true);
|
||||
dword ebp;
|
||||
asm volatile("movl %%ebp, %%eax":"=a"(ebp));
|
||||
asm volatile("movl %%ebp, %%eax"
|
||||
: "=a"(ebp));
|
||||
dump_backtrace_impl(ebp, ksyms_ready);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include <Kernel/IO.h>
|
||||
#include <Kernel/Net/E1000NetworkAdapter.h>
|
||||
#include <Kernel/PCI.h>
|
||||
#include <Kernel/IO.h>
|
||||
|
||||
#define REG_CTRL 0x0000
|
||||
#define REG_STATUS 0x0008
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
#include <Kernel/Net/IPv4Socket.h>
|
||||
#include <Kernel/Net/TCPSocket.h>
|
||||
#include <Kernel/Net/UDPSocket.h>
|
||||
#include <Kernel/UnixTypes.h>
|
||||
#include <Kernel/Process.h>
|
||||
#include <Kernel/Net/NetworkAdapter.h>
|
||||
#include <Kernel/Net/IPv4.h>
|
||||
#include <Kernel/Net/ICMP.h>
|
||||
#include <Kernel/Net/TCP.h>
|
||||
#include <Kernel/Net/UDP.h>
|
||||
#include <Kernel/Net/ARP.h>
|
||||
#include <Kernel/Net/Routing.h>
|
||||
#include <LibC/errno_numbers.h>
|
||||
#include <Kernel/FileSystem/FileDescription.h>
|
||||
#include <Kernel/Net/ARP.h>
|
||||
#include <Kernel/Net/ICMP.h>
|
||||
#include <Kernel/Net/IPv4.h>
|
||||
#include <Kernel/Net/IPv4Socket.h>
|
||||
#include <Kernel/Net/NetworkAdapter.h>
|
||||
#include <Kernel/Net/Routing.h>
|
||||
#include <Kernel/Net/TCP.h>
|
||||
#include <Kernel/Net/TCPSocket.h>
|
||||
#include <Kernel/Net/UDP.h>
|
||||
#include <Kernel/Net/UDPSocket.h>
|
||||
#include <Kernel/Process.h>
|
||||
#include <Kernel/UnixTypes.h>
|
||||
#include <LibC/errno_numbers.h>
|
||||
|
||||
#define IPV4_SOCKET_DEBUG
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#include <Kernel/Net/LocalSocket.h>
|
||||
#include <Kernel/UnixTypes.h>
|
||||
#include <Kernel/Process.h>
|
||||
#include <Kernel/FileSystem/FileDescription.h>
|
||||
#include <Kernel/FileSystem/VirtualFileSystem.h>
|
||||
#include <Kernel/Net/LocalSocket.h>
|
||||
#include <Kernel/Process.h>
|
||||
#include <Kernel/UnixTypes.h>
|
||||
#include <LibC/errno_numbers.h>
|
||||
|
||||
//#define DEBUG_LOCAL_SOCKET
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
#include <Kernel/Net/NetworkAdapter.h>
|
||||
#include <Kernel/Net/EthernetFrameHeader.h>
|
||||
#include <Kernel/Net/EtherType.h>
|
||||
#include <Kernel/StdLib.h>
|
||||
#include <Kernel/kmalloc.h>
|
||||
#include <AK/HashTable.h>
|
||||
#include <Kernel/Lock.h>
|
||||
#include <Kernel/Net/EtherType.h>
|
||||
#include <Kernel/Net/EthernetFrameHeader.h>
|
||||
#include <Kernel/Net/NetworkAdapter.h>
|
||||
#include <Kernel/StdLib.h>
|
||||
#include <Kernel/kmalloc.h>
|
||||
|
||||
static Lockable<HashTable<NetworkAdapter*>>& all_adapters()
|
||||
{
|
||||
|
|
|
@ -1,18 +1,17 @@
|
|||
#include <Kernel/Net/E1000NetworkAdapter.h>
|
||||
#include <Kernel/Net/EthernetFrameHeader.h>
|
||||
#include <Kernel/Lock.h>
|
||||
#include <Kernel/Net/ARP.h>
|
||||
#include <Kernel/Net/E1000NetworkAdapter.h>
|
||||
#include <Kernel/Net/EtherType.h>
|
||||
#include <Kernel/Net/EthernetFrameHeader.h>
|
||||
#include <Kernel/Net/ICMP.h>
|
||||
#include <Kernel/Net/UDP.h>
|
||||
#include <Kernel/Net/TCP.h>
|
||||
#include <Kernel/Net/IPv4.h>
|
||||
#include <Kernel/Net/IPv4Socket.h>
|
||||
#include <Kernel/Net/TCPSocket.h>
|
||||
#include <Kernel/Net/UDPSocket.h>
|
||||
#include <Kernel/Net/LoopbackAdapter.h>
|
||||
#include <Kernel/Net/TCP.h>
|
||||
#include <Kernel/Net/TCPSocket.h>
|
||||
#include <Kernel/Net/UDP.h>
|
||||
#include <Kernel/Net/UDPSocket.h>
|
||||
#include <Kernel/Process.h>
|
||||
#include <Kernel/Net/EtherType.h>
|
||||
#include <Kernel/Lock.h>
|
||||
|
||||
|
||||
//#define ETHERNET_DEBUG
|
||||
#define IPV4_DEBUG
|
||||
|
@ -91,8 +90,7 @@ void NetworkTask_main()
|
|||
eth.source().to_string().characters(),
|
||||
eth.destination().to_string().characters(),
|
||||
eth.ether_type(),
|
||||
packet.size()
|
||||
);
|
||||
packet.size());
|
||||
#endif
|
||||
|
||||
switch (eth.ether_type()) {
|
||||
|
@ -117,15 +115,13 @@ void handle_arp(const EthernetFrameHeader& eth, int frame_size)
|
|||
if (packet.hardware_type() != 1 || packet.hardware_address_length() != sizeof(MACAddress)) {
|
||||
kprintf("handle_arp: Hardware type not ethernet (%w, len=%u)\n",
|
||||
packet.hardware_type(),
|
||||
packet.hardware_address_length()
|
||||
);
|
||||
packet.hardware_address_length());
|
||||
return;
|
||||
}
|
||||
if (packet.protocol_type() != EtherType::IPv4 || packet.protocol_address_length() != sizeof(IPv4Address)) {
|
||||
kprintf("handle_arp: Protocol type not IPv4 (%w, len=%u)\n",
|
||||
packet.hardware_type(),
|
||||
packet.protocol_address_length()
|
||||
);
|
||||
packet.protocol_address_length());
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -135,8 +131,7 @@ void handle_arp(const EthernetFrameHeader& eth, int frame_size)
|
|||
packet.sender_hardware_address().to_string().characters(),
|
||||
packet.sender_protocol_address().to_string().characters(),
|
||||
packet.target_hardware_address().to_string().characters(),
|
||||
packet.target_protocol_address().to_string().characters()
|
||||
);
|
||||
packet.target_protocol_address().to_string().characters());
|
||||
#endif
|
||||
|
||||
if (packet.operation() == ARPOperation::Request) {
|
||||
|
@ -183,8 +178,7 @@ void handle_ipv4(const EthernetFrameHeader& eth, int frame_size)
|
|||
#ifdef IPV4_DEBUG
|
||||
kprintf("handle_ipv4: source=%s, target=%s\n",
|
||||
packet.source().to_string().characters(),
|
||||
packet.destination().to_string().characters()
|
||||
);
|
||||
packet.destination().to_string().characters());
|
||||
#endif
|
||||
|
||||
switch ((IPv4Protocol)packet.protocol()) {
|
||||
|
@ -210,8 +204,7 @@ void handle_icmp(const EthernetFrameHeader& eth, int frame_size)
|
|||
ipv4_packet.source().to_string().characters(),
|
||||
ipv4_packet.destination().to_string().characters(),
|
||||
icmp_header.type(),
|
||||
icmp_header.code()
|
||||
);
|
||||
icmp_header.code());
|
||||
#endif
|
||||
|
||||
{
|
||||
|
@ -233,8 +226,7 @@ void handle_icmp(const EthernetFrameHeader& eth, int frame_size)
|
|||
kprintf("handle_icmp: EchoRequest from %s: id=%u, seq=%u\n",
|
||||
ipv4_packet.source().to_string().characters(),
|
||||
(word)request.identifier,
|
||||
(word)request.sequence_number
|
||||
);
|
||||
(word)request.sequence_number);
|
||||
size_t icmp_packet_size = ipv4_packet.payload_size();
|
||||
auto buffer = ByteBuffer::create_zeroed(icmp_packet_size);
|
||||
auto& response = *(ICMPEchoPacket*)buffer.pointer();
|
||||
|
@ -267,8 +259,7 @@ void handle_udp(const EthernetFrameHeader& eth, int frame_size)
|
|||
udp_packet.source_port(),
|
||||
ipv4_packet.destination().to_string().characters(),
|
||||
udp_packet.destination_port(),
|
||||
udp_packet.length()
|
||||
);
|
||||
udp_packet.length());
|
||||
#endif
|
||||
|
||||
auto socket = UDPSocket::from_port(udp_packet.destination_port());
|
||||
|
@ -308,8 +299,7 @@ void handle_tcp(const EthernetFrameHeader& eth, int frame_size)
|
|||
tcp_packet.has_syn() ? "SYN" : "",
|
||||
tcp_packet.has_ack() ? "ACK" : "",
|
||||
tcp_packet.window_size(),
|
||||
payload_size
|
||||
);
|
||||
payload_size);
|
||||
#endif
|
||||
|
||||
auto socket = TCPSocket::from_port(tcp_packet.destination_port());
|
||||
|
@ -354,8 +344,7 @@ void handle_tcp(const EthernetFrameHeader& eth, int frame_size)
|
|||
tcp_packet.sequence_number(),
|
||||
payload_size,
|
||||
socket->ack_number(),
|
||||
socket->sequence_number()
|
||||
);
|
||||
socket->sequence_number());
|
||||
socket->send_tcp_packet(TCPFlags::ACK);
|
||||
|
||||
if (payload_size != 0)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include <Kernel/Net/Routing.h>
|
||||
#include <Kernel/Net/LoopbackAdapter.h>
|
||||
#include <Kernel/Net/Routing.h>
|
||||
|
||||
NetworkAdapter* adapter_for_route_to(const IPv4Address& ipv4_address)
|
||||
{
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#include <Kernel/FileSystem/FileDescription.h>
|
||||
#include <Kernel/Net/Socket.h>
|
||||
#include <Kernel/Net/LocalSocket.h>
|
||||
#include <Kernel/Net/IPv4Socket.h>
|
||||
#include <Kernel/UnixTypes.h>
|
||||
#include <Kernel/Net/LocalSocket.h>
|
||||
#include <Kernel/Net/Socket.h>
|
||||
#include <Kernel/Process.h>
|
||||
#include <Kernel/UnixTypes.h>
|
||||
#include <LibC/errno_numbers.h>
|
||||
|
||||
KResultOr<Retained<Socket>> Socket::create(int domain, int type, int protocol)
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#include <Kernel/Net/TCPSocket.h>
|
||||
#include <Kernel/Net/TCP.h>
|
||||
#include <Kernel/Devices/RandomDevice.h>
|
||||
#include <Kernel/Net/NetworkAdapter.h>
|
||||
#include <Kernel/Net/Routing.h>
|
||||
#include <Kernel/Net/TCP.h>
|
||||
#include <Kernel/Net/TCPSocket.h>
|
||||
#include <Kernel/Process.h>
|
||||
#include <Kernel/Devices/RandomDevice.h>
|
||||
|
||||
Lockable<HashMap<word, TCPSocket*>>& TCPSocket::sockets_by_port()
|
||||
{
|
||||
|
@ -27,7 +27,6 @@ TCPSocketHandle TCPSocket::from_port(word port)
|
|||
return { move(socket) };
|
||||
}
|
||||
|
||||
|
||||
TCPSocket::TCPSocket(int protocol)
|
||||
: IPv4Socket(SOCK_STREAM, protocol)
|
||||
{
|
||||
|
@ -102,14 +101,14 @@ void TCPSocket::send_tcp_packet(word flags, const void* payload, int payload_siz
|
|||
tcp_packet.has_syn() ? "SYN" : "",
|
||||
tcp_packet.has_ack() ? "ACK" : "",
|
||||
tcp_packet.sequence_number(),
|
||||
tcp_packet.ack_number()
|
||||
);
|
||||
tcp_packet.ack_number());
|
||||
adapter->send_ipv4(MACAddress(), peer_address(), IPv4Protocol::TCP, move(buffer));
|
||||
}
|
||||
|
||||
NetworkOrdered<word> TCPSocket::compute_tcp_checksum(const IPv4Address& source, const IPv4Address& destination, const TCPPacket& packet, word payload_size)
|
||||
{
|
||||
struct [[gnu::packed]] PseudoHeader {
|
||||
struct [[gnu::packed]] PseudoHeader
|
||||
{
|
||||
IPv4Address source;
|
||||
IPv4Address destination;
|
||||
byte zero;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#include <Kernel/Net/UDPSocket.h>
|
||||
#include <Kernel/Net/UDP.h>
|
||||
#include <Kernel/Net/NetworkAdapter.h>
|
||||
#include <Kernel/Process.h>
|
||||
#include <Kernel/Devices/RandomDevice.h>
|
||||
#include <Kernel/Net/NetworkAdapter.h>
|
||||
#include <Kernel/Net/Routing.h>
|
||||
#include <Kernel/Net/UDP.h>
|
||||
#include <Kernel/Net/UDPSocket.h>
|
||||
#include <Kernel/Process.h>
|
||||
|
||||
Lockable<HashMap<word, UDPSocket*>>& UDPSocket::sockets_by_port()
|
||||
{
|
||||
|
@ -27,7 +27,6 @@ UDPSocketHandle UDPSocket::from_port(word port)
|
|||
return { move(socket) };
|
||||
}
|
||||
|
||||
|
||||
UDPSocket::UDPSocket(int protocol)
|
||||
: IPv4Socket(SOCK_DGRAM, protocol)
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include <Kernel/PCI.h>
|
||||
#include <Kernel/IO.h>
|
||||
#include <Kernel/PCI.h>
|
||||
|
||||
#define PCI_VENDOR_ID 0x00 // word
|
||||
#define PCI_DEVICE_ID 0x02 // word
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#include <AK/Types.h>
|
||||
#include "i386.h"
|
||||
#include "IO.h"
|
||||
#include "PIC.h"
|
||||
#include "Assertions.h"
|
||||
#include "IO.h"
|
||||
#include "i386.h"
|
||||
#include <AK/Types.h>
|
||||
|
||||
// The slave 8259 is connected to the master's IRQ2 line.
|
||||
// This is really only to enhance clarity.
|
||||
|
|
|
@ -1,31 +1,31 @@
|
|||
#include <AK/Types.h>
|
||||
#include "Process.h"
|
||||
#include "kmalloc.h"
|
||||
#include "StdLib.h"
|
||||
#include "i386.h"
|
||||
#include <Kernel/FileSystem/FileDescription.h>
|
||||
#include <Kernel/FileSystem/VirtualFileSystem.h>
|
||||
#include <Kernel/Devices/NullDevice.h>
|
||||
#include <Kernel/VM/MemoryManager.h>
|
||||
#include "i8253.h"
|
||||
#include "RTC.h"
|
||||
#include <AK/StdLibExtras.h>
|
||||
#include <LibC/signal_numbers.h>
|
||||
#include <LibC/errno_numbers.h>
|
||||
#include "Syscall.h"
|
||||
#include "Scheduler.h"
|
||||
#include <Kernel/FileSystem/FIFO.h>
|
||||
#include "KSyms.h"
|
||||
#include <Kernel/Net/Socket.h>
|
||||
#include <Kernel/TTY/MasterPTY.h>
|
||||
#include <AK/ELF/exec_elf.h>
|
||||
#include "RTC.h"
|
||||
#include "Scheduler.h"
|
||||
#include "StdLib.h"
|
||||
#include "Syscall.h"
|
||||
#include "i386.h"
|
||||
#include "i8253.h"
|
||||
#include "kmalloc.h"
|
||||
#include <AK/ELF/ELFLoader.h>
|
||||
#include <AK/ELF/exec_elf.h>
|
||||
#include <AK/StdLibExtras.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <AK/Time.h>
|
||||
#include <Kernel/SharedMemory.h>
|
||||
#include <Kernel/ProcessTracer.h>
|
||||
#include <AK/Types.h>
|
||||
#include <Kernel/Devices/NullDevice.h>
|
||||
#include <Kernel/FileSystem/Custody.h>
|
||||
#include <Kernel/FileSystem/FIFO.h>
|
||||
#include <Kernel/FileSystem/FileDescription.h>
|
||||
#include <Kernel/FileSystem/VirtualFileSystem.h>
|
||||
#include <Kernel/Multiboot.h>
|
||||
#include <Kernel/Net/Socket.h>
|
||||
#include <Kernel/ProcessTracer.h>
|
||||
#include <Kernel/SharedMemory.h>
|
||||
#include <Kernel/TTY/MasterPTY.h>
|
||||
#include <Kernel/VM/MemoryManager.h>
|
||||
#include <LibC/errno_numbers.h>
|
||||
#include <LibC/signal_numbers.h>
|
||||
|
||||
//#define DEBUG_POLL_SELECT
|
||||
//#define DEBUG_IO
|
||||
|
@ -307,7 +307,6 @@ int Process::do_exec(String path, Vector<String> arguments, Vector<String> envir
|
|||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
|
||||
|
||||
auto parts = path.split('/');
|
||||
if (parts.is_empty())
|
||||
return -ENOENT;
|
||||
|
@ -1442,8 +1441,8 @@ 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
|
||||
|
@ -2573,10 +2572,14 @@ int Process::sys$get_shared_buffer_size(int shared_buffer_id)
|
|||
const char* to_string(Process::Priority priority)
|
||||
{
|
||||
switch (priority) {
|
||||
case Process::IdlePriority: return "Idle";
|
||||
case Process::LowPriority: return "Low";
|
||||
case Process::NormalPriority: return "Normal";
|
||||
case Process::HighPriority: return "High";
|
||||
case Process::IdlePriority:
|
||||
return "Idle";
|
||||
case Process::LowPriority:
|
||||
return "Low";
|
||||
case Process::NormalPriority:
|
||||
return "Normal";
|
||||
case Process::HighPriority:
|
||||
return "High";
|
||||
}
|
||||
kprintf("to_string(Process::Priority): Invalid priority: %u\n", priority);
|
||||
ASSERT_NOT_REACHED();
|
||||
|
|
|
@ -1,15 +1,13 @@
|
|||
#include <Kernel/ProcessTracer.h>
|
||||
#include <AK/kstdio.h>
|
||||
#include <Kernel/ProcessTracer.h>
|
||||
|
||||
ProcessTracer::ProcessTracer(pid_t pid)
|
||||
: m_pid(pid)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
ProcessTracer::~ProcessTracer()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void ProcessTracer::did_syscall(dword function, dword arg1, dword arg2, dword arg3, dword result)
|
||||
|
|
|
@ -124,4 +124,3 @@ time_t now()
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
#include "i8253.h"
|
||||
#include <AK/TemporaryChange.h>
|
||||
#include <Kernel/Alarm.h>
|
||||
#include <Kernel/FileSystem/FileDescription.h>
|
||||
#include <Kernel/Devices/PCSpeaker.h>
|
||||
#include <Kernel/FileSystem/FileDescription.h>
|
||||
|
||||
//#define LOG_EVERY_CONTEXT_SWITCH
|
||||
//#define SCHEDULER_DEBUG
|
||||
|
@ -312,9 +312,7 @@ void Scheduler::switch_now()
|
|||
descriptor.type = 9;
|
||||
flush_gdt();
|
||||
asm("sti\n"
|
||||
"ljmp *(%%eax)\n"
|
||||
::"a"(¤t->far_ptr())
|
||||
);
|
||||
"ljmp *(%%eax)\n" ::"a"(¤t->far_ptr()));
|
||||
}
|
||||
|
||||
bool Scheduler::context_switch(Thread& thread)
|
||||
|
@ -456,6 +454,5 @@ void Scheduler::timer_tick(RegisterDump& regs)
|
|||
asm(
|
||||
"pushf\n"
|
||||
"orl $0x00004000, (%esp)\n"
|
||||
"popf\n"
|
||||
);
|
||||
"popf\n");
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#include <Kernel/SharedMemory.h>
|
||||
#include <Kernel/VM/VMObject.h>
|
||||
#include <AK/HashMap.h>
|
||||
#include <Kernel/Lock.h>
|
||||
#include <Kernel/Process.h>
|
||||
#include <AK/HashMap.h>
|
||||
#include <Kernel/SharedMemory.h>
|
||||
#include <Kernel/VM/VMObject.h>
|
||||
|
||||
Lockable<HashMap<String, RetainPtr<SharedMemory>>>& shared_memories()
|
||||
{
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#include <AK/Types.h>
|
||||
#include "Assertions.h"
|
||||
#include "kmalloc.h"
|
||||
#include <AK/StdLibExtras.h>
|
||||
|
@ -22,17 +21,14 @@ void* memcpy(void* dest_ptr, const void* src_ptr, size_t n)
|
|||
"rep movsl\n"
|
||||
: "=S"(src), "=D"(dest)
|
||||
: "S"(src), "D"(dest), "c"(size_ts)
|
||||
: "memory"
|
||||
);
|
||||
: "memory");
|
||||
n -= size_ts * sizeof(size_t);
|
||||
if (n == 0)
|
||||
return dest_ptr;
|
||||
}
|
||||
asm volatile(
|
||||
"rep movsb\n"
|
||||
:: "S"(src), "D"(dest), "c"(n)
|
||||
: "memory"
|
||||
);
|
||||
"rep movsb\n" ::"S"(src), "D"(dest), "c"(n)
|
||||
: "memory");
|
||||
return dest_ptr;
|
||||
}
|
||||
|
||||
|
@ -52,7 +48,8 @@ char* strcpy(char* dest, const char *src)
|
|||
{
|
||||
auto* dest_ptr = dest;
|
||||
auto* src_ptr = src;
|
||||
while ((*dest_ptr++ = *src_ptr++) != '\0');
|
||||
while ((*dest_ptr++ = *src_ptr++) != '\0')
|
||||
;
|
||||
return dest;
|
||||
}
|
||||
|
||||
|
@ -79,8 +76,7 @@ void* memset(void* dest_ptr, int c, size_t n)
|
|||
"rep stosl\n"
|
||||
: "=D"(dest)
|
||||
: "D"(dest), "c"(size_ts), "a"(expanded_c)
|
||||
: "memory"
|
||||
);
|
||||
: "memory");
|
||||
n -= size_ts * sizeof(size_t);
|
||||
if (n == 0)
|
||||
return dest_ptr;
|
||||
|
@ -89,8 +85,7 @@ void* memset(void* dest_ptr, int c, size_t n)
|
|||
"rep stosb\n"
|
||||
: "=D"(dest), "=c"(n)
|
||||
: "0"(dest), "1"(n), "a"(c)
|
||||
: "memory"
|
||||
);
|
||||
: "memory");
|
||||
return dest_ptr;
|
||||
}
|
||||
|
||||
|
@ -145,5 +140,4 @@ int memcmp(const void* v1, const void* v2, size_t n)
|
|||
{
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#include "i386.h"
|
||||
#include "Process.h"
|
||||
#include "Syscall.h"
|
||||
#include "Console.h"
|
||||
#include "Scheduler.h"
|
||||
#include <Kernel/Console.h>
|
||||
#include <Kernel/Process.h>
|
||||
#include <Kernel/ProcessTracer.h>
|
||||
#include <Kernel/Scheduler.h>
|
||||
#include <Kernel/Syscall.h>
|
||||
#include <Kernel/i386.h>
|
||||
|
||||
extern "C" void syscall_trap_entry(RegisterDump&);
|
||||
extern "C" void syscall_trap_handler();
|
||||
|
@ -34,8 +34,7 @@ asm(
|
|||
" popw %es\n"
|
||||
" popw %ds\n"
|
||||
" popa\n"
|
||||
" iret\n"
|
||||
);
|
||||
" iret\n");
|
||||
|
||||
namespace Syscall {
|
||||
|
||||
|
@ -303,4 +302,3 @@ void syscall_trap_entry(RegisterDump& regs)
|
|||
tracer->did_syscall(function, arg1, arg2, arg3, regs.eax);
|
||||
current->process().big_lock().unlock();
|
||||
}
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@
|
|||
__ENUMERATE_SYSCALL(getpeername) \
|
||||
__ENUMERATE_SYSCALL(sched_setparam) \
|
||||
__ENUMERATE_SYSCALL(sched_getparam) \
|
||||
__ENUMERATE_SYSCALL(fchown) \
|
||||
__ENUMERATE_SYSCALL(fchown)
|
||||
|
||||
namespace Syscall {
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "MasterPTY.h"
|
||||
#include "SlavePTY.h"
|
||||
#include "PTYMultiplexer.h"
|
||||
#include "SlavePTY.h"
|
||||
#include <Kernel/Process.h>
|
||||
#include <LibC/errno_numbers.h>
|
||||
#include <LibC/signal_numbers.h>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include <Kernel/TTY/TTY.h>
|
||||
#include "Process.h"
|
||||
#include <Kernel/TTY/TTY.h>
|
||||
#include <LibC/errno_numbers.h>
|
||||
#include <LibC/signal_numbers.h>
|
||||
#include <LibC/sys/ioctl_numbers.h>
|
||||
|
@ -94,21 +94,18 @@ void TTY::set_termios(const termios& t)
|
|||
tty_name().characters(),
|
||||
should_echo_input(),
|
||||
should_generate_signals(),
|
||||
in_canonical_mode()
|
||||
);
|
||||
in_canonical_mode());
|
||||
dbgprintf("%s set_termios: ECHOE=%u, ECHOK=%u, ECHONL=%u\n",
|
||||
tty_name().characters(),
|
||||
(m_termios.c_lflag & ECHOE) != 0,
|
||||
(m_termios.c_lflag & ECHOK) != 0,
|
||||
(m_termios.c_lflag & ECHONL) != 0
|
||||
);
|
||||
(m_termios.c_lflag & ECHONL) != 0);
|
||||
dbgprintf("%s set_termios: ISTRIP=%u, ICRNL=%u, INLCR=%u, IGNCR=%u\n",
|
||||
tty_name().characters(),
|
||||
(m_termios.c_iflag & ISTRIP) != 0,
|
||||
(m_termios.c_iflag & ICRNL) != 0,
|
||||
(m_termios.c_iflag & INLCR) != 0,
|
||||
(m_termios.c_iflag & IGNCR) != 0
|
||||
);
|
||||
(m_termios.c_iflag & IGNCR) != 0);
|
||||
}
|
||||
|
||||
int TTY::ioctl(FileDescription&, unsigned request, unsigned arg)
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#include "VirtualConsole.h"
|
||||
#include "kmalloc.h"
|
||||
#include "i386.h"
|
||||
#include "IO.h"
|
||||
#include "StdLib.h"
|
||||
#include "i386.h"
|
||||
#include "kmalloc.h"
|
||||
#include <AK/AKString.h>
|
||||
|
||||
static byte* s_vga_buffer;
|
||||
|
@ -128,7 +128,8 @@ inline bool is_valid_final_character(byte ch)
|
|||
return ch >= 0x40 && ch <= 0x7e;
|
||||
}
|
||||
|
||||
enum class VGAColor : byte {
|
||||
enum class VGAColor : byte
|
||||
{
|
||||
Black = 0,
|
||||
Blue,
|
||||
Green,
|
||||
|
@ -147,7 +148,8 @@ enum class VGAColor : byte {
|
|||
White,
|
||||
};
|
||||
|
||||
enum class ANSIColor : byte {
|
||||
enum class ANSIColor : byte
|
||||
{
|
||||
Black = 0,
|
||||
Red,
|
||||
Green,
|
||||
|
@ -169,22 +171,38 @@ enum class ANSIColor : byte {
|
|||
static inline VGAColor ansi_color_to_vga(ANSIColor color)
|
||||
{
|
||||
switch (color) {
|
||||
case ANSIColor::Black: return VGAColor::Black;
|
||||
case ANSIColor::Red: return VGAColor::Red;
|
||||
case ANSIColor::Brown: return VGAColor::Brown;
|
||||
case ANSIColor::Blue: return VGAColor::Blue;
|
||||
case ANSIColor::Magenta: return VGAColor::Magenta;
|
||||
case ANSIColor::Green: return VGAColor::Green;
|
||||
case ANSIColor::Cyan: return VGAColor::Cyan;
|
||||
case ANSIColor::LightGray: return VGAColor::LightGray;
|
||||
case ANSIColor::DarkGray: return VGAColor::DarkGray;
|
||||
case ANSIColor::BrightRed: return VGAColor::BrightRed;
|
||||
case ANSIColor::BrightGreen: return VGAColor::BrightGreen;
|
||||
case ANSIColor::Yellow: return VGAColor::Yellow;
|
||||
case ANSIColor::BrightBlue: return VGAColor::BrightBlue;
|
||||
case ANSIColor::BrightMagenta: return VGAColor::BrightMagenta;
|
||||
case ANSIColor::BrightCyan: return VGAColor::BrightCyan;
|
||||
case ANSIColor::White: return VGAColor::White;
|
||||
case ANSIColor::Black:
|
||||
return VGAColor::Black;
|
||||
case ANSIColor::Red:
|
||||
return VGAColor::Red;
|
||||
case ANSIColor::Brown:
|
||||
return VGAColor::Brown;
|
||||
case ANSIColor::Blue:
|
||||
return VGAColor::Blue;
|
||||
case ANSIColor::Magenta:
|
||||
return VGAColor::Magenta;
|
||||
case ANSIColor::Green:
|
||||
return VGAColor::Green;
|
||||
case ANSIColor::Cyan:
|
||||
return VGAColor::Cyan;
|
||||
case ANSIColor::LightGray:
|
||||
return VGAColor::LightGray;
|
||||
case ANSIColor::DarkGray:
|
||||
return VGAColor::DarkGray;
|
||||
case ANSIColor::BrightRed:
|
||||
return VGAColor::BrightRed;
|
||||
case ANSIColor::BrightGreen:
|
||||
return VGAColor::BrightGreen;
|
||||
case ANSIColor::Yellow:
|
||||
return VGAColor::Yellow;
|
||||
case ANSIColor::BrightBlue:
|
||||
return VGAColor::BrightBlue;
|
||||
case ANSIColor::BrightMagenta:
|
||||
return VGAColor::BrightMagenta;
|
||||
case ANSIColor::BrightCyan:
|
||||
return VGAColor::BrightCyan;
|
||||
case ANSIColor::White:
|
||||
return VGAColor::White;
|
||||
}
|
||||
ASSERT_NOT_REACHED();
|
||||
return VGAColor::LightGray;
|
||||
|
@ -317,14 +335,29 @@ void VirtualConsole::execute_escape_sequence(byte final)
|
|||
params.append(value);
|
||||
}
|
||||
switch (final) {
|
||||
case 'A': escape$A(params); break;
|
||||
case 'D': escape$D(params); break;
|
||||
case 'H': escape$H(params); break;
|
||||
case 'J': escape$J(params); break;
|
||||
case 'm': escape$m(params); break;
|
||||
case 's': escape$s(params); break;
|
||||
case 'u': escape$u(params); break;
|
||||
default: break;
|
||||
case 'A':
|
||||
escape$A(params);
|
||||
break;
|
||||
case 'D':
|
||||
escape$D(params);
|
||||
break;
|
||||
case 'H':
|
||||
escape$H(params);
|
||||
break;
|
||||
case 'J':
|
||||
escape$J(params);
|
||||
break;
|
||||
case 'm':
|
||||
escape$m(params);
|
||||
break;
|
||||
case 's':
|
||||
escape$s(params);
|
||||
break;
|
||||
case 'u':
|
||||
escape$u(params);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
m_parameters.clear();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <Kernel/Thread.h>
|
||||
#include <Kernel/Scheduler.h>
|
||||
#include <Kernel/Process.h>
|
||||
#include <Kernel/FileSystem/FileDescription.h>
|
||||
#include <Kernel/Process.h>
|
||||
#include <Kernel/Scheduler.h>
|
||||
#include <Kernel/Thread.h>
|
||||
#include <Kernel/VM/MemoryManager.h>
|
||||
#include <LibC/signal_numbers.h>
|
||||
|
||||
|
@ -145,24 +145,42 @@ void Thread::sleep(dword ticks)
|
|||
const char* to_string(Thread::State state)
|
||||
{
|
||||
switch (state) {
|
||||
case Thread::Invalid: return "Invalid";
|
||||
case Thread::Runnable: return "Runnable";
|
||||
case Thread::Running: return "Running";
|
||||
case Thread::Dying: return "Dying";
|
||||
case Thread::Dead: return "Dead";
|
||||
case Thread::Stopped: return "Stopped";
|
||||
case Thread::Skip1SchedulerPass: return "Skip1";
|
||||
case Thread::Skip0SchedulerPasses: return "Skip0";
|
||||
case Thread::BlockedSleep: return "Sleep";
|
||||
case Thread::BlockedWait: return "Wait";
|
||||
case Thread::BlockedRead: return "Read";
|
||||
case Thread::BlockedWrite: return "Write";
|
||||
case Thread::BlockedSignal: return "Signal";
|
||||
case Thread::BlockedSelect: return "Select";
|
||||
case Thread::BlockedLurking: return "Lurking";
|
||||
case Thread::BlockedConnect: return "Connect";
|
||||
case Thread::BlockedReceive: return "Receive";
|
||||
case Thread::BlockedSnoozing: return "Snoozing";
|
||||
case Thread::Invalid:
|
||||
return "Invalid";
|
||||
case Thread::Runnable:
|
||||
return "Runnable";
|
||||
case Thread::Running:
|
||||
return "Running";
|
||||
case Thread::Dying:
|
||||
return "Dying";
|
||||
case Thread::Dead:
|
||||
return "Dead";
|
||||
case Thread::Stopped:
|
||||
return "Stopped";
|
||||
case Thread::Skip1SchedulerPass:
|
||||
return "Skip1";
|
||||
case Thread::Skip0SchedulerPasses:
|
||||
return "Skip0";
|
||||
case Thread::BlockedSleep:
|
||||
return "Sleep";
|
||||
case Thread::BlockedWait:
|
||||
return "Wait";
|
||||
case Thread::BlockedRead:
|
||||
return "Read";
|
||||
case Thread::BlockedWrite:
|
||||
return "Write";
|
||||
case Thread::BlockedSignal:
|
||||
return "Signal";
|
||||
case Thread::BlockedSelect:
|
||||
return "Select";
|
||||
case Thread::BlockedLurking:
|
||||
return "Lurking";
|
||||
case Thread::BlockedConnect:
|
||||
return "Connect";
|
||||
case Thread::BlockedReceive:
|
||||
return "Receive";
|
||||
case Thread::BlockedSnoozing:
|
||||
return "Snoozing";
|
||||
}
|
||||
kprintf("to_string(Thread::State): Invalid state: %u\n", state);
|
||||
ASSERT_NOT_REACHED();
|
||||
|
@ -236,7 +254,8 @@ ShouldUnblockThread Thread::dispatch_one_pending_signal()
|
|||
return dispatch_signal(signal);
|
||||
}
|
||||
|
||||
enum class DefaultSignalAction {
|
||||
enum class DefaultSignalAction
|
||||
{
|
||||
Terminate,
|
||||
Ignore,
|
||||
DumpCore,
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
#include <Kernel/VM/MemoryManager.h>
|
||||
#include <Kernel/FileSystem/Inode.h>
|
||||
#include "CMOS.h"
|
||||
#include "Process.h"
|
||||
#include "StdLib.h"
|
||||
#include "i386.h"
|
||||
#include <AK/Assertions.h>
|
||||
#include <AK/kstdio.h>
|
||||
#include "i386.h"
|
||||
#include "StdLib.h"
|
||||
#include "Process.h"
|
||||
#include "CMOS.h"
|
||||
#include <Kernel/FileSystem/Inode.h>
|
||||
#include <Kernel/VM/MemoryManager.h>
|
||||
|
||||
//#define MM_DEBUG
|
||||
//#define PAGE_FAULT_DEBUG
|
||||
|
@ -100,8 +100,8 @@ void MemoryManager::initialize_paging()
|
|||
asm volatile(
|
||||
"movl %%cr0, %%eax\n"
|
||||
"orl $0x80000001, %%eax\n"
|
||||
"movl %%eax, %%cr0\n"
|
||||
:::"%eax", "memory");
|
||||
"movl %%eax, %%cr0\n" ::
|
||||
: "%eax", "memory");
|
||||
|
||||
#ifdef MM_DEBUG
|
||||
dbgprintf("MM: Paging initialized.\n");
|
||||
|
@ -302,7 +302,6 @@ bool MemoryManager::copy_on_write(Region& region, unsigned page_index_in_region)
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool MemoryManager::page_in_from_inode(Region& region, unsigned page_index_in_region)
|
||||
{
|
||||
ASSERT(region.page_directory());
|
||||
|
@ -451,21 +450,24 @@ void MemoryManager::enter_process_paging_scope(Process& process)
|
|||
ASSERT(current);
|
||||
InterruptDisabler disabler;
|
||||
current->tss().cr3 = process.page_directory().cr3();
|
||||
asm volatile("movl %%eax, %%cr3"::"a"(process.page_directory().cr3()):"memory");
|
||||
asm volatile("movl %%eax, %%cr3" ::"a"(process.page_directory().cr3())
|
||||
: "memory");
|
||||
}
|
||||
|
||||
void MemoryManager::flush_entire_tlb()
|
||||
{
|
||||
asm volatile(
|
||||
"mov %%cr3, %%eax\n"
|
||||
"mov %%eax, %%cr3\n"
|
||||
::: "%eax", "memory"
|
||||
);
|
||||
"mov %%eax, %%cr3\n" ::
|
||||
: "%eax", "memory");
|
||||
}
|
||||
|
||||
void MemoryManager::flush_tlb(LinearAddress laddr)
|
||||
{
|
||||
asm volatile("invlpg %0": :"m" (*(char*)laddr.get()) : "memory");
|
||||
asm volatile("invlpg %0"
|
||||
:
|
||||
: "m"(*(char*)laddr.get())
|
||||
: "memory");
|
||||
}
|
||||
|
||||
void MemoryManager::map_for_kernel(LinearAddress laddr, PhysicalAddress paddr)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <Kernel/VM/PageDirectory.h>
|
||||
#include <Kernel/VM/MemoryManager.h>
|
||||
#include <Kernel/Process.h>
|
||||
#include <Kernel/Thread.h>
|
||||
#include <Kernel/VM/MemoryManager.h>
|
||||
#include <Kernel/VM/PageDirectory.h>
|
||||
|
||||
static const dword userspace_range_base = 0x01000000;
|
||||
static const dword kernelspace_range_base = 0xc0000000;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include <Kernel/VM/PhysicalPage.h>
|
||||
#include <Kernel/VM/MemoryManager.h>
|
||||
#include <Kernel/VM/PhysicalPage.h>
|
||||
#include <Kernel/kmalloc.h>
|
||||
|
||||
Retained<PhysicalPage> PhysicalPage::create_eternal(PhysicalAddress paddr, bool supervisor)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include <AK/QuickSort.h>
|
||||
#include <Kernel/VM/RangeAllocator.h>
|
||||
#include <Kernel/kstdio.h>
|
||||
#include <AK/QuickSort.h>
|
||||
|
||||
//#define VRA_DEBUG
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#include <Kernel/VM/Region.h>
|
||||
#include <Kernel/VM/VMObject.h>
|
||||
#include <Kernel/VM/MemoryManager.h>
|
||||
#include <Kernel/Process.h>
|
||||
#include <Kernel/Thread.h>
|
||||
#include <Kernel/VM/MemoryManager.h>
|
||||
#include <Kernel/VM/Region.h>
|
||||
#include <Kernel/VM/VMObject.h>
|
||||
|
||||
Region::Region(const Range& range, String&& n, byte access, bool cow)
|
||||
: m_range(range)
|
||||
|
|
|
@ -10,6 +10,7 @@ class VMObject;
|
|||
|
||||
class Region : public Retainable<Region> {
|
||||
friend class MemoryManager;
|
||||
|
||||
public:
|
||||
enum Access
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <Kernel/VM/VMObject.h>
|
||||
#include <Kernel/VM/MemoryManager.h>
|
||||
#include <Kernel/FileSystem/FileSystem.h>
|
||||
#include <Kernel/FileSystem/Inode.h>
|
||||
#include <Kernel/VM/MemoryManager.h>
|
||||
#include <Kernel/VM/VMObject.h>
|
||||
|
||||
Retained<VMObject> VMObject::create_file_backed(RetainPtr<Inode>&& inode)
|
||||
{
|
||||
|
@ -59,7 +59,6 @@ VMObject::VMObject(PhysicalAddress paddr, size_t size)
|
|||
ASSERT(m_physical_pages.size() == page_count());
|
||||
}
|
||||
|
||||
|
||||
VMObject::VMObject(RetainPtr<Inode>&& inode)
|
||||
: m_inode(move(inode))
|
||||
{
|
||||
|
|
|
@ -1,16 +1,17 @@
|
|||
#include <AK/Types.h>
|
||||
#include "i386.h"
|
||||
#include "Assertions.h"
|
||||
#include "Process.h"
|
||||
#include <Kernel/VM/MemoryManager.h>
|
||||
#include "IRQHandler.h"
|
||||
#include "PIC.h"
|
||||
#include "Process.h"
|
||||
#include "Scheduler.h"
|
||||
#include <AK/Types.h>
|
||||
#include <Kernel/KSyms.h>
|
||||
#include <Kernel/VM/MemoryManager.h>
|
||||
|
||||
//#define PAGE_FAULT_DEBUG
|
||||
|
||||
struct [[gnu::packed]] DescriptorTablePointer {
|
||||
struct [[gnu::packed]] DescriptorTablePointer
|
||||
{
|
||||
word limit;
|
||||
void* address;
|
||||
};
|
||||
|
@ -55,8 +56,7 @@ asm(
|
|||
" popw %es\n"
|
||||
" popw %ds\n"
|
||||
" popa\n"
|
||||
" iret\n"
|
||||
);
|
||||
" iret\n");
|
||||
|
||||
#define EH_ENTRY(ec) \
|
||||
extern "C" void exception_##ec##_handler(RegisterDumpWithExceptionCode&); \
|
||||
|
@ -87,8 +87,7 @@ asm( \
|
|||
" popw %ds\n" \
|
||||
" popa\n" \
|
||||
" add $0x4, %esp\n" \
|
||||
" iret\n" \
|
||||
);
|
||||
" iret\n");
|
||||
|
||||
#define EH_ENTRY_NO_CODE(ec) \
|
||||
extern "C" void exception_##ec##_handler(RegisterDump&); \
|
||||
|
@ -118,8 +117,7 @@ asm( \
|
|||
" popw %es\n" \
|
||||
" popw %ds\n" \
|
||||
" popa\n" \
|
||||
" iret\n" \
|
||||
);
|
||||
" iret\n");
|
||||
|
||||
template<typename DumpType>
|
||||
static void dump(const DumpType& regs)
|
||||
|
@ -158,7 +156,6 @@ static void dump(const DumpType& regs)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// 6: Invalid Opcode
|
||||
EH_ENTRY_NO_CODE(6);
|
||||
void exception_6_handler(RegisterDump& regs)
|
||||
|
@ -171,8 +168,7 @@ void exception_6_handler(RegisterDump& regs)
|
|||
kprintf("%s Illegal instruction: %s(%u)\n",
|
||||
current->process().is_ring0() ? "Kernel" : "Process",
|
||||
current->process().name().characters(),
|
||||
current->pid()
|
||||
);
|
||||
current->pid());
|
||||
|
||||
dump(regs);
|
||||
dump_backtrace();
|
||||
|
@ -195,7 +191,8 @@ void exception_7_handler(RegisterDump& regs)
|
|||
if (g_last_fpu_thread == current)
|
||||
return;
|
||||
if (g_last_fpu_thread) {
|
||||
asm volatile("fxsave %0":"=m"(g_last_fpu_thread->fpu_state()));
|
||||
asm volatile("fxsave %0"
|
||||
: "=m"(g_last_fpu_thread->fpu_state()));
|
||||
} else {
|
||||
asm volatile("fnclex");
|
||||
}
|
||||
|
@ -214,7 +211,6 @@ void exception_7_handler(RegisterDump& regs)
|
|||
#endif
|
||||
}
|
||||
|
||||
|
||||
// 0: Divide error
|
||||
EH_ENTRY_NO_CODE(0);
|
||||
void exception_0_handler(RegisterDump& regs)
|
||||
|
@ -222,8 +218,7 @@ void exception_0_handler(RegisterDump& regs)
|
|||
kprintf("%s Division by zero: %s(%u)\n",
|
||||
current->process().is_ring0() ? "Kernel" : "User",
|
||||
current->process().name().characters(),
|
||||
current->pid()
|
||||
);
|
||||
current->pid());
|
||||
|
||||
dump(regs);
|
||||
|
||||
|
@ -235,7 +230,6 @@ void exception_0_handler(RegisterDump& regs)
|
|||
current->process().crash(SIGFPE);
|
||||
}
|
||||
|
||||
|
||||
// 13: General Protection Fault
|
||||
EH_ENTRY(13);
|
||||
void exception_13_handler(RegisterDumpWithExceptionCode& regs)
|
||||
|
@ -259,10 +253,12 @@ void exception_14_handler(RegisterDumpWithExceptionCode& regs)
|
|||
ASSERT(current);
|
||||
|
||||
dword faultAddress;
|
||||
asm ("movl %%cr2, %%eax":"=a"(faultAddress));
|
||||
asm("movl %%cr2, %%eax"
|
||||
: "=a"(faultAddress));
|
||||
|
||||
dword fault_page_directory;
|
||||
asm ("movl %%cr3, %%eax":"=a"(fault_page_directory));
|
||||
asm("movl %%cr3, %%eax"
|
||||
: "=a"(fault_page_directory));
|
||||
|
||||
#ifdef PAGE_FAULT_DEBUG
|
||||
dbgprintf("%s(%u): ring%u %s page fault in PD=%x, %s L%x\n",
|
||||
|
@ -304,10 +300,14 @@ void exception_14_handler(RegisterDumpWithExceptionCode& regs)
|
|||
{ \
|
||||
kprintf(msg "\n"); \
|
||||
dword cr0, cr2, cr3, cr4; \
|
||||
asm ("movl %%cr0, %%eax":"=a"(cr0)); \
|
||||
asm ("movl %%cr2, %%eax":"=a"(cr2)); \
|
||||
asm ("movl %%cr3, %%eax":"=a"(cr3)); \
|
||||
asm ("movl %%cr4, %%eax":"=a"(cr4)); \
|
||||
asm("movl %%cr0, %%eax" \
|
||||
: "=a"(cr0)); \
|
||||
asm("movl %%cr2, %%eax" \
|
||||
: "=a"(cr2)); \
|
||||
asm("movl %%cr3, %%eax" \
|
||||
: "=a"(cr3)); \
|
||||
asm("movl %%cr4, %%eax" \
|
||||
: "=a"(cr4)); \
|
||||
kprintf("CR0=%x CR2=%x CR3=%x CR4=%x\n", cr0, cr2, cr3, cr4); \
|
||||
hang(); \
|
||||
}
|
||||
|
@ -350,7 +350,8 @@ void flush_gdt()
|
|||
{
|
||||
s_gdtr.address = s_gdt;
|
||||
s_gdtr.limit = (s_gdt_length * 8) - 1;
|
||||
asm("lgdt %0"::"m"(s_gdtr):"memory");
|
||||
asm("lgdt %0" ::"m"(s_gdtr)
|
||||
: "memory");
|
||||
}
|
||||
|
||||
void gdt_init()
|
||||
|
@ -379,16 +380,13 @@ void gdt_init()
|
|||
"mov %%ax, %%es\n"
|
||||
"mov %%ax, %%fs\n"
|
||||
"mov %%ax, %%gs\n"
|
||||
"mov %%ax, %%ss\n"
|
||||
:: "a"(0x10)
|
||||
: "memory"
|
||||
);
|
||||
"mov %%ax, %%ss\n" ::"a"(0x10)
|
||||
: "memory");
|
||||
|
||||
// Make sure CS points to the kernel code descriptor.
|
||||
asm volatile(
|
||||
"ljmpl $0x8, $sanity\n"
|
||||
"sanity:\n"
|
||||
);
|
||||
"sanity:\n");
|
||||
}
|
||||
|
||||
static void unimp_trap()
|
||||
|
@ -438,8 +436,7 @@ extern "C" void irq7_handler();
|
|||
asm(
|
||||
".globl irq7_handler \n"
|
||||
"irq7_handler: \n"
|
||||
" iret\n"
|
||||
);
|
||||
" iret\n");
|
||||
|
||||
void idt_init()
|
||||
{
|
||||
|
@ -511,7 +508,8 @@ void __assertion_failed(const char* msg, const char* file, unsigned line, const
|
|||
kprintf("ASSERTION FAILED: %s\n%s:%u in %s\n", msg, file, line, func);
|
||||
dump_backtrace();
|
||||
asm volatile("hlt");
|
||||
for (;;);
|
||||
for (;;)
|
||||
;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -524,6 +522,5 @@ void sse_init()
|
|||
"mov %eax, %cr0\n"
|
||||
"mov %cr4, %eax\n"
|
||||
"orl $0x600, %eax\n"
|
||||
"mov %eax, %cr4\n"
|
||||
);
|
||||
"mov %eax, %cr4\n");
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#include "i8253.h"
|
||||
#include "i386.h"
|
||||
#include "IO.h"
|
||||
#include "PIC.h"
|
||||
#include "Scheduler.h"
|
||||
#include "i386.h"
|
||||
|
||||
#define IRQ_TIMER 0
|
||||
|
||||
|
@ -34,8 +34,7 @@ asm(
|
|||
" popw %es\n"
|
||||
" popw %ds\n"
|
||||
" popa\n"
|
||||
" iret\n"
|
||||
);
|
||||
" iret\n");
|
||||
|
||||
static dword s_ticks_this_second;
|
||||
static dword s_seconds_since_boot;
|
||||
|
|
|
@ -1,34 +1,34 @@
|
|||
#include <AK/Types.h>
|
||||
#include "kmalloc.h"
|
||||
#include "KSyms.h"
|
||||
#include "PIC.h"
|
||||
#include "Process.h"
|
||||
#include "RTC.h"
|
||||
#include "Scheduler.h"
|
||||
#include "i386.h"
|
||||
#include "i8253.h"
|
||||
#include <Kernel/Devices/KeyboardDevice.h>
|
||||
#include "Process.h"
|
||||
#include "PIC.h"
|
||||
#include <Kernel/Devices/IDEDiskDevice.h>
|
||||
#include <Kernel/Devices/MBRPartitionTable.h>
|
||||
#include <Kernel/Devices/DiskPartition.h>
|
||||
#include "KSyms.h"
|
||||
#include <Kernel/Devices/NullDevice.h>
|
||||
#include <Kernel/Devices/ZeroDevice.h>
|
||||
#include <Kernel/Devices/FullDevice.h>
|
||||
#include <Kernel/Devices/RandomDevice.h>
|
||||
#include <Kernel/FileSystem/Ext2FileSystem.h>
|
||||
#include <Kernel/FileSystem/VirtualFileSystem.h>
|
||||
#include <Kernel/VM/MemoryManager.h>
|
||||
#include <Kernel/FileSystem/ProcFS.h>
|
||||
#include "RTC.h"
|
||||
#include <Kernel/TTY/VirtualConsole.h>
|
||||
#include "Scheduler.h"
|
||||
#include <Kernel/Devices/PS2MouseDevice.h>
|
||||
#include <Kernel/TTY/PTYMultiplexer.h>
|
||||
#include <Kernel/FileSystem/DevPtsFS.h>
|
||||
#include "kmalloc.h"
|
||||
#include <AK/Types.h>
|
||||
#include <Kernel/Devices/BXVGADevice.h>
|
||||
#include <Kernel/Devices/DebugLogDevice.h>
|
||||
#include <Kernel/Devices/DiskPartition.h>
|
||||
#include <Kernel/Devices/FullDevice.h>
|
||||
#include <Kernel/Devices/IDEDiskDevice.h>
|
||||
#include <Kernel/Devices/KeyboardDevice.h>
|
||||
#include <Kernel/Devices/MBRPartitionTable.h>
|
||||
#include <Kernel/Devices/NullDevice.h>
|
||||
#include <Kernel/Devices/PS2MouseDevice.h>
|
||||
#include <Kernel/Devices/RandomDevice.h>
|
||||
#include <Kernel/Devices/ZeroDevice.h>
|
||||
#include <Kernel/FileSystem/DevPtsFS.h>
|
||||
#include <Kernel/FileSystem/Ext2FileSystem.h>
|
||||
#include <Kernel/FileSystem/ProcFS.h>
|
||||
#include <Kernel/FileSystem/VirtualFileSystem.h>
|
||||
#include <Kernel/KParams.h>
|
||||
#include <Kernel/Multiboot.h>
|
||||
#include <Kernel/Net/E1000NetworkAdapter.h>
|
||||
#include <Kernel/Net/NetworkTask.h>
|
||||
#include <Kernel/Devices/DebugLogDevice.h>
|
||||
#include <Kernel/Multiboot.h>
|
||||
#include <Kernel/KParams.h>
|
||||
#include <Kernel/TTY/PTYMultiplexer.h>
|
||||
#include <Kernel/TTY/VirtualConsole.h>
|
||||
#include <Kernel/VM/MemoryManager.h>
|
||||
|
||||
//#define STRESS_TEST_SPAWNING
|
||||
|
||||
|
|
|
@ -3,18 +3,19 @@
|
|||
* just to get going. Don't ever let anyone see this shit. :^)
|
||||
*/
|
||||
|
||||
#include <AK/Assertions.h>
|
||||
#include <AK/Types.h>
|
||||
#include <Kernel/kmalloc.h>
|
||||
#include <Kernel/StdLib.h>
|
||||
#include <Kernel/i386.h>
|
||||
#include <Kernel/KSyms.h>
|
||||
#include <Kernel/Process.h>
|
||||
#include <Kernel/Scheduler.h>
|
||||
#include <Kernel/KSyms.h>
|
||||
#include <AK/Assertions.h>
|
||||
#include <Kernel/StdLib.h>
|
||||
#include <Kernel/i386.h>
|
||||
#include <Kernel/kmalloc.h>
|
||||
|
||||
#define SANITIZE_KMALLOC
|
||||
|
||||
struct [[gnu::packed]] allocation_t {
|
||||
struct [[gnu::packed]] allocation_t
|
||||
{
|
||||
size_t start;
|
||||
size_t nchunk;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue