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
Andreas Kling
10347b9ae8
Add ASSERT_INTERRUPTS_DISABLED in Task::fromPID().
2018-10-26 15:11:29 +02:00
Andreas Kling
63e5583c18
Properly null-terminate the argv list created by sh.
2018-10-26 15:04:20 +02:00
Andreas Kling
1c45b28da6
Add sys$uname() and a /bin/uname utility.
2018-10-26 14:57:26 +02:00
Andreas Kling
384e2f24d4
Add per-task limit for open fd's. Hard-coded at 16 for now.
2018-10-26 14:30:38 +02:00
Andreas Kling
2749e7f1c2
Implement sys$chdir() and teach sh+ls to cd around and browse different dirs.
2018-10-26 14:24:11 +02:00
Andreas Kling
ac738b03d6
Add memcpy() and strcmp() to LibC.
2018-10-26 13:32:13 +02:00
Andreas Kling
0af9254812
If spawning a task fails after we did a partial ELF load, remap current.
...
This is an annoying issue. It'd be nice if this code didn't have to worry
about preserving the calling task's mappings.
2018-10-26 12:22:22 +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
6312c3f253
Fix mixup between /dev/null and /dev/zero device registration.
2018-10-26 11:25:46 +02:00
Andreas Kling
df87dda63c
Implement argc/argv support for spawned tasks.
...
Celebrate the new functionality with a simple /bin/cat implementation. :^)
2018-10-26 11:16:56 +02:00
Andreas Kling
53abfa7ea1
Add sys$gethostname and /bin/hostname
2018-10-26 09:54:29 +02:00
Andreas Kling
3faaa3e04a
Add /bin/false and /bin/true for fun. :^)
2018-10-25 21:39:37 +02:00
Andreas Kling
dc6f57f19c
Add gettimeofday() syscall and LibC wrappers gettimeofday() and time().
...
This only has second accuracy right now, I'll work out subseconds later.
2018-10-25 17:36:18 +02:00
Andreas Kling
5978185242
Add a "sleep" syscall that sleeps for N seconds.
2018-10-25 13:56:03 +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
ba56f4afde
If no context switch occurs, add 1 to the timesScheduled() for current.
...
This seems like more accurate accounting.
2018-10-25 12:45:29 +02:00
Andreas Kling
571dc8234f
Make the stage2 init task sleep dreamily when finished.
...
Something is off about scheduling, I don't think the kernel is handing
out all the available time to processes that are available to run.
2018-10-25 12:40:17 +02:00
Andreas Kling
fdc782c1d1
Add a very naive block cache to the DiskBackedFileSystem.
...
This would be a lot better as an LRU. Right now it's a 32-slot
hash table with random eviction.
2018-10-25 12:36:50 +02:00
Andreas Kling
82bbfa8496
Keyboard should support the space character (jeez!)
2018-10-25 12:10:25 +02:00
Andreas Kling
260b14e505
Implement errno in LibC.
...
This also meant I had to implement BSS (SHT_NOBITS) sections in ELFLoader.
I also added an strerror() so we can print out what the errors are.
2018-10-25 12:06:50 +02:00
Andreas Kling
434b6a8688
Unify the Task constructors.
...
There's now Task::create() and Task::createKernelTask().
2018-10-25 11:17:47 +02:00
Andreas Kling
dff516f6d0
Remove unused Task states.
2018-10-25 10:51:51 +02:00