97eacc027e
Kernel: Use PAGE_SIZE in more places
2022-10-12 13:05:57 +02:00
f5deb1048a
Kernel: Add functions to push and pop the interrupt state
...
This can be useful when you want to disable interrupts, but then only enable them back if they were previously enabled.
2022-10-12 12:58:56 +02:00
b3e16068ef
Kernel: Add Utilities::get_rflags(), and thus Interrupts::are_enabled()
2022-10-12 12:56:55 +02:00
e90b90c556
Kernel, libc: Round up to nearest page-aligned size instead of down
2022-10-12 12:15:12 +02:00
a8eb7a6b66
Merge branch descriptive_headers into main
...
Reviewed-on: #11
2022-10-12 10:11:45 +00:00
d89685bb36
libc: Document sys/types.h
2022-10-12 12:07:42 +02:00
1e16a78106
libc: Document functions in sys/mman.h
2022-10-12 12:06:45 +02:00
a3362429d3
libc: Update strerror()
2022-10-12 12:01:18 +02:00
0d3e7d4463
libc: Document errno.h
2022-10-12 12:01:07 +02:00
b42c866db8
Correct description for fopen()
2022-10-12 11:58:07 +02:00
9f5b3b76d2
libc: Document the function in fcntl.h
2022-10-12 11:57:49 +02:00
f44411aa46
libc: Document the functions in luna.h
2022-10-12 11:54:29 +02:00
6aabe19fb4
libc: Document the functions in stdio.h
2022-10-12 11:51:32 +02:00
ffc223c2cf
libc: Document functions in stdlib.h
...
Also, add prototypes for calloc() and realloc(), which were already implemented but not in the header.
2022-10-12 11:30:21 +02:00
c8c4d31cca
Add a FIXME to string.cpp
2022-10-12 11:20:48 +02:00
19ee20b6f5
libc: Document the functions in string.h
2022-10-12 11:19:14 +02:00
38e87d8f8f
libc: Document the functions in unistd.h
2022-10-12 11:02:18 +02:00
96b1d1c2f2
Devices: Tell a device which name you want it to be instantiated with
...
This allows us to create a device in any path, with any filename.
2022-10-12 10:54:46 +02:00
eb03ae91e0
Devices: Add a new Serial device
...
This device permits userspace to interface with the serial port.
2022-10-12 10:44:30 +02:00
89cbe5957b
Update .gdbconf to point to the non-stripped kernel executable
2022-10-12 10:17:49 +02:00
44834b8a0f
libc: Implement fputs, fputc, putc and putchar
2022-10-12 10:05:14 +02:00
eaf7a1620b
Next version!
2022-10-11 21:42:23 +02:00
e145690db8
apps: Remove demo programs (except for init)
...
We no longer need those, and they just make the initrd larger.
2022-10-11 21:37:27 +02:00
25ab31c7ce
Remove unnecessary comments
2022-10-11 21:32:28 +02:00
d3ac590e24
Kernel: Remove the sys_getversion() syscall
...
User programs can now acquire this information by reading /dev/version.
2022-10-11 21:31:28 +02:00
112e375b5e
Kernel: Add a FIXME
2022-10-11 21:21:27 +02:00
c30041b733
fix naming
2022-10-11 21:17:07 +02:00
88a01fcfc7
libc: make perror output to stderr
2022-10-11 21:13:38 +02:00
b67011c626
libc: Use the new write() syscall
...
The new one is write(fd, buf, count).
The old one was write(buf, count).
So the old one tries to pass buf as a file descriptor, and write() complains that 4000000 is too large of a file descriptor and throws EBADF.
We now use the new syscall, through the wrapper that fwrite() provides us.
2022-10-11 21:12:19 +02:00
0f47f59364
libc: make fprintf actually write to the chosen file
...
Also, printf now is kind of an alias for fprintf(stdout,...), as it should be.
2022-10-11 21:10:19 +02:00
2f46e46aa4
libc: Implement fwrite()
...
Now that we have the write() syscall and libc wrapper, fwrite can finally be implemented.
2022-10-11 21:09:30 +02:00
80ab982fe4
libc: make stdout and stderr functional
...
what were before one extern FILE* without reference now are opened by libc on program initialization, to point to /dev/console by default.
2022-10-11 21:08:46 +02:00
53a4b3b85e
libc: Add new flags to open()
...
Since we now have write support, we can add O_WRONLY and O_RDWR to fcntl.h :)
2022-10-11 21:07:21 +02:00
12cf37d0a7
Kernel/syscalls: Modify sys_write to accept a file descriptor and write to it
...
Previously, sys_write only wrote to the tty. Now, it uses the VFS interface, as it should.
2022-10-11 21:06:12 +02:00
e764647133
Devices: add a new ConsoleDevice
...
This new device is the userspace interface to the text console/tty.
2022-10-11 21:04:50 +02:00
b1fcfd0d74
VersionDevice: Ignore offset instead of erroring out + set flags to 0
2022-10-11 21:04:14 +02:00
e67ef7778c
VFS: Support writing to files
2022-10-11 21:03:30 +02:00
f6e783ea45
init: do not show 'read n bytes' when printing version
...
that was to debug why reading /dev/version returned 'versionmoon 0.10-' instead of 'moon 0.10-fffffff'
it works now, so...
2022-10-11 20:13:00 +02:00
8e57df518f
apps: build with optimizations enabled
2022-10-11 19:57:24 +02:00
0c451e504e
Kernel: Mounting /dev MUST succeed
2022-10-11 19:53:55 +02:00
04da26bff5
kernel: add a few comments
2022-10-11 19:51:24 +02:00
feb8c1c31b
libc: Implement strchr()
2022-10-11 19:50:18 +02:00
0131193379
ELFLoader, Scheduler: Transition to use VFS
...
We should start to drop the old InitRD API, which only allows for files to be loaded from the initrd, and which forces pathnames to be relative (bin/init)
With VFS, we can load any kind of file from any kind of filesystem, and using paths that make sense (/bin/init)
2022-10-11 19:33:48 +02:00
86b50a6aa0
Remove random demos
...
Cool, but cumbersome in practice: have to continually restart until I get the demo I want.
So let's stick to init for now.
2022-10-11 19:25:19 +02:00
0a7d4a530d
VFS, DeviceFS: Implement a device filesystem
...
For now, we just have a version device. (this will allow us to get rid of sys_getversion!!)
More should be implemented soon.
2022-10-11 19:21:16 +02:00
a198cf8d8d
Add initrd_mkdir to registered directories in the initrd
2022-10-11 18:25:11 +02:00
4aa3da8c12
VFS: Add basic mount(), unmount() and mkdir() functions (not accessible to userspace yet)
2022-10-11 18:23:00 +02:00
1278cec065
VFS: Add a 'type' flag to Nodes, implement EISDIR
2022-10-11 17:48:11 +02:00
7a097f16ea
apps: add a new example app which does all kinds of stdio misbehaving >.<
2022-10-11 17:31:06 +02:00
667d308fc3
kernel/main.cpp: remove obsolete reference to _userspace
2022-10-11 17:30:40 +02:00