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

6 years agoAdd (incomplete) sosetopt() and sogetopt() functions
Matthias Kruk [Sat, 5 Oct 2019 06:31:45 +0000 (15:31 +0900)]
Add (incomplete) sosetopt() and sogetopt() functions

6 years agoImplement functions for copying memory between page directories
Matthias Kruk [Sat, 5 Oct 2019 06:14:44 +0000 (15:14 +0900)]
Implement functions for copying memory between page directories

6 years agoAdd definition for EADDRNOTAVAIL
Matthias Kruk [Sat, 5 Oct 2019 06:00:07 +0000 (15:00 +0900)]
Add definition for EADDRNOTAVAIL

6 years agoAdd definition for SOL_SOCKET
Matthias Kruk [Fri, 4 Oct 2019 07:06:42 +0000 (16:06 +0900)]
Add definition for SOL_SOCKET

6 years agoAdd definitions for various socket options
Matthias Kruk [Fri, 4 Oct 2019 06:50:39 +0000 (15:50 +0900)]
Add definitions for various socket options

6 years agoCall soclose() from sys_close()
Matthias Kruk [Fri, 4 Oct 2019 06:40:10 +0000 (15:40 +0900)]
Call soclose() from sys_close()

6 years agoInitialize a new socket's refcount to 1
Matthias Kruk [Fri, 4 Oct 2019 06:39:33 +0000 (15:39 +0900)]
Initialize a new socket's refcount to 1

6 years agoAdd soclose() and sofree() functions
Matthias Kruk [Fri, 4 Oct 2019 06:38:29 +0000 (15:38 +0900)]
Add soclose() and sofree() functions

6 years agoAdd process_flookup() and process_get_current() functions
Matthias Kruk [Fri, 4 Oct 2019 06:37:58 +0000 (15:37 +0900)]
Add process_flookup() and process_get_current() functions

6 years agoAdd a comment to task.S high-lighting a possible future problem with regards to EBX
Matthias Kruk [Thu, 3 Oct 2019 09:44:13 +0000 (18:44 +0900)]
Add a comment to task.S high-lighting a possible future problem with regards to EBX

6 years agoAdd a pointer to struct task that points to the process the task is a part of
Matthias Kruk [Thu, 3 Oct 2019 09:43:29 +0000 (18:43 +0900)]
Add a pointer to struct task that points to the process the task is a part of

6 years agoInclude socket.c file in compilation of kernel core
Matthias Kruk [Thu, 3 Oct 2019 09:42:28 +0000 (18:42 +0900)]
Include socket.c file in compilation of kernel core

6 years agoCall socreate() function from sys_socket()
Matthias Kruk [Thu, 3 Oct 2019 09:41:38 +0000 (18:41 +0900)]
Call socreate() function from sys_socket()

6 years agoAdd very simplistic socreate() implementation
Matthias Kruk [Thu, 3 Oct 2019 09:41:17 +0000 (18:41 +0900)]
Add very simplistic socreate() implementation

6 years agoAdd infrastructure to allocate file descriptors to processes
Matthias Kruk [Thu, 3 Oct 2019 09:39:51 +0000 (18:39 +0900)]
Add infrastructure to allocate file descriptors to processes

6 years agoAdd some definitions to sys/socket.h that can be used to check the validity of parame...
Matthias Kruk [Thu, 3 Oct 2019 09:38:08 +0000 (18:38 +0900)]
Add some definitions to sys/socket.h that can be used to check the validity of parameters passed to socket()

6 years agoAdd some error numbers needed by the socket layer:
Matthias Kruk [Thu, 3 Oct 2019 09:36:44 +0000 (18:36 +0900)]
Add some error numbers needed by the socket layer:
 - EAFNOSUPPORT
 - EMFILE
 - EBADF
 - ENFILE

6 years agoAdd CONFIG_SOCKET_MAX configuration option to adjust the system-wide socket limit
Matthias Kruk [Thu, 3 Oct 2019 09:36:05 +0000 (18:36 +0900)]
Add CONFIG_SOCKET_MAX configuration option to adjust the system-wide socket limit

6 years agoAdd definitions for syscall interrupt vectors to corax/syscall.h
Matthias Kruk [Wed, 2 Oct 2019 07:36:55 +0000 (16:36 +0900)]
Add definitions for syscall interrupt vectors to corax/syscall.h

6 years agoAdd sys_bind() syscall
Matthias Kruk [Wed, 2 Oct 2019 07:23:39 +0000 (16:23 +0900)]
Add sys_bind() syscall

