Commit Graph

111 Commits

Author SHA1 Message Date
Andreas Kling
0c5ecd303c Share GraphicsBitmaps between the windowing server and the client process.
This is pretty cool. :^)

GraphicsBitmaps are now mapped into both the server and the client address
space (usually at different addresses but that doesn't matter.)

Added a GUI syscall for getting a window's backing store, and another one
for invalidating a window so that the server redraws it.
2019-01-14 15:25:34 +01:00
Andreas Kling
b0e3f73375 Start refactoring the windowing system to use an event loop.
Userspace programs can now open /dev/gui_events and read a stream of GUI_Event
structs one at a time.

I was stuck on a stupid problem where we'd reenter Scheduler::yield() due to
having one of the has_data_available_for_reading() implementations using locks.
2019-01-14 14:42:49 +01:00
Andreas Kling
973ff14180 Make QtCreator stop complaining about the ASSERT macro. 2019-01-14 00:35:07 +01:00
Andreas Kling
b2d86b7597 Add basic GUI API for creating labels and buttons. 2019-01-13 05:03:17 +01:00
Andreas Kling
8f8c8d1ca3 Start working on a GUI kernel API. 2019-01-13 02:02:34 +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
ec1c487dcd Yet another pass of style fixes. 2018-12-21 02:10:45 +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
038d8641f9 Implement utime() along with a naive /bin/touch.
This synchronous approach to inodes is silly, obviously. I need to rework
it so that the in-memory CoreInode object is the canonical inode, and then
we just need a sync() that flushes pending changes to disk.
2018-12-19 21:14:55 +01:00
Andreas Kling
4f6438ec66 VirtualConsole: Support the 'A' and 'D' CSI sequences.
This makes backspace work correctly when line editing with bash-2.05b.
2018-12-07 01:19:02 +01:00
Andreas Kling
ca6847b5bb Import a simple text editor I started working on. 2018-12-04 00:27:16 +01:00
Andreas Kling
e7cc08226f Implement basic support for times().
The kernel now bills processes for time spent in kernelspace and userspace
separately. The accounting is forwarded to the parent process in reap().

This makes the "time" builtin in bash work.
2018-12-03 01:14:19 +01:00
Andreas Kling
ac7a60225e Add TIOCGWINSZ ioctl so userland can determine terminal geometry.
(Don't) use this to implement short-form output in ls.
I'm too tired to make a nice column formatting algorithm.
I just wanted something concise when I type "ls".
2018-11-29 03:45:23 +01:00
Andreas Kling
464a16afa2 Implement signal() via sigaction() and get rid of sys$signal(). 2018-11-28 22:27:32 +01:00
Andreas Kling
e88f306d07 Make /proc/PID/vm more readable.
And move the unreadable detail-heavy mess to /proc/PID/vmo.
2018-11-19 01:49:19 +01:00
Andreas Kling
526dcafd57 Some improvements to LibC malloc(). 2018-11-19 01:40:19 +01:00
Andreas Kling
85649077cd Adapt kmalloc() for userspace.
A slightly more useful malloc() for userspace. The max allocation limit
is still 128 kB, but at least now free() is able to recycle memory.
2018-11-19 00:53:02 +01:00
Andreas Kling
de4604ac95 Finally hook up the mkdir code to a syscall.
Added a /bin/mkdir that makes directories. How very neat :^)
There are various limitations because of missing functionality.
2018-11-18 15:02:16 +01:00
Andreas Kling
303577df16 Various stubs while trying to get an old coreutils to build. 2018-11-17 15:56:09 +01:00
Andreas Kling
9d05f6b7a7 Make bash-2.05b build with minimal changes.
This is really neat. :^)
2018-11-17 00:14:07 +01:00
Andreas Kling
2cf477a151 Add fcntl() F_DUPFD which is slightly different from dup2(). 2018-11-16 22:14:40 +01:00
Andreas Kling
8a286b9244 Improve syscall address validation a bit. 2018-11-16 16:10:59 +01:00
Andreas Kling
084287ca45 Reimplement tcsetattr/tcgetattr as ioctls. 2018-11-16 15:41:48 +01:00
Andreas Kling
c99f8af66d Add ioctl() and reimplement tcsetpgrp/tcsetpgrp as ioctls. 2018-11-16 13:13:50 +01:00
Andreas Kling
97c799576a Add close-on-exec flag for file descriptors.
I was surprised to find that dup()'ed fds don't share the close-on-exec flag.
That means it has to be stored separately from the FileDescriptor object.
2018-11-13 01:36:31 +01:00
Andreas Kling
f1404aa948 Add primitive FIFO and hook it up to sys$pipe().
It's now possible to do this in bash:

