Commit graph

348 commits

Author SHA1 Message Date
Andreas Kling c43903eebd Don't use dword-by-dword memset/memcpy if the addresses are unaligned.
Also don't enable the large kmalloc catcher by default.
2019-01-12 23:36:08 +01:00
Andreas Kling 3ac977f50b Paper over a race in DoubleBuffer.
I'm still somewhat okay throwing InterruptDisabler at races as they screw me.
Eventually I'm gonna have to devise a different strategy though.
2019-01-12 23:23:35 +01:00
Andreas Kling 2e2d883c09 Print process name and PID when kmalloc() panics. 2019-01-12 21:48:41 +01:00
Andreas Kling edc827077e Optimize WindowManager::flush() with fast_dword_copy(). 2019-01-12 21:45:45 +01:00
Andreas Kling 24b2cadb82 Make the kernel's memcpy() and memset() go fast with dword copies.
Also I learned that the ABI allows us to assume DF=0 on function entry.
2019-01-12 18:14:40 +01:00
Andreas Kling 780e15a6cc All right, let's double buffer the display. It looks so much better.
This performs like dogshit. I need to make some optimizations. :^)
2019-01-12 06:39:34 +01:00
Andreas Kling fd4e86460b Make PS2MouseDevice behave more like a proper character device.
Get rid of the goofy MouseClient interface and have the GUI event loop just
read mouse data from the character device.

The previous approach was awful as it was sending us into random GUI code
in the mouse interrupt handler.
2019-01-12 05:23:16 +01:00
Andreas Kling bb28c31531 Get rid of the "root widget" concept in WindowManager.
Instead just create a GraphicsBitmap wrapper around the display framebuffer
and teach Painter how to draw directly into a GraphicsBitmap.
2019-01-12 03:42:50 +01:00
Andreas Kling 0e6c19ffa6 Reduce PS2MouseDevice debug spam in every dang mouse interrupt. 2019-01-12 03:20:48 +01:00
Andreas Kling fa6029eed0 Make the kernel's memset do a "rep stosb" because. 2019-01-12 02:23:09 +01:00
Andreas Kling b95aa18315 Hook up the Keyboard device to the AbstractScreen.
Basic text editing in a TextBox works. How very cool :^)
2019-01-11 04:40:05 +01:00
Andreas Kling a3c39ea9d6 Throw up some widgets on screen so we can see what they look like. 2019-01-11 04:10:07 +01:00
Andreas Kling e5e295052f Hook up the PS2MouseDevice to the AbstractScreen+WindowManager.
Render the mouse cursor by xor'ing the pixels. I don't know anything about
hardware cursors yet and this way we don't need to recompose the window
hierarchy every time you move the mouse. :^)
2019-01-11 03:52:09 +01:00
Andreas Kling 31667b47a5 Teach PS2MouseDevice to read the left and right buttons. 2019-01-11 02:45:06 +01:00
Andreas Kling e740f1195a Add a simple PS/2 mouse device.
It's not hooked up to anything just yet, but it does read movement deltas.
2019-01-11 02:28:53 +01:00
Andreas Kling d1ceb4b603 Fix uninitialized AbstractScreen instance pointer.
...yeah yeah, one day I'm gonna zero out the kernel's BSS segment. Soon..
2019-01-11 01:43:41 +01:00
Andreas Kling f6d2c3ed87 Hook everything up to run the GUI on top of the kernel.
Okay things kinda sorta work. Both Bochs and QEMU now boot into GUI mode.
There's a ton of stuff that doesn't make sense and so many things to rework.