6 years agoAdd CONFIG_DEBUG_NET definition to config.h
Matthias Kruk [Wed, 2 Oct 2019 07:22:49 +0000 (16:22 +0900)]
Add CONFIG_DEBUG_NET definition to config.h

6 years agoAdd sys_cxnet() handler for network-related syscalls and handler stubs for a number...
Matthias Kruk [Wed, 2 Oct 2019 07:16:35 +0000 (16:16 +0900)]
Add sys_cxnet() handler for network-related syscalls and handler stubs for a number of sub-syscalls:
 - sys_socket()
 - sys_close()
 - sys_sendto()
 - sys_recvfrom()
 - sys_connect()
 - sys_listen()
 - sys_accept()
 - sys_setsockopt()
 - sys_getsockopt()
 - sys_shutdown()
 - sys_select()
 - sys_poll()

6 years agoAdd include/poll.h header
Matthias Kruk [Wed, 2 Oct 2019 07:15:46 +0000 (16:15 +0900)]
Add include/poll.h header

6 years agoAdd sys/select.h header
Matthias Kruk [Wed, 2 Oct 2019 07:12:36 +0000 (16:12 +0900)]
Add sys/select.h header

6 years agoAdd sys/types.h header
Matthias Kruk [Wed, 2 Oct 2019 07:12:07 +0000 (16:12 +0900)]
Add sys/types.h header

6 years agoAdd definitions for struct timeval and struct timezone
Matthias Kruk [Wed, 2 Oct 2019 07:11:46 +0000 (16:11 +0900)]
Add definitions for struct timeval and struct timezone

6 years agoAdd generic socket definitions
Matthias Kruk [Wed, 2 Oct 2019 07:11:17 +0000 (16:11 +0900)]
Add generic socket definitions

6 years agoPass the 6th argument of a syscall in ebp
Matthias Kruk [Wed, 2 Oct 2019 06:13:10 +0000 (15:13 +0900)]
Pass the 6th argument of a syscall in ebp

6 years agoAdd syscall number definitions
Matthias Kruk [Wed, 2 Oct 2019 05:50:22 +0000 (14:50 +0900)]
Add syscall number definitions

6 years agoAdd interrupt vector for network-related syscalls
Matthias Kruk [Wed, 2 Oct 2019 05:22:22 +0000 (14:22 +0900)]
Add interrupt vector for network-related syscalls

6 years agoMake debug output from the scheduler depend on CONFIG_DEBUG_SCHED
Matthias Kruk [Wed, 2 Oct 2019 05:02:49 +0000 (14:02 +0900)]
Make debug output from the scheduler depend on CONFIG_DEBUG_SCHED

6 years agoMake _int_handle(), _exc_handle(), and _sys_handle() void functions since the assembl...
Matthias Kruk [Wed, 2 Oct 2019 05:00:37 +0000 (14:00 +0900)]
Make _int_handle(), _exc_handle(), and _sys_handle() void functions since the assembly code that calls them ignores the return value

6 years agoSave/restore the EBP register used in kernel-space during task switches, otherwise...
Matthias Kruk [Tue, 1 Oct 2019 17:20:15 +0000 (02:20 +0900)]
Save/restore the EBP register used in kernel-space during task switches, otherwise the new task will execute on the old stack (causing a page fault) after the C function that called task_switch returns

6 years agoIssue the EOI at the beginning of the interrupt handler in order to avoid deadlocks
Matthias Kruk [Tue, 1 Oct 2019 12:53:28 +0000 (21:53 +0900)]
Issue the EOI at the beginning of the interrupt handler in order to avoid deadlocks

6 years agoImprove interrupt handling and task switching code:
Matthias Kruk [Tue, 1 Oct 2019 09:13:09 +0000 (18:13 +0900)]
Improve interrupt handling and task switching code:
 - Introduce definitions to make task_prepare and task_switch easier to understand
 - Make interrupt handlers push cr3 onto the stack and restore it before an iret
 - Make interrupt handlers adjust the stack pointers upon entry/exit since the tasks'
   kernel-mode stacks are mapped at their linear addresses in the kernel's page directory

6 years agoDon't perform arithmetic on the stack pointer arguments within task_prepare, i.e...
Matthias Kruk [Tue, 1 Oct 2019 07:01:49 +0000 (16:01 +0900)]
Don't perform arithmetic on the stack pointer arguments within task_prepare, i.e. the caller is expected to provide the correct addresses where the stacks may be placed