]>
git.corax.cc Git - corax/log
Matthias Kruk [Sat, 8 Feb 2020 15:45:07 +0000 (00:45 +0900)]
klibc/sem: Add semaphore implementation
Matthias Kruk [Sat, 8 Feb 2020 15:42:54 +0000 (00:42 +0900)]
errno: Add definition for EOVERFLOW
Matthias Kruk [Sat, 8 Feb 2020 15:40:35 +0000 (00:40 +0900)]
klibc/mutex: Reduce the amount of code executed in mutex_trylock() while the spinlock is held
Matthias Kruk [Sat, 8 Feb 2020 15:03:25 +0000 (00:03 +0900)]
klibc/mutex: Move mutex definition to mutex.h and remove unused includes
Matthias Kruk [Sat, 8 Feb 2020 14:26:08 +0000 (23:26 +0900)]
klibc/mutex: Avoid priority inversion in the mutex implementation
Wake up all tasks waiting on a mutex when it gets unlocked. This way,
the order in which the waiting tasks will acquire the mutex depends
solely on the scheduler (and the tasks priority), not implicitly on
the mutex.
Matthias Kruk [Mon, 3 Feb 2020 22:34:13 +0000 (07:34 +0900)]
Add "lazy" scheduler implementation
Matthias Kruk [Mon, 3 Feb 2020 22:31:16 +0000 (07:31 +0900)]
Add simple kernel queue implementation to klibc
Matthias Kruk [Mon, 3 Feb 2020 22:26:28 +0000 (07:26 +0900)]
Move CPU_ID macro to kernel/include/arch.h
Matthias Kruk [Sat, 1 Feb 2020 06:47:15 +0000 (15:47 +0900)]
Add generic scheduler interface, to be implemented by all schedulers
Matthias Kruk [Fri, 31 Jan 2020 11:32:06 +0000 (20:32 +0900)]
Clean up message handling in the stdio daemon by moving it into a separate function
Matthias Kruk [Fri, 31 Jan 2020 11:31:20 +0000 (20:31 +0900)]
Initialize the heap when starting the net daemon
Matthias Kruk [Fri, 31 Jan 2020 11:30:45 +0000 (20:30 +0900)]
Remove some unused code from main.c
Matthias Kruk [Fri, 31 Jan 2020 11:29:32 +0000 (20:29 +0900)]
Implement several of the syscalls of the socket interface
Matthias Kruk [Fri, 31 Jan 2020 11:28:30 +0000 (20:28 +0900)]
Add some more refined definitions for ipc messages to corax/ipc.h (but don't use them yet)
Matthias Kruk [Fri, 31 Jan 2020 11:26:41 +0000 (20:26 +0900)]
Correctly check the return value of cxrecv() in vga daemon, print a message during startup
Matthias Kruk [Fri, 31 Jan 2020 11:24:53 +0000 (20:24 +0900)]
Add strlen() function to userspace libc
Matthias Kruk [Fri, 31 Jan 2020 11:23:55 +0000 (20:23 +0900)]
Add fork and execfve syscall stubs to userspace libc
Matthias Kruk [Sat, 25 Jan 2020 07:46:31 +0000 (16:46 +0900)]
Add functions to raise sleeping processes and tasks
- Implement sched_task_raise()
- Implement sched_raise()
Matthias Kruk [Sat, 25 Jan 2020 07:41:55 +0000 (16:41 +0900)]
Fix some minor problems in the process implementation
- Don't lock tasks in process_task_foreach()
- Wake up processes when they receive signals
Matthias Kruk [Sun, 19 Jan 2020 09:11:43 +0000 (18:11 +0900)]
Deliver signals to processes by storing pending signals and accompanying
signal information in the destination process structure, from where the
destination process will retrieve it before returning from an interrupt
or system call. Exception delivery is not affected by this because
exceptions can be delivered directly.
Function implementations added:
- task_signal_handle()
- process_put_signal()
- process_get_signal()
- process_clear_signal()
- process_set_sighandler()
Matthias Kruk [Sun, 19 Jan 2020 09:08:58 +0000 (18:08 +0900)]
Add definitions for SA_* flags to signal.h
Matthias Kruk [Sat, 18 Jan 2020 08:30:42 +0000 (17:30 +0900)]
Deliver keyboard interrupts to keyboard driver
Matthias Kruk [Sat, 18 Jan 2020 08:17:45 +0000 (17:17 +0900)]
Clean up kernel/include/arch.h a little and add IRQ() macro
Matthias Kruk [Sat, 18 Jan 2020 07:39:58 +0000 (16:39 +0900)]
Change return type of _process_hwint_deliver() so that the caller can find out whether or not the interrupt has been successfully delivered
Matthias Kruk [Thu, 16 Jan 2020 10:49:51 +0000 (19:49 +0900)]
Use parentheses in the definition of sigset_t's val member, otherwise it will be 16 times as large as intended
Matthias Kruk [Tue, 14 Jan 2020 12:23:45 +0000 (21:23 +0900)]
Implement mechanism to deliver hardware interrupts to userspace processes by
co-opting the sigaction() syscall in combination with a new signal, SIGHWINT.
The signal mask that is passed to sigaction() by means of a struct sigaction
is used to notify the kernel which interrupts the process would like to receive.
Processes that choose to use the same handler for multiple hardware interrupts
should set the SA_SIGINFO flag in the sigaction structure. The interrupt handler
will then be passed an additional siginfo_t structure (and a struct ucontext*)
which can be used to find out the hardware interrupt number by inspecting the
siginfo_t structure's si_trapno member.
Matthias Kruk [Tue, 14 Jan 2020 12:07:34 +0000 (21:07 +0900)]
Extend task_signal_deliver() function to allow passing of a siginfo_t to the signal handler
Matthias Kruk [Tue, 14 Jan 2020 12:03:03 +0000 (21:03 +0900)]
Move several definitions from kernel/arch/defs.h to kernel/include/arch.h to make them visible to other parts of the kernel (especially device drivers)
Matthias Kruk [Tue, 14 Jan 2020 11:44:16 +0000 (20:44 +0900)]
Provide a dummy errno.h
Matthias Kruk [Tue, 14 Jan 2020 11:37:18 +0000 (20:37 +0900)]
Provide a dummy printf() function in klibc
Matthias Kruk [Tue, 14 Jan 2020 11:27:24 +0000 (20:27 +0900)]
Implement functions for manipulating sigset_t types in klibc
- sigemptyset()
- sigfillset()
- sigaddset()
- sigdelset()
- sigismember()
Matthias Kruk [Tue, 14 Jan 2020 11:27:07 +0000 (20:27 +0900)]
Add prototypes for functions manipulating sigset_t types
Matthias Kruk [Tue, 14 Jan 2020 10:56:13 +0000 (19:56 +0900)]
Add assembly stub for sigaction syscall to klibc
Matthias Kruk [Tue, 14 Jan 2020 10:55:13 +0000 (19:55 +0900)]
Add definition for SYS_SIGACTION
Matthias Kruk [Tue, 14 Jan 2020 10:53:28 +0000 (19:53 +0900)]
Correct/amend signal.h
- Add the correct definitions of sigset_t and sigval_t
- Wrap struct sigaction's sa_handler and sa_sigaction members in a union
- Add the prototype for sigaction()
Matthias Kruk [Sun, 5 Jan 2020 11:28:07 +0000 (20:28 +0900)]
Add remark about signal handling in user-mode
Matthias Kruk [Sun, 5 Jan 2020 11:13:12 +0000 (20:13 +0900)]
Also deliver a signal to a process causing a page fault
Matthias Kruk [Sun, 5 Jan 2020 08:01:19 +0000 (17:01 +0900)]
sys_debug: Make sure strings are properly NUL-terminated before passing them to dbg_printf()
Matthias Kruk [Sun, 5 Jan 2020 07:56:47 +0000 (16:56 +0900)]
Add prototype for debug() syscall
Matthias Kruk [Sun, 5 Jan 2020 07:56:12 +0000 (16:56 +0900)]
Add SIGMAX definition to signal.h
Matthias Kruk [Sun, 5 Jan 2020 07:55:54 +0000 (16:55 +0900)]
Deliver a POSIX signal to a process that has caused an exception
Matthias Kruk [Sun, 5 Jan 2020 07:52:36 +0000 (16:52 +0900)]
Implement _task_sig_stub assembly function for tasks executing signal handlers on the way out from the kernel
Matthias Kruk [Sun, 5 Jan 2020 07:50:48 +0000 (16:50 +0900)]
Add process_get_sighandler() function
Matthias Kruk [Sun, 5 Jan 2020 06:27:34 +0000 (15:27 +0900)]
Add debug syscall for low-level/last-resort debugging
Matthias Kruk [Thu, 2 Jan 2020 07:46:59 +0000 (16:46 +0900)]
Add a cast when assigning the return value in sys_mmap(), to avoid compiler warnings
Matthias Kruk [Thu, 2 Jan 2020 07:41:15 +0000 (16:41 +0900)]
Deliver signals to processes causing exceptions, panic only if the kernel itself causes an exception
Matthias Kruk [Thu, 2 Jan 2020 07:39:45 +0000 (16:39 +0900)]
Make a thread execute the signal handler itself if it is delivering a signal to the current process (instead of going through the trouble of electing a handling task)
Matthias Kruk [Thu, 2 Jan 2020 07:37:03 +0000 (16:37 +0900)]
Add prototype for process_signal_deliver() to kernel/include/process.h
Matthias Kruk [Thu, 2 Jan 2020 07:32:58 +0000 (16:32 +0900)]
Add _exit() syscall to klibc
Matthias Kruk [Thu, 2 Jan 2020 07:28:21 +0000 (16:28 +0900)]
Add parantheses to SEGM_CS() and SEGM_DS() macros to avoid ambiguousness
Matthias Kruk [Tue, 31 Dec 2019 06:05:37 +0000 (15:05 +0900)]
Fix return values of sys_inb() and sys_outb()
Matthias Kruk [Tue, 31 Dec 2019 06:01:54 +0000 (15:01 +0900)]
Statically link against libgcc for now, because of __udivdi3 and __umoddi3
Matthias Kruk [Tue, 31 Dec 2019 06:00:34 +0000 (15:00 +0900)]
Disable output from dbg_printf() once the init process has been spawned
Matthias Kruk [Tue, 31 Dec 2019 05:57:46 +0000 (14:57 +0900)]
Include stdio.c in klibc compilation
Matthias Kruk [Tue, 31 Dec 2019 05:05:47 +0000 (14:05 +0900)]
Fix %% and %c conversion specifications in snprintf() format strings
Matthias Kruk [Tue, 31 Dec 2019 04:49:07 +0000 (13:49 +0900)]
Add snprintf() implementation to klibc
Matthias Kruk [Thu, 26 Dec 2019 05:46:48 +0000 (14:46 +0900)]
Make sure _pg_dir_xfer() doesn't copy more data than was requested
Matthias Kruk [Thu, 26 Dec 2019 02:58:33 +0000 (11:58 +0900)]
Implement sys_cxsendrecv() function
Matthias Kruk [Tue, 24 Dec 2019 14:44:04 +0000 (23:44 +0900)]
Add simple processes for vga and keyboard handling
Matthias Kruk [Mon, 23 Dec 2019 07:32:39 +0000 (16:32 +0900)]
Add sys_inb() and sys_outb() syscalls
Matthias Kruk [Mon, 23 Dec 2019 07:29:46 +0000 (16:29 +0900)]
Add io_inb and io_outb methods for IO-port access on Intel-based platforms
Matthias Kruk [Wed, 18 Dec 2019 09:26:18 +0000 (18:26 +0900)]
Implement sys_mmap() function
Matthias Kruk [Wed, 18 Dec 2019 09:24:13 +0000 (18:24 +0900)]
Add assembly stubs, definitions, and prototypes for mmap() and munmap() syscalls
Matthias Kruk [Wed, 18 Dec 2019 08:44:15 +0000 (17:44 +0900)]
Add pg_dir_mmap() and pg_dir_munmap() functions to implement the low-level half of the mmap() and munmap() syscalls
Matthias Kruk [Wed, 18 Dec 2019 08:28:35 +0000 (17:28 +0900)]
Add off_t type definition to corax/types.h
Matthias Kruk [Wed, 18 Dec 2019 06:57:42 +0000 (15:57 +0900)]
Fix order in that objects in the kernel code are linked
Matthias Kruk [Wed, 18 Dec 2019 06:57:01 +0000 (15:57 +0900)]
Fix function names and prototypes for klibc's heap implementation
Matthias Kruk [Wed, 18 Dec 2019 06:38:18 +0000 (15:38 +0900)]
Add heap implementation for use in drivers and system services
Matthias Kruk [Mon, 16 Dec 2019 14:13:16 +0000 (23:13 +0900)]
Make the sbrk() syscall behave as specified in brk(2) with regards to the return value
Matthias Kruk [Thu, 12 Dec 2019 09:33:11 +0000 (18:33 +0900)]
Smaller fixes to the paging code:
- Make pg_dir_sbrk() return the address where the heap would start, if there is no heap
- Don't map any segments but the kernel BSS and TEXT segments into process page directories
Matthias Kruk [Tue, 10 Dec 2019 08:46:37 +0000 (17:46 +0900)]
Print the affected page directory and page table entries, when a page fault occurs; make sure PAGE_ATTR_WRITABLE is set on the page table, if it contains writable pages
Matthias Kruk [Mon, 2 Dec 2019 10:09:21 +0000 (19:09 +0900)]
Move _kernel_cr3 back into the .bss segment since we can't get around mapping that into the process page directories anyway
Matthias Kruk [Mon, 2 Dec 2019 09:37:16 +0000 (18:37 +0900)]
Switch back to the user page directory after having modified the _cpu structure, so it can be removed from the process's page directory
Matthias Kruk [Mon, 2 Dec 2019 09:27:06 +0000 (18:27 +0900)]
Remove unused reference to _kernel_cr3 from arch/init.S
Matthias Kruk [Mon, 2 Dec 2019 09:26:31 +0000 (18:26 +0900)]
Move _kernel_cr3 symbol to .text segment
Matthias Kruk [Mon, 2 Dec 2019 08:12:40 +0000 (17:12 +0900)]
Implement sbrk() POSIX syscall
- Implement sys_sbrk() syscall handler
- Add brk() and sbrk() syscall stubs to klibc
- Add prototypes for brk() and sbrk() to unistd.h
Matthias Kruk [Mon, 2 Dec 2019 08:09:00 +0000 (17:09 +0900)]
Implement page-directory-level functions to handle heaps
- Add pg_dir_sbrk() function to handle heap allocation and size adjustments
- Add pg_dir_get_heap() function to locate the base of the heap
- Add documentation for pg_dir_map() function
Matthias Kruk [Mon, 2 Dec 2019 08:05:33 +0000 (17:05 +0900)]
Add ssize_t type to sys/types.h
Matthias Kruk [Fri, 29 Nov 2019 05:10:04 +0000 (14:10 +0900)]
Include corax/types.h from corax/ipc.h
Matthias Kruk [Wed, 27 Nov 2019 06:27:21 +0000 (15:27 +0900)]
Implement message handling in stdio process
Matthias Kruk [Wed, 27 Nov 2019 06:25:03 +0000 (15:25 +0900)]
Add stddef.h header with offsetof() macro
Matthias Kruk [Tue, 26 Nov 2019 09:52:49 +0000 (18:52 +0900)]
Remove unused local variable from _clone_kernel_region()
Matthias Kruk [Mon, 25 Nov 2019 07:23:15 +0000 (16:23 +0900)]
Add a fixed-length wait queue to mutexes, to speed up locking and unlocking operations; make use of sched_task_suspend() and sched_task_resume() in mutex implementation
Matthias Kruk [Mon, 25 Nov 2019 07:20:32 +0000 (16:20 +0900)]
Add sched_task_resume() function
Matthias Kruk [Mon, 25 Nov 2019 07:19:57 +0000 (16:19 +0900)]
Add definition of EBUSY to corax/errno.h
Matthias Kruk [Mon, 25 Nov 2019 07:11:04 +0000 (16:11 +0900)]
Make sched.h visible to all parts of the kernel
Matthias Kruk [Mon, 25 Nov 2019 06:22:45 +0000 (15:22 +0900)]
Suspend the executing task, if the caller of sched_task_suspend() is attempting to suspend itself
Matthias Kruk [Mon, 25 Nov 2019 06:09:31 +0000 (15:09 +0900)]
Add missing implementation of process_suspend()
Matthias Kruk [Mon, 25 Nov 2019 06:08:43 +0000 (15:08 +0900)]
Implement sched_task_suspend() function
Matthias Kruk [Mon, 25 Nov 2019 05:44:12 +0000 (14:44 +0900)]
Lock the process in process_task_foreach()
Matthias Kruk [Mon, 25 Nov 2019 05:43:17 +0000 (14:43 +0900)]
Protect processes with a spinlock
Matthias Kruk [Mon, 25 Nov 2019 05:39:53 +0000 (14:39 +0900)]
Add process_task_foreach() function
Matthias Kruk [Mon, 25 Nov 2019 05:36:15 +0000 (14:36 +0900)]
Protect tasks with a spinlock
Matthias Kruk [Mon, 25 Nov 2019 05:16:19 +0000 (14:16 +0900)]
Exclude networking code from compilation for now
Matthias Kruk [Mon, 25 Nov 2019 05:08:51 +0000 (14:08 +0900)]
Remove fds from processes in the kernel
Matthias Kruk [Mon, 25 Nov 2019 05:06:12 +0000 (14:06 +0900)]
Use a static-size array to keep track of the tasks in a process for now
Matthias Kruk [Mon, 25 Nov 2019 05:00:42 +0000 (14:00 +0900)]
Add definition of EBADFD to corax/errno.h
Matthias Kruk [Sat, 23 Nov 2019 06:45:24 +0000 (15:45 +0900)]
Make use of fork() and execfve() to spawn STDIO and NET daemons
Matthias Kruk [Sat, 23 Nov 2019 06:43:48 +0000 (15:43 +0900)]
Move cxsend(), cxrecv(), cxsendrecv() syscalls from core into klibc
Matthias Kruk [Sat, 23 Nov 2019 06:37:49 +0000 (15:37 +0900)]
Move fork() and execfve() syscalls from core to klibc