From 8dfe27531e4619325ff65fe42689112a9d58cbd4 Mon Sep 17 00:00:00 2001 From: jspc Date: Sat, 5 Feb 2022 13:53:05 +0000 Subject: [PATCH 1/9] Call various kernel inits directly, rather than via an import See: https://github.com/icexin/eggos/issues/98 Because of the way go loads init functions from packages, any steps which must occur before kernel init (setting loglevels, perhaps) requires a bit of hacking. By generating these calls as a first class init function for a given unikernel we can avoid having to hack around the golang init function loader. This change adds a generate command to egg, which can be to allow developers to maintain their own eggos include file to allow for developers to change how their unikernel is run, such as being able to change the value of GOMAXPROCS, or disable networking. The build command now checks for the presence of this file. If it does not exist then the build command will use the current method of generating a file and overlay. Otherwise it uses the user specified file. Finally, the file we generate is prefixed with `zz_` to try and influence when the file loads, in order to let user specified init functions (like setting log levels) to run first --- FAQ.md | 8 +++++ cmd/egg/build/builder.go | 23 ++++++------ cmd/egg/build/patch.go | 68 ++++++++++++++++-------------------- cmd/egg/cmd/build.go | 4 --- cmd/egg/cmd/generate.go | 43 +++++++++++++++++++++++ cmd/egg/cmd/run.go | 9 ----- cmd/egg/generate/generate.go | 62 ++++++++++++++++++++++++++++++++ cmd/egg/generate/template.go | 49 ++++++++++++++++++++++++++ cmd/egg/util/util.go | 15 ++++++++ 9 files changed, 220 insertions(+), 61 deletions(-) create mode 100644 cmd/egg/cmd/generate.go create mode 100644 cmd/egg/generate/generate.go create mode 100644 cmd/egg/generate/template.go create mode 100644 cmd/egg/util/util.go diff --git a/FAQ.md b/FAQ.md index 23702d4..d253399 100644 --- a/FAQ.md +++ b/FAQ.md @@ -14,3 +14,11 @@ Nope. You can install [multiple versions](https://go.dev/doc/manage-install#inst ```bash $ GOROOT=$(go1.16.13 env GOROOT) egg build ``` + +### How do I disable mouse/ network/ filesystem support? + +By default, running `egg build` will transparently load a set of well tested, useful drivers and kernel components into your application by generating an init function which configures things. + +This works wonderfully for turning any application into a useful, and usable, unikernel but is not without drawbacks- especially where things like mice, or filesystem support is not needed. + +You can run `egg generate` at the root of your project and then edit the file `zz_load_eggos.go` accordingly. The presence of this file will stop `egg build` generating anything its self. diff --git a/cmd/egg/build/builder.go b/cmd/egg/build/builder.go index aa540d9..dfd2f0e 100644 --- a/cmd/egg/build/builder.go +++ b/cmd/egg/build/builder.go @@ -4,7 +4,8 @@ import ( "io/ioutil" "os" "os/exec" - "path/filepath" + + "github.com/icexin/eggos/cmd/egg/util" ) type Config struct { @@ -19,11 +20,13 @@ type Config struct { type Builder struct { cfg Config basedir string + gobin string } func NewBuilder(cfg Config) *Builder { return &Builder{ - cfg: cfg, + cfg: cfg, + gobin: util.GoBin(), } } @@ -34,6 +37,7 @@ func (b *Builder) Build() error { return err } b.basedir = basedir + defer os.RemoveAll(basedir) } else { b.basedir = b.cfg.Basedir @@ -47,13 +51,6 @@ func (b *Builder) Build() error { return b.buildPkg() } -func (b *Builder) gobin() string { - if b.cfg.GoRoot == "" { - return "go" - } - return filepath.Join(b.cfg.GoRoot, "bin", "go") -} - func (b *Builder) fixGoTags() bool { args := b.cfg.GoArgs for i, arg := range args { @@ -84,7 +81,11 @@ func (b *Builder) buildPkg() error { buildArgs = append(buildArgs, "-tags", "eggos") } buildArgs = append(buildArgs, "-ldflags", ldflags) - buildArgs = append(buildArgs, "-overlay", b.overlayFile()) + + if !b.localImportFileExists() { + buildArgs = append(buildArgs, "-overlay", b.overlayFile()) + } + buildArgs = append(buildArgs, b.cfg.GoArgs...) env := append([]string{}, os.Environ()...) @@ -94,7 +95,7 @@ func (b *Builder) buildPkg() error { "CGO_ENABLED=0", }...) - cmd := exec.Command(b.gobin(), buildArgs...) + cmd := exec.Command(b.gobin, buildArgs...) cmd.Env = env cmd.Stdin = os.Stdin cmd.Stdout = os.Stdout diff --git a/cmd/egg/build/patch.go b/cmd/egg/build/patch.go index d7c50f7..6db508f 100644 --- a/cmd/egg/build/patch.go +++ b/cmd/egg/build/patch.go @@ -3,29 +3,21 @@ package build import ( "bytes" "encoding/json" + "errors" "log" "os" "os/exec" "path/filepath" "strings" - "text/template" + + "github.com/icexin/eggos/cmd/egg/generate" ) const ( eggosModulePath = "github.com/icexin/eggos" - eggosImportFile = "import_eggos.go" overlayFile = "overlay.json" ) -var ( - eggosImportTpl = template.Must(template.New("eggos").Parse(` - //+build eggos - - package {{.name}} - import _ "github.com/icexin/eggos" - `)) -) - type gomodule struct { Module struct { Path string `json:"Path"` @@ -45,16 +37,27 @@ type buildOverlay struct { } func (b *Builder) eggosImportFile() string { - return filepath.Join(b.basedir, eggosImportFile) + return filepath.Join(b.basedir, generate.ImportFile) +} + +func (b Builder) localImportFileExists() bool { + _, err := os.Stat(generate.ImportFile) + if err == nil { + return true + } + + if errors.Is(err, os.ErrNotExist) { + return false + } + + panic(err) } func (b *Builder) overlayFile() string { return filepath.Join(b.basedir, overlayFile) } -func (b *Builder) buildPrepare() error { - var err error - +func (b *Builder) buildPrepare() (err error) { if !b.modHasEggos() { log.Printf("eggos not found in go.mod") err = b.editGoMod() @@ -63,12 +66,16 @@ func (b *Builder) buildPrepare() error { } } - err = b.writeImportFile(b.eggosImportFile()) + if b.localImportFileExists() { + return + } + + err = b.writeImportFile() if err != nil { return err } - err = writeOverlayFile(b.overlayFile(), eggosImportFile, b.eggosImportFile()) + err = writeOverlayFile(b.overlayFile(), generate.ImportFile, b.eggosImportFile()) if err != nil { return err } @@ -87,7 +94,7 @@ func writeOverlayFile(overlayFile, dest, source string) error { func (b *Builder) readGomodule() (*gomodule, error) { var buf bytes.Buffer - cmd := exec.Command(b.gobin(), "mod", "edit", "-json") + cmd := exec.Command(b.gobin, "mod", "edit", "-json") cmd.Stdout = &buf err := cmd.Run() if err != nil { @@ -129,23 +136,15 @@ func (b *Builder) editGoMod() error { "GOARCH=amd64", } env = append(env, os.Environ()...) - cmd := exec.Command(b.gobin(), "get", getPath) + cmd := exec.Command(b.gobin, "get", getPath) cmd.Env = env cmd.Stdout = os.Stdout cmd.Stderr = os.Stderr return cmd.Run() } -func (b *Builder) currentPkgName() string { - out, err := exec.Command(b.gobin(), "list", "-f", `{{.Name}}`).CombinedOutput() - if err != nil { - log.Panicf("get current package name:%s", out) - } - return strings.TrimSpace(string(out)) -} - func (b *Builder) currentModulePath() string { - out, err := exec.Command(b.gobin(), "list", "-f", `{{.Module.Path}}`).CombinedOutput() + out, err := exec.Command(b.gobin, "list", "-f", `{{.Module.Path}}`).CombinedOutput() if err != nil { log.Panicf("get current module path:%s", out) } @@ -153,16 +152,11 @@ func (b *Builder) currentModulePath() string { } -func (b *Builder) writeImportFile(fname string) error { - pkgname := b.currentPkgName() - var rawFile bytes.Buffer - err := eggosImportTpl.Execute(&rawFile, map[string]interface{}{ - "name": pkgname, - }) +func (b *Builder) writeImportFile() (err error) { + g, err := generate.NewGenerator(b.basedir) if err != nil { - return err + return } - err = os.WriteFile(fname, rawFile.Bytes(), 0644) - return err + return g.Generate() } diff --git a/cmd/egg/cmd/build.go b/cmd/egg/cmd/build.go index b4ee0ec..ba2aed9 100644 --- a/cmd/egg/cmd/build.go +++ b/cmd/egg/cmd/build.go @@ -22,10 +22,6 @@ import ( "github.com/spf13/cobra" ) -var ( - output string -) - // buildCmd represents the build command var buildCmd = &cobra.Command{ Use: "build", diff --git a/cmd/egg/cmd/generate.go b/cmd/egg/cmd/generate.go new file mode 100644 index 0000000..288806e --- /dev/null +++ b/cmd/egg/cmd/generate.go @@ -0,0 +1,43 @@ +package cmd + +import ( + "log" + "os" + + "github.com/icexin/eggos/cmd/egg/generate" + "github.com/spf13/cobra" +) + +// generateCmd represents the generate command +var generateCmd = &cobra.Command{ + Use: "generate", + Short: "generate an eggos loader file in this project", + Long: `generate the zz_load_eggos.go file in this projetc directly +in order to affect the components which are built into the unikernel. + +Should this file not exist, running 'egg build' will generate a temporary one.`, + Run: func(*cobra.Command, []string) { + err := runGenerate() + if err != nil { + log.Fatal(err) + } + }, +} + +func runGenerate() (err error) { + wd, err := os.Getwd() + if err != nil { + return + } + + g, err := generate.NewGenerator(wd) + if err != nil { + return + } + + return g.Generate() +} + +func init() { + rootCmd.AddCommand(generateCmd) +} diff --git a/cmd/egg/cmd/run.go b/cmd/egg/cmd/run.go index 5e4b55d..4fc25b2 100644 --- a/cmd/egg/cmd/run.go +++ b/cmd/egg/cmd/run.go @@ -122,15 +122,6 @@ func runKernel(args []string) error { } } -func fileExists(name string) bool { - if _, err := os.Stat(name); err != nil { - if os.IsNotExist(err) { - return false - } - } - return true -} - func mustLoaderFile(fname string) { content, err := assets.Boot.ReadFile("boot/multiboot.elf") if err != nil { diff --git a/cmd/egg/generate/generate.go b/cmd/egg/generate/generate.go new file mode 100644 index 0000000..50afa98 --- /dev/null +++ b/cmd/egg/generate/generate.go @@ -0,0 +1,62 @@ +package generate + +import ( + "bytes" + "log" + "os" + "os/exec" + "path/filepath" + "strings" + + "github.com/icexin/eggos/cmd/egg/util" +) + +const ( + ImportFile = "zz_load_eggos.go" +) + +type Generator struct { + gobin string + basedir string +} + +func NewGenerator(basedir string) (g Generator, err error) { + g = Generator{ + gobin: util.GoBin(), + basedir: basedir, + } + + return +} + +func (g Generator) Generate() error { + return g.writeImportFile(g.eggosImportFile()) +} + +func (g *Generator) eggosImportFile() string { + return filepath.Join(g.basedir, ImportFile) +} + +func (b *Generator) currentPkgName() string { + out, err := exec.Command(b.gobin, "list", "-f", `{{.Name}}`).CombinedOutput() + if err != nil { + log.Panicf("get current package name:%s", out) + } + + return strings.TrimSpace(string(out)) +} + +func (g *Generator) writeImportFile(fname string) error { + pkgname := g.currentPkgName() + var rawFile bytes.Buffer + + err := eggosImportTpl.Execute(&rawFile, map[string]interface{}{ + "name": pkgname, + }) + + if err != nil { + return err + } + + return os.WriteFile(fname, rawFile.Bytes(), 0644) +} diff --git a/cmd/egg/generate/template.go b/cmd/egg/generate/template.go new file mode 100644 index 0000000..993f29a --- /dev/null +++ b/cmd/egg/generate/template.go @@ -0,0 +1,49 @@ +package generate + +import ( + "text/template" +) + +var ( + eggosImportTpl = template.Must(template.New("eggos").Parse(`//+build eggos +package {{.name}} + +import ( + "runtime" + + "github.com/icexin/eggos/console" + "github.com/icexin/eggos/drivers/cga/fbcga" + _ "github.com/icexin/eggos/drivers/e1000" + "github.com/icexin/eggos/drivers/kbd" + "github.com/icexin/eggos/drivers/pci" + "github.com/icexin/eggos/drivers/ps2/mouse" + "github.com/icexin/eggos/drivers/uart" + "github.com/icexin/eggos/drivers/vbe" + "github.com/icexin/eggos/fs" + "github.com/icexin/eggos/inet" + "github.com/icexin/eggos/kernel" +) + +func kernelInit() { + // trap and syscall threads use two Ps, + // and the remainings are for other goroutines + runtime.GOMAXPROCS(6) + + kernel.Init() + uart.Init() + kbd.Init() + mouse.Init() + console.Init() + + fs.Init() + vbe.Init() + fbcga.Init() + pci.Init() + inet.Init() +} + +func init() { + kernelInit() +} +`)) +) diff --git a/cmd/egg/util/util.go b/cmd/egg/util/util.go new file mode 100644 index 0000000..170e631 --- /dev/null +++ b/cmd/egg/util/util.go @@ -0,0 +1,15 @@ +package util + +import ( + "os" + "path/filepath" +) + +func GoBin() string { + gr, ok := os.LookupEnv("GOROOT") + if !ok { + return "go" + } + + return filepath.Join(gr, "bin", "go") +} From 5d9febd7e4abb3b210aba1c0c2e128464d3b3aa5 Mon Sep 17 00:00:00 2001 From: jspc Date: Sat, 5 Feb 2022 15:55:05 +0000 Subject: [PATCH 2/9] Use egg generate to manage package entrypoint --- magefile.go | 8 +++++++- eggos.go => zz_load_eggos.go | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) rename eggos.go => zz_load_eggos.go (98%) diff --git a/magefile.go b/magefile.go index 3185c7f..45c4876 100644 --- a/magefile.go +++ b/magefile.go @@ -1,4 +1,5 @@ -//+build mage +//go:build mage +// +build mage package main @@ -157,6 +158,11 @@ func Egg() error { return nil } +func Includes() error { + mg.Deps(Egg) + return sh.RunV(eggBin, "generate") +} + func Clean() { rmGlob("*.o") rmGlob("kernel.elf") diff --git a/eggos.go b/zz_load_eggos.go similarity index 98% rename from eggos.go rename to zz_load_eggos.go index 4240d24..dcc6399 100644 --- a/eggos.go +++ b/zz_load_eggos.go @@ -1,3 +1,4 @@ +//+build eggos package eggos import ( From 63937712df62fde0ba46876594f22e9765c49721 Mon Sep 17 00:00:00 2001 From: jspc Date: Sat, 5 Feb 2022 15:55:36 +0000 Subject: [PATCH 3/9] Allow egg to control test app --- tests/net_test.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/net_test.go b/tests/net_test.go index 7df5227..672cc93 100644 --- a/tests/net_test.go +++ b/tests/net_test.go @@ -4,8 +4,6 @@ import ( "net" "net/http" "testing" - - _ "github.com/icexin/eggos" ) func TestHTTP(t *testing.T) { From d1842e049bbc1b365f01b1e57fe42268e0b9a008 Mon Sep 17 00:00:00 2001 From: jspc Date: Wed, 26 Oct 2022 11:25:47 +0100 Subject: [PATCH 4/9] Replace module path to aid install --- app/cmd/cat.go | 2 +- app/cmd/cd.go | 2 +- app/cmd/cpuinfo.go | 2 +- app/cmd/date.go | 4 ++-- app/cmd/echo.go | 2 +- app/cmd/ls.go | 2 +- app/cmd/memtest.go | 2 +- app/cmd/mount.go | 8 ++++---- app/cmd/nes.go | 8 ++++---- app/cmd/nssh.go | 2 +- app/cmd/pstack.go | 2 +- app/cmd/sleep.go | 2 +- app/cmd/top.go | 6 +++--- app/cmd/win.go | 12 ++++++------ app/context.go | 4 ++-- app/cowsay/cowsay.go | 4 ++-- app/examples/graphic/main.go | 2 +- app/examples/syscall/main.go | 2 +- app/gin/server.go | 2 +- app/go.mod | 12 ++++++------ app/httpd/httpd.go | 4 ++-- app/js/autocomplete.go | 2 +- app/js/js.go | 2 +- app/js/repl.go | 2 +- app/js/vm.go | 2 +- app/kmain/apps.go | 16 ++++++++-------- app/kmain/main.go | 8 ++++---- app/phy/game.go | 6 +++--- app/sh/autocomplete.go | 2 +- app/sh/sh.go | 4 ++-- app/shiny/event.go | 4 ++-- app/shiny/window.go | 8 ++++---- app/sshd/sshd.go | 2 +- app/uidemo/demo.go | 4 ++-- cmd/egg/build/builder.go | 4 ++-- cmd/egg/build/patch.go | 4 ++-- cmd/egg/cmd/build.go | 2 +- cmd/egg/cmd/generate.go | 2 +- cmd/egg/cmd/pack.go | 4 ++-- cmd/egg/cmd/run.go | 4 ++-- cmd/egg/cmd/test.go | 2 +- cmd/egg/generate/generate.go | 2 +- cmd/egg/generate/template.go | 22 +++++++++++----------- cmd/egg/main.go | 2 +- cmd/go.mod | 2 +- console/console.go | 6 +++--- drivers/cga/backend.go | 6 +++--- drivers/cga/fbcga/fbcga.go | 2 +- drivers/clock/cmos.go | 2 +- drivers/e1000/e1000.go | 12 ++++++------ drivers/kbd/kbd.go | 6 +++--- drivers/pci/addr.go | 2 +- drivers/pci/pci.go | 6 +++--- drivers/pic/pic.go | 2 +- drivers/ps2/mouse/mouse.go | 6 +++--- drivers/ps2/ps2.go | 2 +- drivers/qemu/qemu.go | 2 +- drivers/uart/uart.go | 6 +++--- drivers/vbe/fb.go | 6 +++--- fs/vfs.go | 12 ++++++------ go.mod | 2 +- inet/dhcp/client.go | 2 +- inet/socket.go | 2 +- inet/sockfile.go | 6 +++--- inet/stack.go | 4 ++-- kernel/env.go | 4 ++-- kernel/epoll.go | 4 ++-- kernel/init.go | 2 +- kernel/isyscall/syscall.go | 2 +- kernel/mm/mm.go | 6 +++--- kernel/mm/pool.go | 2 +- kernel/panic.go | 8 ++++---- kernel/pipe.go | 2 +- kernel/rt0.go | 8 ++++---- kernel/seg_amd64.go | 2 +- kernel/syscall.go | 14 +++++++------- kernel/syscall_thread.go | 6 +++--- kernel/thread.go | 4 ++-- kernel/timer.go | 6 +++--- kernel/trap.go | 10 +++++----- kernel/trap_thread.go | 6 +++--- log/log.go | 6 +++--- log/log_test.go | 2 +- zz_load_eggos.go | 22 +++++++++++----------- 84 files changed, 204 insertions(+), 204 deletions(-) diff --git a/app/cmd/cat.go b/app/cmd/cat.go index d2200b0..9dab2c2 100644 --- a/app/cmd/cat.go +++ b/app/cmd/cat.go @@ -5,7 +5,7 @@ import ( "fmt" "io" - "github.com/icexin/eggos/app" + "github.com/jspc/eggos/app" "github.com/spf13/afero" ) diff --git a/app/cmd/cd.go b/app/cmd/cd.go index 4ede274..13a7e6b 100644 --- a/app/cmd/cd.go +++ b/app/cmd/cd.go @@ -3,7 +3,7 @@ package cmd import ( "errors" - "github.com/icexin/eggos/app" + "github.com/jspc/eggos/app" ) func cdmain(ctx *app.Context) error { diff --git a/app/cmd/cpuinfo.go b/app/cmd/cpuinfo.go index 99e287c..de24795 100644 --- a/app/cmd/cpuinfo.go +++ b/app/cmd/cpuinfo.go @@ -4,7 +4,7 @@ import ( "encoding/json" "fmt" - "github.com/icexin/eggos/app" + "github.com/jspc/eggos/app" "github.com/klauspost/cpuid" ) diff --git a/app/cmd/date.go b/app/cmd/date.go index a97d23b..7b8dd09 100644 --- a/app/cmd/date.go +++ b/app/cmd/date.go @@ -4,8 +4,8 @@ import ( "fmt" "time" - "github.com/icexin/eggos/app" - "github.com/icexin/eggos/drivers/clock" + "github.com/jspc/eggos/app" + "github.com/jspc/eggos/drivers/clock" ) func datemain(ctx *app.Context) error { diff --git a/app/cmd/echo.go b/app/cmd/echo.go index 0e87a88..7e756f7 100644 --- a/app/cmd/echo.go +++ b/app/cmd/echo.go @@ -4,7 +4,7 @@ import ( "fmt" "strings" - "github.com/icexin/eggos/app" + "github.com/jspc/eggos/app" ) func echomain(ctx *app.Context) error { diff --git a/app/cmd/ls.go b/app/cmd/ls.go index e9fec8a..3db2647 100644 --- a/app/cmd/ls.go +++ b/app/cmd/ls.go @@ -6,7 +6,7 @@ import ( "os" "text/tabwriter" - "github.com/icexin/eggos/app" + "github.com/jspc/eggos/app" ) func printfiles(w io.Writer, files ...os.FileInfo) { diff --git a/app/cmd/memtest.go b/app/cmd/memtest.go index a0478cc..232d059 100644 --- a/app/cmd/memtest.go +++ b/app/cmd/memtest.go @@ -6,7 +6,7 @@ import ( "math/rand" "time" - "github.com/icexin/eggos/app" + "github.com/jspc/eggos/app" ) func memtestmain(ctx *app.Context) error { diff --git a/app/cmd/mount.go b/app/cmd/mount.go index ebd3b73..a768c78 100644 --- a/app/cmd/mount.go +++ b/app/cmd/mount.go @@ -4,10 +4,10 @@ import ( "errors" "net/url" - "github.com/icexin/eggos/app" - "github.com/icexin/eggos/fs" - "github.com/icexin/eggos/fs/smb" - "github.com/icexin/eggos/fs/stripprefix" + "github.com/jspc/eggos/app" + "github.com/jspc/eggos/fs" + "github.com/jspc/eggos/fs/smb" + "github.com/jspc/eggos/fs/stripprefix" ) func mountmain(ctx *app.Context) error { diff --git a/app/cmd/nes.go b/app/cmd/nes.go index 15dfb21..ef0a0d4 100644 --- a/app/cmd/nes.go +++ b/app/cmd/nes.go @@ -10,10 +10,10 @@ import ( "io" "time" - "github.com/icexin/eggos/app" - "github.com/icexin/eggos/drivers/kbd" - "github.com/icexin/eggos/drivers/vbe" - "github.com/icexin/eggos/log" + "github.com/jspc/eggos/app" + "github.com/jspc/eggos/drivers/kbd" + "github.com/jspc/eggos/drivers/vbe" + "github.com/jspc/eggos/log" "github.com/fogleman/nes/nes" "golang.org/x/image/draw" diff --git a/app/cmd/nssh.go b/app/cmd/nssh.go index fbfbe0b..2939a87 100644 --- a/app/cmd/nssh.go +++ b/app/cmd/nssh.go @@ -4,7 +4,7 @@ import ( "fmt" "net" - "github.com/icexin/eggos/app" + "github.com/jspc/eggos/app" ) func nsshmain(ctx *app.Context) error { diff --git a/app/cmd/pstack.go b/app/cmd/pstack.go index daeb6f8..0e89c48 100644 --- a/app/cmd/pstack.go +++ b/app/cmd/pstack.go @@ -3,7 +3,7 @@ package cmd import ( "runtime" - "github.com/icexin/eggos/app" + "github.com/jspc/eggos/app" ) func gostack() []byte { diff --git a/app/cmd/sleep.go b/app/cmd/sleep.go index 69f09b2..90acac6 100644 --- a/app/cmd/sleep.go +++ b/app/cmd/sleep.go @@ -6,7 +6,7 @@ import ( "fmt" "time" - "github.com/icexin/eggos/app" + "github.com/jspc/eggos/app" ) func sleepmain(ctx *app.Context) error { diff --git a/app/cmd/top.go b/app/cmd/top.go index bd145ac..d3e6fb0 100644 --- a/app/cmd/top.go +++ b/app/cmd/top.go @@ -5,9 +5,9 @@ import ( "strings" "time" - "github.com/icexin/eggos/app" - "github.com/icexin/eggos/drivers/kbd" - "github.com/icexin/eggos/kernel" + "github.com/jspc/eggos/app" + "github.com/jspc/eggos/drivers/kbd" + "github.com/jspc/eggos/kernel" ) func printstat(ctx *app.Context) { diff --git a/app/cmd/win.go b/app/cmd/win.go index 7c75939..5e7b058 100644 --- a/app/cmd/win.go +++ b/app/cmd/win.go @@ -9,12 +9,12 @@ import ( "unsafe" "github.com/fogleman/fauxgl" - "github.com/icexin/eggos/app" - "github.com/icexin/eggos/drivers/kbd" - "github.com/icexin/eggos/drivers/ps2/mouse" - "github.com/icexin/eggos/drivers/vbe" - "github.com/icexin/nk/cnk" - "github.com/icexin/nk/libc" + "github.com/jspc/eggos/app" + "github.com/jspc/eggos/drivers/kbd" + "github.com/jspc/eggos/drivers/ps2/mouse" + "github.com/jspc/eggos/drivers/vbe" + "github.com/jspc/nk/cnk" + "github.com/jspc/nk/libc" "golang.org/x/image/draw" ) diff --git a/app/context.go b/app/context.go index 2b38411..3e000ad 100644 --- a/app/context.go +++ b/app/context.go @@ -5,8 +5,8 @@ import ( "fmt" "io" - "github.com/icexin/eggos/fs" - "github.com/icexin/eggos/fs/chdir" + "github.com/jspc/eggos/fs" + "github.com/jspc/eggos/fs/chdir" "github.com/peterh/liner" ) diff --git a/app/cowsay/cowsay.go b/app/cowsay/cowsay.go index f8f22d5..ef24209 100644 --- a/app/cowsay/cowsay.go +++ b/app/cowsay/cowsay.go @@ -15,8 +15,8 @@ import ( "github.com/dj456119/go-cowsay/gocowsay" - "github.com/icexin/eggos/app" - "github.com/icexin/eggos/app/cowsay/animal" + "github.com/jspc/eggos/app" + "github.com/jspc/eggos/app/cowsay/animal" ) var animalTempalteMap = make(map[string]AnimalTemplate) diff --git a/app/examples/graphic/main.go b/app/examples/graphic/main.go index 6342584..78cec10 100644 --- a/app/examples/graphic/main.go +++ b/app/examples/graphic/main.go @@ -8,7 +8,7 @@ import ( "math/rand" "time" - "github.com/icexin/eggos/drivers/vbe" + "github.com/jspc/eggos/drivers/vbe" ) var palette = []color.Color{color.White, color.Black} diff --git a/app/examples/syscall/main.go b/app/examples/syscall/main.go index 0d0731a..60a4387 100644 --- a/app/examples/syscall/main.go +++ b/app/examples/syscall/main.go @@ -5,7 +5,7 @@ import ( "os" "syscall" - "github.com/icexin/eggos/kernel/isyscall" + "github.com/jspc/eggos/kernel/isyscall" ) var handler isyscall.Handler diff --git a/app/gin/server.go b/app/gin/server.go index 1279116..41e12e1 100644 --- a/app/gin/server.go +++ b/app/gin/server.go @@ -6,7 +6,7 @@ import ( "net/http" "github.com/gin-gonic/gin" - "github.com/icexin/eggos/app" + "github.com/jspc/eggos/app" ) func main(ctx *app.Context) error { diff --git a/app/go.mod b/app/go.mod index 8a2be26..47a3033 100644 --- a/app/go.mod +++ b/app/go.mod @@ -1,4 +1,4 @@ -module github.com/icexin/eggos/app +module github.com/jspc/eggos/app go 1.16 @@ -10,8 +10,8 @@ require ( github.com/fogleman/nes v0.0.0-20210605215016-0aace4b1814a github.com/gin-gonic/gin v1.7.2 github.com/gliderlabs/ssh v0.3.3 - github.com/icexin/eggos v0.0.0-00010101000000-000000000000 - github.com/icexin/nk v0.1.0 + github.com/jspc/eggos v0.0.0-00010101000000-000000000000 + github.com/jspc/nk v0.1.0 github.com/jakecoffman/cp v1.1.0 github.com/klauspost/cpuid v1.3.1 github.com/mattn/go-shellwords v1.0.12 @@ -27,7 +27,7 @@ require ( ) replace ( - github.com/aarzilli/nucular => github.com/icexin/nucular v0.0.0-20210713192454-c3f236ca56cb - github.com/fogleman/nes => github.com/icexin/nes v0.0.0-20200906065456-8ff789fac016 - github.com/icexin/eggos => ../ + github.com/aarzilli/nucular => github.com/jspc/nucular v0.0.0-20210713192454-c3f236ca56cb + github.com/fogleman/nes => github.com/jspc/nes v0.0.0-20200906065456-8ff789fac016 + github.com/jspc/eggos => ../ ) diff --git a/app/httpd/httpd.go b/app/httpd/httpd.go index 209151c..4b52803 100644 --- a/app/httpd/httpd.go +++ b/app/httpd/httpd.go @@ -3,8 +3,8 @@ package httpd import ( "net/http" - "github.com/icexin/eggos/app" - "github.com/icexin/eggos/fs" + "github.com/jspc/eggos/app" + "github.com/jspc/eggos/fs" "github.com/spf13/afero" ) diff --git a/app/js/autocomplete.go b/app/js/autocomplete.go index fd94aa9..2c5c478 100644 --- a/app/js/autocomplete.go +++ b/app/js/autocomplete.go @@ -4,7 +4,7 @@ import ( "regexp" "strings" - "github.com/icexin/eggos/app" + "github.com/jspc/eggos/app" "github.com/peterh/liner" "github.com/robertkrimen/otto" ) diff --git a/app/js/js.go b/app/js/js.go index 5dc392c..38b9fe4 100644 --- a/app/js/js.go +++ b/app/js/js.go @@ -1,7 +1,7 @@ package js import ( - "github.com/icexin/eggos/app" + "github.com/jspc/eggos/app" "github.com/robertkrimen/otto" "github.com/spf13/afero" ) diff --git a/app/js/repl.go b/app/js/repl.go index d838bad..3d0f111 100644 --- a/app/js/repl.go +++ b/app/js/repl.go @@ -4,7 +4,7 @@ import ( "fmt" "strings" - "github.com/icexin/eggos/app" + "github.com/jspc/eggos/app" "github.com/robertkrimen/otto" ) diff --git a/app/js/vm.go b/app/js/vm.go index 0d8245a..6a6dc5f 100644 --- a/app/js/vm.go +++ b/app/js/vm.go @@ -6,7 +6,7 @@ import ( "io/ioutil" "net/http" - "github.com/icexin/eggos/kernel/sys" + "github.com/jspc/eggos/kernel/sys" "github.com/robertkrimen/otto" ) diff --git a/app/kmain/apps.go b/app/kmain/apps.go index 8c5cbcd..c881de7 100644 --- a/app/kmain/apps.go +++ b/app/kmain/apps.go @@ -1,13 +1,13 @@ package main import ( - _ "github.com/icexin/eggos/app/cmd" - // _ "github.com/icexin/eggos/app/gin" - _ "github.com/icexin/eggos/app/cowsay" - _ "github.com/icexin/eggos/app/httpd" - _ "github.com/icexin/eggos/app/js" - _ "github.com/icexin/eggos/app/phy" + _ "github.com/jspc/eggos/app/cmd" + // _ "github.com/jspc/eggos/app/gin" + _ "github.com/jspc/eggos/app/cowsay" + _ "github.com/jspc/eggos/app/httpd" + _ "github.com/jspc/eggos/app/js" + _ "github.com/jspc/eggos/app/phy" - // _ "github.com/icexin/eggos/app/sshd" - _ "github.com/icexin/eggos/app/uidemo" + // _ "github.com/jspc/eggos/app/sshd" + _ "github.com/jspc/eggos/app/uidemo" ) diff --git a/app/kmain/main.go b/app/kmain/main.go index afbeb83..77e5004 100644 --- a/app/kmain/main.go +++ b/app/kmain/main.go @@ -6,10 +6,10 @@ import ( "os" "runtime" - _ "github.com/icexin/eggos" - "github.com/icexin/eggos/app/sh" - "github.com/icexin/eggos/console" - "github.com/icexin/eggos/log" + _ "github.com/jspc/eggos" + "github.com/jspc/eggos/app/sh" + "github.com/jspc/eggos/console" + "github.com/jspc/eggos/log" ) func main() { diff --git a/app/phy/game.go b/app/phy/game.go index 4f83b01..02d22bf 100644 --- a/app/phy/game.go +++ b/app/phy/game.go @@ -10,9 +10,9 @@ import ( "math/rand" "time" - "github.com/icexin/eggos/app" - "github.com/icexin/eggos/drivers/kbd" - "github.com/icexin/eggos/drivers/vbe" + "github.com/jspc/eggos/app" + "github.com/jspc/eggos/drivers/kbd" + "github.com/jspc/eggos/drivers/vbe" "github.com/jakecoffman/cp" ) diff --git a/app/sh/autocomplete.go b/app/sh/autocomplete.go index f0918d8..3ec69d4 100644 --- a/app/sh/autocomplete.go +++ b/app/sh/autocomplete.go @@ -4,7 +4,7 @@ import ( "path" "strings" - "github.com/icexin/eggos/app" + "github.com/jspc/eggos/app" "github.com/spf13/afero" ) diff --git a/app/sh/sh.go b/app/sh/sh.go index a8247ea..969ae2a 100644 --- a/app/sh/sh.go +++ b/app/sh/sh.go @@ -5,8 +5,8 @@ import ( "log" "strings" - "github.com/icexin/eggos/app" - "github.com/icexin/eggos/console" + "github.com/jspc/eggos/app" + "github.com/jspc/eggos/console" "github.com/mattn/go-shellwords" ) diff --git a/app/shiny/event.go b/app/shiny/event.go index b992f38..cbe4f8e 100644 --- a/app/shiny/event.go +++ b/app/shiny/event.go @@ -1,8 +1,8 @@ package shiny import ( - "github.com/icexin/eggos/console" - imouse "github.com/icexin/eggos/drivers/ps2/mouse" + "github.com/jspc/eggos/console" + imouse "github.com/jspc/eggos/drivers/ps2/mouse" "golang.org/x/mobile/event/key" "golang.org/x/mobile/event/mouse" "golang.org/x/sys/unix" diff --git a/app/shiny/window.go b/app/shiny/window.go index f9384e7..92200fa 100644 --- a/app/shiny/window.go +++ b/app/shiny/window.go @@ -6,10 +6,10 @@ import ( "image/draw" "image/png" - "github.com/icexin/eggos/assets" - imouse "github.com/icexin/eggos/drivers/ps2/mouse" - "github.com/icexin/eggos/drivers/uart" - "github.com/icexin/eggos/drivers/vbe" + "github.com/jspc/eggos/assets" + imouse "github.com/jspc/eggos/drivers/ps2/mouse" + "github.com/jspc/eggos/drivers/uart" + "github.com/jspc/eggos/drivers/vbe" "golang.org/x/exp/shiny/screen" "golang.org/x/image/math/f64" ) diff --git a/app/sshd/sshd.go b/app/sshd/sshd.go index 8ee9e64..843155a 100644 --- a/app/sshd/sshd.go +++ b/app/sshd/sshd.go @@ -6,7 +6,7 @@ import ( "net" "github.com/gliderlabs/ssh" - "github.com/icexin/eggos/app" + "github.com/jspc/eggos/app" ) var rsaContent = ` diff --git a/app/uidemo/demo.go b/app/uidemo/demo.go index 224830a..8ac0eaf 100644 --- a/app/uidemo/demo.go +++ b/app/uidemo/demo.go @@ -14,8 +14,8 @@ import ( "github.com/aarzilli/nucular/rect" nstyle "github.com/aarzilli/nucular/style" styled "github.com/aarzilli/nucular/style-editor" - "github.com/icexin/eggos/app" - "github.com/icexin/eggos/app/shiny" + "github.com/jspc/eggos/app" + "github.com/jspc/eggos/app/shiny" "golang.org/x/mobile/event/key" ) diff --git a/cmd/egg/build/builder.go b/cmd/egg/build/builder.go index dfd2f0e..f14409e 100644 --- a/cmd/egg/build/builder.go +++ b/cmd/egg/build/builder.go @@ -5,7 +5,7 @@ import ( "os" "os/exec" - "github.com/icexin/eggos/cmd/egg/util" + "github.com/jspc/eggos/cmd/egg/util" ) type Config struct { @@ -70,7 +70,7 @@ func (b *Builder) fixGoTags() bool { func (b *Builder) buildPkg() error { var buildArgs []string - ldflags := "-E github.com/icexin/eggos/kernel.rt0 -T 0x100000" + ldflags := "-E github.com/jspc/eggos/kernel.rt0 -T 0x100000" if !b.cfg.BuildTest { buildArgs = append(buildArgs, "build") } else { diff --git a/cmd/egg/build/patch.go b/cmd/egg/build/patch.go index 6db508f..5748bdc 100644 --- a/cmd/egg/build/patch.go +++ b/cmd/egg/build/patch.go @@ -10,11 +10,11 @@ import ( "path/filepath" "strings" - "github.com/icexin/eggos/cmd/egg/generate" + "github.com/jspc/eggos/cmd/egg/generate" ) const ( - eggosModulePath = "github.com/icexin/eggos" + eggosModulePath = "github.com/jspc/eggos" overlayFile = "overlay.json" ) diff --git a/cmd/egg/cmd/build.go b/cmd/egg/cmd/build.go index ba2aed9..d9a8fb0 100644 --- a/cmd/egg/cmd/build.go +++ b/cmd/egg/cmd/build.go @@ -18,7 +18,7 @@ package cmd import ( "log" - "github.com/icexin/eggos/cmd/egg/build" + "github.com/jspc/eggos/cmd/egg/build" "github.com/spf13/cobra" ) diff --git a/cmd/egg/cmd/generate.go b/cmd/egg/cmd/generate.go index 288806e..af02069 100644 --- a/cmd/egg/cmd/generate.go +++ b/cmd/egg/cmd/generate.go @@ -4,7 +4,7 @@ import ( "log" "os" - "github.com/icexin/eggos/cmd/egg/generate" + "github.com/jspc/eggos/cmd/egg/generate" "github.com/spf13/cobra" ) diff --git a/cmd/egg/cmd/pack.go b/cmd/egg/cmd/pack.go index b7439d1..e3248df 100644 --- a/cmd/egg/cmd/pack.go +++ b/cmd/egg/cmd/pack.go @@ -25,8 +25,8 @@ import ( "os/exec" "path/filepath" - "github.com/icexin/eggos/cmd/egg/assets" - "github.com/icexin/eggos/cmd/egg/build" + "github.com/jspc/eggos/cmd/egg/assets" + "github.com/jspc/eggos/cmd/egg/build" "github.com/spf13/cobra" ) diff --git a/cmd/egg/cmd/run.go b/cmd/egg/cmd/run.go index 4fc25b2..6642f98 100644 --- a/cmd/egg/cmd/run.go +++ b/cmd/egg/cmd/run.go @@ -25,8 +25,8 @@ import ( "strings" "github.com/google/shlex" - "github.com/icexin/eggos/cmd/egg/assets" - "github.com/icexin/eggos/cmd/egg/build" + "github.com/jspc/eggos/cmd/egg/assets" + "github.com/jspc/eggos/cmd/egg/build" "github.com/spf13/cobra" ) diff --git a/cmd/egg/cmd/test.go b/cmd/egg/cmd/test.go index 1817b5b..1a1c11a 100644 --- a/cmd/egg/cmd/test.go +++ b/cmd/egg/cmd/test.go @@ -21,7 +21,7 @@ import ( "os" "path/filepath" - "github.com/icexin/eggos/cmd/egg/build" + "github.com/jspc/eggos/cmd/egg/build" "github.com/spf13/cobra" ) diff --git a/cmd/egg/generate/generate.go b/cmd/egg/generate/generate.go index 50afa98..5369296 100644 --- a/cmd/egg/generate/generate.go +++ b/cmd/egg/generate/generate.go @@ -8,7 +8,7 @@ import ( "path/filepath" "strings" - "github.com/icexin/eggos/cmd/egg/util" + "github.com/jspc/eggos/cmd/egg/util" ) const ( diff --git a/cmd/egg/generate/template.go b/cmd/egg/generate/template.go index 993f29a..f8458db 100644 --- a/cmd/egg/generate/template.go +++ b/cmd/egg/generate/template.go @@ -11,17 +11,17 @@ package {{.name}} import ( "runtime" - "github.com/icexin/eggos/console" - "github.com/icexin/eggos/drivers/cga/fbcga" - _ "github.com/icexin/eggos/drivers/e1000" - "github.com/icexin/eggos/drivers/kbd" - "github.com/icexin/eggos/drivers/pci" - "github.com/icexin/eggos/drivers/ps2/mouse" - "github.com/icexin/eggos/drivers/uart" - "github.com/icexin/eggos/drivers/vbe" - "github.com/icexin/eggos/fs" - "github.com/icexin/eggos/inet" - "github.com/icexin/eggos/kernel" + "github.com/jspc/eggos/console" + "github.com/jspc/eggos/drivers/cga/fbcga" + _ "github.com/jspc/eggos/drivers/e1000" + "github.com/jspc/eggos/drivers/kbd" + "github.com/jspc/eggos/drivers/pci" + "github.com/jspc/eggos/drivers/ps2/mouse" + "github.com/jspc/eggos/drivers/uart" + "github.com/jspc/eggos/drivers/vbe" + "github.com/jspc/eggos/fs" + "github.com/jspc/eggos/inet" + "github.com/jspc/eggos/kernel" ) func kernelInit() { diff --git a/cmd/egg/main.go b/cmd/egg/main.go index 39945ca..8da449f 100644 --- a/cmd/egg/main.go +++ b/cmd/egg/main.go @@ -15,7 +15,7 @@ limitations under the License. */ package main -import "github.com/icexin/eggos/cmd/egg/cmd" +import "github.com/jspc/eggos/cmd/egg/cmd" func main() { cmd.Execute() diff --git a/cmd/go.mod b/cmd/go.mod index e3b11d3..2a4f45f 100644 --- a/cmd/go.mod +++ b/cmd/go.mod @@ -1,4 +1,4 @@ -module github.com/icexin/eggos/cmd +module github.com/jspc/eggos/cmd go 1.16 diff --git a/console/console.go b/console/console.go index 8701ebe..e866aab 100644 --- a/console/console.go +++ b/console/console.go @@ -6,9 +6,9 @@ import ( "syscall" "unsafe" - "github.com/icexin/eggos/drivers/cga" - "github.com/icexin/eggos/drivers/kbd" - "github.com/icexin/eggos/drivers/uart" + "github.com/jspc/eggos/drivers/cga" + "github.com/jspc/eggos/drivers/kbd" + "github.com/jspc/eggos/drivers/uart" ) const ( diff --git a/drivers/cga/backend.go b/drivers/cga/backend.go index b3aef9a..a52085e 100644 --- a/drivers/cga/backend.go +++ b/drivers/cga/backend.go @@ -3,9 +3,9 @@ package cga import ( "unsafe" - "github.com/icexin/eggos/drivers/cga/fbcga" - "github.com/icexin/eggos/drivers/vbe" - "github.com/icexin/eggos/kernel/sys" + "github.com/jspc/eggos/drivers/cga/fbcga" + "github.com/jspc/eggos/drivers/vbe" + "github.com/jspc/eggos/kernel/sys" ) type Backend interface { diff --git a/drivers/cga/fbcga/fbcga.go b/drivers/cga/fbcga/fbcga.go index 55808f0..0f7a6ee 100644 --- a/drivers/cga/fbcga/fbcga.go +++ b/drivers/cga/fbcga/fbcga.go @@ -5,7 +5,7 @@ import ( "image/color" "image/draw" - "github.com/icexin/eggos/drivers/vbe" + "github.com/jspc/eggos/drivers/vbe" "golang.org/x/image/font" "golang.org/x/image/font/basicfont" diff --git a/drivers/clock/cmos.go b/drivers/clock/cmos.go index 96bae35..50f131b 100644 --- a/drivers/clock/cmos.go +++ b/drivers/clock/cmos.go @@ -3,7 +3,7 @@ package clock import ( "time" - "github.com/icexin/eggos/kernel/sys" + "github.com/jspc/eggos/kernel/sys" ) type CmosTime struct { diff --git a/drivers/e1000/e1000.go b/drivers/e1000/e1000.go index bfe0564..60394de 100644 --- a/drivers/e1000/e1000.go +++ b/drivers/e1000/e1000.go @@ -6,12 +6,12 @@ import ( "time" "unsafe" - "github.com/icexin/eggos/drivers/pci" - "github.com/icexin/eggos/drivers/pic" - "github.com/icexin/eggos/inet" - "github.com/icexin/eggos/kernel/mm" - "github.com/icexin/eggos/kernel/sys" - "github.com/icexin/eggos/log" + "github.com/jspc/eggos/drivers/pci" + "github.com/jspc/eggos/drivers/pic" + "github.com/jspc/eggos/inet" + "github.com/jspc/eggos/kernel/mm" + "github.com/jspc/eggos/kernel/sys" + "github.com/jspc/eggos/log" "gvisor.dev/gvisor/pkg/tcpip/buffer" "gvisor.dev/gvisor/pkg/tcpip/stack" diff --git a/drivers/kbd/kbd.go b/drivers/kbd/kbd.go index a7750d4..6754dbf 100644 --- a/drivers/kbd/kbd.go +++ b/drivers/kbd/kbd.go @@ -1,9 +1,9 @@ package kbd import ( - "github.com/icexin/eggos/drivers/pic" - "github.com/icexin/eggos/kernel/sys" - "github.com/icexin/eggos/kernel/trap" + "github.com/jspc/eggos/drivers/pic" + "github.com/jspc/eggos/kernel/sys" + "github.com/jspc/eggos/kernel/trap" ) const ( diff --git a/drivers/pci/addr.go b/drivers/pci/addr.go index e15d88d..d36ad87 100644 --- a/drivers/pci/addr.go +++ b/drivers/pci/addr.go @@ -1,6 +1,6 @@ package pci -import "github.com/icexin/eggos/kernel/sys" +import "github.com/jspc/eggos/kernel/sys" const ( configAddrPort = 0xcf8 diff --git a/drivers/pci/pci.go b/drivers/pci/pci.go index efe3b91..6aecfa4 100644 --- a/drivers/pci/pci.go +++ b/drivers/pci/pci.go @@ -1,9 +1,9 @@ package pci import ( - "github.com/icexin/eggos/drivers/pic" - "github.com/icexin/eggos/kernel/trap" - "github.com/icexin/eggos/log" + "github.com/jspc/eggos/drivers/pic" + "github.com/jspc/eggos/kernel/trap" + "github.com/jspc/eggos/log" ) type Identity struct { diff --git a/drivers/pic/pic.go b/drivers/pic/pic.go index b476278..90a5858 100644 --- a/drivers/pic/pic.go +++ b/drivers/pic/pic.go @@ -1,6 +1,6 @@ package pic -import "github.com/icexin/eggos/kernel/sys" +import "github.com/jspc/eggos/kernel/sys" const ( PIC1_CMD = 0x20 diff --git a/drivers/ps2/mouse/mouse.go b/drivers/ps2/mouse/mouse.go index 25db9d3..352e92b 100644 --- a/drivers/ps2/mouse/mouse.go +++ b/drivers/ps2/mouse/mouse.go @@ -1,9 +1,9 @@ package mouse import ( - "github.com/icexin/eggos/drivers/pic" - "github.com/icexin/eggos/drivers/ps2" - "github.com/icexin/eggos/kernel/trap" + "github.com/jspc/eggos/drivers/pic" + "github.com/jspc/eggos/drivers/ps2" + "github.com/jspc/eggos/kernel/trap" ) const ( diff --git a/drivers/ps2/ps2.go b/drivers/ps2/ps2.go index d13b9c7..2e230bf 100644 --- a/drivers/ps2/ps2.go +++ b/drivers/ps2/ps2.go @@ -1,6 +1,6 @@ package ps2 -import "github.com/icexin/eggos/kernel/sys" +import "github.com/jspc/eggos/kernel/sys" const ( _CMD_PORT = 0x64 diff --git a/drivers/qemu/qemu.go b/drivers/qemu/qemu.go index b041546..cfa2d5c 100644 --- a/drivers/qemu/qemu.go +++ b/drivers/qemu/qemu.go @@ -1,6 +1,6 @@ package qemu -import "github.com/icexin/eggos/kernel/sys" +import "github.com/jspc/eggos/kernel/sys" const ( qemuExitPort = 0x501 diff --git a/drivers/uart/uart.go b/drivers/uart/uart.go index 4bb4e49..a2c268c 100644 --- a/drivers/uart/uart.go +++ b/drivers/uart/uart.go @@ -1,9 +1,9 @@ package uart import ( - "github.com/icexin/eggos/drivers/pic" - "github.com/icexin/eggos/kernel/sys" - "github.com/icexin/eggos/kernel/trap" + "github.com/jspc/eggos/drivers/pic" + "github.com/jspc/eggos/kernel/sys" + "github.com/jspc/eggos/kernel/trap" ) const ( diff --git a/drivers/vbe/fb.go b/drivers/vbe/fb.go index 00bf434..fea6926 100644 --- a/drivers/vbe/fb.go +++ b/drivers/vbe/fb.go @@ -4,9 +4,9 @@ import ( "image" "unsafe" - "github.com/icexin/eggos/drivers/multiboot" - "github.com/icexin/eggos/drivers/uart" - "github.com/icexin/eggos/kernel/mm" + "github.com/jspc/eggos/drivers/multiboot" + "github.com/jspc/eggos/drivers/uart" + "github.com/jspc/eggos/kernel/mm" ) const bootloaderMagic = 0x2BADB002 diff --git a/fs/vfs.go b/fs/vfs.go index b53bad9..0646ea9 100644 --- a/fs/vfs.go +++ b/fs/vfs.go @@ -8,10 +8,10 @@ import ( "syscall" "unsafe" - "github.com/icexin/eggos/console" - "github.com/icexin/eggos/fs/mount" - "github.com/icexin/eggos/kernel/isyscall" - "github.com/icexin/eggos/kernel/sys" + "github.com/jspc/eggos/console" + "github.com/jspc/eggos/fs/mount" + "github.com/jspc/eggos/kernel/isyscall" + "github.com/jspc/eggos/kernel/sys" "github.com/spf13/afero" ) @@ -215,8 +215,8 @@ func sysUname(c *isyscall.Request) { } buf := (*syscall.Utsname)(unsafe.Pointer(c.Arg(0))) copy(unsafebuf(&buf.Machine), "x86_32") - copy(unsafebuf(&buf.Domainname), "icexin.com") - copy(unsafebuf(&buf.Nodename), "icexin.local") + copy(unsafebuf(&buf.Domainname), "jspc.com") + copy(unsafebuf(&buf.Nodename), "jspc.local") copy(unsafebuf(&buf.Release), "0") copy(unsafebuf(&buf.Sysname), "eggos") copy(unsafebuf(&buf.Version), "0") diff --git a/go.mod b/go.mod index 2534a37..9f78d82 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/icexin/eggos +module github.com/jspc/eggos go 1.16 diff --git a/inet/dhcp/client.go b/inet/dhcp/client.go index 376eade..8d239dc 100644 --- a/inet/dhcp/client.go +++ b/inet/dhcp/client.go @@ -14,7 +14,7 @@ import ( "sync" "time" - "github.com/icexin/eggos/log" + "github.com/jspc/eggos/log" "gvisor.dev/gvisor/pkg/tcpip" "gvisor.dev/gvisor/pkg/tcpip/adapters/gonet" diff --git a/inet/socket.go b/inet/socket.go index 254272a..eb0aba3 100644 --- a/inet/socket.go +++ b/inet/socket.go @@ -3,7 +3,7 @@ package inet import ( "syscall" - "github.com/icexin/eggos/kernel/isyscall" + "github.com/jspc/eggos/kernel/isyscall" "gvisor.dev/gvisor/pkg/tcpip" "gvisor.dev/gvisor/pkg/tcpip/network/ipv4" diff --git a/inet/sockfile.go b/inet/sockfile.go index 535ff5c..bc73bb3 100644 --- a/inet/sockfile.go +++ b/inet/sockfile.go @@ -8,15 +8,15 @@ import ( "time" "unsafe" - "github.com/icexin/eggos/fs" - "github.com/icexin/eggos/log" + "github.com/jspc/eggos/fs" + "github.com/jspc/eggos/log" "gvisor.dev/gvisor/pkg/abi/linux" "gvisor.dev/gvisor/pkg/tcpip" "gvisor.dev/gvisor/pkg/waiter" ) -//go:linkname evnotify github.com/icexin/eggos/kernel.epollNotify +//go:linkname evnotify github.com/jspc/eggos/kernel.epollNotify func evnotify(fd, events uintptr) type sockFile struct { diff --git a/inet/stack.go b/inet/stack.go index 5873306..d97044f 100644 --- a/inet/stack.go +++ b/inet/stack.go @@ -5,8 +5,8 @@ import ( "errors" "time" - "github.com/icexin/eggos/inet/dhcp" - "github.com/icexin/eggos/log" + "github.com/jspc/eggos/inet/dhcp" + "github.com/jspc/eggos/log" "gvisor.dev/gvisor/pkg/tcpip" "gvisor.dev/gvisor/pkg/tcpip/header" diff --git a/kernel/env.go b/kernel/env.go index 530925a..b43f28f 100644 --- a/kernel/env.go +++ b/kernel/env.go @@ -3,8 +3,8 @@ package kernel import ( "unsafe" - "github.com/icexin/eggos/drivers/multiboot" - "github.com/icexin/eggos/kernel/sys" + "github.com/jspc/eggos/drivers/multiboot" + "github.com/jspc/eggos/kernel/sys" "gvisor.dev/gvisor/pkg/abi/linux" ) diff --git a/kernel/epoll.go b/kernel/epoll.go index bb9bcba..feb9aa4 100644 --- a/kernel/epoll.go +++ b/kernel/epoll.go @@ -4,8 +4,8 @@ import ( "syscall" "unsafe" - "github.com/icexin/eggos/kernel/isyscall" - "github.com/icexin/eggos/kernel/mm" + "github.com/jspc/eggos/kernel/isyscall" + "github.com/jspc/eggos/kernel/mm" "gvisor.dev/gvisor/pkg/abi/linux" "gvisor.dev/gvisor/pkg/abi/linux/errno" ) diff --git a/kernel/init.go b/kernel/init.go index 5ca7822..f493a19 100644 --- a/kernel/init.go +++ b/kernel/init.go @@ -1,6 +1,6 @@ package kernel -import "github.com/icexin/eggos/drivers/clock" +import "github.com/jspc/eggos/drivers/clock" // called when go runtime init done func Init() { diff --git a/kernel/isyscall/syscall.go b/kernel/isyscall/syscall.go index acd7269..8461318 100644 --- a/kernel/isyscall/syscall.go +++ b/kernel/isyscall/syscall.go @@ -13,7 +13,7 @@ var ( handlers [512]Handler ) -//go:linkname wakeup github.com/icexin/eggos/kernel.wakeup +//go:linkname wakeup github.com/jspc/eggos/kernel.wakeup func wakeup(lock *uintptr, n int) type Handler func(req *Request) diff --git a/kernel/mm/mm.go b/kernel/mm/mm.go index 6a8a64f..d0f4bc2 100644 --- a/kernel/mm/mm.go +++ b/kernel/mm/mm.go @@ -3,8 +3,8 @@ package mm import ( "unsafe" - "github.com/icexin/eggos/drivers/multiboot" - "github.com/icexin/eggos/kernel/sys" + "github.com/jspc/eggos/drivers/multiboot" + "github.com/jspc/eggos/kernel/sys" ) const ( @@ -36,7 +36,7 @@ func pageEnable() //go:nosplit func lcr3(topPage *entryPage) -//go:linkname throw github.com/icexin/eggos/kernel.throw +//go:linkname throw github.com/jspc/eggos/kernel.throw func throw(msg string) //go:nosplit diff --git a/kernel/mm/pool.go b/kernel/mm/pool.go index eb76ac1..f07e2d1 100644 --- a/kernel/mm/pool.go +++ b/kernel/mm/pool.go @@ -3,7 +3,7 @@ package mm import ( "unsafe" - "github.com/icexin/eggos/kernel/sys" + "github.com/jspc/eggos/kernel/sys" ) //go:notinheap diff --git a/kernel/panic.go b/kernel/panic.go index f48c01d..c4fd0e2 100644 --- a/kernel/panic.go +++ b/kernel/panic.go @@ -3,10 +3,10 @@ package kernel import ( "unsafe" - "github.com/icexin/eggos/drivers/qemu" - "github.com/icexin/eggos/drivers/uart" - "github.com/icexin/eggos/kernel/sys" - "github.com/icexin/eggos/log" + "github.com/jspc/eggos/drivers/qemu" + "github.com/jspc/eggos/drivers/uart" + "github.com/jspc/eggos/kernel/sys" + "github.com/jspc/eggos/log" ) var ( diff --git a/kernel/pipe.go b/kernel/pipe.go index 115b148..eb5597a 100644 --- a/kernel/pipe.go +++ b/kernel/pipe.go @@ -4,7 +4,7 @@ import ( "syscall" "unsafe" - "github.com/icexin/eggos/kernel/isyscall" + "github.com/jspc/eggos/kernel/isyscall" ) // Timer depends on epoll and pipe. diff --git a/kernel/rt0.go b/kernel/rt0.go index bf5674c..f6cf22a 100644 --- a/kernel/rt0.go +++ b/kernel/rt0.go @@ -1,10 +1,10 @@ package kernel import ( - "github.com/icexin/eggos/drivers/multiboot" - "github.com/icexin/eggos/drivers/pic" - "github.com/icexin/eggos/drivers/uart" - "github.com/icexin/eggos/kernel/mm" + "github.com/jspc/eggos/drivers/multiboot" + "github.com/jspc/eggos/drivers/pic" + "github.com/jspc/eggos/drivers/uart" + "github.com/jspc/eggos/kernel/mm" ) //go:nosplit diff --git a/kernel/seg_amd64.go b/kernel/seg_amd64.go index 5312092..c886609 100644 --- a/kernel/seg_amd64.go +++ b/kernel/seg_amd64.go @@ -3,7 +3,7 @@ package kernel import ( "unsafe" - "github.com/icexin/eggos/kernel/sys" + "github.com/jspc/eggos/kernel/sys" ) const ( diff --git a/kernel/syscall.go b/kernel/syscall.go index a537c81..5d6100d 100644 --- a/kernel/syscall.go +++ b/kernel/syscall.go @@ -4,13 +4,13 @@ import ( "syscall" "unsafe" - "github.com/icexin/eggos/drivers/qemu" - "github.com/icexin/eggos/drivers/uart" - "github.com/icexin/eggos/kernel/isyscall" - "github.com/icexin/eggos/kernel/mm" - "github.com/icexin/eggos/kernel/sys" - "github.com/icexin/eggos/kernel/trap" - "github.com/icexin/eggos/log" + "github.com/jspc/eggos/drivers/qemu" + "github.com/jspc/eggos/drivers/uart" + "github.com/jspc/eggos/kernel/isyscall" + "github.com/jspc/eggos/kernel/mm" + "github.com/jspc/eggos/kernel/sys" + "github.com/jspc/eggos/kernel/trap" + "github.com/jspc/eggos/log" "golang.org/x/sys/unix" "gvisor.dev/gvisor/pkg/abi/linux" "gvisor.dev/gvisor/pkg/abi/linux/errno" diff --git a/kernel/syscall_thread.go b/kernel/syscall_thread.go index c737763..82df42f 100644 --- a/kernel/syscall_thread.go +++ b/kernel/syscall_thread.go @@ -5,9 +5,9 @@ import ( "syscall" "unsafe" - "github.com/icexin/eggos/kernel/isyscall" - "github.com/icexin/eggos/kernel/sys" - "github.com/icexin/eggos/log" + "github.com/jspc/eggos/kernel/isyscall" + "github.com/jspc/eggos/kernel/sys" + "github.com/jspc/eggos/log" ) var ( diff --git a/kernel/thread.go b/kernel/thread.go index c9f334e..fa0a980 100644 --- a/kernel/thread.go +++ b/kernel/thread.go @@ -3,8 +3,8 @@ package kernel import ( "unsafe" - "github.com/icexin/eggos/kernel/mm" - "github.com/icexin/eggos/kernel/sys" + "github.com/jspc/eggos/kernel/mm" + "github.com/jspc/eggos/kernel/sys" ) const ( diff --git a/kernel/timer.go b/kernel/timer.go index d437d2a..622bd6c 100644 --- a/kernel/timer.go +++ b/kernel/timer.go @@ -1,9 +1,9 @@ package kernel import ( - "github.com/icexin/eggos/drivers/pic" - "github.com/icexin/eggos/kernel/sys" - "github.com/icexin/eggos/kernel/trap" + "github.com/jspc/eggos/drivers/pic" + "github.com/jspc/eggos/kernel/sys" + "github.com/jspc/eggos/kernel/trap" "gvisor.dev/gvisor/pkg/abi/linux" ) diff --git a/kernel/trap.go b/kernel/trap.go index d9666cb..4b80137 100644 --- a/kernel/trap.go +++ b/kernel/trap.go @@ -3,11 +3,11 @@ package kernel import ( "unsafe" - "github.com/icexin/eggos/drivers/pic" - "github.com/icexin/eggos/kernel/isyscall" - "github.com/icexin/eggos/kernel/sys" - "github.com/icexin/eggos/kernel/trap" - "github.com/icexin/eggos/log" + "github.com/jspc/eggos/drivers/pic" + "github.com/jspc/eggos/kernel/isyscall" + "github.com/jspc/eggos/kernel/sys" + "github.com/jspc/eggos/kernel/trap" + "github.com/jspc/eggos/log" ) var ( diff --git a/kernel/trap_thread.go b/kernel/trap_thread.go index 12bce71..459ac43 100644 --- a/kernel/trap_thread.go +++ b/kernel/trap_thread.go @@ -6,9 +6,9 @@ import ( "syscall" "unsafe" - "github.com/icexin/eggos/drivers/pic" - "github.com/icexin/eggos/kernel/trap" - "github.com/icexin/eggos/log" + "github.com/jspc/eggos/drivers/pic" + "github.com/jspc/eggos/kernel/trap" + "github.com/jspc/eggos/log" ) var ( diff --git a/log/log.go b/log/log.go index 85d05f6..29e3750 100644 --- a/log/log.go +++ b/log/log.go @@ -5,9 +5,9 @@ import ( "fmt" "os" - "github.com/icexin/eggos/console" - "github.com/icexin/eggos/drivers/uart" - "github.com/icexin/eggos/kernel/sys" + "github.com/jspc/eggos/console" + "github.com/jspc/eggos/drivers/uart" + "github.com/jspc/eggos/kernel/sys" ) type LogLevel int8 diff --git a/log/log_test.go b/log/log_test.go index 7e0a3de..60e29e3 100644 --- a/log/log_test.go +++ b/log/log_test.go @@ -3,7 +3,7 @@ package log_test import ( "testing" - "github.com/icexin/eggos/log" + "github.com/jspc/eggos/log" ) func ExampleSetLogLevel() { diff --git a/zz_load_eggos.go b/zz_load_eggos.go index dcc6399..5b2359d 100644 --- a/zz_load_eggos.go +++ b/zz_load_eggos.go @@ -4,17 +4,17 @@ package eggos import ( "runtime" - "github.com/icexin/eggos/console" - "github.com/icexin/eggos/drivers/cga/fbcga" - _ "github.com/icexin/eggos/drivers/e1000" - "github.com/icexin/eggos/drivers/kbd" - "github.com/icexin/eggos/drivers/pci" - "github.com/icexin/eggos/drivers/ps2/mouse" - "github.com/icexin/eggos/drivers/uart" - "github.com/icexin/eggos/drivers/vbe" - "github.com/icexin/eggos/fs" - "github.com/icexin/eggos/inet" - "github.com/icexin/eggos/kernel" + "github.com/jspc/eggos/console" + "github.com/jspc/eggos/drivers/cga/fbcga" + _ "github.com/jspc/eggos/drivers/e1000" + "github.com/jspc/eggos/drivers/kbd" + "github.com/jspc/eggos/drivers/pci" + "github.com/jspc/eggos/drivers/ps2/mouse" + "github.com/jspc/eggos/drivers/uart" + "github.com/jspc/eggos/drivers/vbe" + "github.com/jspc/eggos/fs" + "github.com/jspc/eggos/inet" + "github.com/jspc/eggos/kernel" ) func kernelInit() { From 727be364ac2a1b4fbca7238a7d73c8778d74d950 Mon Sep 17 00:00:00 2001 From: jspc Date: Wed, 26 Oct 2022 11:54:22 +0100 Subject: [PATCH 5/9] Point to correct icexin forks --- app/cmd/win.go | 5 +++-- app/go.mod | 8 ++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/app/cmd/win.go b/app/cmd/win.go index 5e7b058..28918f4 100644 --- a/app/cmd/win.go +++ b/app/cmd/win.go @@ -1,3 +1,4 @@ +//go:build nk // +build nk package cmd @@ -9,12 +10,12 @@ import ( "unsafe" "github.com/fogleman/fauxgl" + "github.com/icexin/nk/cnk" + "github.com/icexin/nk/libc" "github.com/jspc/eggos/app" "github.com/jspc/eggos/drivers/kbd" "github.com/jspc/eggos/drivers/ps2/mouse" "github.com/jspc/eggos/drivers/vbe" - "github.com/jspc/nk/cnk" - "github.com/jspc/nk/libc" "golang.org/x/image/draw" ) diff --git a/app/go.mod b/app/go.mod index 47a3033..935c725 100644 --- a/app/go.mod +++ b/app/go.mod @@ -10,9 +10,9 @@ require ( github.com/fogleman/nes v0.0.0-20210605215016-0aace4b1814a github.com/gin-gonic/gin v1.7.2 github.com/gliderlabs/ssh v0.3.3 - github.com/jspc/eggos v0.0.0-00010101000000-000000000000 - github.com/jspc/nk v0.1.0 + github.com/icexin/nk v0.1.0 github.com/jakecoffman/cp v1.1.0 + github.com/jspc/eggos v0.0.0-00010101000000-000000000000 github.com/klauspost/cpuid v1.3.1 github.com/mattn/go-shellwords v1.0.12 github.com/peterh/liner v1.2.1 @@ -27,7 +27,7 @@ require ( ) replace ( - github.com/aarzilli/nucular => github.com/jspc/nucular v0.0.0-20210713192454-c3f236ca56cb - github.com/fogleman/nes => github.com/jspc/nes v0.0.0-20200906065456-8ff789fac016 + github.com/aarzilli/nucular => github.com/icexin/nucular v0.0.0-20210713192454-c3f236ca56cb + github.com/fogleman/nes => github.com/icexin/nes v0.0.0-20200906065456-8ff789fac016 github.com/jspc/eggos => ../ ) From 9ad5a436f7fe26218ebdf24aba714f744f3f8674 Mon Sep 17 00:00:00 2001 From: jspc Date: Wed, 26 Oct 2022 11:54:35 +0100 Subject: [PATCH 6/9] Ensure errors are logged --- cmd/egg/generate/generate.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/egg/generate/generate.go b/cmd/egg/generate/generate.go index 5369296..6bdea87 100644 --- a/cmd/egg/generate/generate.go +++ b/cmd/egg/generate/generate.go @@ -40,7 +40,7 @@ func (g *Generator) eggosImportFile() string { func (b *Generator) currentPkgName() string { out, err := exec.Command(b.gobin, "list", "-f", `{{.Name}}`).CombinedOutput() if err != nil { - log.Panicf("get current package name:%s", out) + log.Panicf("get current package name:%s", err) } return strings.TrimSpace(string(out)) From bbb0138400b34b2a65b55da690954c04e8e4c8e1 Mon Sep 17 00:00:00 2001 From: jspc Date: Fri, 28 Oct 2022 13:38:15 +0100 Subject: [PATCH 7/9] Erase full screen --- drivers/cga/backend.go | 8 ++++++++ drivers/cga/cga.go | 28 ++++++++++++++++++++++------ 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/drivers/cga/backend.go b/drivers/cga/backend.go index a52085e..7af3b0d 100644 --- a/drivers/cga/backend.go +++ b/drivers/cga/backend.go @@ -17,6 +17,14 @@ type Backend interface { WriteByte(ch byte) } +type EraseMethod uint8 + +const ( + EraseMethod_Unknown EraseMethod = iota + EraseMethod_Line + EraseMethod_All +) + const ( CRTPORT = 0x3d4 bs = '\b' diff --git a/drivers/cga/cga.go b/drivers/cga/cga.go index 9bfa04d..eaec4c6 100644 --- a/drivers/cga/cga.go +++ b/drivers/cga/cga.go @@ -21,15 +21,21 @@ func setCursorColumn(n int) { getbackend().SetPos(pos) } -func eraseLine(method int) { +func eraseLine(method EraseMethod) { backend := getbackend() pos := backend.GetPos() switch method { - case 0: + case EraseMethod_Line: end := (pos/80 + 1) * 80 for i := pos; i < end; i++ { backend.WritePos(i, ' ') } + + case EraseMethod_All: + for i := 0; i < 25*80; i++ { + backend.WritePos(i, ' ') + } + default: panic("unsupported erase line method") } @@ -38,7 +44,7 @@ func eraseLine(method int) { func writeCSI(action byte, params []string) { // fmt.Fprintf(os.Stderr, "action:%c, params:%v\n", action, params) switch action { - // set cursor + // set cursor column case 'G': if len(params) == 0 { setCursorColumn(1) @@ -49,11 +55,21 @@ func writeCSI(action byte, params []string) { // erase line case 'K': if len(params) == 0 { - eraseLine(0) + eraseLine(EraseMethod_Line) } else { - n, _ := strconv.Atoi(params[0]) - eraseLine(n) + //n, _ := strconv.Atoi(params[0]) + eraseLine(EraseMethod_Unknown) } + + // Erase screen - note; this action *looks* like it ought + // to be just [J - which is 'erase from current line to + // bottom of screen', but I actually want it to mimic [2J + // which is 'erase screen and return to top' + // + // Hopefully nobody ever uses my fork if they expect that functionality + case 'J': + eraseLine(EraseMethod_All) + default: panic("unsupported CSI action") } From 9c4d1dbcd3764a238b6260ac441907d0217277bb Mon Sep 17 00:00:00 2001 From: jspc Date: Fri, 28 Oct 2022 13:44:10 +0100 Subject: [PATCH 8/9] Ensure cursor goes to home after --- drivers/cga/cga.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/cga/cga.go b/drivers/cga/cga.go index eaec4c6..64e86ae 100644 --- a/drivers/cga/cga.go +++ b/drivers/cga/cga.go @@ -21,6 +21,10 @@ func setCursorColumn(n int) { getbackend().SetPos(pos) } +func setCursorHome() { + getbackend().SetPos(0) +} + func eraseLine(method EraseMethod) { backend := getbackend() pos := backend.GetPos() @@ -69,9 +73,10 @@ func writeCSI(action byte, params []string) { // Hopefully nobody ever uses my fork if they expect that functionality case 'J': eraseLine(EraseMethod_All) + setCursorHome() default: - panic("unsupported CSI action") + // ignore } } @@ -103,6 +108,7 @@ func WriteByte(ch byte) { case errInvalidChar: parser.Reset() default: + getbackend().WriteByte(ch) // ignore } } From 556c75c878a5ab818adbab8a71f114a4d22020ab Mon Sep 17 00:00:00 2001 From: jspc Date: Fri, 28 Oct 2022 17:04:21 +0100 Subject: [PATCH 9/9] Don't move on yet --- drivers/cga/backend.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/cga/backend.go b/drivers/cga/backend.go index 7af3b0d..f9e66dc 100644 --- a/drivers/cga/backend.go +++ b/drivers/cga/backend.go @@ -96,7 +96,7 @@ func (c *cgabackend) WriteByte(ch byte) { } } c.SetPos(pos) - crt[pos] = ' ' | 0x0700 + //crt[pos] = ' ' | 0x0700 } func getbackend() Backend {