Commit graph

63808 commits

Author SHA1 Message Date
Andreas Kling 7be30a2fa8 Fuck it, add a 4th virtual console. :^) 2018-10-31 00:27:34 +01:00
Andreas Kling 4dec23b487 Add assertion that RTC year is >= 2018. 2018-10-31 00:27:28 +01:00
Andreas Kling 555c10a1f8 Minor cleanup. 2018-10-31 00:26:22 +01:00
Andreas Kling 72e75c52e3 Pass the register dump to syscall_entry() via an argument.
I'm not sure why this was using a global, but it was very racy and made
processes walk over each other when multiple processes were doing
syscalls simultaneously.
2018-10-31 00:23:46 +01:00
Andreas Kling b4f3bc078f Minor VGA cleanup. 2018-10-30 23:49:06 +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 00c21d1590 Add sys$ttyname_r and ttyname_r() + ttyname().
And print a greeting when sh starts up so we know which TTY we're on.
2018-10-30 22:03:02 +01:00
Andreas Kling 7a85384e47 sh should read from fd 0 (stdin) instead of /dev/keyboard. 2018-10-30 16:17:34 +01:00
Andreas Kling 1b81813a66 Fix crashy bug where we'd try to deactivate VC -1 on boot. 2018-10-30 16:16:20 +01:00
Andreas Kling 7a7956a595 Virtual consoles kinda work!
We now make three VirtualConsoles at boot: tty0, tty1, and tty2.
We launch an instance of /bin/sh in each one.
You switch between them with Alt+1/2/3

How very very cool :^)
2018-10-30 15:33:37 +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 29035ffde7 Hang if a task crashes while it's already crashing.. 2018-10-30 00:12:08 +01:00
Andreas Kling 0f20be05a6 Implement sys$getcwd properly.
Also fixed broken strcpy that didn't copy the null terminator.
2018-10-30 00:06:31 +01:00
Andreas Kling 8e640539ef Add an inode metadata cache to the ext2fs implementation. 2018-10-29 23:45:34 +01:00
Andreas Kling 4259ffb080 Improve ps output. 2018-10-29 23:02:07 +01:00
Andreas Kling b1ff62f605 Okay let's just not have this broken locking at all right now.
I think I should just protect access to shared data structures
and eventually do read/write atomicity locks at the inode level.
2018-10-29 22:43:39 +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 bea106fdb2 Fix up VFS::resolveSymbolicLink() to use a base inode instead of a base path.
Also more VFS error plumbing.
2018-10-28 14:25:51 +01:00
Andreas Kling 97726862dd Add basic symlink support.
- sys$readlink + readlink()
- Add a /proc/PID/exe symlink to the process's executable.
- Print symlink contents in ls output.
- Some work on plumbing options into VFS::open().
2018-10-28 14:11:51 +01:00
Andreas Kling 1d4af51250 Add a VFS::absolutePath(InodeIdentifier).
This is pretty inefficient for ext2fs. We walk the entire block group
containing the inode, searching through every directory for an entry
referencing this inode.

It might be a good idea to cache this information somehow. I'm not sure
how often we'll be searching for it.

Obviously there are multiple caching layers missing in the file system.
2018-10-28 12:20:25 +01:00
Andreas Kling 3f050c1972 Add zone dump to /proc/mm.
Sweet, now we can look at all the zones (physical memory) currently in play.

Building the procfs files with ksprintf and rickety buffer presizing feels
pretty shoddy but I'll fix it up eventually.
2018-10-28 10:39:27 +01:00
Andreas Kling c76dc9a047 Add /proc/mm and a /bin/mm utility that just dumps it.
This shows some info about the MM. Right now it's just the zone count
and the number of free physical pages. Lots more can be added.

Also added "exit" to sh so we can nest shells and exit from them.