cat kernel.map | fgrep List

This is very cool! :^)
2018-11-12 01:28:46 +01:00
Andreas Kling
18e3ddf605 Add a naive /bin/fgrep for testing pipes. 2018-11-11 20:42:41 +01:00
Andreas Kling
d5d45d1088 Rage hacking to get bash to run. It finally runs. So cool! :^) 2018-11-11 15:38:07 +01:00
Andreas Kling
9b70808ab5 Add really cheap atol() since sizeof(int) == sizeof(long) here anyway. 2018-11-11 10:40:50 +01:00
Andreas Kling
f394e3486a Stub out a bunch more functions to get closer to that sweet bash build. 2018-11-11 10:38:33 +01:00
Andreas Kling
e48182d91b Add setvbuf(), setlinebuf(), setbuf(). 2018-11-11 10:11:09 +01:00
Andreas Kling
7cc4caee4f Add ispunct() to LibC + some minor cleanups. 2018-11-11 00:44:04 +01:00
Andreas Kling
3b2f172d48 A bunch of compat work (mostly stubs but some real implementations, too.)
Another pass at getting bash-1.14.7 to build. Not that many symbols remain.
2018-11-11 00:20:53 +01:00
Andreas Kling
6a0a2c9ab4 Some improvements to signals.
- Add sigprocmask() and sigpending().
- Forked children inherit signal dispositions and masks.
- Exec clears signal dispositions and masks.
2018-11-10 23:30:41 +01:00
Andreas Kling
8605711f4b Make /bin/clear work again.
After I made stdio buffered, we were dropping anything unflushed on exit.
Since /bin/clear just prints out some escape sequences without a newline,
the entire buffer was being discarded.

Also add VirtualConsole::clear() that handles clearing of background VC's.
2018-11-10 00:56:10 +01:00
Andreas Kling
4914f3b837 Build LibC and Userland with clang as well. 2018-11-09 14:29:00 +01:00
Andreas Kling
7b3b5f745f Move <utsname.h> to <sys/utsname.h> for correctness. 2018-11-09 10:24:41 +01:00
Andreas Kling
8249c086c3 Get rid of redundant sys$spawn now that we have fork+exec. 2018-11-09 10:22:27 +01:00
Andreas Kling
e9cdb6bb9b Fix all current build warnings in LibC. 2018-11-09 10:09:46 +01:00
Andreas Kling
3c8064a787 Support basic mmap'ing of a file!
All right, we can now mmap() a file and it gets magically paged in from fs
in response to an NP page fault. This is really cool :^)

I need to refactor this to support sharing of read-only file-backed pages,
but it's cool to just have something working.
2018-11-08 12:59:16 +01:00
Andreas Kling
fdbd9f1e27 Start working on memory-mapped files.
First of all, change sys$mmap to take a struct SC_mmap_params since our
sycsall calling convention can't handle more than 3 arguments.

This exposed a bug in Syscall::invoke() needing to use clobber lists.
It was a bit confusing to debug. :^)
2018-11-08 11:40:58 +01:00
Andreas Kling
da3857b0c2 Add some simple write buffering to LibC's stdio.
Plumb it all the way to the VirtualConsole. Also fix /bin/cat to write()
the whole chunks we get from read() directly to stdout.
2018-11-08 01:23:47 +01:00
Andreas Kling
0b3e927597 Oops, waitpid() was not passing the options parameter to the kernel. 2018-11-07 10:46:48 +01:00
Andreas Kling
d7a41579e5 Miscellaneous compat work while seeing if GNU coreutils would build. 2018-11-07 10:23:16 +01:00
Andreas Kling
a7f1d892a9 Add some basic setgroups(), getgroups() and initgroups().
Also teach /bin/id to print the user's supplemental groups.
2018-11-07 01:38:51 +01:00
Andreas Kling
d3bd3791cb Minor fixes in getgrent() and getpwent() function families. 2018-11-07 00:33:10 +01:00
Andreas Kling
90bab5ea71 Add getgrent() family of functions. 2018-11-06 22:27:51 +01:00
Andreas Kling
e5e0bffd76 Add getwd(). 2018-11-06 15:59:57 +01:00
Andreas Kling
7c3746592b Add strsignal() and improve sharing signal numbers between LibC and kernel. 2018-11-06 15:45:16 +01:00
Andreas Kling
8d1f8b2518 Add sys_nerr and sys_errlist.
Also keep the canonical errno list in LibC for now. The kernel gets it
from there. This makes building 3rd party code easier.

..also fix broken strchr().
2018-11-06 14:42:28 +01:00