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;
uintptr_t ret;
if (Config.UseLinuxSyscalls)
if (Config.LinuxSubsystem)
{
ret = HandleLinuxSyscalls(Frame);
goto Ret;

View File

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

View File

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

View File

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

View File

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

View File

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