Commit Graph

23 Commits

Author SHA1 Message Date
Andreas Kling
beda478821 Kernel: Make syscalls that take a buffer size use ssize_t instead of size_t.
Dealing with the unsigned overflow propagation here just seems unreasonably
error prone. Let's limit ourselves to 2GB buffer sizes instead.
2019-02-25 21:21:12 +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
bd3e77cc16 Pass the process to CharacterDevice::read/write.
This is much nicer than grabbing directly at 'current' inside a read().
2019-01-16 00:20:38 +01:00
Andreas Kling
08bfe518f9 Rename CharacterDevice::has_data_available_for_reading() -> can_read(). 2019-01-16 00:10:13 +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
aff89d2fd7 Yet more coding style fixes. 2018-12-03 01:38:22 +01:00
Andreas Kling
f6e27c2abe More coding style changes. 2018-12-03 00:39:25 +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
2ac5e14c08 Merge VGA into VirtualConsole. 2018-11-10 16:26:18 +01:00
Andreas Kling
b833aa4162 Fix bug where Console::the() was initialized too late.
Yet another problem due to lack of BSS zeroing in the kernel loader...
2018-10-30 23:02:06 +01:00
Andreas Kling
68739dc43e Start working on virtual consoles/TTYs.
This is a mess right now, but I'd rather commit as I go.
2018-10-30 13:59:29 +01:00
Andreas Kling
bd2b5327d0 Basic support the backspace key.
This doesn't mean we get any line editing just yet. But the keyboard device
now recognizes the backspace key, and the console device knows what to do
with the backspace characters.
2018-10-30 11:55:58 +01:00
Andreas Kling
e6284a8774 Fix broken SpinLock.
The SpinLock was all backwards and didn't actually work. Fixing it exposed
how wrong most of the locking here is.

I need to come up with a better granularity here.
2018-10-29 22:04:26 +01:00
Andreas Kling
43475f248b Add save/unsave cursor escape sequences.
Also added a little terminal test program called /bin/tst.
2018-10-28 01:44:53 +02:00
Andreas Kling
dd3244137e Add basic support for ANSI color escape sequences. 2018-10-28 00:56:19 +02:00
Andreas Kling
8289a5c93c Implement 'H' and 'J' escape sequences. 2018-10-27 23:42:20 +02:00
Andreas Kling
546ddd7de0 Remove logspam in /dev/{full,null,zero} now that they work just fine.
Also don't echo anything to console when putch'ing '\0'.
2018-10-26 11:27:42 +02:00
Andreas Kling
c6f2890d8e Implement a basic way for read() to block.
FileHandle gets a hasDataAvailableForRead() getter.
If this returns true in sys$read(), the task will block(BlockedRead) + yield.
The fd blocked on is stored in Task::m_fdBlockedOnRead.
The scheduler then looks at the state of that fd during the unblock phase.

This makes "sh" restful. :^)

There's still some problem with the kernel not surviving the colonel task
getting scheduled. I need to figure that out and fix it.
2018-10-25 13:09:56 +02:00
Andreas Kling
3676214a62 Remove remains of the old "panel" task.
...and grow the console by 1 row! :^)
2018-10-23 15:47:03 +02:00
Andreas Kling
77821da42f Also send console output to port 0xe9 (bochs console.)
This is very handy for debugging.
2018-10-23 13:02:38 +02:00
Andreas Kling
79ffdb7205 A lot of hacking:
- More work on funneling console output through Console.
- init() now breaks off into a separate task ASAP.
- ..this leaves the "colonel" task as a simple hlt idle loop.
- Mask all IRQs on startup (except IRQ2 for slave passthru)
- Fix underallocation bug in Task::allocateRegion().
- Remember how many times each Task has been scheduled.

The panel and scheduling banner are disabled until I get things
working nicely in the (brave) new Console world.
2018-10-22 11:15:16 +02:00
Andreas Kling
fc88368582 Have Console::write() directly call vga_putch. 2018-10-21 22:44:26 +02:00
Andreas Kling
a70bfb87d5 Add a Console device and start refactoring screen output. 2018-10-21 21:59:43 +02:00