]> git.corax.cc Git - corax/log
corax
5 years agoDeliver signals to processes by storing pending signals and accompanying
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()

5 years agoAdd definitions for SA_* flags to signal.h
Matthias Kruk [Sun, 19 Jan 2020 09:08:58 +0000 (18:08 +0900)]
Add definitions for SA_* flags to signal.h

5 years agoDeliver keyboard interrupts to keyboard driver
Matthias Kruk [Sat, 18 Jan 2020 08:30:42 +0000 (17:30 +0900)]
Deliver keyboard interrupts to keyboard driver

5 years agoClean up kernel/include/arch.h a little and add IRQ() macro
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

5 years agoChange return type of _process_hwint_deliver() so that the caller can find out whethe...
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

5 years agoUse parentheses in the definition of sigset_t's val member, otherwise it will be...
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

5 years agoImplement mechanism to deliver hardware interrupts to userspace processes by
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.

5 years agoExtend task_signal_deliver() function to allow passing of a siginfo_t to the signal...
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

5 years agoMove several definitions from kernel/arch/defs.h to kernel/include/arch.h to make...
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)

5 years agoProvide a dummy errno.h
Matthias Kruk [Tue, 14 Jan 2020 11:44:16 +0000 (20:44 +0900)]
Provide a dummy errno.h

5 years agoProvide a dummy printf() function in klibc
Matthias Kruk [Tue, 14 Jan 2020 11:37:18 +0000 (20:37 +0900)]
Provide a dummy printf() function in klibc

5 years agoImplement functions for manipulating sigset_t types 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()

5 years agoAdd prototypes for functions manipulating sigset_t types
Matthias Kruk [Tue, 14 Jan 2020 11:27:07 +0000 (20:27 +0900)]
Add prototypes for functions manipulating sigset_t types

5 years agoAdd assembly stub for sigaction syscall to klibc
Matthias Kruk [Tue, 14 Jan 2020 10:56:13 +0000 (19:56 +0900)]
Add assembly stub for sigaction syscall to klibc

5 years agoAdd definition for SYS_SIGACTION
Matthias Kruk [Tue, 14 Jan 2020 10:55:13 +0000 (19:55 +0900)]
Add definition for SYS_SIGACTION

5 years agoCorrect/amend signal.h
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()

5 years agoAdd remark about signal handling in user-mode
Matthias Kruk [Sun, 5 Jan 2020 11:28:07 +0000 (20:28 +0900)]
Add remark about signal handling in user-mode

5 years agoAlso deliver a signal to a process causing a page fault
Matthias Kruk [Sun, 5 Jan 2020 11:13:12 +0000 (20:13 +0900)]
Also deliver a signal to a process causing a page fault

5 years agosys_debug: Make sure strings are properly NUL-terminated before passing them to dbg_p...
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()

5 years agoAdd prototype for debug() syscall
Matthias Kruk [Sun, 5 Jan 2020 07:56:47 +0000 (16:56 +0900)]
Add prototype for debug() syscall

5 years agoAdd SIGMAX definition to signal.h
Matthias Kruk [Sun, 5 Jan 2020 07:56:12 +0000 (16:56 +0900)]
Add SIGMAX definition to signal.h

5 years agoDeliver a POSIX signal to a process that has caused an exception
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

5 years agoImplement _task_sig_stub assembly function for tasks executing signal handlers on...
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

5 years agoAdd process_get_sighandler() function
Matthias Kruk [Sun, 5 Jan 2020 07:50:48 +0000 (16:50 +0900)]
Add process_get_sighandler() function

5 years agoAdd debug syscall for low-level/last-resort debugging
Matthias Kruk [Sun, 5 Jan 2020 06:27:34 +0000 (15:27 +0900)]
Add debug syscall for low-level/last-resort debugging

5 years agoAdd a cast when assigning the return value in sys_mmap(), to avoid compiler warnings
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

5 years agoDeliver signals to processes causing exceptions, panic only if the kernel itself...
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

5 years agoMake a thread execute the signal handler itself if it is delivering a signal to the...
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)

5 years agoAdd prototype for process_signal_deliver() to kernel/include/process.h
Matthias Kruk [Thu, 2 Jan 2020 07:37:03 +0000 (16:37 +0900)]
Add prototype for process_signal_deliver() to kernel/include/process.h

5 years agoAdd _exit() syscall to klibc
Matthias Kruk [Thu, 2 Jan 2020 07:32:58 +0000 (16:32 +0900)]
Add _exit() syscall to klibc

