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

6 years agoSwitch to the kernel page directory when entering the kernel (i.e. separate the kerne...
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)

6 years agoMove some of the definitions from arch/task.S to arch/defs.h so they can be shared...
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

6 years agoInitialize two tasks at boot time, for testing purposes
Matthias Kruk [Sun, 29 Sep 2019 05:54:13 +0000 (14:54 +0900)]
Initialize two tasks at boot time, for testing purposes

6 years agoUse task_switch() to switch tasks in sched_tick(), instead of task_set_current()
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()

6 years agoInitialize the process's time slice and put it on the ready queue in process_create()
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()

6 years agoModify task_switch function so it can be used to switch to new tasks which have not...
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

6 years agoAdd a _very_ naive scheduler
Matthias Kruk [Fri, 27 Sep 2019 07:10:31 +0000 (16:10 +0900)]
Add a _very_ naive scheduler

6 years agoAdd task_get_current() and task_set_current() functions; add definitions for keeping...
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

6 years agoSeparate the architecture dependent and independent parts of the kernel more cleanly:
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

6 years agoMove architecture-independent process implementation out of the arch directory
Matthias Kruk [Fri, 27 Sep 2019 06:08:52 +0000 (15:08 +0900)]
Move architecture-independent process implementation out of the arch directory

6 years agoMove process.h definitions into a kernel-wide header file; add entry argument to...
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()

6 years agoFix order of arguments passed to dbg_printf() in cpu_tss_debug()
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()

6 years agoAdd privilege level information to processes and tasks
Matthias Kruk [Wed, 25 Sep 2019 13:46:09 +0000 (22:46 +0900)]
Add privilege level information to processes and tasks

6 years agoDon't print ESP0 value in process_create(); split long lines
Matthias Kruk [Wed, 25 Sep 2019 10:08:22 +0000 (19:08 +0900)]
Don't print ESP0 value in process_create(); split long lines

6 years agoCreate new processes with privilege level 3 by default
Matthias Kruk [Wed, 25 Sep 2019 10:05:05 +0000 (19:05 +0900)]
Create new processes with privilege level 3 by default

6 years agoMake sure PAGE_ATTR_USER is set on page tables when we're mapping something with...
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)

6 years agoUnmask the timer interrupt when initializing the i8259 PIC
Matthias Kruk [Wed, 25 Sep 2019 10:02:36 +0000 (19:02 +0900)]
Unmask the timer interrupt when initializing the i8259 PIC

6 years agoAdd definitions for the offsets into the TSS; change the TSS selector to 0x48 instead...
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)

6 years agoAdd cpu_tss_debug() function to display the contents of the TSS; make cpu_debug(...
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

6 years agoFix a bug in task_switch() that would cause the TSS update to be skipped
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

6 years agoLeave interrupts disabled until we switch to user-space
Matthias Kruk [Wed, 25 Sep 2019 09:40:05 +0000 (18:40 +0900)]
Leave interrupts disabled until we switch to user-space

6 years agoUse KERNEL_CODE macro when initializing the IDT, instead of numerals
Matthias Kruk [Wed, 25 Sep 2019 09:24:53 +0000 (18:24 +0900)]
Use KERNEL_CODE macro when initializing the IDT, instead of numerals

6 years agoSet the limit of the TSS descriptor to TSS_SIZE + 1
Matthias Kruk [Wed, 25 Sep 2019 08:47:30 +0000 (17:47 +0900)]
Set the limit of the TSS descriptor to TSS_SIZE + 1

6 years agoUpdate the ESP0 and SS0 TSS entries when switching tasks
Matthias Kruk [Wed, 25 Sep 2019 08:07:48 +0000 (17:07 +0900)]
Update the ESP0 and SS0 TSS entries when switching tasks

6 years agoEnsure that PAGE_ATTR_USER is set and PAGE_ATTR_WRITABLE is not set on kernel code...
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

6 years agoImplement functions to spawn and run processes
Matthias Kruk [Tue, 24 Sep 2019 08:42:12 +0000 (17:42 +0900)]
Implement functions to spawn and run processes

6 years agoFix several paging-related issues; implement functions to get the addresses of the...
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

6 years agoDisable interrupts while we don't have a valid stack in task_switch()
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()

6 years agoMove the per-process kernel stack to 0xffffe000
Matthias Kruk [Tue, 24 Sep 2019 08:32:40 +0000 (17:32 +0900)]
Move the per-process kernel stack to 0xffffe000

6 years agoFix control flow in task_switch function; add userspace esp argument to task_prepare...
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

6 years agoAdd code for debugging of PAE paging structures
Matthias Kruk [Fri, 20 Sep 2019 06:15:59 +0000 (15:15 +0900)]
Add code for debugging of PAE paging structures

6 years agoImplement pg_frame_free() function; add code for debugging physical page tables ...
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)

6 years agoMake debug messages in heap.c depend on CONFIG_DEBUG_HEAP instead of CONFIG_DEBUG...
Matthias Kruk [Fri, 20 Sep 2019 05:00:43 +0000 (14:00 +0900)]
Make debug messages in heap.c depend on CONFIG_DEBUG_HEAP instead of CONFIG_DEBUG since they cause a lot of output

