From ec6ce4b70e0b81b289b0a75507fe4e47c13360c1 Mon Sep 17 00:00:00 2001 From: Achilleas Anagnostopoulos Date: Wed, 31 May 2017 15:07:02 +0100 Subject: [PATCH] Move Kmain into its own package This allows us to keep the error definition in the kernel package without causing circular import errors --- Makefile | 2 +- kernel/{ => kmain}/kmain.go | 2 +- stub.go | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) rename kernel/{ => kmain}/kmain.go (98%) diff --git a/Makefile b/Makefile index 11f945b..69d64a8 100644 --- a/Makefile +++ b/Makefile @@ -52,7 +52,7 @@ go.o: @# with slashes we create a global symbol alias for kernel.Kmain @echo "[objcopy] creating global symbol alias 'kernel.Kmain' for 'github.com/achilleasa/gopher-os/kernel.Kmain' in go.o" @objcopy \ - --add-symbol kernel.Kmain=.text:0x`nm $(BUILD_DIR)/go.o | grep "kernel.Kmain$$" | cut -d' ' -f1` \ + --add-symbol kernel.Kmain=.text:0x`nm $(BUILD_DIR)/go.o | grep "kmain.Kmain$$" | cut -d' ' -f1` \ $(BUILD_DIR)/go.o $(BUILD_DIR)/go.o binutils_version_check: diff --git a/kernel/kmain.go b/kernel/kmain/kmain.go similarity index 98% rename from kernel/kmain.go rename to kernel/kmain/kmain.go index b2a4ae6..9ee1f8f 100644 --- a/kernel/kmain.go +++ b/kernel/kmain/kmain.go @@ -1,4 +1,4 @@ -package kernel +package kmain import ( "github.com/achilleasa/gopher-os/kernel/hal" diff --git a/stub.go b/stub.go index 28fe2b4..5263408 100644 --- a/stub.go +++ b/stub.go @@ -1,6 +1,6 @@ package main -import "github.com/achilleasa/gopher-os/kernel" +import "github.com/achilleasa/gopher-os/kernel/kmain" var multibootInfoPtr uintptr @@ -11,5 +11,5 @@ var multibootInfoPtr uintptr // A global variable is passed as an argument to Kmain to prevent the compiler // from inlining the actual call and removing Kmain from the generated .o file. func main() { - kernel.Kmain(multibootInfoPtr) + kmain.Kmain(multibootInfoPtr) }