5 years agoAdd parantheses to SEGM_CS() and SEGM_DS() macros to avoid ambiguousness
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

5 years agoFix return values of sys_inb() and sys_outb()
Matthias Kruk [Tue, 31 Dec 2019 06:05:37 +0000 (15:05 +0900)]
Fix return values of sys_inb() and sys_outb()

5 years agoStatically link against libgcc for now, because of __udivdi3 and __umoddi3
Matthias Kruk [Tue, 31 Dec 2019 06:01:54 +0000 (15:01 +0900)]
Statically link against libgcc for now, because of __udivdi3 and __umoddi3

5 years agoDisable output from dbg_printf() once the init process has been spawned
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

5 years agoInclude stdio.c in klibc compilation
Matthias Kruk [Tue, 31 Dec 2019 05:57:46 +0000 (14:57 +0900)]
Include stdio.c in klibc compilation

5 years agoFix %% and %c conversion specifications in snprintf() format strings
Matthias Kruk [Tue, 31 Dec 2019 05:05:47 +0000 (14:05 +0900)]
Fix %% and %c conversion specifications in snprintf() format strings

5 years agoAdd snprintf() implementation to klibc
Matthias Kruk [Tue, 31 Dec 2019 04:49:07 +0000 (13:49 +0900)]
Add snprintf() implementation to klibc

5 years agoMake sure _pg_dir_xfer() doesn't copy more data than was requested
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

5 years agoImplement sys_cxsendrecv() function
Matthias Kruk [Thu, 26 Dec 2019 02:58:33 +0000 (11:58 +0900)]
Implement sys_cxsendrecv() function

5 years agoAdd simple processes for vga and keyboard handling
Matthias Kruk [Tue, 24 Dec 2019 14:44:04 +0000 (23:44 +0900)]
Add simple processes for vga and keyboard handling

5 years agoAdd sys_inb() and sys_outb() syscalls
Matthias Kruk [Mon, 23 Dec 2019 07:32:39 +0000 (16:32 +0900)]
Add sys_inb() and sys_outb() syscalls

5 years agoAdd io_inb and io_outb methods for IO-port access on Intel-based platforms
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

5 years agoImplement sys_mmap() function
Matthias Kruk [Wed, 18 Dec 2019 09:26:18 +0000 (18:26 +0900)]
Implement sys_mmap() function

5 years agoAdd assembly stubs, definitions, and prototypes for mmap() and munmap() syscalls
Matthias Kruk [Wed, 18 Dec 2019 09:24:13 +0000 (18:24 +0900)]
Add assembly stubs, definitions, and prototypes for mmap() and munmap() syscalls

5 years agoAdd pg_dir_mmap() and pg_dir_munmap() functions to implement the low-level half of...
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

5 years agoAdd off_t type definition to corax/types.h
Matthias Kruk [Wed, 18 Dec 2019 08:28:35 +0000 (17:28 +0900)]
Add off_t type definition to corax/types.h

5 years agoFix order in that objects in the kernel code are linked
Matthias Kruk [Wed, 18 Dec 2019 06:57:42 +0000 (15:57 +0900)]
Fix order in that objects in the kernel code are linked

5 years agoFix function names and prototypes for klibc's heap implementation
Matthias Kruk [Wed, 18 Dec 2019 06:57:01 +0000 (15:57 +0900)]
Fix function names and prototypes for klibc's heap implementation

5 years agoAdd heap implementation for use in drivers and system services
Matthias Kruk [Wed, 18 Dec 2019 06:38:18 +0000 (15:38 +0900)]
Add heap implementation for use in drivers and system services

5 years agoMake the sbrk() syscall behave as specified in brk(2) with regards to the return...
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

5 years agoSmaller fixes to the paging code:
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

5 years agoPrint the affected page directory and page table entries, when a page fault occurs...
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

6 years agoMove _kernel_cr3 back into the .bss segment since we can't get around mapping that...
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

6 years agoSwitch back to the user page directory after having modified the _cpu structure,...
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

6 years agoRemove unused reference to _kernel_cr3 from arch/init.S
Matthias Kruk [Mon, 2 Dec 2019 09:27:06 +0000 (18:27 +0900)]
Remove unused reference to _kernel_cr3 from arch/init.S

6 years agoMove _kernel_cr3 symbol to .text segment
Matthias Kruk [Mon, 2 Dec 2019 09:26:31 +0000 (18:26 +0900)]
Move _kernel_cr3 symbol to .text segment

