Skip to content
Merged

GPL #107

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions arch/x86_64/interrupts/Interrupts.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "Interrupts.h"

#include "Kernel.h"
#include "Atomics.h"
#include "Console.h"
#include "Ide.h"
Expand All @@ -12,7 +12,7 @@
volatile uint32_t PITTicks = 0;

// The C-level interrupt handler, called from the assembly stub
void InterruptHandler(Registers* regs) {
asmlinkage void InterruptHandler(Registers* regs) {
ASSERT(regs != NULL);

// Handle hardware interrupts first
Expand Down
64 changes: 35 additions & 29 deletions docs/ARCHITECTURE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# The VoidFrame monolithic kernel 💫 v0.0.1-beta5.3
# The VoidFrame monolithic kernel 💫 v0.0.1-beta5.4

## Table of Contents

Expand Down Expand Up @@ -371,15 +371,15 @@ The goal is to create a system that feels fast and responsive under load but doe

The following functions and commands provide interfaces to the process management subsystem.

| Function / Command | Description |
|:-----------------------------|:---------------------------------------------------------------------------------------------------------------------------------|
| `CreateProcess(entry_point)` | Creates a new user-level process. A simplified wrapper around `CreateSecureProcess`. |
| `KillProcess(pid)` | Safely requests the termination of a process with the given PID. |
| `MLFQYield()` | A cooperative function that allows a process to voluntarily give up the remainder of its time slice and trigger the scheduler. |
| `GetProcessByPid(pid)` | Retrieves a pointer to the PCB for a given PID. |
| `ListProcesses()` | A shell/debug command that prints a formatted list of all active processes, including their PID, state, priority, and CPU usage. |
| `DumpSchedulerState()` | A debug command that prints detailed internal statistics about the scheduler, including queue depths and load. |
| `DumpPerformanceStats()` | A debug command that prints performance counters like total context switches and security violations. |
| Function / Command | Description |
|:------------------------------|:---------------------------------------------------------------------------------------------------------------------------------|
| `CreateProcess(entry_point)` | Creates a new user-level process. A simplified wrapper around `CreateSecureProcess`. |
| `KillProcess(pid)` | Safely requests the termination of a process with the given PID. |
| `MLFQYield()` | A cooperative function that allows a process to voluntarily give up the remainder of its time slice and trigger the scheduler. |
| `GetProcessByPid(pid)` | Retrieves a pointer to the PCB for a given PID. |
| `ListProcesses()` | A shell/debug command that prints a formatted list of all active processes, including their PID, state, priority, and CPU usage. |
| `DumpSchedulerState()` | A debug command that prints detailed internal statistics about the scheduler, including queue depths and load. |
| `DumpPerformanceStats()` | A debug command that prints performance counters like total context switches and security violations. |

## Debugging and Development
- Debugging:
Expand Down Expand Up @@ -411,23 +411,29 @@ The following functions and commands provide interfaces to the process managemen
- The kernel build options and flags are as follow (modify as needed)
```jetbrainsmeson
vf_config_flags = [
'-DVF_CONFIG_ENABLE_XHCI',
'-DVF_CONFIG_ENABLE_VIRTIO',
'-DVF_CONFIG_ENABLE_ISA',
'-DVF_CONFIG_ENABLE_LPT',
'-DVF_CONFIG_ENABLE_PCI',
'-DVF_CONFIG_ENABLE_PS2',
'-DVF_CONFIG_ENABLE_INITRD',
'-DVF_CONFIG_ENABLE_IDE',
'-DVF_CONFIG_ENFORCE_MEMORY_PROTECTION',
'-DVF_CONFIG_VM_HOST',
'-DVF_CONFIG_MLFQ_SCHED',
'-DVF_CONFIG_PROCINFO_CREATE_DEFAULT',
'-DVF_CONFIG_USE_VFSHELL',
'-DVF_CONFIG_USE_DYNAMOX',
'-DVF_CONFIG_USE_ASTRA',
# '-DVF_CONFIG_USE_CERBERUS',
# '-DVF_CONFIG_PANIC_OVERRIDE',
]
'-DVF_CONFIG_ENABLE_XHCI',
'-DVF_CONFIG_ENABLE_VIRTIO',
'-DVF_CONFIG_ENABLE_ISA',
'-DVF_CONFIG_ENABLE_LPT',
'-DVF_CONFIG_ENABLE_PCI',
'-DVF_CONFIG_ENABLE_PS2',
'-DVF_CONFIG_ENABLE_INITRD',
'-DVF_CONFIG_ENABLE_IDE',
'-DVF_CONFIG_RTC_CENTURY',
'-DVF_CONFIG_ENFORCE_MEMORY_PROTECTION',
'-DVF_CONFIG_VM_HOST',
'-DVF_CONFIG_PROCINFO_CREATE_DEFAULT',
'-DVF_CONFIG_USE_VFSHELL',
'-DVF_CONFIG_USE_DYNAMOX',
'-DVF_CONFIG_USE_ASTRA',
'-DVF_CONFIG_USE_CERBERUS',
'-DVF_CONFIG_CERBERUS_VFS_LOGGING',
'-DVF_CONFIG_CERBERUS_THREAT_REPORTING',
#'-DVF_CONFIG_CERBERUS_STACK_PROTECTION',
'-DVF_CONFIG_SCHED_MLFQ',
'-DVF_CONFIG_PROCINFO_AUTO_CLEANUP',
#'-DVF_CONFIG_SCHED_CFS',
#'-DVF_CONFIG_PANIC_OVERRIDE',
]
```
> assembler-0 @ voidframe-kernel - 11:54 01/09/2025
> assembler-0 @ voidframe-kernel - 14:40 02/09/2025
29 changes: 23 additions & 6 deletions docs/STRUCTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,19 @@ VoidFrame/
│ ├── PCI/
│ │ ├── PCI.h
│ │ └── PCI.c
│ ├── ISA/
│ │ ├── ISA.h
│ │ └── ISA.c
│ ├── LPT/
│ │ ├── LPT.h
│ │ └── LPT.c
│ ├── sound/
│ │ ├── SB16.h
│ │ └── SB16.c
│ ├── virtio/
│ │ ├── Virtio.h
│ │ ├── VirtioBlk.h
│ │ └── VirtioBlk.c
│ ├── RTC/
│ │ ├── Rtc.h
│ │ └── Rtc.c
Expand All @@ -51,21 +64,23 @@ VoidFrame/
├── fs/
│ ├── FAT12.h # Filesystems
│ ├── FAT12.c
│ ├── Fs.h
│ ├── VFRFS.h
│ ├── VFRFS.c
│ ├── FsUtils.h
│ ├── FsUtils.c
│ ├── FsUtils.h
│ ├── VFS.c
│ └── VFS.h
├── include/ # Common includes
│ ├── Font.h
│ ├── Io.h
│ ├── Switch.h
│ ├── Paging.asm
│ ├── Switch.asm
│ ├── stdbool.h
│ ├── stdint.h
│ ├── stddef.h
│ ├── stdlib.h
│ ├── Ltypes.h
│ ├── ctypes.h
│ ├── ctypes.c
│ └── stdarg.h
├── kernel/ # Kernel core
│ ├── atomic/ # Atomic operations
Expand Down Expand Up @@ -95,8 +110,9 @@ VoidFrame/
│ ├── ipc/ # IPC related files
│ │ ├── Ipc.c
│ │ └── Ipc.h
│ └── process/ # MLFQ scheduler
│ ├── Process.c
│ └── sched/ # Scheduler and Process management
│ ├── Shared.h
│ ├── MLFQ.c
│ └── MLFQ.h
├── mm/ # Physical and Virtual memory manager
│ ├── KernelHeap.c
Expand All @@ -116,5 +132,6 @@ VoidFrame/
├── linker.ld
├── grub.cfg
├── meson.build
├── vfconfig.py
└── ...
```
152 changes: 0 additions & 152 deletions docs/TIMING_UPGRADE.md

This file was deleted.

31 changes: 25 additions & 6 deletions drivers/RTC/Rtc.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,20 @@ void RtcReadTime(rtc_time_t* rtc_time) {
// values match. This ensures an update didn't happen in the middle of our read.
do {
// Wait until no update is in progress
while (get_update_in_progress_flag());
while (get_update_in_progress_flag()) {}

rtc_time->second = cmos_read(CMOS_REG_SECONDS);
rtc_time->minute = cmos_read(CMOS_REG_MINUTES);
rtc_time->hour = cmos_read(CMOS_REG_HOURS);
rtc_time->day = cmos_read(CMOS_REG_DAY);
rtc_time->month = cmos_read(CMOS_REG_MONTH);
rtc_time->year = cmos_read(CMOS_REG_YEAR);

rtc_time->century = cmos_read(CMOS_REG_CENTURY);
// Make a copy of the values we just read
last_time = *rtc_time;

// Wait again to ensure we are past the update
while (get_update_in_progress_flag());
while (get_update_in_progress_flag()){}

// Read a second time
last_time.second = cmos_read(CMOS_REG_SECONDS);
Expand All @@ -61,13 +61,20 @@ void RtcReadTime(rtc_time_t* rtc_time) {
last_time.day = cmos_read(CMOS_REG_DAY);
last_time.month = cmos_read(CMOS_REG_MONTH);
last_time.year = cmos_read(CMOS_REG_YEAR);
#ifdef VF_CONFIG_RTC_CENTURY
last_time.century = cmos_read(CMOS_REG_CENTURY);
#endif

} while ( (last_time.second != rtc_time->second) ||
(last_time.minute != rtc_time->minute) ||
(last_time.hour != rtc_time->hour) ||
(last_time.day != rtc_time->day) ||
(last_time.month != rtc_time->month) ||
(last_time.year != rtc_time->year) );
(last_time.year != rtc_time->year)
#ifdef VF_CONFIG_RTC_CENTURY
|| (last_time.century != rtc_time->century)
#endif
);


// Now that we have a stable read, convert from BCD if necessary
Expand All @@ -82,6 +89,18 @@ void RtcReadTime(rtc_time_t* rtc_time) {
rtc_time->month = bcd_to_bin(rtc_time->month);
rtc_time->year = bcd_to_bin(rtc_time->year);
}

rtc_time->year += 2000; // trust me
#ifdef VF_CONFIG_RTC_CENTURY
{
uint16_t cval = (uint16_t)rtc_time->century;
if (cval != 0) {
if (bcd_mode)
cval = bcd_to_bin((uint8_t)cval);
rtc_time->year += (uint16_t)(cval * 100);
} else {
rtc_time->year += 2000;
}
}
#else
rtc_time->year += 2000;
#endif
}
1 change: 1 addition & 0 deletions drivers/RTC/Rtc.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ typedef struct {
uint8_t day;
uint8_t month;
uint16_t year;
uint16_t century;
} rtc_time_t;

// Reads the current date and time from the RTC into the provided struct.
Expand Down
Loading