Commit graph

488 commits

Author SHA1 Message Date
Andreas Kling 3a9c01619f Ext2FS: Avoid a kmallocation every time we fetch an inode from disk. 2019-02-03 04:05:30 +01:00
Andreas Kling 333aa1646c Kernel: Increase default userspace stack size to 64 kilobytes. 2019-02-03 03:56:08 +01:00
Andreas Kling 2d17fe58bc Kernel: Remove unnecessary assertion in page_in_from_inode().
Turns out I had confused myself about the situation. Just because a page
has been paged in by another process doesn't mean that the *current*
process's page directory has the present bit set! D'oh. :^)
2019-02-03 03:04:40 +01:00
Andreas Kling 3eeff0dd14 Kernel: Improve crash info if page_in_from_inode() is called redundantly. 2019-02-03 02:49:59 +01:00
Andreas Kling c63d476da2 Kernel: Let's have cli() and sti() clobber memory.
I don't like the idea of the compiler reordering anything around either
cli() or sti(), so let's make sure it doesn't.
2019-02-03 02:47:55 +01:00
Andreas Kling 7e4376d469 Kernel: When entering page_in_from_inode(), assert that !physical_page.
It would be really weird to enter here with a physical page already present
in the VMObject's page slot. Let's assert that this doesn't happen.
2019-02-03 02:33:47 +01:00
Andreas Kling abe3f515b1 Make font loading use mmap().
This exposed a serious race condition in page_in_from_inode().
Reordered the logic and added a paging lock to VMObject.
Now, only one process can page in from a VMObject at a time.
There are definitely ways to optimize this, for instance by making
the locking be per-page instead. It's not something that I'm going
to worry about right now though.
2019-02-03 01:36:25 +01:00
Andreas Kling 6fc3c38324 Start working on a simple graphical font editor.
Editing fonts by editing text files is really slow and boring.
A simple font editor seems like a good way to take LibGUI for a spin.
2019-02-02 08:07:06 +01:00
Andreas Kling 5e0b7f1a56 Add basic automatic dependency management to Makefiles. 2019-02-02 04:41:59 +01:00
Andreas Kling feed67ede2 Kernel: VFS::open/create should take base Inode& instead of InodeIdentifier. 2019-02-01 15:36:45 +01:00
Andreas Kling 6618411fba Kernel: mkdir() should use the containing directory's FS for inode creation. 2019-02-01 15:29:11 +01:00
Andreas Kling 33e7df5955 Kernel: mkdir() should fail if the pathname is empty. 2019-02-01 15:29:05 +01:00
Andreas Kling 95c3442d59 Implement event loop timers.
GObjects can now register a timer with the GEventLoop. This will eventually
cause GTimerEvents to be dispatched to the GObject.

This needed a few supporting changes in the kernel:

- The PIT now ticks 1000 times/sec.
- select() now supports an arbitrary timeout.
- gettimeofday() now returns something in the tv_usec field.

With these changes, the clock window in guitest2 finally ticks on its own.
2019-02-01 03:50:06 +01:00
Andreas Kling ffab6897aa Big, possibly complete sweep of naming changes. 2019-01-31 17:31:23 +01:00
Andreas Kling 27fa09aee4 LibC: Add mktime(). 2019-01-31 16:51:27 +01:00
Andreas Kling 2dc9c86bad Kernel: Make Process a Weakable class.
Use this to fix a use-after-free in ~GraphicsBitmap(). We'd hit this when
the WindowServer was doing a deferred destruction of a WSWindow whose
backing store referred to a now-reaped Process.
2019-01-31 07:02:40 +01:00
Andreas Kling fc0b63ca3c Kernel: Include absolute paths of mount points in /proc/mounts 2019-01-31 06:13:55 +01:00
Andreas Kling 34e745b0b4 Add uid and gid to CharacterDevices.
The vast majority of them will be owned by 0:0 (the default.)
However, PTY pairs will now be owned by the uid:gid of the opening process.
2019-01-31 05:55:30 +01:00
Andreas Kling c4fce9b3f9 Make stat() work on device files again.
FileDescriptor will now keep a pointer to the original inode even after
opening it resolves to a character device.

Fixed up /bin/ls to display major and minor device numbers instead of size
for device files.
2019-01-31 05:05:57 +01:00
Andreas Kling c3cc318028 Ext2FS: Remove an unnecessary heap allocation in create_inode(). 2019-01-31 04:17:16 +01:00
Andreas Kling 0932efe72e Kernel: Actually zero-fill eagerly committed regions.
Previously, calling Region::commit() would make sure to allocate any missing
physical pages, but they would contain uninitialized data. This was very
obvious when allocating GraphicsBitmaps as they would have garbage pixels
rather than being filled with black.

