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