mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-28 21:28:21 +00:00
kernel_args: redo implementation
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
#include <kernel/vmm.h>
|
||||
#include <kernel/interrupt.h>
|
||||
#include <arch/tsc.h>
|
||||
#include <kernel/cmdline.h>
|
||||
#include <kernel/kernel_args.h>
|
||||
|
||||
#include <uacpi/acpi.h>
|
||||
#include <uacpi/tables.h>
|
||||
@@ -61,8 +61,10 @@ static void counterirq(isr_t *isr, context_t *context) {
|
||||
write64(HPET_REG_CONFIG, 1 + ((hpet_private.type == TYPE_LEGACY) ? 2 : 0));
|
||||
}
|
||||
|
||||
DEFINE_KERNEL_ARGUMENT(nohpet, bool);
|
||||
|
||||
static bool hpet_probe(void) {
|
||||
if (cmdline_get("nohpet"))
|
||||
if (GET_KERNEL_ARGUMENT(nohpet, bool))
|
||||
return false;
|
||||
|
||||
bool usable = false;
|
||||
|
||||
@@ -48,6 +48,13 @@ SECTIONS
|
||||
*(.data .data.*);
|
||||
} :data
|
||||
|
||||
. = ALIGN(8);
|
||||
.kernel_arguments : {
|
||||
kernel_arguments = .;
|
||||
*(.kernel_arguments);
|
||||
kernel_arguments_end = .;
|
||||
} :data
|
||||
|
||||
. = ALIGN(8);
|
||||
.bss : {
|
||||
*(COMMON)
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include <arch/cpuid.h>
|
||||
#include <kernel/pmm.h>
|
||||
#include <arch/tsc.h>
|
||||
#include <kernel/cmdline.h>
|
||||
#include <kernel/kernel_args.h>
|
||||
|
||||
#define KVM_TIMER_SYSTEM_TIME_ALIGNMENT 4
|
||||
#define KVM_TIMER_SYSTEM_TIME_ENABLE 1
|
||||
@@ -23,8 +23,10 @@ typedef struct {
|
||||
uint8_t padding1[2];
|
||||
} __attribute__((packed)) kvm_timer_info_t;
|
||||
|
||||
DEFINE_KERNEL_ARGUMENT(nokvmclock, bool);
|
||||
|
||||
static bool kvm_timer_probe(void) {
|
||||
if (cmdline_get("nokvmclock"))
|
||||
if (GET_KERNEL_ARGUMENT(nokvmclock, bool))
|
||||
return false;
|
||||
|
||||
// figure out if we are running in kvm
|
||||
|
||||
@@ -4,11 +4,13 @@
|
||||
#include <arch/cpu.h>
|
||||
#include <arch/gdt.h>
|
||||
#include <arch/idt.h>
|
||||
#include <kernel/cmdline.h>
|
||||
#include <kernel/kernel_args.h>
|
||||
#include <arch/smp.h>
|
||||
#include <kernel/alloc.h>
|
||||
#include <kernel/init.h>
|
||||
|
||||
DEFINE_KERNEL_ARGUMENT(nosmp, bool);
|
||||
|
||||
static volatile struct limine_smp_request smprequest = {
|
||||
.id = LIMINE_SMP_REQUEST
|
||||
};
|
||||
@@ -58,8 +60,8 @@ void arch_smp_haltallothers(void) {
|
||||
}
|
||||
|
||||
size_t arch_smp_get_cpu_count(void) {
|
||||
//if (cmdline_get("nosmp"))
|
||||
// return 1;
|
||||
if (GET_KERNEL_ARGUMENT(nosmp, bool))
|
||||
return 1;
|
||||
|
||||
struct limine_smp_response *response = smprequest.response;
|
||||
if (response == NULL)
|
||||
@@ -95,7 +97,7 @@ void arch_smp_wakeup(void) {
|
||||
smp_cpus = alloc(response->cpu_count * sizeof(cpu_t *));
|
||||
__assert(smp_cpus);
|
||||
|
||||
void (*wakeupfn)(struct limine_smp_info *) = cpuwakeup;//cmdline_get("nosmp") ? cpuwakeuphalt : cpuwakeup;
|
||||
void (*wakeupfn)(struct limine_smp_info *) = GET_KERNEL_ARGUMENT(nosmp, bool) ? cpuwakeuphalt : cpuwakeup;
|
||||
|
||||
// make the other processors jump to cpuwakeup()
|
||||
for (int i = 0; i < response->cpu_count; ++i) {
|
||||
|
||||
@@ -4,10 +4,12 @@
|
||||
#include <logging.h>
|
||||
#include <kernel/alloc.h>
|
||||
#include <arch/hpet.h>
|
||||
#include <kernel/cmdline.h>
|
||||
#include <kernel/kernel_args.h>
|
||||
|
||||
DEFINE_KERNEL_ARGUMENT(notsc, bool);
|
||||
|
||||
static bool tsc_probe(void) {
|
||||
if (cmdline_get("notsc"))
|
||||
if (GET_KERNEL_ARGUMENT(notsc, bool))
|
||||
return false;
|
||||
|
||||
cpuid_results_t cpuid_results;
|
||||
|
||||
Reference in New Issue
Block a user