]> git.corax.cc Git - corax/log
corax
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

6 years agoAdd some methods for process_t types:
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

6 years agoAdd definitions for EPERM and EACCES
Matthias Kruk [Wed, 13 Nov 2019 07:34:40 +0000 (16:34 +0900)]
Add definitions for EPERM and EACCES

6 years agoStart implementation of facilities to support userspace processes
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

6 years agoMake kernel spawn the idle and init processes in main.c, perform any other testing...
Matthias Kruk [Tue, 12 Nov 2019 07:31:34 +0000 (16:31 +0900)]
Make kernel spawn the idle and init processes in main.c, perform any other testing in the init process, once it's working

6 years agoImplement process ownership and inheritance
Matthias Kruk [Wed, 6 Nov 2019 06:51:42 +0000 (15:51 +0900)]
Implement process ownership and inheritance

6 years agoAdd dummy process_suspend() function
Matthias Kruk [Wed, 6 Nov 2019 06:38:47 +0000 (15:38 +0900)]
Add dummy process_suspend() function

6 years agoImplement some basic handling of POSIX signals
Matthias Kruk [Wed, 6 Nov 2019 06:13:55 +0000 (15:13 +0900)]
Implement some basic handling of POSIX signals

6 years agoAdd prototype of _pg_dir_vpxlate() to arch.h
Matthias Kruk [Wed, 6 Nov 2019 06:12:37 +0000 (15:12 +0900)]
Add prototype of _pg_dir_vpxlate() to arch.h

6 years agoAdd signal.h header
Matthias Kruk [Wed, 6 Nov 2019 06:12:09 +0000 (15:12 +0900)]
Add signal.h header

6 years agoAdd prototype for _pg_dir_vpxlate() to arch/paging.h
Matthias Kruk [Tue, 5 Nov 2019 07:20:36 +0000 (16:20 +0900)]
Add prototype for _pg_dir_vpxlate() to arch/paging.h

6 years agoAdd uid_t and gid_t types, and definitions for UID_ROOT and GID_ROOT
Matthias Kruk [Mon, 4 Nov 2019 09:28:55 +0000 (18:28 +0900)]
Add uid_t and gid_t types, and definitions for UID_ROOT and GID_ROOT

6 years agoImplement process_detach() method, to create a new session for a process, i.e. detach...
Matthias Kruk [Mon, 4 Nov 2019 08:35:24 +0000 (17:35 +0900)]
Implement process_detach() method, to create a new session for a process, i.e. detach it from its parent

6 years agoModify process_create() function to finalize sys_fork() implementation:
Matthias Kruk [Mon, 4 Nov 2019 02:06:34 +0000 (11:06 +0900)]
Modify process_create() function to finalize sys_fork() implementation:
 - Copy the contents of the user-mode stack
 - Call task_prepare_fork to copy/modify the new task's kernel-mode stack
 - Set the state of the new task to TASK_STATE_FORKED
 - Set t_pgdir and other values that would normally be set by task_prepare

6 years agoAllow forked processes to be enqueued using sched_enqueue()
Matthias Kruk [Mon, 4 Nov 2019 02:03:50 +0000 (11:03 +0900)]
Allow forked processes to be enqueued using sched_enqueue()

6 years agoAdd task_prepare_fork method and modify task_switch to facilitate the implementation...
Matthias Kruk [Mon, 4 Nov 2019 02:03:15 +0000 (11:03 +0900)]
Add task_prepare_fork method and modify task_switch to facilitate the implementation of sys_fork()

6 years agoChange the signature of sys_posixcall() so it can modify the caller's stackframe...
Matthias Kruk [Mon, 4 Nov 2019 02:01:45 +0000 (11:01 +0900)]
Change the signature of sys_posixcall() so it can modify the caller's stackframe in the case of sys_fork()

6 years agoMove definition of struct stack_frame to arch.h
Matthias Kruk [Mon, 4 Nov 2019 01:46:32 +0000 (10:46 +0900)]
Move definition of struct stack_frame to arch.h

6 years agoAdd implementation of process_fork(), modify process_create() so that it can be used...
Matthias Kruk [Wed, 30 Oct 2019 08:14:20 +0000 (17:14 +0900)]
Add implementation of process_fork(), modify process_create() so that it can be used to fork a running process

6 years agoCall process_fork() from sys_fork() and sys_vfork()
Matthias Kruk [Wed, 30 Oct 2019 08:08:18 +0000 (17:08 +0900)]
Call process_fork() from sys_fork() and sys_vfork()

6 years agoCall process_exit() from sys_exit()
Matthias Kruk [Tue, 29 Oct 2019 05:11:41 +0000 (14:11 +0900)]
Call process_exit() from sys_exit()

6 years agoAdd process_exit() function
Matthias Kruk [Tue, 29 Oct 2019 05:09:56 +0000 (14:09 +0900)]
Add process_exit() function