Still it's quite cool to have made it this far. :^)
2019-01-10 23:19:29 +01:00
Andreas Kling 8626e95509 Make Widgets/ build inside the kernel. 2019-01-10 22:52:14 +01:00
Andreas Kling 659c54e32b Switch into 1024x768x32bpp VESA LFB mode at boot.
This is going to be pretty cool once I can hook up the Widgets/ code to it.
2019-01-09 02:29:11 +01:00
Andreas Kling 2735b7e50d Add PhysicalAddress::offset(). 2019-01-08 22:29:34 +01:00
Andreas Kling 355201f34d Vector<String>() -> { } 2019-01-08 22:28:11 +01:00
Andreas Kling ba91ab1038 Don't omit frame pointers. Duh. This fixes /proc/PID/stack listings. 2019-01-04 19:02:21 +01:00
Andreas Kling bad2fe33ad Fix crash when doing "ls -l" in the /proc/PID directory for a kernel process. 2019-01-04 18:50:16 +01:00
Andreas Kling 7731aef7b2 Let the "reaped unparented process" messages go straight to the debugger. 2019-01-01 03:56:39 +01:00
Andreas Kling 4b6a8f8a08 Unbreak ksym loading and make reading /proc/PID/stack not crash. 2019-01-01 02:20:01 +01:00
Andreas Kling 683185e4aa MM: Allocate page tables from a separate set of physical pages.
The old approach only worked because of an overpermissive accident.
There's now a concept of supervisor physical pages that can be allocated.
They all sit in the low 4 MB of physical memory and are identity mapped,
shared between all processes, and only ring 0 can access them.
2019-01-01 02:09:43 +01:00
Andreas Kling a5ffa2eec7 Add a PageDirectory::flush() that does nothing if another PD is active.
This way callers can just flush() every time after making any modification
and the PageDirectory itself will decide if TLB invalidation is necessary.
2018-12-31 20:52:59 +01:00
Andreas Kling 9eca2ffd41 Make PhysicalPage eternally allocated. 2018-12-31 20:25:42 +01:00
Andreas Kling 3e37a1f5c3 Optimize PageDirectory destruction.
Remove an extra hash lookup and only iterate over the actually-used
PhysicalPages that we need to clean up.
2018-12-31 15:18:02 +01:00
Andreas Kling edac1d6748 Make PageDirectory store physical pages in a HashMap.
This container is really just there to keep a retain on the individual
PhysicalPages for each page table. A HashMap does the job with far greater
space efficiency.
2018-12-31 15:10:12 +01:00
Andreas Kling 193ead94f8 Let PageDirectory have a PhysicalPage for the PDB instead of being the PDB.
This is more efficient than using the wasteful kmalloc_aligned() approach
to allocation. It also allows much tighter encapsulation of the class.
2018-12-31 14:58:03 +01:00
Andreas Kling 0dd5279eb1 MM: Fix bug when mapping a region with a VMO with non-zero offset. 2018-12-29 03:35:48 +01:00
Andreas Kling 46ce47a984 Use the entry point address from the ELF header instead of looking up _start.
I love these kind of dumb gotcha moments. Turns out you can find the entry
address right there in the header. :^)
2018-12-29 03:28:55 +01:00
Andreas Kling 3f3535213b Fix some issues uncovered by the spawn stress test. 2018-12-26 22:02:24 +01:00
Andreas Kling f6179ad9f9 Add slightly better kmalloc_aligned() and kfree_aligned().
Process page directories can now actually be freed. This could definitely
be implemented in a nicer, less wasteful way, but this works for now.

The spawn stress test can now run for a lot longer but eventually dies
due to kmalloc running out of memory.
2018-12-26 21:47:15 +01:00
Andreas Kling 55c722096d Process::create_user_process() shouldn't leak a process if exec() fails. 2018-12-26 21:04:27 +01:00
Andreas Kling 2f010e941c Unbreak the spawn stress test. 2018-12-26 20:57:51 +01:00
Andreas Kling 12a6963a5d Fix bug where Vnode kept its Inode alive indefinitely. 2018-12-24 23:24:49 +01:00
Andreas Kling 033a42b580 The syncd loop can just be a lambda. 2018-12-24 23:10:48 +01:00
Andreas Kling 503e32552c Move kernel symbolication code out of init.cpp and into its own KSym files.
Also use a simple array of { dword, const char* } for the KSyms and put the
whole shebang in kmalloc_eternal() memory. This was a fugly source of
kmalloc perma-frag.
2018-12-24 23:01:09 +01:00
Andreas Kling 6a9fa3e41a Let sys$sigaction() fail if called with SIGKILL or SIGSTOP. 2018-12-24 22:22:35 +01:00
Andreas Kling 7bc41532be Remove FS::read_entire_inode() in favor of Inode::read_entire(). 2018-12-21 17:45:42 +01:00
Andreas Kling 3a0a8848fb Make syscall invocations look pleasant.
Old: Syscall::invoke(Syscall::SC_foo, (dword)arg1, (dword)arg2)
New: syscall(SC_foo, arg1, arg2)
2018-12-21 03:02:06 +01:00
Andreas Kling 36bd53b36a Add a simple /bin/more. 2018-12-21 02:42:30 +01:00
Andreas Kling 4dd50b1f6d Get rid of three test utilities that I no longer need. 2018-12-21 02:22:21 +01:00
Andreas Kling ec1c487dcd Yet another pass of style fixes. 2018-12-21 02:10:45 +01:00
Andreas Kling 89040cdc99 Add a "syncd" kernel process that periodically calls sync(). 2018-12-20 02:41:55 +01:00
Andreas Kling ed7ae6c02c Add sync() syscall and a /bin/sync.
It walks all the live Inode objects and flushes pending metadata changes
wherever needed.

This could be optimized by keeping a separate list of dirty Inodes,
but let's not get ahead of ourselves.
2018-12-20 00:39:29 +01:00
Andreas Kling d0f06e5f3f Automatically call Inode::flush_metadata() before an Inode is destroyed.
Use a little template magic to have Retainable::release() call out to
T::will_be_destroyed() if such a function exists before actually calling
the destructor. This gives us full access to virtual functions in the
pre-destruction code.
2018-12-19 22:28:09 +01:00
Andreas Kling 1f44cd9dd9 Reworked Inode to have a dirty bit and subclass-implemented flush_metadata().
This way we can defer disk writes as long as we like. There's no automatic
flushing happening just yet.
2018-12-19 21:56:45 +01:00