6 years agoImplement sbrk() POSIX syscall
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

6 years agoImplement page-directory-level functions to handle heaps
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

6 years agoAdd ssize_t type to sys/types.h
Matthias Kruk [Mon, 2 Dec 2019 08:05:33 +0000 (17:05 +0900)]
Add ssize_t type to sys/types.h

6 years agoInclude corax/types.h from corax/ipc.h
Matthias Kruk [Fri, 29 Nov 2019 05:10:04 +0000 (14:10 +0900)]
Include corax/types.h from corax/ipc.h

6 years agoImplement message handling in stdio process
Matthias Kruk [Wed, 27 Nov 2019 06:27:21 +0000 (15:27 +0900)]
Implement message handling in stdio process

6 years agoAdd stddef.h header with offsetof() macro
Matthias Kruk [Wed, 27 Nov 2019 06:25:03 +0000 (15:25 +0900)]
Add stddef.h header with offsetof() macro

6 years agoRemove unused local variable from _clone_kernel_region()
Matthias Kruk [Tue, 26 Nov 2019 09:52:49 +0000 (18:52 +0900)]
Remove unused local variable from _clone_kernel_region()

6 years agoAdd a fixed-length wait queue to mutexes, to speed up locking and unlocking operation...
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

6 years agoAdd sched_task_resume() function
Matthias Kruk [Mon, 25 Nov 2019 07:20:32 +0000 (16:20 +0900)]
Add sched_task_resume() function

6 years agoAdd definition of EBUSY to corax/errno.h
Matthias Kruk [Mon, 25 Nov 2019 07:19:57 +0000 (16:19 +0900)]
Add definition of EBUSY to corax/errno.h

6 years agoMake sched.h visible to all parts of the kernel
Matthias Kruk [Mon, 25 Nov 2019 07:11:04 +0000 (16:11 +0900)]
Make sched.h visible to all parts of the kernel

6 years agoSuspend the executing task, if the caller of sched_task_suspend() is attempting to...
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

6 years agoAdd missing implementation of process_suspend()
Matthias Kruk [Mon, 25 Nov 2019 06:09:31 +0000 (15:09 +0900)]
Add missing implementation of process_suspend()

6 years agoImplement sched_task_suspend() function
Matthias Kruk [Mon, 25 Nov 2019 06:08:43 +0000 (15:08 +0900)]
Implement sched_task_suspend() function

6 years agoLock the process in process_task_foreach()
Matthias Kruk [Mon, 25 Nov 2019 05:44:12 +0000 (14:44 +0900)]
Lock the process in process_task_foreach()

6 years agoProtect processes with a spinlock
Matthias Kruk [Mon, 25 Nov 2019 05:43:17 +0000 (14:43 +0900)]
Protect processes with a spinlock

6 years agoAdd process_task_foreach() function
Matthias Kruk [Mon, 25 Nov 2019 05:39:53 +0000 (14:39 +0900)]
Add process_task_foreach() function

6 years agoProtect tasks with a spinlock
Matthias Kruk [Mon, 25 Nov 2019 05:36:15 +0000 (14:36 +0900)]
Protect tasks with a spinlock

6 years agoExclude networking code from compilation for now
Matthias Kruk [Mon, 25 Nov 2019 05:16:19 +0000 (14:16 +0900)]
Exclude networking code from compilation for now

6 years agoRemove fds from processes in the kernel
Matthias Kruk [Mon, 25 Nov 2019 05:08:51 +0000 (14:08 +0900)]
Remove fds from processes in the kernel

6 years agoUse a static-size array to keep track of the tasks in a process for now
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

6 years agoAdd definition of EBADFD to corax/errno.h
Matthias Kruk [Mon, 25 Nov 2019 05:00:42 +0000 (14:00 +0900)]
Add definition of EBADFD to corax/errno.h

6 years agoMake use of fork() and execfve() to spawn STDIO and NET daemons
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

6 years agoMove cxsend(), cxrecv(), cxsendrecv() syscalls from core into klibc
Matthias Kruk [Sat, 23 Nov 2019 06:43:48 +0000 (15:43 +0900)]
Move cxsend(), cxrecv(), cxsendrecv() syscalls from core into klibc

6 years agoMove fork() and execfve() syscalls from core to klibc
Matthias Kruk [Sat, 23 Nov 2019 06:37:49 +0000 (15:37 +0900)]
Move fork() and execfve() syscalls from core to klibc