6 years agoMinor improvements to the scheduler:
Matthias Kruk [Tue, 29 Oct 2019 05:07:20 +0000 (14:07 +0900)]
Minor improvements to the scheduler:
 - Make _unq() return an error if it didn't succeed
 - Add sched_dequeue() function
 - Modify sched_tick() not to put tasks with TASK_STATE_EXIT back onto the ready queue
 - Add a header with prototypes for the functions implemented in sched.c

6 years agoAdd TASK_STATE_EXIT state to identify tasks that are exitting
Matthias Kruk [Tue, 29 Oct 2019 05:06:21 +0000 (14:06 +0900)]
Add TASK_STATE_EXIT state to identify tasks that are exitting

6 years agoAdd an argument to process_create() so the caller may request the process to be creat...
Matthias Kruk [Mon, 28 Oct 2019 09:35:32 +0000 (18:35 +0900)]
Add an argument to process_create() so the caller may request the process to be created with a specific pid

6 years agoAdd syscall stubs for some POSIX process management syscalls (fork, vfork, exit,...
Matthias Kruk [Mon, 28 Oct 2019 09:33:46 +0000 (18:33 +0900)]
Add syscall stubs for some POSIX process management syscalls (fork, vfork, exit, ...)

6 years agoTemporarily add assembly stubs for syscalls, to avoid having to link against the...
Matthias Kruk [Sun, 27 Oct 2019 16:20:19 +0000 (01:20 +0900)]
Temporarily add assembly stubs for syscalls, to avoid having to link against the C library

6 years agoAdd some IPC testing code to main.c
Matthias Kruk [Sun, 27 Oct 2019 16:18:53 +0000 (01:18 +0900)]
Add some IPC testing code to main.c

6 years agoMake debug output in IPC code depend on CONFIG_DEBUG_IPC
Matthias Kruk [Sun, 27 Oct 2019 15:58:17 +0000 (00:58 +0900)]
Make debug output in IPC code depend on CONFIG_DEBUG_IPC

6 years agoSignal the receiving process in process_inbox_put()
Matthias Kruk [Sun, 27 Oct 2019 15:53:51 +0000 (00:53 +0900)]
Signal the receiving process in process_inbox_put()

6 years agoPrint the address and pid of the executing context when an exception occurs
Matthias Kruk [Sun, 27 Oct 2019 15:52:27 +0000 (00:52 +0900)]
Print the address and pid of the executing context when an exception occurs

6 years agoImplement various IPC and scheduling improvements:
Matthias Kruk [Sat, 26 Oct 2019 07:24:58 +0000 (16:24 +0900)]
Implement various IPC and scheduling improvements:
 - Implement signalling/waiting facilities for processes and tasks
 - Implement primitive message passing between processes
 - Implement helper functions for accesing properties of a process
 - Also keep the pid within the task structure, for faster access
 - Add a wait-queue to the scheduler, to keep track of waiting processes

6 years agoAdd CONFIG_IPC_MSGSIZE configuration option
Matthias Kruk [Sat, 26 Oct 2019 07:23:06 +0000 (16:23 +0900)]
Add CONFIG_IPC_MSGSIZE configuration option

6 years agoAdd definitions for ENOTSUP, EOPNOTSUPP, and ENOENT
Matthias Kruk [Sat, 26 Oct 2019 07:22:49 +0000 (16:22 +0900)]
Add definitions for ENOTSUP, EOPNOTSUPP, and ENOENT

6 years agoAdd typedef for pid_t
Matthias Kruk [Sat, 26 Oct 2019 05:17:03 +0000 (14:17 +0900)]
Add typedef for pid_t

6 years agoImplement process_memcpy_ptop() function for copying data directly between processes
Matthias Kruk [Sat, 26 Oct 2019 05:12:54 +0000 (14:12 +0900)]
Implement process_memcpy_ptop() function for copying data directly between processes

6 years agoAdd mbuf type and functions to allocate and free them
Matthias Kruk [Fri, 25 Oct 2019 06:45:33 +0000 (15:45 +0900)]
Add mbuf type and functions to allocate and free them

6 years agoAdd sobind() function stub and call it from sys_bind()
Matthias Kruk [Sat, 5 Oct 2019 07:22:14 +0000 (16:22 +0900)]
Add sobind() function stub and call it from sys_bind()

6 years agoAlso compile libc from the top-level Makefile
Matthias Kruk [Sat, 5 Oct 2019 07:14:17 +0000 (16:14 +0900)]
Also compile libc from the top-level Makefile

6 years agoAdd dummy soshutdown() function and call it from sys_shutdown()
Matthias Kruk [Sat, 5 Oct 2019 07:13:21 +0000 (16:13 +0900)]
Add dummy soshutdown() function and call it from sys_shutdown()

6 years agoStart implementation of a statically linked standard C library:
Matthias Kruk [Sat, 5 Oct 2019 07:06:45 +0000 (16:06 +0900)]
Start implementation of a statically linked standard C library:
 - Add implementation of network-related syscalls

6 years agoImplement sys_getsockopt() and sys_setsockopt() functions
Matthias Kruk [Sat, 5 Oct 2019 06:32:37 +0000 (15:32 +0900)]
Implement sys_getsockopt() and sys_setsockopt() functions