Commit Graph

1190 Commits

Author SHA1 Message Date
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
Andreas Kling
c110cf193d Kernel: Have the open() syscall take an explicit path length parameter.
Instead of computing the path length inside the syscall handler, let the
caller do that work. This allows us to implement to new variants of open()
and creat(), called open_with_path_length() and creat_with_path_length().
These are suitable for use with e.g StringView.
2019-07-08 20:01:49 +02:00
Andreas Kling
4d904340b4 Kernel: Don't interrupt blocked syscalls to dispatch ignored signals.
This was just causing syscalls to return EINTR for no reason.
2019-07-08 18:59:48 +02:00
Andreas Kling
cda5a6eca3 Kernel: Add LogStream operator<< for Process.
It simply prints "process-name(pid)", nothing fancy, but kinda useful.
2019-07-08 18:58:19 +02:00
Andreas Kling
0e75aba7c3 StringView: Rename characters() to characters_without_null_termination().
This should make you think twice before trying to use the const char* from
a StringView as if it's a null-terminated string.
2019-07-08 15:38:44 +02:00
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
04b9dc2d30 Libraries: Create top level directory for libraries.
Things were getting a little crowded in the project root, so this patch
moves the Lib*/ directories into Libraries/.
2019-07-04 16:16:50 +02:00
Andreas Kling
1b013ba699 AK: Move some of LogStream out of line & add overloads for smart pointers. 2019-07-04 07:05:58 +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
Dan MacDonald
c4c4bbc5ba Build: Use sudo -E to preserve EVs when calling build-image-qemu.sh from makeall.sh 2019-07-03 18:12:16 +02:00
Dan MacDonald
0d19a4eaab Build: Fix incorrect user and group settings for disk image (#280)
Build: Fix incorrect user and group settings for disk image.

Fixes #261.
2019-07-03 16:57:37 +02:00
Andreas Kling
54d7670fc3 Kernel+Userland: Convert /proc/df to JSON. 2019-07-01 18:54:02 +02:00
Andreas Kling
aaedc24f15 Kernel+ProcessManager: Convert /proc/memstat to JSON. 2019-07-01 18:43:01 +02:00
Andreas Kling
24c0aae34e Build: Remove Userland/qs if we see one lying around.
Userland/qs was moved to Applications/QuickShow, but some people still have
old built binaries lying around in their Userland/ directories and the build
system complains about this. Here goes a silly temporary hack to just get
rid of them.
2019-07-01 14:33:30 +02:00
Andreas Kling
f6498bb0e9 Kernel: Make more crash info show up in dmesg.
kprintf() shows up in dmesg, dbgprintf() does not.
2019-06-30 15:02:23 +02:00
Andreas Kling
e7ce4514ec Kernel: Disable interrupts in Thread::set_state().
We don't want to get interrupted while we're manipulating the thread lists.
2019-06-30 11:42:27 +02:00
VAN BOSSUYT Nicolas
802d4dcb6b Meta: Removed all gitignore in the source tree only keeping the root one 2019-06-30 10:41:26 +02:00
Andreas Kling
d5bb98acbc AK: Defer to Traits<T> for equality comparison in container templates.
This is prep work for supporting HashMap with NonnullRefPtr<T> as values.
It's currently not possible because many HashTable functions require being
able to default-construct the value type.
2019-06-29 19:14:03 +02:00
Andreas Kling
2735ff4687 ProcFS: Remove unused StringBuilder in procfs$all(). 2019-06-29 12:07:46 +02:00
Andreas Kling
2bd8118843 Kernel: Change the format of /proc/all to JSON.
Update ProcessManager, top and WSCPUMonitor to handle the new format.

Since the kernel is not allowed to use floating-point math, we now compile
the JSON classes in AK without JsonValue::Type::Double support.
To accomodate large unsigned ints, I added a JsonValue::Type::UnsignedInt.
2019-06-29 09:04:45 +02:00
Andreas Kling
4c285f9e1a AK: Add Vector(std::initializer_list<T>) constructor.
This allows us to construct a Vector from an initializer list like so:

Vector<Object> objects = { object1, object2, object3 };
2019-06-28 20:21:23 +02:00
Andreas Kling
75a24c3a1f Kernel: More use of NonnullRefPtrVector in the kernel. 2019-06-27 13:44:26 +02:00
Andreas Kling
601b0a8c68 Kernel: Use NonnullRefPtrVector in parts of the kernel. 2019-06-27 13:35:02 +02:00
Andreas Kling
8f3f5ac8ce Kernel: Automatically populate page tables with lazy kernel regions.
If we get an NP page fault in a process, and the fault address is in the
kernel address range (anywhere above 0xc0000000), we probably just need
to copy the page table info over from the kernel page directory.

The kernel doesn't allocate address space until it's needed, and when it
does allocate some, it only puts the info in the kernel page directory,
and any *new* page directories created from that point on. Existing page
directories need to be updated, and that's what this patch fixes.
2019-06-26 22:27:41 +02:00
Andreas Kling
183205d51c Kernel: Make the x86 paging code slightly less insane.
Instead of PDE's and PTE's being weird wrappers around dword*, just have
MemoryManager::ensure_pte() return a PageDirectoryEntry&, which in turn has
a PageTableEntry* entries().

I've been trying to understand how things ended up this way, and I suspect
it was because I inadvertently invoked the PageDirectoryEntry copy ctor in
the original work on this, which must have made me very confused..

Anyways, now things are a bit saner and we can move forward towards a better
future, etc. :^)
2019-06-26 21:45:56 +02:00
Andreas Kling
048705e1c2 Kernel: Share code between all the exceptions that cause process crash. 2019-06-25 05:55:18 +02:00
Andreas Kling
eedb4f6b2f QuickShow: Allow panning and zooming the image instead of stretching it.
This needs more work and polish, but it's a step in a more pleasant and
useful direction.

