diff --git a/abstract-machine/am/src/native/CMakeLists.txt b/abstract-machine/am/src/native/CMakeLists.txt index d991825..c0ca761 100644 --- a/abstract-machine/am/src/native/CMakeLists.txt +++ b/abstract-machine/am/src/native/CMakeLists.txt @@ -21,5 +21,5 @@ set_target_properties( find_package(SDL2 REQUIRED) target_link_libraries( am-native - PUBLIC SDL2::SDL2 + PUBLIC SDL2::SDL2 dl PRIVATE klib_interface am_interface) diff --git a/abstract-machine/am/src/native/platform.c b/abstract-machine/am/src/native/platform.c index 02f8941..813939a 100644 --- a/abstract-machine/am/src/native/platform.c +++ b/abstract-machine/am/src/native/platform.c @@ -1,11 +1,11 @@ #define _GNU_SOURCE -#include -#include +#include "platform.h" #include #include -#include #include -#include "platform.h" +#include +#include +#include #define MAX_CPU 16 #define TRAP_PAGE_START (void *)0x100000 @@ -70,12 +70,12 @@ static void init_platform() { assert(ret2 == 0); pmem = mmap(PMEM_START, PMEM_SIZE, PROT_READ | PROT_WRITE | PROT_EXEC, - MAP_SHARED | MAP_FIXED, pmem_fd, 0); + MAP_SHARED | MAP_FIXED, pmem_fd, 0); assert(pmem != (void *)-1); // allocate private per-cpu structure thiscpu = mmap(NULL, sizeof(*thiscpu), PROT_READ | PROT_WRITE, - MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); + MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); assert(thiscpu != (void *)-1); thiscpu->cpuid = 0; thiscpu->vm_head = NULL; @@ -83,7 +83,7 @@ static void init_platform() { // create trap page to receive syscall and yield by SIGSEGV int sys_pgsz = sysconf(_SC_PAGESIZE); void *ret = mmap(TRAP_PAGE_START, sys_pgsz, PROT_NONE, - MAP_SHARED | MAP_ANONYMOUS | MAP_FIXED, -1, 0); + MAP_SHARED | MAP_ANONYMOUS | MAP_FIXED, -1, 0); assert(ret != (void *)-1); // save the address of memcpy() in glibc, since it may be linked with klib @@ -94,7 +94,7 @@ static void init_platform() { Elf64_Phdr *phdr = (void *)getauxval(AT_PHDR); int phnum = (int)getauxval(AT_PHNUM); int i; - for (i = 0; i < phnum; i ++) { + for (i = 0; i < phnum; i++) { if (phdr[i].p_type == PT_LOAD && (phdr[i].p_flags & PF_W)) { // allocate temporary memory extern char end; @@ -102,7 +102,8 @@ static void init_platform() { uintptr_t pad = (uintptr_t)vaddr & 0xfff; void *vaddr_align = vaddr - pad; uintptr_t size = phdr[i].p_memsz + pad; - void *temp_mem = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); + void *temp_mem = mmap(NULL, size, PROT_READ | PROT_WRITE, + MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); assert(temp_mem != (void *)-1); // save data and bss sections @@ -110,11 +111,13 @@ static void init_platform() { // save the address of mmap() which will be used after munamp(), // since calling the library functions requires accessing GOT, which will be unmapped - void *(*mmap_libc)(void *, size_t, int, int, int, off_t) = dlsym(RTLD_NEXT, "mmap"); + void *(*mmap_libc)(void *, size_t, int, int, int, off_t) = + dlsym(RTLD_NEXT, "mmap"); assert(mmap_libc != NULL); // load the address of memcpy() on stack, which can still be accessed // after the data section is unmapped - void *(*volatile memcpy_libc_temp)(void *, const void *, size_t) = memcpy_libc; + void *(*volatile memcpy_libc_temp)(void *, const void *, size_t) = + memcpy_libc; // unmap the data and bss sections ret2 = munmap(vaddr_align, size); @@ -122,7 +125,7 @@ static void init_platform() { // map the sections again with MAP_SHARED, which will be shared across fork() ret = mmap_libc(vaddr_align, size, PROT_READ | PROT_WRITE | PROT_EXEC, - MAP_SHARED | MAP_FIXED | MAP_ANONYMOUS, -1, 0); + MAP_SHARED | MAP_FIXED | MAP_ANONYMOUS, -1, 0); assert(ret == vaddr_align); // restore the data in the sections @@ -176,7 +179,8 @@ static void init_platform() { void __am_exit_platform(int code) { // let Linux clean up other resource extern int __am_mpe_init; - if (__am_mpe_init && cpu_count() > 1) kill(0, SIGKILL); + if (__am_mpe_init && cpu_count() > 1) + kill(0, SIGKILL); exit(code); } @@ -185,10 +189,12 @@ void __am_pmem_map(void *va, void *pa, int prot) { int mmap_prot = PROT_NONE; // we do not support executable bit, so mark // all readable pages executable as well - if (prot & MMAP_READ) mmap_prot |= PROT_READ | PROT_EXEC; - if (prot & MMAP_WRITE) mmap_prot |= PROT_WRITE; - void *ret = mmap(va, __am_pgsize, mmap_prot, - MAP_SHARED | MAP_FIXED, pmem_fd, (uintptr_t)(pa - pmem)); + if (prot & MMAP_READ) + mmap_prot |= PROT_READ | PROT_EXEC; + if (prot & MMAP_WRITE) + mmap_prot |= PROT_WRITE; + void *ret = mmap(va, __am_pgsize, mmap_prot, MAP_SHARED | MAP_FIXED, pmem_fd, + (uintptr_t)(pa - pmem)); assert(ret != (void *)-1); } @@ -205,26 +211,21 @@ void __am_get_intr_sigmask(sigset_t *s) { memcpy_libc(s, &__am_intr_sigmask, sizeof(__am_intr_sigmask)); } -int __am_is_sigmask_sti(sigset_t *s) { - return !sigismember(s, SIGVTALRM); -} +int __am_is_sigmask_sti(sigset_t *s) { return !sigismember(s, SIGVTALRM); } -void __am_send_kbd_intr() { - kill(getpid(), SIGUSR1); -} +void __am_send_kbd_intr() { kill(getpid(), SIGUSR1); } void __am_pmem_protect() { -// int ret = mprotect(PMEM_START, PMEM_SIZE, PROT_NONE); -// assert(ret == 0); + // int ret = mprotect(PMEM_START, PMEM_SIZE, PROT_NONE); + // assert(ret == 0); } void __am_pmem_unprotect() { -// int ret = mprotect(PMEM_START, PMEM_SIZE, PROT_READ | PROT_WRITE | PROT_EXEC); -// assert(ret == 0); + // int ret = mprotect(PMEM_START, PMEM_SIZE, PROT_READ | PROT_WRITE | PROT_EXEC); + // assert(ret == 0); } // This dummy function will be called in trm.c. // The purpose of this dummy function is to let linker add this file to the object // file set. Without it, the constructor of @_init_platform will not be linked. -void __am_platform_dummy() { -} +void __am_platform_dummy() {} diff --git a/abstract-machine/am/src/riscv/nemu/CMakeLists.txt b/abstract-machine/am/src/riscv/nemu/CMakeLists.txt index 0ec140f..36a1966 100644 --- a/abstract-machine/am/src/riscv/nemu/CMakeLists.txt +++ b/abstract-machine/am/src/riscv/nemu/CMakeLists.txt @@ -6,7 +6,7 @@ add_library(am-riscv-nemu cte.c start.S trap.S vme.c ${NEMU_SOURCES}) target_compile_options(am-riscv-nemu PRIVATE ${NEMU_COMPILE_OPTIONS} ${RISCV_COMPILE_OPTIONS}) -target_link_options(am-riscv-nemu PRIVATE ${NEMU_LINK_OPITIONS} +target_link_options(am-riscv-nemu INTERFACE ${NEMU_LINK_OPITIONS} ${RISCV_LINK_OPTIONS}) target_include_directories(am-riscv-nemu PRIVATE ${NEMU_INCLUDE_DIRECTORIES}) diff --git a/abstract-machine/cmake/nemu-settings.cmake b/abstract-machine/cmake/nemu-settings.cmake index 910cdcf..d19a2d3 100644 --- a/abstract-machine/cmake/nemu-settings.cmake +++ b/abstract-machine/cmake/nemu-settings.cmake @@ -1,11 +1,12 @@ set(NEMU_COMPILE_OPTIONS -fdata-sections -ffunction-sections) set(NEMU_LINK_OPTIONS + -nostartfiles + -nolibc --defsym=_pmem_start=0x80000000 --defsym=_entry_offset=0x0 --gc-sections - -e _start) -set(NEMU_INCLUDE_DIRECTORIES - ${CMAKE_SOURCE_DIR}/am/src/platform/nemu/include) -file(GLOB_RECURSE NEMU_SOURCES - ${CMAKE_SOURCE_DIR}/am/src/platform/nemu/*.[cS]) + -e + _start) +set(NEMU_INCLUDE_DIRECTORIES ${CMAKE_SOURCE_DIR}/am/src/platform/nemu/include) +file(GLOB_RECURSE NEMU_SOURCES ${CMAKE_SOURCE_DIR}/am/src/platform/nemu/*.[cS]) set(INCLUDE_LINKER_SCRIPT ON) diff --git a/abstract-machine/default.nix b/abstract-machine/default.nix index 4e3fb1c..85232e0 100644 --- a/abstract-machine/default.nix +++ b/abstract-machine/default.nix @@ -1,9 +1,10 @@ -{ stdenv, - lib, - cmake, - SDL2, - isa ? "native", - platform ? [ ] +{ stdenv +, lib +, cmake +, SDL2 +, glibc +, isa ? "native" +, platform ? [ ] }: stdenv.mkDerivation { pname = "abstract-machine"; @@ -11,7 +12,7 @@ stdenv.mkDerivation { src = ./.; - cmakeFlags = [ + cmakeFlags = [ (lib.cmakeFeature "ISA" isa) ] ++ map (p: (lib.cmakeBool "__PLATFORM_${lib.strings.toUpper p}__" true)) platform; @@ -24,7 +25,7 @@ stdenv.mkDerivation { buildInputs = [ - ] ++ (if isa=="native" then [ SDL2 ] else [ ]); + ] ++ (if isa == "native" then [ SDL2 ] else [ ]); doCheck = true; } diff --git a/abstract-machine/klib/src/CMakeLists.txt b/abstract-machine/klib/src/CMakeLists.txt index 5d173b7..8f521fc 100644 --- a/abstract-machine/klib/src/CMakeLists.txt +++ b/abstract-machine/klib/src/CMakeLists.txt @@ -9,7 +9,6 @@ set(SOURCES cpp.c int64.c stdio.c stdlib.c string.c add_library(klib ${SOURCES}) target_link_libraries(klib PUBLIC am_interface klib_interface) target_compile_options(klib PUBLIC -fno-builtin) -target_link_options(klib PUBLIC -nostartfiles -nolibc) install( TARGETS klib diff --git a/flake.lock b/flake.lock index 4e79596..1aa5691 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,48 @@ { "nodes": { + "am-kernels": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs", + "pre-commit-hooks": "pre-commit-hooks", + "ysyx-workbench": "ysyx-workbench" + }, + "locked": { + "lastModified": 1723617032, + "narHash": "sha256-oL5Vx933Jhn+T9jn67wFbh8vy7w8OJNCn4DOOlX/r0U=", + "ref": "dev", + "rev": "3ee527c3de481e38767fffbd9e16bf48359fc638", + "revCount": 78, + "type": "git", + "url": "https://git.xinyang.life/xin/am-kernels.git" + }, + "original": { + "ref": "dev", + "type": "git", + "url": "https://git.xinyang.life/xin/am-kernels.git" + } + }, + "diffu": { + "inputs": { + "flake-utils": "flake-utils_5", + "nixpkgs": "nixpkgs_2", + "nur-xin": "nur-xin_2", + "pre-commit-hooks": "pre-commit-hooks_3" + }, + "locked": { + "lastModified": 1723627842, + "narHash": "sha256-+Ovf1e5ESap4sGMsH945SkZLhyYUxGE7shKVl3Ue1CQ=", + "ref": "refs/heads/master", + "rev": "7b3881a9712bcb7bfea90614a44888ae5df6e849", + "revCount": 17, + "type": "git", + "url": "https://git.xinyang.life/xin/diffu.git" + }, + "original": { + "type": "git", + "url": "https://git.xinyang.life/xin/diffu.git" + } + }, "flake-compat": { "flake": false, "locked": { @@ -16,6 +59,54 @@ "type": "github" } }, + "flake-compat_2": { + "flake": false, + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-compat_3": { + "flake": false, + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-compat_4": { + "flake": false, + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, "flake-utils": { "inputs": { "systems": "systems" @@ -52,7 +143,182 @@ "type": "github" } }, + "flake-utils_3": { + "inputs": { + "systems": "systems_3" + }, + "locked": { + "lastModified": 1709126324, + "narHash": "sha256-q6EQdSeUZOG26WelxqkmR7kArjgWCdw5sfJVHPH/7j8=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "d465f4819400de7c8d874d50b982301f28a84605", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_4": { + "inputs": { + "systems": "systems_4" + }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_5": { + "inputs": { + "systems": "systems_5" + }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_6": { + "inputs": { + "systems": "systems_6" + }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_7": { + "inputs": { + "systems": "systems_7" + }, + "locked": { + "lastModified": 1709126324, + "narHash": "sha256-q6EQdSeUZOG26WelxqkmR7kArjgWCdw5sfJVHPH/7j8=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "d465f4819400de7c8d874d50b982301f28a84605", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_8": { + "inputs": { + "systems": "systems_8" + }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "gitignore": { + "inputs": { + "nixpkgs": [ + "am-kernels", + "pre-commit-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "gitignore_2": { + "inputs": { + "nixpkgs": [ + "am-kernels", + "ysyx-workbench", + "pre-commit-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "gitignore_3": { + "inputs": { + "nixpkgs": [ + "diffu", + "pre-commit-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "gitignore_4": { "inputs": { "nixpkgs": [ "pre-commit-hooks", @@ -105,6 +371,22 @@ "type": "github" } }, + "nixpkgs-circt162_2": { + "locked": { + "lastModified": 1705645507, + "narHash": "sha256-tX3vipIAmNDBA8WNWG4oY4KyTfnm2YieTHO2BhG8ISA=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "7995cae3ad60e3d6931283d650d7f43d31aaa5c7", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "7995cae3ad60e3d6931283d650d7f43d31aaa5c7", + "type": "github" + } + }, "nixpkgs-stable": { "locked": { "lastModified": 1710695816, @@ -121,7 +403,130 @@ "type": "github" } }, + "nixpkgs-stable_2": { + "locked": { + "lastModified": 1710695816, + "narHash": "sha256-3Eh7fhEID17pv9ZxrPwCLfqXnYP006RKzSs0JptsN84=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "614b4613980a522ba49f0d194531beddbb7220d3", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-23.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-stable_3": { + "locked": { + "lastModified": 1710695816, + "narHash": "sha256-3Eh7fhEID17pv9ZxrPwCLfqXnYP006RKzSs0JptsN84=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "614b4613980a522ba49f0d194531beddbb7220d3", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-23.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-stable_4": { + "locked": { + "lastModified": 1710695816, + "narHash": "sha256-3Eh7fhEID17pv9ZxrPwCLfqXnYP006RKzSs0JptsN84=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "614b4613980a522ba49f0d194531beddbb7220d3", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-23.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1711703276, + "narHash": "sha256-iMUFArF0WCatKK6RzfUJknjem0H9m4KgorO/p3Dopkk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "d8fe5e6c92d0d190646fb9f1056741a229980089", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { + "locked": { + "lastModified": 1709237383, + "narHash": "sha256-cy6ArO4k5qTx+l5o+0mL9f5fa86tYUX3ozE1S+Txlds=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "1536926ef5621b09bba54035ae2bb6d806d72ac8", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "nur-xin": { + "inputs": { + "nixpkgs": [ + "am-kernels", + "ysyx-workbench", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1721891452, + "narHash": "sha256-2c9nDuXXARzoRXE67lte5kKBeFb1XmTNsvdiIbRUEgE=", + "ref": "refs/heads/master", + "rev": "de8ad578fc4fe527772cec23a7f660bde14c8570", + "revCount": 152, + "type": "git", + "url": "https://git.xinyang.life/xin/nur.git" + }, + "original": { + "type": "git", + "url": "https://git.xinyang.life/xin/nur.git" + } + }, + "nur-xin_2": { + "inputs": { + "nixpkgs": [ + "diffu", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1721891452, + "narHash": "sha256-2c9nDuXXARzoRXE67lte5kKBeFb1XmTNsvdiIbRUEgE=", + "ref": "refs/heads/master", + "rev": "de8ad578fc4fe527772cec23a7f660bde14c8570", + "revCount": 152, + "type": "git", + "url": "https://git.xinyang.life/xin/nur.git" + }, + "original": { + "type": "git", + "url": "https://git.xinyang.life/xin/nur.git" + } + }, + "nur-xin_3": { "inputs": { "nixpkgs": [ "nixpkgs" @@ -147,6 +552,7 @@ "flake-utils": "flake-utils_2", "gitignore": "gitignore", "nixpkgs": [ + "am-kernels", "nixpkgs" ], "nixpkgs-stable": "nixpkgs-stable" @@ -165,13 +571,90 @@ "type": "github" } }, + "pre-commit-hooks_2": { + "inputs": { + "flake-compat": "flake-compat_2", + "flake-utils": "flake-utils_4", + "gitignore": "gitignore_2", + "nixpkgs": [ + "am-kernels", + "ysyx-workbench", + "nixpkgs" + ], + "nixpkgs-stable": "nixpkgs-stable_2" + }, + "locked": { + "lastModified": 1712055707, + "narHash": "sha256-4XLvuSIDZJGS17xEwSrNuJLL7UjDYKGJSbK1WWX2AK8=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "e35aed5fda3cc79f88ed7f1795021e559582093a", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, + "pre-commit-hooks_3": { + "inputs": { + "flake-compat": "flake-compat_3", + "flake-utils": "flake-utils_6", + "gitignore": "gitignore_3", + "nixpkgs": [ + "diffu", + "nixpkgs" + ], + "nixpkgs-stable": "nixpkgs-stable_3" + }, + "locked": { + "lastModified": 1712055707, + "narHash": "sha256-4XLvuSIDZJGS17xEwSrNuJLL7UjDYKGJSbK1WWX2AK8=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "e35aed5fda3cc79f88ed7f1795021e559582093a", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, + "pre-commit-hooks_4": { + "inputs": { + "flake-compat": "flake-compat_4", + "flake-utils": "flake-utils_8", + "gitignore": "gitignore_4", + "nixpkgs": [ + "nixpkgs" + ], + "nixpkgs-stable": "nixpkgs-stable_4" + }, + "locked": { + "lastModified": 1712055707, + "narHash": "sha256-4XLvuSIDZJGS17xEwSrNuJLL7UjDYKGJSbK1WWX2AK8=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "e35aed5fda3cc79f88ed7f1795021e559582093a", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, "root": { "inputs": { - "flake-utils": "flake-utils", - "nixpkgs": "nixpkgs", - "nixpkgs-circt162": "nixpkgs-circt162", - "nur-xin": "nur-xin", - "pre-commit-hooks": "pre-commit-hooks" + "am-kernels": "am-kernels", + "diffu": "diffu", + "flake-utils": "flake-utils_7", + "nixpkgs": "nixpkgs_3", + "nixpkgs-circt162": "nixpkgs-circt162_2", + "nur-xin": "nur-xin_3", + "pre-commit-hooks": "pre-commit-hooks_4" } }, "systems": { @@ -203,6 +686,121 @@ "repo": "default", "type": "github" } + }, + "systems_3": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_4": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_5": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_6": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_7": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_8": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "ysyx-workbench": { + "inputs": { + "flake-utils": "flake-utils_3", + "nixpkgs": [ + "am-kernels", + "nixpkgs" + ], + "nixpkgs-circt162": "nixpkgs-circt162", + "nur-xin": "nur-xin", + "pre-commit-hooks": "pre-commit-hooks_2" + }, + "locked": { + "lastModified": 1723551098, + "narHash": "sha256-/AnVxufgQoAuvNBSKm0BG+tTS++/HuaNoW+loroSQig=", + "ref": "refs/heads/master", + "rev": "8ee1551dc2857091fca6456c1367aab7090899fe", + "revCount": 119, + "type": "git", + "url": "https://git.xinyang.life/xin/ysyx-workbench" + }, + "original": { + "type": "git", + "url": "https://git.xinyang.life/xin/ysyx-workbench" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 61fa944..86c9a4f 100644 --- a/flake.nix +++ b/flake.nix @@ -11,11 +11,11 @@ url = "git+https://git.xinyang.life/xin/nur.git"; inputs.nixpkgs.follows = "nixpkgs"; }; - # diffu.url = "github:xinyangli/diffu"; - # am-kernels.url = "git+https://git.xinyang.life/xin/am-kernels.git"; + diffu.url = "git+https://git.xinyang.life/xin/diffu.git"; + am-kernels.url = "git+https://git.xinyang.life/xin/am-kernels.git?ref=dev"; }; - outputs = { self, flake-utils, nixpkgs, nixpkgs-circt162, pre-commit-hooks, nur-xin }@inputs: + outputs = { self, flake-utils, nixpkgs, nixpkgs-circt162, pre-commit-hooks, nur-xin, diffu, am-kernels }@inputs: flake-utils.lib.eachDefaultSystem (system: let pkgs = import nixpkgs { @@ -135,6 +135,14 @@ mini-gdbstub ] ++ self.checks.${system}.pre-commit-check.enabledPackages; }; + + devShells.difftest = pkgs.mkShell { + packages = [ + diffu.packages.${system}.default + am-kernels.packages.${system}.rv32Cross.am-kernels-npc + self.packages.${system}.nemu-lib + ]; + }; } ); }