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: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 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 [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, 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 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, 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, 18 Nov 2019 08:25:01 +0000 (17:25 +0900)]
Make several amendments to the paging code to facilitate process memory management:
- Move definition of struct region to kernel-wide arch.h header
- Make page directories refer to their regions through a pointer array rather than a linked list
- Add pg_dir_foreach_region() function for iterating over the mappings in a page directory
- Add pg_dir_map_region() function for mapping a region from one page directory into another
- Add a reference counter to each region
- Add flags to regions so they can be marked as private, shared, or kernel-related
Matthias Kruk [Wed, 13 Nov 2019 07:35:01 +0000 (16:35 +0900)]
Add some methods for process_t types:
- process_set_pagedir() / process_get_pagedir() - Convenience functions to access the process's pagedir
- process_setuid() - Set the process's user id
- process_setgid() - Set the process's group id
Matthias Kruk [Tue, 12 Nov 2019 09:06:54 +0000 (18:06 +0900)]
Start implementation of facilities to support userspace processes
- Add crxstd.h header with prototypes for Corax-specific syscalls
- Add dummy NET process
- Add dummy STDIO process
- Start NET and STDIO processes from process daemon