feat(kernel): update configuration

Signed-off-by: EnderIce2 <enderice2@protonmail.com>
This commit is contained in:
EnderIce2 2025-03-27 14:31:22 +00:00
parent 4cc058ab42
commit 13d52897b8
Signed by: enderice2
GPG Key ID: FEB6B8A8507BA62E
6 changed files with 14 additions and 24 deletions

View File

@ -64,7 +64,7 @@ extern "C" uintptr_t SystemCallsHandler(SyscallsFrame *Frame)
Tasking::TaskInfo *Ttinfo = &thisThread->Info; Tasking::TaskInfo *Ttinfo = &thisThread->Info;
uintptr_t ret; uintptr_t ret;
if (Config.UseLinuxSyscalls) if (Config.LinuxSubsystem)
{ {
ret = HandleLinuxSyscalls(Frame); ret = HandleLinuxSyscalls(Frame);
goto Ret; goto Ret;

View File

@ -33,7 +33,7 @@ struct KernelConfig
bool SchedulerType; bool SchedulerType;
char DriverDirectory[256]; char DriverDirectory[256];
char InitPath[256]; char InitPath[256];
bool UseLinuxSyscalls; bool LinuxSubsystem;
bool InterruptsOnCrash; bool InterruptsOnCrash;
int Cores; int Cores;
int IOAPICInterruptCore; int IOAPICInterruptCore;

View File

@ -43,7 +43,7 @@ struct KernelConfig Config = {
.SchedulerType = Multi, .SchedulerType = Multi,
.DriverDirectory = {'/', 's', 'y', 's', '/', 'd', 'r', 'v', '\0'}, .DriverDirectory = {'/', 's', 'y', 's', '/', 'd', 'r', 'v', '\0'},
.InitPath = {'/', 's', 'y', 's', '/', 'b', 'i', 'n', '/', 'i', 'n', 'i', 't', '\0'}, .InitPath = {'/', 's', 'y', 's', '/', 'b', 'i', 'n', '/', 'i', 'n', 'i', 't', '\0'},
.UseLinuxSyscalls = false, .LinuxSubsystem = false,
.InterruptsOnCrash = true, .InterruptsOnCrash = true,
.Cores = 0, .Cores = 0,
.IOAPICInterruptCore = 0, .IOAPICInterruptCore = 0,

View File

@ -65,7 +65,7 @@ static struct cag_option ConfigOptions[] = {
.access_letters = "yY", .access_letters = "yY",
.access_name = "linux", .access_name = "linux",
.value_name = "BOOL", .value_name = "BOOL",
.description = "Use Linux syscalls by default"}, .description = "Use Linux Subsystem"},
{.identifier = 'l', {.identifier = 'l',
.access_letters = NULL, .access_letters = NULL,
@ -99,21 +99,11 @@ static struct cag_option ConfigOptions[] = {
void ParseConfig(char *ConfigString, KernelConfig *ModConfig) void ParseConfig(char *ConfigString, KernelConfig *ModConfig)
{ {
if (ConfigString == NULL || assert(ConfigString != NULL && ModConfig != NULL);
strlen(ConfigString) == 0) if (strlen(ConfigString) == 0)
{
KPrint("Empty kernel parameters!");
return; return;
}
if (ModConfig == NULL)
{
KPrint("ModConfig is NULL!");
return;
}
KPrint("Kernel parameters: %s", ConfigString); KPrint("Kernel parameters: %s", ConfigString);
debug("Kernel parameters: %s", ConfigString);
char *argv[32]; char *argv[32];
int argc = 0; int argc = 0;
@ -214,9 +204,9 @@ void ParseConfig(char *ConfigString, KernelConfig *ModConfig)
{ {
value = cag_option_get_value(&context); value = cag_option_get_value(&context);
strcmp(value, "true") == 0 strcmp(value, "true") == 0
? ModConfig->UseLinuxSyscalls = true ? ModConfig->LinuxSubsystem = true
: ModConfig->UseLinuxSyscalls = false; : ModConfig->LinuxSubsystem = false;
KPrint("Use Linux syscalls by default: %s", value); KPrint("Use Linux Subsystem by default: %s", value);
break; break;
} }
case 'o': case 'o':
@ -255,9 +245,9 @@ void ParseConfig(char *ConfigString, KernelConfig *ModConfig)
} }
case 'h': case 'h':
{ {
KPrint("\n---------------------------------------------------------------------------\nUsage: fennix.elf [OPTION]...\nKernel configuration."); KPrint("Usage: fennix.elf [OPTION]...");
cag_option_print(ConfigOptions, CAG_ARRAY_SIZE(ConfigOptions), KPrint("Fennix Kernel v%s", KERNEL_VERSION);
nullptr); cag_option_print(ConfigOptions, CAG_ARRAY_SIZE(ConfigOptions), nullptr);
KPrint("\x1b[1;31;41mSystem Halted."); KPrint("\x1b[1;31;41mSystem Halted.");
CPU::Stop(); CPU::Stop();
} }

View File

@ -48,7 +48,7 @@ cold int SpawnInit()
nullptr}; nullptr};
Tasking::TaskCompatibility compat = Tasking::Native; Tasking::TaskCompatibility compat = Tasking::Native;
if (Config.UseLinuxSyscalls) if (Config.LinuxSubsystem)
compat = Tasking::Linux; compat = Tasking::Linux;
return Execute::Spawn(Config.InitPath, argv, envp, return Execute::Spawn(Config.InitPath, argv, envp,

View File

@ -600,7 +600,7 @@ void KShellThread()
} }
Tasking::TaskCompatibility compat = Tasking::Native; Tasking::TaskCompatibility compat = Tasking::Native;
if (Config.UseLinuxSyscalls) if (Config.LinuxSubsystem)
compat = Tasking::Linux; compat = Tasking::Linux;
int ret = Execute::Spawn((char *)path.c_str(), argv, envp, int ret = Execute::Spawn((char *)path.c_str(), argv, envp,