6 years agoMake the hacky reboot-upon-keyboard-interrupt behavior depend on CONFIG_DEBUG
Matthias Kruk [Fri, 20 Sep 2019 04:58:23 +0000 (13:58 +0900)]
Make the hacky reboot-upon-keyboard-interrupt behavior depend on CONFIG_DEBUG

6 years agoRename pg_dir_alloc() method to pg_dir_create()
Matthias Kruk [Thu, 19 Sep 2019 11:18:51 +0000 (20:18 +0900)]
Rename pg_dir_alloc() method to pg_dir_create()

6 years agoUse the kernel stack passed to task_prepare on the stack, instead of the (invalid...
Matthias Kruk [Thu, 19 Sep 2019 10:38:42 +0000 (19:38 +0900)]
Use the kernel stack passed to task_prepare on the stack, instead of the (invalid) pointer in the task structure

6 years agoKeep a pointer to the kernel stack in struct task, instead of the entire stack
Matthias Kruk [Thu, 19 Sep 2019 10:34:19 +0000 (19:34 +0900)]
Keep a pointer to the kernel stack in struct task, instead of the entire stack

6 years agoRemove the kernel stack from the struct cpu structure, since each task will be alloca...
Matthias Kruk [Thu, 19 Sep 2019 10:05:46 +0000 (19:05 +0900)]
Remove the kernel stack from the struct cpu structure, since each task will be allocated its own kernel-mode stack; instead, the initial kernel stack will start at 0x200000 and disappear when the kernel switches into user mode

6 years agoRename struct region's reg_flags member to reg_type
Matthias Kruk [Thu, 19 Sep 2019 09:39:49 +0000 (18:39 +0900)]
Rename struct region's reg_flags member to reg_type

6 years agoDynamically allocate the region structures that are associated with page directories
Matthias Kruk [Thu, 19 Sep 2019 05:33:12 +0000 (14:33 +0900)]
Dynamically allocate the region structures that are associated with page directories

6 years agoChange the definition of PAGE_ATTR_NO_EXEC for now, since we don't support it yet...
Matthias Kruk [Thu, 19 Sep 2019 05:31:12 +0000 (14:31 +0900)]
Change the definition of PAGE_ATTR_NO_EXEC for now, since we don't support it yet anyways

6 years agoAdd symbols to identify the rodata, data, bss sections in the linker script and page...
Matthias Kruk [Thu, 19 Sep 2019 05:30:04 +0000 (14:30 +0900)]
Add symbols to identify the rodata, data, bss sections in the linker script and page-align the start of the kernel heap

6 years agoRemove h_pgdir member from kernel heap structure
Matthias Kruk [Thu, 19 Sep 2019 04:29:06 +0000 (13:29 +0900)]
Remove h_pgdir member from kernel heap structure

6 years agoAdd CONFIG_DEBUG definition to config.h
Matthias Kruk [Wed, 18 Sep 2019 07:13:57 +0000 (16:13 +0900)]
Add CONFIG_DEBUG definition to config.h

6 years agoFix a bug in heap_grow() that would cause the heap list to be bent into a loop
Matthias Kruk [Wed, 18 Sep 2019 07:13:21 +0000 (16:13 +0900)]
Fix a bug in heap_grow() that would cause the heap list to be bent into a loop

6 years agoMake _pg_dir_map_legacy() map large pages, where possible
Matthias Kruk [Tue, 17 Sep 2019 07:48:40 +0000 (16:48 +0900)]
Make _pg_dir_map_legacy() map large pages, where possible

6 years agoAdd errno.h header with some preliminary error definitions
Matthias Kruk [Tue, 17 Sep 2019 07:22:55 +0000 (16:22 +0900)]
Add errno.h header with some preliminary error definitions

6 years agoImplement methods to allocate and populate page directories
Matthias Kruk [Tue, 17 Sep 2019 07:22:03 +0000 (16:22 +0900)]
Implement methods to allocate and populate page directories

6 years agoMake kmalloc() wipe the newly allocated memory
Matthias Kruk [Tue, 17 Sep 2019 07:18:34 +0000 (16:18 +0900)]
Make kmalloc() wipe the newly allocated memory

6 years agoFix start and size of the kernel heap memory region
Matthias Kruk [Mon, 16 Sep 2019 15:15:33 +0000 (00:15 +0900)]
Fix start and size of the kernel heap memory region

6 years agoImplement growing of kernel heap
Matthias Kruk [Mon, 16 Sep 2019 14:47:51 +0000 (23:47 +0900)]
Implement growing of kernel heap

6 years agoMake page frame allocations available to other kernel functions; move ALIGNED() and...
Matthias Kruk [Mon, 16 Sep 2019 14:14:32 +0000 (23:14 +0900)]
Make page frame allocations available to other kernel functions; move ALIGNED() and ALIGN() macros to paging.h

6 years agoAdd simple kernel heap implementation
Matthias Kruk [Mon, 16 Sep 2019 08:17:12 +0000 (17:17 +0900)]
Add simple kernel heap implementation

6 years agoClean up the paging code; fix known issues with the frame set
Matthias Kruk [Mon, 16 Sep 2019 06:12:34 +0000 (15:12 +0900)]
Clean up the paging code; fix known issues with the frame set

6 years agoRemove unused pg_dir_create() function
Matthias Kruk [Mon, 16 Sep 2019 04:54:05 +0000 (13:54 +0900)]
Remove unused pg_dir_create() function

6 years agoFix curly brackets
Matthias Kruk [Mon, 16 Sep 2019 04:45:10 +0000 (13:45 +0900)]
Fix curly brackets

6 years agoMove definition of struct task from arch/task.h to include/arch.h; add proper impleme...
Matthias Kruk [Fri, 6 Sep 2019 17:52:58 +0000 (02:52 +0900)]
Move definition of struct task from arch/task.h to include/arch.h; add proper implementations of task_prepare() and task_switch()

6 years agoMake symbol _int_restore global so that it can be used for task switching
Matthias Kruk [Fri, 6 Sep 2019 17:50:45 +0000 (02:50 +0900)]
Make symbol _int_restore global so that it can be used for task switching

6 years agoRemove arch_init() prototype from arch.h
Matthias Kruk [Fri, 6 Sep 2019 14:24:24 +0000 (23:24 +0900)]
Remove arch_init() prototype from arch.h

6 years agoRemove inclusion of corax/errno.h from arch/interrupt.c
Matthias Kruk [Fri, 6 Sep 2019 11:50:43 +0000 (20:50 +0900)]
Remove inclusion of corax/errno.h from arch/interrupt.c

6 years agoMask the keyboard interrupt while were not handling it properly
Matthias Kruk [Fri, 6 Sep 2019 08:50:39 +0000 (17:50 +0900)]
Mask the keyboard interrupt while were not handling it properly

6 years agoAdd stub code to handle POSIX interrupts in _sys_handle()
Matthias Kruk [Fri, 6 Sep 2019 08:48:54 +0000 (17:48 +0900)]
Add stub code to handle POSIX interrupts in _sys_handle()

6 years agoCreate code and data segments for all privilege levels in order to allow more fine...
Matthias Kruk [Fri, 6 Sep 2019 08:34:56 +0000 (17:34 +0900)]
Create code and data segments for all privilege levels in order to allow more fine-grained separation of processes in the future

6 years agoUpdate copyright header in config.h
Matthias Kruk [Fri, 6 Sep 2019 08:32:55 +0000 (17:32 +0900)]
Update copyright header in config.h

6 years agoAdd CONFIG_POSIX feature to config.h
Matthias Kruk [Fri, 6 Sep 2019 06:04:52 +0000 (15:04 +0900)]
Add CONFIG_POSIX feature to config.h

6 years agoAdd FEATURE macro to config.h
Matthias Kruk [Fri, 6 Sep 2019 06:04:06 +0000 (15:04 +0900)]
Add FEATURE macro to config.h

6 years agoMove the arch_init() call out of the #if 0 preprocessor directive
Matthias Kruk [Fri, 6 Sep 2019 04:47:29 +0000 (13:47 +0900)]
Move the arch_init() call out of the #if 0 preprocessor directive

6 years agoRemove task-related code from main.c
Matthias Kruk [Tue, 3 Sep 2019 16:42:44 +0000 (01:42 +0900)]
Remove task-related code from main.c

6 years agoPreserve the value of the ebx register in cpu_get_capabilities()
Matthias Kruk [Tue, 3 Sep 2019 16:42:00 +0000 (01:42 +0900)]
Preserve the value of the ebx register in cpu_get_capabilities()

6 years agoInclude config.h from kernel/arch/cpu.h
Matthias Kruk [Tue, 3 Sep 2019 16:41:20 +0000 (01:41 +0900)]
Include config.h from kernel/arch/cpu.h

6 years agoDon't leave the cr3 variable in pg_init() uninitialized; remove unused braces and...
Matthias Kruk [Tue, 3 Sep 2019 16:02:29 +0000 (01:02 +0900)]
Don't leave the cr3 variable in pg_init() uninitialized; remove unused braces and calls to dbg_printf()

6 years agoMake sure the upper half of eax as returned by cpu_set_pstate() is zero
Matthias Kruk [Tue, 3 Sep 2019 16:00:49 +0000 (01:00 +0900)]
Make sure the upper half of eax as returned by cpu_set_pstate() is zero

6 years agoModify arch_init() to preserve the contents of the ebx register
Matthias Kruk [Tue, 3 Sep 2019 15:51:19 +0000 (00:51 +0900)]
Modify arch_init() to preserve the contents of the ebx register

6 years agoRemove object files that were added in error; add current state of the source
Matthias Kruk [Tue, 3 Sep 2019 15:12:59 +0000 (00:12 +0900)]
Remove object files that were added in error; add current state of the source

6 years agoInitial commit, starting with the code base from github master
Matthias Kruk [Tue, 3 Sep 2019 07:05:17 +0000 (16:05 +0900)]
Initial commit, starting with the code base from github