]>
git.corax.cc Git - corax/log
Matthias Kruk [Tue, 5 Nov 2019 07:20:36 +0000 (16:20 +0900)]
Add prototype for _pg_dir_vpxlate() to arch/paging.h
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
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
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
Matthias Kruk [Mon, 4 Nov 2019 02:03:50 +0000 (11:03 +0900)]
Allow forked processes to be enqueued using sched_enqueue()
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()
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()
Matthias Kruk [Mon, 4 Nov 2019 01:46:32 +0000 (10:46 +0900)]
Move definition of struct stack_frame to arch.h
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
Matthias Kruk [Wed, 30 Oct 2019 08:08:18 +0000 (17:08 +0900)]
Call process_fork() from sys_fork() and sys_vfork()
Matthias Kruk [Tue, 29 Oct 2019 05:11:41 +0000 (14:11 +0900)]
Call process_exit() from sys_exit()
Matthias Kruk [Tue, 29 Oct 2019 05:09:56 +0000 (14:09 +0900)]
Add process_exit() function
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
Matthias Kruk [Tue, 29 Oct 2019 05:06:21 +0000 (14:06 +0900)]
Add TASK_STATE_EXIT state to identify tasks that are exitting
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
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, ...)
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
Matthias Kruk [Sun, 27 Oct 2019 16:18:53 +0000 (01:18 +0900)]
Add some IPC testing code to main.c
Matthias Kruk [Sun, 27 Oct 2019 15:58:17 +0000 (00:58 +0900)]
Make debug output in IPC code depend on CONFIG_DEBUG_IPC
Matthias Kruk [Sun, 27 Oct 2019 15:53:51 +0000 (00:53 +0900)]
Signal the receiving process in process_inbox_put()
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
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
Matthias Kruk [Sat, 26 Oct 2019 07:23:06 +0000 (16:23 +0900)]
Add CONFIG_IPC_MSGSIZE configuration option
Matthias Kruk [Sat, 26 Oct 2019 07:22:49 +0000 (16:22 +0900)]
Add definitions for ENOTSUP, EOPNOTSUPP, and ENOENT
Matthias Kruk [Sat, 26 Oct 2019 05:17:03 +0000 (14:17 +0900)]
Add typedef for pid_t
Matthias Kruk [Sat, 26 Oct 2019 05:12:54 +0000 (14:12 +0900)]
Implement process_memcpy_ptop() function for copying data directly between processes
Matthias Kruk [Fri, 25 Oct 2019 06:45:33 +0000 (15:45 +0900)]
Add mbuf type and functions to allocate and free them
Matthias Kruk [Sat, 5 Oct 2019 07:22:14 +0000 (16:22 +0900)]
Add sobind() function stub and call it from sys_bind()
Matthias Kruk [Sat, 5 Oct 2019 07:14:17 +0000 (16:14 +0900)]
Also compile libc from the top-level Makefile
Matthias Kruk [Sat, 5 Oct 2019 07:13:21 +0000 (16:13 +0900)]
Add dummy soshutdown() function and call it from sys_shutdown()
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
Matthias Kruk [Sat, 5 Oct 2019 06:32:37 +0000 (15:32 +0900)]
Implement sys_getsockopt() and sys_setsockopt() functions
Matthias Kruk [Sat, 5 Oct 2019 06:31:45 +0000 (15:31 +0900)]
Add (incomplete) sosetopt() and sogetopt() functions
Matthias Kruk [Sat, 5 Oct 2019 06:14:44 +0000 (15:14 +0900)]
Implement functions for copying memory between page directories
Matthias Kruk [Sat, 5 Oct 2019 06:00:07 +0000 (15:00 +0900)]
Add definition for EADDRNOTAVAIL
Matthias Kruk [Fri, 4 Oct 2019 07:06:42 +0000 (16:06 +0900)]
Add definition for SOL_SOCKET
Matthias Kruk [Fri, 4 Oct 2019 06:50:39 +0000 (15:50 +0900)]
Add definitions for various socket options
Matthias Kruk [Fri, 4 Oct 2019 06:40:10 +0000 (15:40 +0900)]
Call soclose() from sys_close()
Matthias Kruk [Fri, 4 Oct 2019 06:39:33 +0000 (15:39 +0900)]
Initialize a new socket's refcount to 1
Matthias Kruk [Fri, 4 Oct 2019 06:38:29 +0000 (15:38 +0900)]
Add soclose() and sofree() functions
Matthias Kruk [Fri, 4 Oct 2019 06:37:58 +0000 (15:37 +0900)]
Add process_flookup() and process_get_current() functions
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
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
Matthias Kruk [Thu, 3 Oct 2019 09:42:28 +0000 (18:42 +0900)]
Include socket.c file in compilation of kernel core
Matthias Kruk [Thu, 3 Oct 2019 09:41:38 +0000 (18:41 +0900)]
Call socreate() function from sys_socket()
Matthias Kruk [Thu, 3 Oct 2019 09:41:17 +0000 (18:41 +0900)]
Add very simplistic socreate() implementation
Matthias Kruk [Thu, 3 Oct 2019 09:39:51 +0000 (18:39 +0900)]
Add infrastructure to allocate file descriptors to processes
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()
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
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
Matthias Kruk [Wed, 2 Oct 2019 07:36:55 +0000 (16:36 +0900)]
Add definitions for syscall interrupt vectors to corax/syscall.h
Matthias Kruk [Wed, 2 Oct 2019 07:23:39 +0000 (16:23 +0900)]
Add sys_bind() syscall
Matthias Kruk [Wed, 2 Oct 2019 07:22:49 +0000 (16:22 +0900)]
Add CONFIG_DEBUG_NET definition to config.h
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()
Matthias Kruk [Wed, 2 Oct 2019 07:15:46 +0000 (16:15 +0900)]
Add include/poll.h header
Matthias Kruk [Wed, 2 Oct 2019 07:12:36 +0000 (16:12 +0900)]
Add sys/select.h header
Matthias Kruk [Wed, 2 Oct 2019 07:12:07 +0000 (16:12 +0900)]
Add sys/types.h header
Matthias Kruk [Wed, 2 Oct 2019 07:11:46 +0000 (16:11 +0900)]
Add definitions for struct timeval and struct timezone
Matthias Kruk [Wed, 2 Oct 2019 07:11:17 +0000 (16:11 +0900)]
Add generic socket definitions
Matthias Kruk [Wed, 2 Oct 2019 06:13:10 +0000 (15:13 +0900)]
Pass the 6th argument of a syscall in ebp
Matthias Kruk [Wed, 2 Oct 2019 05:50:22 +0000 (14:50 +0900)]
Add syscall number definitions
Matthias Kruk [Wed, 2 Oct 2019 05:22:22 +0000 (14:22 +0900)]
Add interrupt vector for network-related syscalls
Matthias Kruk [Wed, 2 Oct 2019 05:02:49 +0000 (14:02 +0900)]
Make debug output from the scheduler depend on CONFIG_DEBUG_SCHED
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
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
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
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
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
Matthias Kruk [Tue, 1 Oct 2019 06:42:37 +0000 (15:42 +0900)]
Switch to the kernel page directory when entering the kernel (i.e. separate the kernel and user address spaces to avoid side-channel attacks on speculative execution in certain CPUs)
Matthias Kruk [Tue, 1 Oct 2019 06:37:52 +0000 (15:37 +0900)]
Move some of the definitions from arch/task.S to arch/defs.h so they can be shared with other source files
Matthias Kruk [Sun, 29 Sep 2019 05:54:13 +0000 (14:54 +0900)]
Initialize two tasks at boot time, for testing purposes
Matthias Kruk [Sun, 29 Sep 2019 05:53:38 +0000 (14:53 +0900)]
Use task_switch() to switch tasks in sched_tick(), instead of task_set_current()
Matthias Kruk [Sun, 29 Sep 2019 05:52:25 +0000 (14:52 +0900)]
Initialize the process's time slice and put it on the ready queue in process_create()
Matthias Kruk [Fri, 27 Sep 2019 07:51:46 +0000 (16:51 +0900)]
Modify task_switch function so it can be used to switch to new tasks which have not been executed before, but also to return to interrupted tasks
Matthias Kruk [Fri, 27 Sep 2019 07:10:31 +0000 (16:10 +0900)]
Add a _very_ naive scheduler
Matthias Kruk [Fri, 27 Sep 2019 07:09:05 +0000 (16:09 +0900)]
Add task_get_current() and task_set_current() functions; add definitions for keeping track of a task's state and quantum
Matthias Kruk [Fri, 27 Sep 2019 06:18:59 +0000 (15:18 +0900)]
Separate the architecture dependent and independent parts of the kernel more cleanly:
- Add pg_dir_get_pdbr() function
- Make definitions, types, and functions necessary for other parts of the
kernel visible to them by moving them into the kernel/include/arch.h header
Matthias Kruk [Fri, 27 Sep 2019 06:08:52 +0000 (15:08 +0900)]
Move architecture-independent process implementation out of the arch directory
Matthias Kruk [Fri, 27 Sep 2019 06:06:12 +0000 (15:06 +0900)]
Move process.h definitions into a kernel-wide header file; add entry argument to process_create()
Matthias Kruk [Thu, 26 Sep 2019 07:27:33 +0000 (16:27 +0900)]
Fix order of arguments passed to dbg_printf() in cpu_tss_debug()
Matthias Kruk [Wed, 25 Sep 2019 13:46:09 +0000 (22:46 +0900)]
Add privilege level information to processes and tasks
Matthias Kruk [Wed, 25 Sep 2019 10:08:22 +0000 (19:08 +0900)]
Don't print ESP0 value in process_create(); split long lines
Matthias Kruk [Wed, 25 Sep 2019 10:05:05 +0000 (19:05 +0900)]
Create new processes with privilege level 3 by default
Matthias Kruk [Wed, 25 Sep 2019 10:03:51 +0000 (19:03 +0900)]
Make sure PAGE_ATTR_USER is set on page tables when we're mapping something with PAGE_ATTR_USER within them (IA-32 legacy paging)
Matthias Kruk [Wed, 25 Sep 2019 10:02:36 +0000 (19:02 +0900)]
Unmask the timer interrupt when initializing the i8259 PIC
Matthias Kruk [Wed, 25 Sep 2019 10:01:35 +0000 (19:01 +0900)]
Add definitions for the offsets into the TSS; change the TSS selector to 0x48 instead of (0x48 | RPL_USER)
Matthias Kruk [Wed, 25 Sep 2019 10:00:29 +0000 (19:00 +0900)]
Add cpu_tss_debug() function to display the contents of the TSS; make cpu_debug() and cpu_tss_debug() depend on CONFIG_DEBUG
Matthias Kruk [Wed, 25 Sep 2019 09:57:58 +0000 (18:57 +0900)]
Fix a bug in task_switch() that would cause the TSS update to be skipped
Matthias Kruk [Wed, 25 Sep 2019 09:40:05 +0000 (18:40 +0900)]
Leave interrupts disabled until we switch to user-space
Matthias Kruk [Wed, 25 Sep 2019 09:24:53 +0000 (18:24 +0900)]
Use KERNEL_CODE macro when initializing the IDT, instead of numerals
Matthias Kruk [Wed, 25 Sep 2019 08:47:30 +0000 (17:47 +0900)]
Set the limit of the TSS descriptor to TSS_SIZE + 1
Matthias Kruk [Wed, 25 Sep 2019 08:07:48 +0000 (17:07 +0900)]
Update the ESP0 and SS0 TSS entries when switching tasks
Matthias Kruk [Wed, 25 Sep 2019 08:07:03 +0000 (17:07 +0900)]
Ensure that PAGE_ATTR_USER is set and PAGE_ATTR_WRITABLE is not set on kernel code/data segments in user-space page directories
Matthias Kruk [Tue, 24 Sep 2019 08:42:12 +0000 (17:42 +0900)]
Implement functions to spawn and run processes
Matthias Kruk [Tue, 24 Sep 2019 08:39:34 +0000 (17:39 +0900)]
Fix several paging-related issues; implement functions to get the addresses of the kernel and user-space stack that is mapped within a page directory
Matthias Kruk [Tue, 24 Sep 2019 08:38:26 +0000 (17:38 +0900)]
Disable interrupts while we don't have a valid stack in task_switch()
Matthias Kruk [Tue, 24 Sep 2019 08:32:40 +0000 (17:32 +0900)]
Move the per-process kernel stack to 0xffffe000
Matthias Kruk [Sat, 21 Sep 2019 02:31:50 +0000 (11:31 +0900)]
Fix control flow in task_switch function; add userspace esp argument to task_prepare function
Matthias Kruk [Fri, 20 Sep 2019 06:15:59 +0000 (15:15 +0900)]
Add code for debugging of PAE paging structures
Matthias Kruk [Fri, 20 Sep 2019 05:48:14 +0000 (14:48 +0900)]
Implement pg_frame_free() function; add code for debugging physical page tables (legacy IA-32 mode)