Commit Graph

214 Commits

Author SHA1 Message Date
Tom
00a7c48d6e APIC: Enable APIC and start APs 2019-10-16 19:14:02 +02:00
supercomputer7
de49714f36 PartitionTable: Initial GPT Support, Adding Block Limit
Also added a script to handle creation of GPT partitioned disk (with
GRUB config file). Block limit will be used to disallow potential access
to other partitions.
2019-10-07 10:11:39 +02:00
Andreas Kling
5d491fa1cd Kernel: Add a simple slab allocator for small allocations
This is a freelist allocator with static size classes that works as a
complement to the generic kmalloc(). It's a lot faster than kmalloc()
since allocation just means popping from the freelist.

It's also significantly more compact when there are a lot of objects
smaller than the minimum kmalloc chunk size (32 bytes.)

This patch enables it for the Region and PhysicalPage classes.
In the PhysicalPage (8 bytes) case, it's a huge improvement since we
no longer waste 75% of the storage allocated.

There are also a number of ways this can be improved, so let's keep
working on it going forward.
2019-09-16 10:33:27 +02:00
Andreas Kling
1c692e87a6 Kernel: Move kmalloc() into a Kernel/Heap/ directory 2019-09-16 09:01:44 +02:00
Andreas Kling
e1481dcb42 Kernel: Stop idling after handling an IRQ
If we receive an IRQ while the idle task is running, prevent it from
re-halting the CPU after the IRQ handler returns.

Instead have the idle task yield to the scheduler, so we can see if
the IRQ has unblocked something.
2019-09-14 20:21:10 +02:00
Conrad Pankoff
93c16590f1 Kernel: Remove specific devices from network code
By setting up the devices in init() and looping over the registered
network adapters in NetworkTask_main, we can remove the remaining
hard-coded adapter references from the network code.

This also assigns IPs according to the default range supplied by QEMU
in its slirp networking mode.
2019-08-29 06:25:06 +02:00
Conrad Pankoff
61bdf09d78 Kernel: Run NetworkTask in init stage 2 to allow use of locks 2019-08-29 06:25:06 +02:00
Conrad Pankoff
4afe9e4f2a Kernel: Implement rtl8139 network interface driver 2019-08-21 17:10:34 +02:00
Conrad Pankoff
b957c61e6f Kernel: Implement generic VGA device using multiboot info
This implements a very basic VGA device using the information provided
to us by the bootloader in the multiboot header. This allows Serenity to
boot to the desktop on basically any halfway modern system.
2019-08-18 07:40:53 +02:00
Conrad Pankoff
879bc28e14 Kernel: Disable VGA console in graphical mode 2019-08-18 07:37:12 +02:00
Sergey Bugaev
6778abb999 Kernel+SystemServer: Mount filesystems and start TTYServer in userspace 2019-08-17 12:07:55 +02:00
Sergey Bugaev
66a0a12435 DevPtsFS: Do not assume there is one of it
Unfortunately, that also means it can no longer inherit from SynthFS.
2019-08-17 12:07:55 +02:00
Sergey Bugaev
37cc80fb96 ProcFS: Do not assume there is one of it
The complication is around /proc/sys/ variables, which were attached
to inodes. Now they're their own thing, and the corresponding inodes
are lazily created (as all other ProcFS inodes are) and simply refer
to them by index.
2019-08-17 12:07:55 +02:00
Sergey Bugaev
b4c607a8da Kernel: Add TmpFS
This is an FS that stores all of its contents directly in memory.
It's mounted on /tmp by default.
2019-08-15 19:20:51 +02:00
Conrad Pankoff
67a4256a98 Server: Add TTYServer, a rudimentary text console manager
This should probably call out to a login program at some point. Right now
it just puts a root terminal on tty{1,2,3}.

Remember not to leave your Serenity workstation unattended!
2019-08-12 13:52:20 +02:00
Conrad Pankoff
d1a7316799 Kernel: Print out PCI devices during boot
This will make boot logs much more useful on real hardware, by showing
exactly what Serenity is trying to boot on.
2019-08-11 08:23:16 +02:00
Conrad Pankoff
3026c37d5d Kernel: Add serial_debug cmdline parameter
serial_debug will output all the kprintf and dbgprintf data to COM1 at
8-N-1 57600 baud. this is particularly useful for debugging the boot
process on live hardware.

