Vystem 0.2

This commit is contained in:
2026-05-27 19:34:54 +02:00
parent a43c08b893
commit d238606b75
372 changed files with 51320 additions and 83217 deletions

View File

@@ -5,7 +5,22 @@
#include "std/status.h"
#include "memory/page.h"
#include "memory/vmem_layout.h"
#include "devs/devs.h"
#define SH_CONF_BOOT_CONFIG_VA SH_VMEM_LAYOUT_BOOT_CONFIG_VA
// Framebuffer configuration
typedef struct __attribute__((aligned(8))) {
sh_bool fb_present;
sh_page_VIRTUAL_ADDRESS fb_pa;
sh_uint32 white_pixel_value;
sh_uint32 gray_pixel_value;
sh_uint64 size_in_bytes;
sh_uint32 fb_height;
sh_uint32 fb_width;
sh_uint16 text_x;
sh_uint16 text_y;
sh_uint16 text_width;
sh_uint16 text_height;
} sh_conf_FB_CONFIG;
// Boot config structure.
typedef struct __attribute__((aligned(8))) {
sh_uint8 sig_start[8];
@@ -18,8 +33,14 @@ typedef struct __attribute__((aligned(8))) {
sh_bool log_disable_serial_port;
sh_bool disable_serial_port;
sh_uint16 log_ring_size;
sh_uint64 acpi_rsdp;
sh_uint8 acpi_ver;
sh_uint16 kbd_events_queue_capacity;
sh_conf_FB_CONFIG fb_config;
sh_uint8 sig_end[8];
} sh_conf_BOOT_CONFIG;
// Check and create boot config structure.
SH_STATUS sh_conf_get_boot_config(sh_conf_BOOT_CONFIG **config);
// Parse a configuration DevS query
SH_STATUS sh_conf_devs_query(char *sub_path,sh_devs_RESULT *result);
#endif

View File

@@ -0,0 +1,12 @@
// SPDX-License-Identifier: MPL-2.0
#ifndef SH_LIB_EFIFB_H
#define SH_LIB_EFIFB_H
#include "std/stdlib.h"
#include "kernel/conf.h"
// Initialize the EFI FB subsystem
SH_STATUS sh_efifb_init_fb(sh_conf_FB_CONFIG *fb_conf,sh_page_PAGE_TABLE_POOL *ptp);
// Initialize the boot progress bar
SH_STATUS sh_efifb_init_bar();
// Set the progress bar to a certain percentage
SH_STATUS sh_efifb_set_bar(sh_uint8 percent);
#endif

View File

@@ -12,6 +12,7 @@ typedef sh_uint8 sh_log_OUTPUT_TYPE;
#define SH_LOG_CRITICAL ((sh_log_OUTPUT_TYPE)4)
#define SH_LOG_FATAL ((sh_log_OUTPUT_TYPE)5)
#define SH_LOG_TEST ((sh_log_OUTPUT_TYPE)6)
#define SH_LOG_FAULT ((sh_log_OUTPUT_TYPE)7)
typedef sh_uint16 sh_log_OUTPUT_SOURCE;
#define SH_LOG_SOURCE_MAIN ((sh_log_OUTPUT_SOURCE)0)
#define SH_LOG_SOURCE_CONF ((sh_log_OUTPUT_SOURCE)1)
@@ -22,6 +23,11 @@ typedef sh_uint16 sh_log_OUTPUT_SOURCE;
#define SH_LOG_SOURCE_PBA ((sh_log_OUTPUT_SOURCE)6)
#define SH_LOG_SOURCE_HEAP ((sh_log_OUTPUT_SOURCE)7)
#define SH_LOG_SOURCE_STD ((sh_log_OUTPUT_SOURCE)8)
#define SH_LOG_SOURCE_MEMS ((sh_log_OUTPUT_SOURCE)9)
#define SH_LOG_SOURCE_CPUF ((sh_log_OUTPUT_SOURCE)10)
#define SH_LOG_SOURCE_ACPI ((sh_log_OUTPUT_SOURCE)11)
#define SH_LOG_SOURCE_TSC ((sh_log_OUTPUT_SOURCE)12)
#define SH_LOG_SOURCE_SMP ((sh_log_OUTPUT_SOURCE)13)
typedef struct {
sh_log_OUTPUT_TYPE output_type;
sh_log_OUTPUT_SOURCE output_source;
@@ -30,11 +36,11 @@ typedef struct {
} sh_log_OUTPUT_PAYLOAD;
// Return SH_TRUE if provided output type is valid.
static inline sh_bool sh_log_output_type_valid(sh_log_OUTPUT_TYPE t) {
return t<=SH_LOG_TEST;
return t<=SH_LOG_FAULT;
}
// Return SH_TRUE if provided source type is valid.
static inline sh_bool sh_log_output_source_valid(sh_log_OUTPUT_SOURCE s) {
return s<=SH_LOG_SOURCE_STD;
return s<=SH_LOG_SOURCE_SMP;
}
// Load serial logging setting
void sh_log_load_serial_setting(sh_bool is_disabled);
@@ -46,6 +52,8 @@ void sh_log_load_logging_ring_size(sh_uint16 pages_count);
sh_uint32 sh_log_get_logging_ring_size();
// Return total bytes written to the ring buffer
sh_uint64 sh_log_get_total_bytes_written();
// Disable global logging ring, should only be used after SMP is enabled
void sh_log_disable_global_logging_ring();
// Log a byte
void sh_log_byte(sh_uint8 byte);
// Log a string
@@ -103,6 +111,8 @@ SH_STATUS sh_log_error(const char* str,sh_log_OUTPUT_SOURCE source);
SH_STATUS sh_log_critical(const char* str,sh_log_OUTPUT_SOURCE source);
// Print a string to fatal channel, from provided source.
SH_STATUS sh_log_fatal(const char* str,sh_log_OUTPUT_SOURCE source);
// Print a string to fault channel, from provided source.
SH_STATUS sh_log_fault(const char* str,sh_log_OUTPUT_SOURCE source);
// Print a string to test channel. Doesn't include the new line caracter.
SH_STATUS sh_log_ltest(const char* str);
// Print a string to debug channel, from provided source. Doesn't include the new line caracter.
@@ -117,6 +127,8 @@ SH_STATUS sh_log_lerror(const char* str,sh_log_OUTPUT_SOURCE source);
SH_STATUS sh_log_lcritical(const char* str,sh_log_OUTPUT_SOURCE source);
// Print a string to fatal channel, from provided source. Doesn't include the new line caracter.
SH_STATUS sh_log_lfatal(const char* str,sh_log_OUTPUT_SOURCE source);
// Print a string to fault channel, from provided source. Doesn't include the new line caracter.
SH_STATUS sh_log_lfault(const char* str,sh_log_OUTPUT_SOURCE source);
// The following functions format the output before logging it. The syntax is as follow:
// - %s : char*
// - %d : double
@@ -141,6 +153,8 @@ SH_STATUS sh_log_ferror(const sh_log_OUTPUT_SOURCE source,const char* format,...
SH_STATUS sh_log_fcritical(const sh_log_OUTPUT_SOURCE source,const char* format,...);
// Print a string to fatal channel, from provided source. Format it before hand
SH_STATUS sh_log_ffatal(const sh_log_OUTPUT_SOURCE source,const char* format,...);
// Print a string to fault channel, from provided source. Format it before hand
SH_STATUS sh_log_ffault(const sh_log_OUTPUT_SOURCE source,const char* format,...);
// Print every information about memory statictics. Require log level to be 1 or 0
SH_STATUS sh_log_mem_stats(sh_log_OUTPUT_SOURCE source);
#endif

View File

@@ -4,4 +4,5 @@
#include "kernel/tests/test_radix.h"
#include "kernel/tests/test_pez.h"
#include "kernel/tests/test_malloc.h"
#include "kernel/tests/test_queues.h"
#include "kernel/tests/test_utils.h"

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,8 @@
// SPDX-License-Identifier: MPL-2.0
#ifndef SH_LIB_TEST_QUEUES_H
#define SH_LIB_TEST_QUEUES_H
#include "std/stdlib.h"
#include "cpu/tsc.h"
// Test and benchmark queues from standard library
SH_STATUS sh_test_benchmark_queues();
#endif

View File

@@ -5,7 +5,7 @@
#include "std/status.h"
#include "cpu/tsc.h"
// Compute and print time stats based on provided list of TSC values.
SH_STATUS sh_test_compute_print_stats(char* benchname,sh_tsc_TSC_VALUE *tsc_value_array,sh_uint64 array_size);
SH_STATUS sh_test_compute_print_stats(char* benchname,sh_tsc_TSC_VALUE *tsc_value_array,sh_uint64 array_size,sh_bool use_std_print);
// Return pointer to TSC values buffer
sh_tsc_TSC_VALUE* sh_test_get_tsc_values_buffer_ptr();
// Load the number of iterations for benchmarks.