I also noticed that we were leaking all the physical pages, so fixed that.
2018-10-28 10:28:21 +01:00
Andreas Kling 0a6a2521e8 Add subregions to /proc/PID/vm 2018-10-28 10:03:54 +01:00
Andreas Kling 1d5afbdffc Add sys$set_mmap_name and use it from LibC's malloc.
It's nice to be able to identify mmap's in /proc/PID/vm.
2018-10-28 09:57:22 +01:00
Andreas Kling e904f193c1 Canonicalize the path used by sh.
With a bunch of LibC work to support the feature. LibC now initializes
AK::StringImpl by default. It's now fine to use AK in LibC/Userland! :^)
2018-10-28 09:36:21 +01:00
Andreas Kling 88ad59bfb1 Add a simple FileSystemPath class that can canonicalize paths.
Also a simple StringBuilder to help him out.
2018-10-28 08:54:20 +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 ea6221dd06 Stop committing changes to _fs_contents and generate it in the sync script. 2018-10-28 01:21:15 +02:00
Andreas Kling e2dbdd14aa Colorize ls output. 2018-10-28 01:17:48 +02:00
Andreas Kling 52c19136f2 Give the shell a nice, colorful prompt.
The cwd looks like crap, I need to write some code to strip out ".."
and extra slashes from the path string.
2018-10-28 01:08:01 +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 cc7e3519a6 Add a /bin/clear that prints the clear terminal escape sequence.
It doesn't work yet, but it will!
2018-10-27 17:39:08 +02:00
Andreas Kling 8f91a47aeb Add some basic field width support to printf().
Use it to make "ls" output a bit better. Also sys$spawn now fails with EACCES
if the path is not a file that's executable by the current uid/gid.
2018-10-27 16:43:03 +02:00
Andreas Kling de2fb183cc Rename "kernel map" concept to just "ksyms" 2018-10-27 15:02:39 +02:00
Andreas Kling 9a71c7759a Implement loading of linked ELF executables.
This took me a couple hours. :^)

The ELF loading code now allocates a single region for the entire
file and creates virtual memory mappings for the sections as needed.

Very nice!
2018-10-27 14:56:52 +02:00
Andreas Kling 99ee6acd69 Enable A20 line at boot. 2018-10-27 14:09:33 +02:00
Andreas Kling 601d0d1739 Better int hashing. This was going to bite me sooner or later. 2018-10-27 09:33:24 +02:00
Andreas Kling ec07761d0f Implement waitpid() support for getting the waitee's exit code. 2018-10-27 01:24:22 +02:00
Andreas Kling 5cfeeede7c Remove the obsolete "Userspace" stuff. 2018-10-27 00:41:23 +02:00
Andreas Kling 42c88b5f2d Turn off the floppy drive after the boot loader is finished. 2018-10-27 00:40:42 +02:00
Andreas Kling 3db8d7ae1a Use Unix::stat for sys$lstat(). 2018-10-27 00:29:31 +02:00
Andreas Kling 509e5f9952 Add some basic address validation to syscalls.
This is extremely ineffcient, but it doesn't really matter yet.
2018-10-27 00:29:24 +02:00
Andreas Kling 2716a9e2d7 Greatly improve /proc/PID/stack by tracing the ebp frame chain.
I also added a generator cache to FileHandle. This way, multiple
reads to a generated file (i.e in a synthfs) can transparently
handle multiple calls to read() without the contents changing
between calls.

The cache is discarded at EOF (or when the FileHandle is destroyed.)
2018-10-27 00:14:24 +02:00
Andreas Kling c928b06218 Add a very hackish /proc/PID/stack.
It walks the stack and identifies anything that looks like a kernel symbol.
This could be a lot more sophisticated.
2018-10-26 22:33:15 +02:00
Andreas Kling 81627cf7d5 Add a simple /proc/mounts that enumerates the current VFS mounts. 2018-10-26 18:43:25 +02:00
Andreas Kling a447359916 Add a /proc/kmalloc stats file. 2018-10-26 18:28:25 +02:00
Andreas Kling edb81a635c Fix bug where you couldn't "cd .." into the root of a mounted fs. 2018-10-26 18:19:31 +02:00
Andreas Kling a32b3a3ddf Implement /proc/PID/vm.
Refactored SyntheticFileSystem to maintain an arbitrary directory structure.
ProcFileSystem creates a directory entry in /proc for each new process.
2018-10-26 17:44:19 +02:00