6 years agoAdd spinlock implementation (should have been in commit aa0e4586dd3efe434b34ae7956a4c...
Matthias Kruk [Sat, 23 Nov 2019 06:32:04 +0000 (15:32 +0900)]
Add spinlock implementation (should have been in commit aa0e4586dd3efe434b34ae7956a4c27220cb798d)

6 years agoAdd execfve() syscall
Matthias Kruk [Sat, 23 Nov 2019 06:30:35 +0000 (15:30 +0900)]
Add execfve() syscall

6 years agoAdd mutex implementation to klibc
Matthias Kruk [Thu, 21 Nov 2019 08:33:28 +0000 (17:33 +0900)]
Add mutex implementation to klibc

6 years agoAdd spinlock implementation to klibc
Matthias Kruk [Thu, 21 Nov 2019 07:22:16 +0000 (16:22 +0900)]
Add spinlock implementation to klibc

6 years agoUse standard C functions from klibc within the kernel
Matthias Kruk [Tue, 19 Nov 2019 06:55:01 +0000 (15:55 +0900)]
Use standard C functions from klibc within the kernel

6 years agoAdd memset() function to klibc
Matthias Kruk [Tue, 19 Nov 2019 06:45:26 +0000 (15:45 +0900)]
Add memset() function to klibc

6 years agoAdd standard C library for use inside the kernel
Matthias Kruk [Tue, 19 Nov 2019 06:42:26 +0000 (15:42 +0900)]
Add standard C library for use inside the kernel

6 years agoAdd CONFIG_DEBUG_HEAP definition to config.h
Matthias Kruk [Mon, 18 Nov 2019 11:37:24 +0000 (20:37 +0900)]
Add CONFIG_DEBUG_HEAP definition to config.h

6 years agoAdd unistd.h header
Matthias Kruk [Mon, 18 Nov 2019 11:36:57 +0000 (20:36 +0900)]
Add unistd.h header

6 years agoAdd SYS_SLEEP and SYS_EXECFVE definitions to corax/syscall.h
Matthias Kruk [Mon, 18 Nov 2019 11:36:27 +0000 (20:36 +0900)]
Add SYS_SLEEP and SYS_EXECFVE definitions to corax/syscall.h

6 years agoSkip kernel regions in _fork_region() and _vfork_region()
Matthias Kruk [Mon, 18 Nov 2019 11:29:26 +0000 (20:29 +0900)]
Skip kernel regions in _fork_region() and _vfork_region()

6 years agoAdd kernel regions correctly in pg_dir_map_region(), use pg_dir_map_region() in _clon...
Matthias Kruk [Mon, 18 Nov 2019 11:28:40 +0000 (20:28 +0900)]
Add kernel regions correctly in pg_dir_map_region(), use pg_dir_map_region() in _clone_kernel_region() function

6 years agoDirectly map read-only regions instead of copying them, when forking a process
Matthias Kruk [Mon, 18 Nov 2019 09:02:55 +0000 (18:02 +0900)]
Directly map read-only regions instead of copying them, when forking a process

6 years agoMake use of pg_dir_foreach_region() function in process_create() function to clone...
Matthias Kruk [Mon, 18 Nov 2019 08:56:38 +0000 (17:56 +0900)]
Make use of pg_dir_foreach_region() function in process_create() function to clone or map memory regions of the parent process, where necessary

6 years agoAdd pg_dir_clone_region() method for copying a region from one page directory into...
Matthias Kruk [Mon, 18 Nov 2019 08:55:30 +0000 (17:55 +0900)]
Add pg_dir_clone_region() method for copying a region from one page directory into another one

6 years agoMake several amendments to the paging code to facilitate process memory management:
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

6 years agoAdd some paging and permission-related configuration options
Matthias Kruk [Mon, 18 Nov 2019 08:23:51 +0000 (17:23 +0900)]
Add some paging and permission-related configuration options

6 years agoAdd definition of ERANGE
Matthias Kruk [Mon, 18 Nov 2019 07:57:15 +0000 (16:57 +0900)]
Add definition of ERANGE

6 years agoAdd task_move_stack() function, which moves the current stack and updates ESP and EBP
Matthias Kruk [Thu, 14 Nov 2019 07:46:53 +0000 (16:46 +0900)]
Add task_move_stack() function, which moves the current stack and updates ESP and EBP