The MM quickmap mechanism didn't work when operating on a non-active page
directory (which happens when we're in the middle of exec, for example.)
This patch changes quickmap to reside in the shared kernel page directory.

Also added some missing clobber lists to inline asm that I stumbled on.
2019-01-31 04:03:05 +01:00
Andreas Kling 6b88025dda Remove the last remaining #ifndef SERENITY blocks. 2019-01-31 02:56:54 +01:00
Andreas Kling 56b6fb198a Add support for keyboard arrow keys.
Also have them send the appropriate escape sequences in Terminal.
Basic history browsing now works in bash. How nice! :^)
2019-01-30 21:18:13 +01:00
Andreas Kling d1b805172d Rename the default user to "anon" and give him a home directory. 2019-01-30 20:40:41 +01:00
Andreas Kling 2a7af0eacf Kernel: Don't try to dump invalid code memory in page fault handler. 2019-01-30 20:18:50 +01:00
Andreas Kling 37ab7b7a8c LibGUI: Implement destroying individual windows without exiting the process. 2019-01-30 20:03:52 +01:00
Andreas Kling 5c25f0c4db Destroy all remaining windows in a process when it dies. 2019-01-30 19:35:38 +01:00
Andreas Kling 3a4207b863 Fix dumb bug in HashTable::clear().
We forgot to clear the m_buckets pointer. This meant that multiple calls to
clear() would cause trouble.
2019-01-30 19:32:54 +01:00
Andreas Kling 2b4374d08e Let the slave PTY keep the master PTY alive.
This ownership model is a bit confusing. There's a retain cycle between
MasterPTY and SlavePTY, but it's broken when the SlavePTY is closed, meaning
that there are no more FileDescriptors referring to it.
2019-01-30 19:05:59 +01:00
Andreas Kling 45fba60ab5 Kernel: select() should fail with EBADF if any set contains an invalid fd. 2019-01-30 19:01:31 +01:00
Andreas Kling b4e478aa50 Deallocate PTY's when they close.
This required a fair bit of plumbing. The CharacterDevice::close() virtual
will now be closed by ~FileDescriptor(), allowing device implementations to
do custom cleanup at that point.

One big problem remains: if the master PTY is closed before the slave PTY,
we go into crashy land.
2019-01-30 18:47:18 +01:00
Andreas Kling 027d26cd5d Add a String::format() and use that in place of ksprintf() in the Kernel.
You're never gonna be right 100% of the time when guessing how much buffer
space you need. This avoids having to make that type of decision in a bunch
of cases. :^)
2019-01-30 16:28:51 +01:00
Andreas Kling e9b948103d Add a /dev/pts filesystem and make PTY allocation dynamic.
You can now open as many PTY pairs as you like. Well, it's actually capped
at 8 for now, but it's just a constant and trivial to change.

Unregistering a PTY pair is untested because I didn't want to start
mucking with that in Terminal right now.
2019-01-30 00:49:20 +01:00
Andreas Kling c30e2c8d44 Implement basic chmod() syscall and /bin/chmod helper.
Only raw octal modes are supported right now.
This patch also changes mode_t from 32-bit to 16-bit to match the on-disk
type used by Ext2FS.

I also ran into EPERM being errno=0 which was confusing, so I inserted an
ESUCCESS in its place.
2019-01-29 04:55:08 +01:00
Andreas Kling cc906a2897 VFS: Resolve FIXME in Inode::read_entire() about using dynamic allocation. 2019-01-28 22:55:55 +01:00
Andreas Kling f83a94ca39 Kernel: Remove outdated FIXME. 2019-01-28 22:53:31 +01:00
Andreas Kling 7455f5ea42 Expose the kernel log buffer through /proc/dmesg.
Also add a /bin/dmesg program for convenience.
2019-01-28 22:40:55 +01:00
Andreas Kling c95228b128 Add support for removing directories.
It's really only supported in Ext2FS since SynthFS doesn't really want you
mucking around with its files. This is pretty neat though :^)

I ran into some trouble with HashMap while working on this but opted to work
around it and leave that for a separate investigation.
2019-01-28 04:16:01 +01:00
Andreas Kling 031c62a21e .bochsrc: Toggle mouse grab with ctrl-alt (works nicer on 1-button mice.) 2019-01-28 02:34:09 +01:00
Andreas Kling 0e73aa36c8 Kernel: Unbreak symbolication yet another time. 2019-01-27 10:17:56 +01:00
Andreas Kling 6d351bb326 Kernel: Move RAM size detection to MemoryManager and use what we learn. 2019-01-27 10:17:27 +01:00
Andreas Kling 069d21ed7f Make buttons unpress when the cursor leaves the button rect.
Implement this functionality by adding global cursor tracking.
It's currently only possible for one GWidget per GWindow to track the cursor.
2019-01-27 08:48:34 +01:00
Andreas Kling 15fad649ea Userland: Make a simple /bin/cp for copying files. 2019-01-27 07:18:26 +01:00
Andreas Kling a34bb07abb Make .bochsrc work with the stock Bochs on Ubuntu. 2019-01-27 07:17:24 +01:00
Andreas Kling d72575d196 LibGUI: Start bringing up GTextBox in the standalone world. 2019-01-26 06:39:13 +01:00
Andreas Kling 9fa8d4e22f WindowServer: Rename the two painting phases.
Work now happens in terms of two messages:

    - WM_ClientWantsToPaint
    - WM_ClientFinishedPaint

This feels fairly obvious compared to the old Paint/Invalidate.
2019-01-26 05:45:47 +01:00
Andreas Kling 244d5bcce1 WindowServer: More event -> message renaming. 2019-01-26 05:35:45 +01:00
Andreas Kling bba21adae3 WindowServer: Rename WSEvent to WSMessage.
Also do the same for WSMessageLoop and WSMessageReceiver. More to come.
2019-01-26 05:28:02 +01:00
Andreas Kling 7cf3c7461c Refactor GUI rendering model to be two-phased.
Instead of clients painting whenever they feel like it, we now ask that they
paint in response to a paint message.

After finishing painting, clients notify the WindowServer about the rect(s)
they painted into and then flush eventually happens, etc.

This stuff leaves us with a lot of badly named things. Need to fix that.
2019-01-26 05:20:32 +01:00
Andreas Kling a54848f451 Let's not auto-start guitest. guitest2 is so much more useful. 2019-01-25 15:52:55 +01:00