Commit graph

45 commits

Author SHA1 Message Date
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 eb4074bb9d Put more logspam behind EXT2_DEBUG. 2018-10-24 13:38:53 +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 57136ad87e synthfs: generated files should have size=0.
This way we don't need to generate the file just to see how big it would get.
2018-10-24 00:50:23 +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 ed2422d7af Start adding a basic /proc filesystem and a "ps" utility. 2018-10-23 12:04:03 +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 72514c8b97 Don't use doubles in RandomDevice.
...since Computron doesn't have FPU support yet, I'm gonna avoid using it
here in Serenity for now.
2018-10-23 00:35:11 +02:00
Andreas Kling 63764b3a65 Import very modest Userland. 2018-10-22 14:06:22 +02:00
Andreas Kling ba185e3eba Zero out VirtualFileSystem::s_the in initializeGlobals().
This catches attempts to access the vfs before it's been constructed.
2018-10-22 12:54:19 +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 a89bebfda4 printf -> kprintf 2018-10-21 23:48:13 +02:00
Andreas Kling 2d1d01661b Add a way to initialize VFS globals.
This is needed since the kernel loader doesn't even zero out bss,
much less call any static constructors.
2018-10-19 11:20:49 +02:00
Andreas Kling e86cadc7af Add an fd field to FileHandle in Kernel builds. 2018-10-18 10:27:07 +02:00
Andreas Kling f82b25d4f9 Fix some minor build warnings. 2018-10-17 16:48:43 +02:00
Andreas Kling 7580ac576f Make VFS host build work again. 2018-10-17 12:23:19 +02:00
Andreas Kling 39fa1eb2c2 Print the contents of motd.txt on boot. 2018-10-17 12:07:39 +02:00
Andreas Kling 705832f387 List the root directory after mounting /.
So cool that it works! It's spewing out a bunch of terminal escape sequences
that the OS console obviously doesn't support, but we'll get there too.
2018-10-17 11:47:14 +02:00
Andreas Kling d2425495ca VirtualFileSystem class builds inside Kernel. 2018-10-17 11:40:58 +02:00
Andreas Kling 9171521752 Integrate ext2 from VFS into Kernel. 2018-10-17 10:57:23 +02:00
Andreas Kling aec8ab0a60 Add the basic character devices to kernel. 2018-10-16 14:33:16 +02:00
Andreas Kling 8293a0ff36 Rework DiskDevice's read() and write() to be non-virtual wrappers.
This way subclasses only have to implement readBlock() and writeBlock().
read() and write() require that the offset and length are both divisible
by the blockSize().
2018-10-16 14:13:32 +02:00
Andreas Kling cafb5b2ad6 Fixup small.fs again. 2018-10-16 14:00:44 +02:00
Andreas Kling 9cd0a34b5c BlockDevice -> DiskDevice.
BlockDevice was the wrong name for this abstraction, since a block device
is a type of file in a unix system, and we should use that name for that
concept in the fs implementation.
2018-10-16 11:21:49 +02:00
Andreas Kling f608629704 Implement creating a new directory. 2018-10-16 00:35:03 +02:00
Andreas Kling 5c50d02c2e Fix bug where allocating a new inode forgot that inodes are 1-based. 2018-10-15 02:42:24 +02:00
Andreas Kling b0eaca436c "stat" command should print st_mode in octal. 2018-10-15 02:12:09 +02:00
Andreas Kling 47fc6344ac Support the ext2 directory entry file_type field. 2018-10-15 01:57:57 +02:00
Andreas Kling e7901476d3 Bring back the intentionally broken symlink I had for testing. 2018-10-15 01:00:01 +02:00
Andreas Kling 05b088ee2f Add a simple /dev/random. 2018-10-15 00:44:54 +02:00
Andreas Kling 9528edab92 Move readEntireInode() up to FileSystem (from ext2.)
It's just a wrapper around multiple calls to readInodeBytes() now.
2018-10-15 00:16:14 +02:00
Andreas Kling 0286b5ea48 Add a "stat" command to test FileHandle::stat(). 2018-10-14 23:39:11 +02:00
Andreas Kling c7c957966a Implement SyntheticFileSystem::readInodeBytes(). 2018-10-14 23:13:45 +02:00
Andreas Kling 1f41a36c52 Add a Unix namespace for foo_t types.
This allows me to keep prototyping things on a random desktop machine,
even if that machine has its own ideas about foo_t types.
2018-10-14 22:57:57 +02:00
Andreas Kling c6d6ba7512 Minor errno fixups. 2018-10-14 22:16:28 +02:00
Andreas Kling c94044a04a Work on POSIX-like read() and lseek() support. 2018-10-14 21:19:27 +02:00
Andreas Kling 9f9b4a2382 Add a simple /dev/full. 2018-10-14 13:16:09 +02:00
Andreas Kling e5acbca0e8 Disable the "create /empty" test path for now. 2018-10-14 03:02:28 +02:00
Andreas Kling 93556d6743 Add basic character device support. Start with null and zero. 2018-10-14 03:01:32 +02:00
Andreas Kling fa3b11ac64 Parse out major/minor device from character and block device inodes. 2018-10-14 02:24:12 +02:00
Andreas Kling 03a0dc0103 Add a /dev/zero to the small.fs image. 2018-10-14 02:09:34 +02:00
Andreas Kling 6ea8ce500c Use HashMap::remove() in some places that I wanted it. 2018-10-13 14:26:37 +02:00
Andreas Kling 750b27cb07 Ext2FileSystem::readInode() should return an empty buffer for 0-length files. 2018-10-13 00:50:35 +02:00
Andreas Kling c2d42710bb Fix build. 2018-10-13 00:44:54 +02:00
Andreas Kling 5a30055157 Import all this stuff into a single repo called Serenity. 2018-10-10 11:53:07 +02:00