Commit Graph

20 Commits

Author SHA1 Message Date
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
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
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
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
16f318408d ELFLoader should fail with an error message for unresolved symbols. 2018-10-25 10:02:04 +02:00
Andreas Kling
ec1d16b307 Add a "pwd" utility to userland.
It's implemented as a separate process. How cute is that.
Tasks now have a current working directory. Spawned tasks inherit their
parent task's working directory.
Currently everyone just uses "/" as there's no way to chdir().
2018-10-24 14:28:22 +02:00
Andreas Kling
5f36a5f22e Add an lstat() syscall and use it to make "ls" nicer. 2018-10-24 13:19:36 +02:00
Andreas Kling
bca4b71bfa Lots of hacking to make a very simple "ls" utility.
I added a dead-simple malloc that only allows allocations < 4096 bytes.
It just forwards the request to mmap() every time.

I also added simplified versions of opendir() and readdir().
2018-10-24 12:50:07 +02:00
Andreas Kling
9a296d63f3 Add simplified mmap() and munmap() syscalls. 2018-10-24 09:48:41 +02:00
Andreas Kling
3253a23b91 Add a simplified waitpid() so that sh can wait on spawned commands. 2018-10-24 00:20:34 +02:00
Andreas Kling
018da1be11 Generalize the SpinLock and move it to AK.
Add a separate lock to protect the VFS. I think this might be a good idea.
I'm not sure it's a good approach though. I'll fiddle with it as I go along.

It's really fun to figure out all these things on my own.
2018-10-23 23:34:05 +02:00
Andreas Kling
fe237ee215 Lots of hacking:
- Turn Keyboard into a CharacterDevice (85,1) at /dev/keyboard.
- Implement MM::unmapRegionsForTask() and MM::unmapRegion()
- Save SS correctly on interrupt.
- Add a simple Spawn syscall for launching another process.
- Move a bunch of IO syscall debug output behind DEBUG_IO.
- Have ASSERT do a "cli" immediately when failing.
  This makes the output look proper every time.
- Implement a bunch of syscalls in LibC.
- Add a simple shell ("sh"). All it can do now is read a line
  of text from /dev/keyboard and then try launching the specified
  executable by calling spawn().

There are definitely bugs in here, but we're moving on forward.
2018-10-23 10:12:50 +02:00
Andreas Kling
b824f15619 Launching an arbitrary ELF executable from disk works! :^)
This is so cool! It's a bit messy now with two Task constructors,
but eventually they should fold into a single constructor somehow.
2018-10-22 15:43:02 +02:00
Andreas Kling
befeabd8fe Okay, with some mucking around, there is now a /bin/id and it runs!
It statically links against everything in LibC that it needs.
This will work just fine for a long time to come!
2018-10-22 14:41:54 +02:00
Andreas Kling
38a621c721 Link "id" against the LibC.
We can now produce what should essentially be a runnable Serenity executable.
2018-10-22 14:13:17 +02:00
Andreas Kling
63764b3a65 Import very modest Userland. 2018-10-22 14:06:22 +02:00
Andreas Kling
4cbf079a17 Start work on a standard C library. I'm calling it... LibC. 2018-10-22 13:57:25 +02:00