Also turn QuickShow into a fully-fledged "application". (By that, I really
just mean giving it its own Applications/ subdirectory.)
2019-06-23 16:35:43 +02:00
Andreas Kling
639478391b Kernel: Colorize debugger output from the kernel.
This makes it easy to distinguish kernel/userspace dbgprintf()'s. :^)
2019-06-22 22:45:16 +02:00
Andreas Kling
7e1cb86da7 LibHTML: Make it possible to build LibHTML on the host.
- "make" builds the normal Serenity libhtml.a
- "make -f Makefile.host" builds a test program for the host machine.
2019-06-22 21:21:57 +02:00
Andreas Kling
46a06c23e3 Kernel: Fix all compiler warnings. 2019-06-22 16:22:34 +02:00
Andreas Kling
1277d583ef printf: Oops, '-' is the left padding modifier, not ' '.
It's kinda funny how I can make a mistake like this in Serenity and then
get so used to it by spending lots of time using this API that I start to
believe that this is how printf() always worked..
2019-06-22 15:53:52 +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
c26e3ce86b Change "retain" to "ref" in various comments. 2019-06-21 18:40:24 +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
Andreas Kling
8c0ae711d8 Kernel+LibC: Make page fault crashes a bit more readable.
We'll now try to detect crashes that were due to dereferencing nullptr,
uninitialized malloc() memory, or recently free()'d memory.
It's not perfect but I think it's pretty good. :^)

Also added some color to the most important parts of the crash log,
and added some more modes to /bin/crash for exercising this code.

Fixes #243.
2019-06-19 20:52:12 +02:00
Andreas Kling
15bea7153a Kernel: Symbolicate the crash address too, not just the call stack.
Also print it in shiny red to make it extra easy to spot. :^)
Fixes #244.
2019-06-19 18:51:17 +02:00
Andreas Kling
d9a48b5916 AK: Move IPv4Address from Kernel/Net/ to AK/ since it's quite useful. 2019-06-18 11:28:48 +02:00
Robin Burchell
0a3abcc0a8 Kernel: Expose kernel command line to userspace through /proc/cmdline 2019-06-16 14:33:59 +02:00
Robin Burchell
952382b413 Kernel/Userland: Add a halt syscall, and a shutdown binary to invoke it 2019-06-16 12:25:30 +02:00
Andreas Kling
9e0f7acfe5 Kernel+Userland: Expose list of network adapters through /proc/netadapters.
Added a simple /bin/ifconfig program that just pretty-prints that file. :^)
2019-06-16 07:06:49 +02:00
Andreas Kling
a67e823838 LibHTML: Start working on a simple HTML library.
I'd like to have rich text, and we might as well use HTML for that. :^)
2019-06-15 18:55:47 +02:00
Sergey Bugaev
d900fe98e2 VM: Remove PhysicalPage::create_eternal().
Now that it is possible to create non-eternal non-freeable
pages, PageDirectory can do just that.
2019-06-14 16:14:49 +02:00
Sergey Bugaev
010314ee66 VM: Make VMObject::create_for_physical_range() create non-freeable pages.
This method is used in BXVGADevice to create pages for the framebuffer;
we should neither make the PhysicalPage instances eternal, nor hand over
actual physical pages to the memory allocator.
2019-06-14 16:14:49 +02:00
Sergey Bugaev
a8e86841ce VM: Support non-freeable, non-eternal PhysicalPages. 2019-06-14 16:14:49 +02:00
Sergey Bugaev
6bb7c80365 VM: Fix leaking PhysicalPage instances.
After PhysicalPage::return_to_freelist(), an actual physical page
is returned back to the memory manager; which will create a new
PhysicalPage instance if it decides to reuse the physical page. This
means this PhysicalPage instance should be freed; otherwise it would
get leaked.
2019-06-14 16:14:49 +02:00
Sergey Bugaev
118cb391dd VM: Pass a PhysicalPage by rvalue reference when returning it to the freelist.
This makes no functional difference, but it makes it clear that
MemoryManager and PhysicalRegion take over the actual physical
page represented by this PhysicalPage instance.
2019-06-14 16:14:49 +02:00