From 8bfd42a027bc3332c06c93216ae6aaea02cb4126 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Thu, 16 Feb 2012 20:55:47 +0800 Subject: [PATCH] Kernel - Fixed bug in x86/proc.c (caused early task preemption) - Also updated some commenting --- KernelLand/Kernel/Makefile | 22 +++++++++++++++++----- KernelLand/Kernel/arch/x86/proc.c | 3 ++- KernelLand/Kernel/drv/vterm.c | 6 +++++- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/KernelLand/Kernel/Makefile b/KernelLand/Kernel/Makefile index 531ab655..da0ecb72 100644 --- a/KernelLand/Kernel/Makefile +++ b/KernelLand/Kernel/Makefile @@ -82,6 +82,8 @@ clean: @$(RM) $(BIN) ../Acess2.$(ARCH).gz $(BIN).dsm ../Map.$(ARCH).txt LineCounts.$(ARCH).txt @$(RM) -r $(OBJDIR) $(OBJ) $(DEPFILES) $(BUILDINFO_SRC) +# Creates a stripped and compressed copy of the kernel +# and installs it to the target install: $(BIN) @cp $(BIN) $(BIN)_ @$(STRIP) $(BIN)_ @@ -89,9 +91,16 @@ install: $(BIN) @$(RM) $(BIN)_ $(xCP) $(GZBIN) $(DISTROOT) +# Compile API documentation apidoc: doxygen Doxyfile.api +# Output binary +# - Links kernel +# - Disassembles it +# - Gets a line count +# - Increments the build count +# - Does whatever architecture defined rules $(BIN): $(OBJ) $(MODS) arch/$(ARCHDIR)/link.ld Makefile ../../BuildConf/$(ARCH)/Makefile.cfg ../../BuildConf/$(ARCH)/$(PLATFORM).mk @echo --- LD -o $(BIN) @$(LD) $(LDFLAGS) -o $(BIN) $(OBJ) $(MODS) --defsym __buildnum=$$(( $(BUILD_NUM) + 1 )) -Map ../Map.$(ARCH).txt @@ -100,6 +109,7 @@ $(BIN): $(OBJ) $(MODS) arch/$(ARCHDIR)/link.ld Makefile ../../BuildConf/$(ARCH)/ @echo BUILD_NUM = $$(( $(BUILD_NUM) + 1 )) > Makefile.BuildNum.$(ARCH) $(POSTBUILD) +# Assembly Sources $(OBJDIR)%.ao$(OBJSUFFIX): %.$(AS_SUFFIX) Makefile @echo --- AS -o $@ @mkdir -p $(dir $@) @@ -108,28 +118,30 @@ ifeq ($(AS_SUFFIX),S) @$(MAKEDEP) $(CPPFLAGS) -MT $@ -o $(OBJDIR)$*.ao.dep$(OBJSUFFIX) $< endif +# C Sources $(OBJDIR)%.o$(OBJSUFFIX): %.c Makefile -# if exists %*/Makefile -# @make -C %*/ all -# else @echo --- CC -o $@ @mkdir -p $(dir $@) @$(CC) $(CFLAGS) $(CPPFLAGS) -o $@ -c $< @$(MAKEDEP) $(CPPFLAGS) -MT $@ -o $(OBJDIR)$*.o.dep$(OBJSUFFIX) $< -# endif +# Build-time linked modules %.xo.$(ARCH): @BUILDTYPE=static make -C $* all +# System call lists include/syscalls.h include/syscalls.inc.asm: syscalls.lst Makefile GenSyscalls.pl perl GenSyscalls.pl -Makefile: ../Makefile.cfg arch/$(ARCHDIR)/Makefile +# Rules based on the makefile +Makefile: ../../Makefile.cfg arch/$(ARCHDIR)/Makefile +# Build-time information (git hash and build number) $(BUILDINFO_SRC): $(filter-out $(BUILDINFO_OBJ), $(OBJ)) $(MODS) arch/$(ARCHDIR)/link.ld Makefile @echo "#include " > $@ @echo "const char gsGitHash[] = \""`git log -n 1 | head -n 1 | awk '{print $$2}'`"\";" >> $@ @echo "const int giBuildNumber = $(BUILD_NUM);" >> $@ +# Compile rule for buildinfo (needs a special one because it's not a general source file) $(BUILDINFO_OBJ): $(BUILDINFO_SRC) @echo --- CC -o $@ @$(CC) $(CFLAGS) $(CPPFLAGS) -o $@ -c $< diff --git a/KernelLand/Kernel/arch/x86/proc.c b/KernelLand/Kernel/arch/x86/proc.c index fb6b52de..aef72785 100644 --- a/KernelLand/Kernel/arch/x86/proc.c +++ b/KernelLand/Kernel/arch/x86/proc.c @@ -986,7 +986,6 @@ void Proc_Scheduler(int CPU) outb(0x20, 0x20); __asm__ __volatile__ ("sti"); - gaCPUs[CPU].LastTimerThread = gaCPUs[CPU].Current; // Call the timer update code Timer_CallTimers(); @@ -995,6 +994,8 @@ void Proc_Scheduler(int CPU) { Proc_Reschedule(); } + + gaCPUs[CPU].LastTimerThread = gaCPUs[CPU].Current; } // === EXPORTS === diff --git a/KernelLand/Kernel/drv/vterm.c b/KernelLand/Kernel/drv/vterm.c index b5e42d3e..5bce8a16 100644 --- a/KernelLand/Kernel/drv/vterm.c +++ b/KernelLand/Kernel/drv/vterm.c @@ -1,5 +1,9 @@ /* - * Acess2 Virtual Terminal Driver + * Acess2 Kernel + * - By John Hodge (thePowersGang) + * + * drv/vterm.c + * - Virtual Terminal - Initialisation and VFS Interface */ #define DEBUG 0 #include "vterm.h" -- 2.20.1