Note: it must be the first parameter in the boot cmdline.
2019-08-11 08:22:42 +02:00
Conrad Pankoff
973c2d9bfd Kernel: fix typo regarding floppy drives in init_stage2 2019-07-30 09:16:47 +02:00
Jesse
59e122f8ba Kernel: Expand PATA driver to support multiple hard drives (#365)
The previous implementation of the PIIX3/4 PATA/IDE channel driver only
supported a single drive, as the object model was wrong (the channel
inherits the IRQ, not the disk drive itself). This fixes it by 'attaching'
two `PATADiskDevices` to a `PATAChannel`, which makes more sense.

The reading/writing code is presented as is, which violates the spec
outlined by Seagate in the linked datasheet. That spec is rather old,
so it might not be 100% up to date, though may cause issues on real
hardware, so until we can actually test it, this will suffice.
2019-07-28 15:44:01 +02:00
Andreas Kling
38b13f1508 Kernel: Remove bitrotted "spawn stress" code.
This was something I used during early kernel development to spam creation
of new processes to see if the kernel could handle it.
2019-07-21 19:51:32 +02:00
Robin Burchell
98929ba715 Finalizer: Don't double-yield
Block will yield for us, so there's no reason to return control to the
scheduler immediately after we just blocked.
2019-07-20 12:15:24 +02:00
Robin Burchell
833d444cd8 Thread: Return a result from block() indicating why the block terminated
And use this to return EINTR in various places; some of which we were
not handling properly before.

This might expose a few bugs in userspace, but should be more compatible
with other POSIX systems, and is certainly a little cleaner.
2019-07-20 12:15:24 +02:00
Robin Burchell
cd76b691fb Kernel: Remove memory allocations from the new Blocker API 2019-07-19 11:03:22 +02:00
Robin Burchell
d2ca91c024 Kernel: Convert BlockedSignal and BlockedLurking to the new Blocker mechanism
The last two of the old block states gone :)
2019-07-19 11:03:22 +02:00
Jesse
10ffaf019f Kernel: Initial FDC Device Driver (#315)
A basic Floppy Disk Controller device driver for any system later than (and including) the IBM AT. The driver is based on the documentation supplied by QEMU, which is the datasheet for the Intel 82078 Floppy Disk controller (found here: https://wiki.qemu.org/images/f/f0/29047403.pdf)

Naturally, floppy disks are a _very_ outdated storage medium, however, as Serenity is a throwback to aesthetic 90s computing, it's a definite must have. Not to mention that there are still a lot of floppy disks around, with countless petabytes of software on them, so it would be nice if people could create images of said disks with serenity.

The code for this is mostly clean. however there are a LOT of values specified in the datasheet, so some of them might be wrong, not to mention that the actual specification itself is rather dirt and seemingly hacked together.

I'm also only supporting 3.5" floppy disks, without PIO polling (DMA only), so if you want anything more/less than 1.44MB HD Floppys, you'll have to do it yourself.
2019-07-17 15:51:51 +02:00
Robin Burchell
6c4024c04a Kernel: First cut of a sb16 driver
Also add an AudioServer that (right now) doesn't do much.
It tries to open, parse, and play a wav file. In the future, it can do more.

My general thinking here here is that /dev/audio will be "owned" by AudioServer,
and we'll do mixing in software before passing buffers off to the kernel
to play, but we have to start somewhere.
2019-07-13 08:00:24 +02:00
Andreas Kling
5254a320d8 Kernel: Remove use of copy_ref() in favor of regular RefPtr copies.
This is obviously more readable. If we ever run into a situation where
ref count churn is actually causing trouble in the future, we can deal with
it then. For now, let's keep it simple. :^)
2019-07-11 15:40:04 +02:00
Andreas Kling
6c87d3afa9 Kernel: Move i8253.cpp => Arch/i386/PIT.cpp 2019-07-09 15:04:45 +02:00
Andreas Kling
9fdcede491 Kernel: Move PIC.cpp into Arch/i386/ 2019-07-09 15:04:43 +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
90b1354688 AK: Rename RetainPtr => RefPtr and Retained => NonnullRefPtr. 2019-06-21 18:37:47 +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
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
bc951ca565 Kernel: Run clang-format on everything. 2019-06-07 11:43:58 +02:00
Conrad Pankoff
0aa1f1c2d6 Kernel: Parse cmdline for root filesystem e.g. root=/dev/hda1
This introduces very basic handling of the kernel command line to choose
the root filesystem at startup. Given that we currently only support a
single IDE hard drive, it's hard-coded to look for `/dev/hda` at the start
of the argument.

If there is nothing following this, or if the parameter is empty,
init_stage2 will try to load the ext2 filesystem from the start of the
device. This is intended to be the default behaviour when running
development builds, as it is faster to set up and doesn't require a
working grub installation.

If `/dev/hda` is followed by a number, init_stage2 will try to read an MBR
partition header from the drive, then load the requested partition. It
will reject non-numeric trailing data, and anything outside of partitions
one through four.
2019-06-04 07:14:40 -07:00
Conrad Pankoff
738f9de9a9 Kernel: Add KParams class for accessing kernel cmdline parameters (#188) 2019-06-04 03:54:27 -07: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
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
4320c5fd58 Kernel: Make better use of the multiboot info.
Define the multiboot info struct properly so we don't have to grab at byte
offsets in the memory access checker code. Also print kernel command line
in init().
2019-06-02 09:53:42 +02:00
Robin Burchell
d31ce9eccd Misc: Add a simple init process
This doesn't do much right now, just fork off a bunch of stuff and set priorities.
2019-05-30 02:57:15 +02:00
Christopher Dumas
dd84dcf31f Launcher loads applications from Launcher.ini, is started by default, and is resized automatically
Co-Authored-By: Andreas Kling <awesomekling@gmail.com>
2019-05-24 20:40:09 +02:00
Andreas Kling
e24e486714 Snake: Flesh out a basic snake game :^) 2019-04-20 03:24:50 +02:00
Andreas Kling
0e6b273620 LibGUI: Start working on GTableView inline editing.
This is pretty shaky still, but the basic idea is that you subclass GModel
and return true for editable indices. The table view also needs to have its
editable flag set.
2019-04-18 22:27:14 +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
33920df299 AK: Try to use StringViews more for substrings and splitting. 2019-04-16 02:39:16 +02:00
Andreas Kling
29d0412a06 Kernel: Remove system.h and make the uptime global a qword. 2019-04-14 01:29:14 +02:00
Andreas Kling
6f90f41516 VisualBuilder: Add some more GWidget default properties. 2019-04-12 14:47:21 +02:00
Andreas Kling
0f5114852a Kernel: Spawn text editor by default while I work on it. 2019-04-12 00:58:09 +02:00