Commit Graph

600 Commits

Author SHA1 Message Date
Andreas Kling
34709a2c24 IDEDiskDevice: Fix build after merging slave device changes. 2019-07-08 08:20:12 +02:00
Jesse
ab90d2e251 Kernel: Extended IDE interface to allow slave device usage (#283)
The IDE Disk Controller driver has been extended to allow the secondary device on the channel to be initialised and used. A test as to whether this is working (for anyone interested) is to modify `init.cpp:87` to `auto dev_hd0 = IDEDiskDevice::create(IdeDiskDevice::DeviceType::SLAVE);`. The kernel will fail to boot, as there is no disk attached to CHANNEL 1's slave. This was born out of the fact that my FAT driver can't be tested as easily without creating a partition on `hda`.
2019-07-08 08:16:52 +02:00
Andreas Kling
27f699ef0c AK: Rename the common integer typedefs to make it obvious what they are.
These types can be picked up by including <AK/Types.h>:

* u8, u16, u32, u64 (unsigned)
* i8, i16, i32, i64 (signed)
2019-07-03 21:20:13 +02:00
Andreas Kling
d343fb2429 AK: Rename Retainable.h => RefCounted.h. 2019-06-21 18:58:45 +02:00
Andreas Kling
550b0b062b AK: Rename RetainPtr.h => RefPtr.h, Retained.h => NonnullRefPtr.h. 2019-06-21 18:45:59 +02:00
Andreas Kling
90b1354688 AK: Rename RetainPtr => RefPtr and Retained => NonnullRefPtr. 2019-06-21 18:37:47 +02:00
Andreas Kling
77b9fa89dd AK: Rename Retainable => RefCounted.
(And various related renames that go along with it.)
2019-06-21 15:30:03 +02:00
Conrad Pankoff
8b1154f5f2 Kernel: Implement serial port driver
This implements a basic 8250 UART serial port driver. It does not
currently handle (or enable) interrupts, nor any runtime configuration.
2019-06-08 18:12:20 +02:00
Conrad Pankoff
842bf96e2c Kernel: Fix booting from "inactive" MBR partitions
Apparently you can boot from any MBR partition, not just the one labeled
as "bootable" or "active". The only ones you don't want to boot from are
the ones that don't exist.
2019-06-08 17:59:17 +02:00
Andreas Kling
736092a087 Kernel: Move i386.{cpp,h} => Arch/i386/CPU.{cpp,h}
There's a ton of work that would need to be done before we could spin up on
another architecture, but let's at least try to separate things out a bit.
2019-06-07 20:02:01 +02:00
Andreas Kling
e42c3b4fd7 Kernel: Rename LinearAddress => VirtualAddress. 2019-06-07 12:56:50 +02:00
Andreas Kling
bc951ca565 Kernel: Run clang-format on everything. 2019-06-07 11:43:58 +02:00
Andreas Kling
08cd75ac4b Kernel: Rename FileDescriptor to FileDescription.
After reading a bunch of POSIX specs, I've learned that a file descriptor
is the number that refers to a file description, not the description itself.
So this patch renames FileDescriptor to FileDescription, and Process now has
FileDescription* file_description(int fd).
2019-06-07 09:36:51 +02:00
Conrad Pankoff
c02b8b715d Kernel: Implement MBR partition loader (#168)
This implements a basic MBR partition loader, which removes the reliance
on a hard-coded filesystem offset in the stage2 init.
2019-06-02 14:57:44 +02:00
Conrad Pankoff
32d78a8526 Kernel: Rename OffsetDiskDevice to DiskPartition 2019-06-02 12:37:29 +02:00
Conrad Pankoff
8eb492aa11 Kernel: Rename offset parameter of OffsetDiskDevice to block_offset 2019-06-02 12:37:29 +02:00
Conrad Pankoff
6f43f81fb4 Kernel: Implement OffsetDiskDevice to prepare for partition support
This implements a passthrough disk driver that translates the read/write
block addresses by a fixed offset. This could form the basis of MBR
partition support if we were to parse the MBR table at boot and create that
OffsetDiskDevice dynamically, rather than seeking to a fixed offset.

This also introduces a dependency in the form of grub. You'll need to have
32-bit grub binaries installed to build the project now.

As a bonus, divorcing Serenity from qemu's kernel loading means we can now
*technically* boot on real hardware. It just... doesn't get very far yet.
If you write the `_disk_image` file to an IDE hard drive and boot it in a
machine that supports all the basic PC hardware, it *will* start loading
the kernel.
2019-06-02 12:37:29 +02:00
Andreas Kling
5e1c7cb32c Kernel: Memory-mapped files now have the absolute path as their name.
It's generated when the mapping is first created, so it won't update if
the file moves. Maybe that's something we should support, too.
2019-06-02 10:14:28 +02:00
Andreas Kling
8454d3e184 Kernel: Add comment block about File, taking some from Device. 2019-06-02 09:23:37 +02:00
Andreas Kling
2dd9ef6863 Kernel: Make File::absolute_path() const. 2019-06-01 18:56:56 +02:00
Andreas Kling
fa6446fc0d FileSystem: VFS should require Badge<Device> for device registration. 2019-05-31 15:36:49 +02:00
Andreas Kling
baaede1bf9 Kernel: Make the Process allocate_region* API's understand "int prot".
Instead of having to inspect 'prot' at every call site, make the Process
API's take care of that so we can just pass it through.
2019-05-30 16:14:37 +02:00
Andreas Kling
66c1a9be3b Kernel: Pass 'prot' argument to File::mmap() and act on it.
Nothing crazy, this just means that PROT_READ allocates readable regions,
and that PROT_WRITE allocates writable ones.
2019-05-30 12:38:35 +02:00
Robin Burchell
0dc9af5f7e Add clang-format file
Also run it across the whole tree to get everything using the One True Style.
We don't yet run this in an automated fashion as it's a little slow, but
there is a snippet to do so in makeall.sh.
2019-05-28 17:31:20 +02:00
Andreas Kling
bb288c1baf IDEDiskDevice: Implement basic DMA writes.
This could share more code with reads, and generally be better. But it works
and it's considerably faster than PIO, so let's use it. :^)
2019-05-26 14:58:21 +02:00
Andreas Kling
ebf645d72a Kernel: Tidy up IDEDiskDevice a bit.
The main cleanup here is putting the I/O address base in a member variable.
2019-05-24 04:17:15 +02:00
Andreas Kling
5f26f83451 IDEDiskDevice: Add sysctl variable for turning DMA on/off. 2019-05-19 15:54:33 +02:00
Andreas Kling
c7d8aa6969 IDEDiskDevice: Support reading multiple sectors at a time with DMA.
This is another sizable improvement to GCC compile times.
2019-05-19 04:40:30 +02:00
Andreas Kling
ed79116e94 IDEDiskDevice: Use wait_for_irq() when waiting for DMA transfers.
Also make sure we return any device errors to caller.
2019-05-19 03:56:06 +02:00
Andreas Kling
c818773983 IDEDiskDevice: Add support for DMA reads.
I've only tested this with the PIIX3 chipset QEMU emulates, but it works
pretty well here. GCC compile times are cut roughly in half :^)
2019-05-19 03:46:50 +02:00
Andreas Kling
3cba2a8a78 Kernel: Add a beep() syscall that beeps the PC speaker.
Hook this up in Terminal so that the '\a' character generates a beep.
Finally emit an '\a' character in the shell line editing code when
backspacing at the start of the line.
2019-05-15 21:40:41 +02:00
Andreas Kling
dae8eb6454 Kernel: Add support for the PS/2 mouse wheel if detected. 2019-05-13 19:48:14 +02:00
Andreas Kling
2470fdcd9b Kernel: Make Socket inherit from File. 2019-05-03 20:42:43 +02:00
Andreas Kling
c3b7ace3e0 Kernel: Assign Lock names in class member initializers. 2019-05-02 03:28:20 +02:00
Andreas Kling
8cbb7f101f Kernel: Have File virtuals take a FileDescriptor& rather than a Process&.
This will allow us to implement different behaviors depending on the role
of the descriptor a File is being accessed through.
2019-04-29 13:58:40 +02:00
Andreas Kling
0a0d739e98 Kernel: Make FIFO inherit from File. 2019-04-29 04:55:54 +02:00
Andreas Kling
e886337a67 Kernel: Make ProcessTracer inherit from File. 2019-04-28 15:02:55 +02:00
Andreas Kling
d7cf841d3d Kernel: Add a comment block about the Device class. 2019-04-24 02:37:57 +02:00
Andreas Kling
ca9ed13643 Kernel: Simplify Device::open(). 2019-04-24 02:20:14 +02:00
Andreas Kling
f042b3adeb Kernel: Make the right shift key work.
I never realized the right shift key wasn't hooked up since my left pinky
always hovers over the left shift key, ready to rock.
2019-04-23 20:47:45 +02:00
Andreas Kling
243e1d8462 Kernel: Use rep insw/outsw for IDE transfers.
There are much faster ways to do disk transfers, but I'm not implementing
those today. In the meantime, this is slightly nicer. :^)
2019-04-23 03:45:55 +02:00
Andreas Kling
37498c1566 Kernel: Send IDE flush command after writing sectors. 2019-04-23 03:16:47 +02:00
Andreas Kling
11e7ce60e5 Kernel: Use IDE LBA addressing instead of the long-obsolete C/H/S. 2019-04-23 02:26:51 +02:00
Andreas Kling
2d7cad6a16 Kernel: Make sure we don't use any FPU/MMX/SSE instructions. 2019-04-22 23:38:33 +02:00
Andreas Kling
3817f5f619 Kernel+LibC: Add a DebugLogDevice that forwards everything to I/O port 0xe9.
This is then used to implement the userspace dbgprintf() in a far more
efficient way than what we had before. :^)
2019-04-18 16:08:52 +02:00
Andreas Kling
644c887594 Kernel: Move FIFO into FileSystem/ and Socket+LocalSocket into Net/. 2019-04-06 20:29:48 +02:00
Andreas Kling
a58d7fd8bb Kernel: Get rid of Kernel/types.h, separate LinearAddress/PhysicalAddress. 2019-04-06 14:29:29 +02:00
Andreas Kling
b9738fa8ac Kernel: Move VM-related files into Kernel/VM/.
Also break MemoryManager.{cpp,h} into one file per class.
2019-04-03 15:13:07 +02:00
Andreas Kling
58c4d41c5f Kernel: Remove Limits.h 2019-04-03 13:18:42 +02:00
Andreas Kling
ab43658c55 Kernel: Move devices into Kernel/Devices/. 2019-04-03 12:36:40 +02:00