From c92cb89399355565e22a7775ddb5e79bdd44eb0f Mon Sep 17 00:00:00 2001 From: Adrien Bourmault Date: Fri, 15 Nov 2019 21:31:10 +0100 Subject: [PATCH] stuff --- Makefile | 5 +++-- kaleid/kernel/ke/cpuid.c | 4 ++-- kaleid/kernel/sh/shcmds.c | 24 +++++++----------------- 3 files changed, 12 insertions(+), 21 deletions(-) diff --git a/Makefile b/Makefile index 08f501c..804affe 100644 --- a/Makefile +++ b/Makefile @@ -31,6 +31,7 @@ # Debug mode ?= debug ram ?= 4G +cpu ?= core2duo # Programs ASM=nasm @@ -265,12 +266,12 @@ OS/K: $(dep) ./ProjectTree $(BINDIR)/kaleid ## QEMU/DEBUG RELATED testkvm: all install - @qemu-system-x86_64 -vga std -cpu core2duo -enable-kvm -soundhw pcspk -s \ + @qemu-system-x86_64 -vga std -enable-kvm -soundhw pcspk -s \ -rtc base=localtime -m $(ram) -hda $(installdisk) \ -d cpu_reset,guest_errors,pcall,int 2> $(BUILDDIR)/qemu.log & test: all install - @qemu-system-x86_64 -vga std -cpu core2duo -soundhw pcspk -s \ + @qemu-system-x86_64 -vga std -cpu $(cpu) -soundhw pcspk -s \ -rtc base=localtime -m $(ram) -hda $(installdisk) \ -d cpu_reset,guest_errors,pcall,int 2> $(BUILDDIR)/qemu.log & diff --git a/kaleid/kernel/ke/cpuid.c b/kaleid/kernel/ke/cpuid.c index 2214694..4c5017b 100644 --- a/kaleid/kernel/ke/cpuid.c +++ b/kaleid/kernel/ke/cpuid.c @@ -40,9 +40,9 @@ void KeGetCpuInfos(void) if (CpuInfo.featureFlag & FEAT_EDX_SSE) { KeActivateSSE(); - } - CpuInfo.frequency = KeGetCpuFrequency(); + CpuInfo.frequency = KeGetCpuFrequency(); + } DebugLog("\tCPU %s %#d KHz detected with features %#x\n", CpuInfo.vendorStr, diff --git a/kaleid/kernel/sh/shcmds.c b/kaleid/kernel/sh/shcmds.c index a284fd6..7ed807e 100644 --- a/kaleid/kernel/sh/shcmds.c +++ b/kaleid/kernel/sh/shcmds.c @@ -115,23 +115,12 @@ error_t CmdColor(int argc, char **argv, char *cmdline) return EOK; } -error_t CmdCpuid(int argc, char **argv, char *cmdline) -{ - return EOK; -} - error_t CmdDate(int argc, char **argv, char *cmdline) { KernLog("%.10s\n", KeFormatCurTime()); return EOK; } -error_t CmdDie(int argc, char **argv, char *cmdline) -{ - *(char *)NULL += 1; - return EOK; -} - error_t CmdSleep(int argc, char **argv, char *cmdline) { int delay = ShAtoi(argv[1]); @@ -211,10 +200,13 @@ error_t CmdMemUsage(int argc, char **argv, char *cmdline); error_t CmdPF(int argc, char **argv, char *cmdline) { - for (int i = 0; i < 32; i++) { - KernLog("%dGB ", i); - *((char*)(i*GB)) = 1; - } + char *address = (void*)(ulong)ShAtoi(argv[1]); + + KernLog("Provoking Page Fault at %#x\n", address); + + *address = 1; + + KernLog("No page fault : address was valid/present\n"); return EOK; } @@ -307,9 +299,7 @@ Command_t shcmdtable[] = { "beep", CmdBeep, "Make a beep" }, { "cls", CmdClear, "Clears standard output" }, { "color", CmdColor, "Change shell text color" }, - { "cpuid", CmdCpuid, "Request a cpuid info." }, { "date", CmdDate, "Print date" }, - { "die", CmdDie, "Die painfully" }, { "dmpsec", CmdDumpATASect, "Dump an ATA sector on screen" }, { "help", CmdHelp, "Show this message" }, { "mmap", CmdMemMap, "Show memory map" },