lol
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge pull request #102766 from siraben/mmix

Initial implementation of cross-compilation to Knuth's MMIX

authored by

John Ericson and committed by
GitHub
86fedc3a 07202f86

+79 -16
+3
lib/systems/doubles.nix
··· 36 36 "riscv64-none" "riscv32-none" 37 37 "vc4-none" 38 38 39 + "mmix-mmixware" 40 + 39 41 "js-ghcjs" 40 42 41 43 "aarch64-genode" "i686-genode" "x86_64-genode" ··· 56 58 i686 = filterDoubles predicates.isi686; 57 59 x86_64 = filterDoubles predicates.isx86_64; 58 60 mips = filterDoubles predicates.isMips; 61 + mmix = filterDoubles predicates.isMmix; 59 62 riscv = filterDoubles predicates.isRiscV; 60 63 vc4 = filterDoubles predicates.isVc4; 61 64 js = filterDoubles predicates.isJavaScript;
+5
lib/systems/examples.nix
··· 109 109 platform = platforms.riscv-multiplatform "32"; 110 110 }; 111 111 112 + mmix = { 113 + config = "mmix-unknown-mmixware"; 114 + libc = "newlib"; 115 + }; 116 + 112 117 msp430 = { 113 118 config = "msp430-elf"; 114 119 libc = "newlib";
+1
lib/systems/inspect.nix
··· 17 17 isAarch32 = { cpu = { family = "arm"; bits = 32; }; }; 18 18 isAarch64 = { cpu = { family = "arm"; bits = 64; }; }; 19 19 isMips = { cpu = { family = "mips"; }; }; 20 + isMmix = { cpu = { family = "mmix"; }; }; 20 21 isRiscV = { cpu = { family = "riscv"; }; }; 21 22 isSparc = { cpu = { family = "sparc"; }; }; 22 23 isWasm = { cpu = { family = "wasm"; }; };
+19 -14
lib/systems/parse.nix
··· 93 93 mips64 = { bits = 64; significantByte = bigEndian; family = "mips"; }; 94 94 mips64el = { bits = 64; significantByte = littleEndian; family = "mips"; }; 95 95 96 + mmix = { bits = 64; significantByte = bigEndian; family = "mmix"; }; 97 + 96 98 powerpc = { bits = 32; significantByte = bigEndian; family = "power"; }; 97 99 powerpc64 = { bits = 64; significantByte = bigEndian; family = "power"; }; 98 100 powerpc64le = { bits = 64; significantByte = littleEndian; family = "power"; }; ··· 268 270 kernels = with execFormats; with kernelFamilies; setTypes types.openKernel { 269 271 # TODO(@Ericson2314): Don't want to mass-rebuild yet to keeping 'darwin' as 270 272 # the nnormalized name for macOS. 271 - macos = { execFormat = macho; families = { inherit darwin; }; name = "darwin"; }; 272 - ios = { execFormat = macho; families = { inherit darwin; }; }; 273 - freebsd = { execFormat = elf; families = { inherit bsd; }; }; 274 - linux = { execFormat = elf; families = { }; }; 275 - netbsd = { execFormat = elf; families = { inherit bsd; }; }; 276 - none = { execFormat = unknown; families = { }; }; 277 - openbsd = { execFormat = elf; families = { inherit bsd; }; }; 278 - solaris = { execFormat = elf; families = { }; }; 279 - wasi = { execFormat = wasm; families = { }; }; 280 - redox = { execFormat = elf; families = { }; }; 281 - windows = { execFormat = pe; families = { }; }; 282 - ghcjs = { execFormat = unknown; families = { }; }; 283 - genode = { execFormat = elf; families = { }; }; 273 + macos = { execFormat = macho; families = { inherit darwin; }; name = "darwin"; }; 274 + ios = { execFormat = macho; families = { inherit darwin; }; }; 275 + freebsd = { execFormat = elf; families = { inherit bsd; }; }; 276 + linux = { execFormat = elf; families = { }; }; 277 + netbsd = { execFormat = elf; families = { inherit bsd; }; }; 278 + none = { execFormat = unknown; families = { }; }; 279 + openbsd = { execFormat = elf; families = { inherit bsd; }; }; 280 + solaris = { execFormat = elf; families = { }; }; 281 + wasi = { execFormat = wasm; families = { }; }; 282 + redox = { execFormat = elf; families = { }; }; 283 + windows = { execFormat = pe; families = { }; }; 284 + ghcjs = { execFormat = unknown; families = { }; }; 285 + genode = { execFormat = elf; families = { }; }; 286 + mmixware = { execFormat = unknown; families = { }; }; 284 287 } // { # aliases 285 288 # 'darwin' is the kernel for all of them. We choose macOS by default. 286 289 darwin = kernels.macos; ··· 382 385 else if (elemAt l 1) == "elf" 383 386 then { cpu = elemAt l 0; vendor = "unknown"; kernel = "none"; abi = elemAt l 1; } 384 387 else { cpu = elemAt l 0; kernel = elemAt l 1; }; 385 - "3" = # Awkwards hacks, beware! 388 + "3" = # Awkward hacks, beware! 386 389 if elemAt l 1 == "apple" 387 390 then { cpu = elemAt l 0; vendor = "apple"; kernel = elemAt l 2; } 388 391 else if (elemAt l 1 == "linux") || (elemAt l 2 == "gnu") ··· 393 396 then { cpu = elemAt l 0; vendor = elemAt l 1; kernel = "wasi"; } 394 397 else if (elemAt l 2 == "redox") 395 398 then { cpu = elemAt l 0; vendor = elemAt l 1; kernel = "redox"; } 399 + else if (elemAt l 2 == "mmixware") 400 + then { cpu = elemAt l 0; vendor = elemAt l 1; kernel = "mmixware"; } 396 401 else if hasPrefix "netbsd" (elemAt l 2) 397 402 then { cpu = elemAt l 0; vendor = elemAt l 1; kernel = elemAt l 2; } 398 403 else if (elem (elemAt l 2) ["eabi" "eabihf" "elf"])
+4 -2
lib/tests/systems.nix
··· 11 11 expr = lib.sort lib.lessThan x; 12 12 expected = lib.sort lib.lessThan y; 13 13 }; 14 - in with lib.systems.doubles; lib.runTests { 15 - testall = mseteq all (linux ++ darwin ++ freebsd ++ openbsd ++ netbsd ++ illumos ++ wasi ++ windows ++ embedded ++ js ++ genode ++ redox); 14 + in 15 + with lib.systems.doubles; lib.runTests { 16 + testall = mseteq all (linux ++ darwin ++ freebsd ++ openbsd ++ netbsd ++ illumos ++ wasi ++ windows ++ embedded ++ mmix ++ js ++ genode ++ redox); 16 17 17 18 testarm = mseteq arm [ "armv5tel-linux" "armv6l-linux" "armv6l-none" "armv7a-linux" "armv7l-linux" "arm-none" "armv7a-darwin" ]; 18 19 testi686 = mseteq i686 [ "i686-linux" "i686-freebsd" "i686-genode" "i686-netbsd" "i686-openbsd" "i686-cygwin" "i686-windows" "i686-none" "i686-darwin" ]; 19 20 testmips = mseteq mips [ "mipsel-linux" ]; 21 + testmmix = mseteq mmix [ "mmix-mmixware" ]; 20 22 testx86_64 = mseteq x86_64 [ "x86_64-linux" "x86_64-darwin" "x86_64-freebsd" "x86_64-genode" "x86_64-redox" "x86_64-openbsd" "x86_64-netbsd" "x86_64-cygwin" "x86_64-solaris" "x86_64-windows" "x86_64-none" ]; 21 23 22 24 testcygwin = mseteq cygwin [ "i686-cygwin" "x86_64-cygwin" ];
+1
pkgs/build-support/bintools-wrapper/default.nix
··· 179 179 mips64 = "btsmip"; 180 180 mips64el = "ltsmip"; 181 181 }.${targetPlatform.parsed.cpu.name} 182 + else if targetPlatform.isMmix then "mmix" 182 183 else if targetPlatform.isPower then if targetPlatform.isBigEndian then "ppc" else "lppc" 183 184 else if targetPlatform.isSparc then "sparc" 184 185 else if targetPlatform.isMsp430 then "msp430"
+44
pkgs/development/tools/mmixware/default.nix
··· 1 + { stdenv, fetchFromGitLab, tetex }: 2 + 3 + stdenv.mkDerivation { 4 + pname = "mmixware"; 5 + version = "unstable-2019-02-19"; 6 + 7 + src = fetchFromGitLab { 8 + domain = "gitlab.lrz.de"; 9 + owner = "mmix"; 10 + repo = "mmixware"; 11 + rev = "a330d68aafcfe739ecaaece888a669b8e7d9bcb8"; 12 + sha256 = "0bq0d19vqhfbpk4mcqzmd0hygbkhapl1mzlfkcr6afx0fhlhi087"; 13 + }; 14 + 15 + hardeningDisable = [ "format" ]; 16 + 17 + postPatch = '' 18 + substituteInPlace Makefile --replace 'rm abstime.h' "" 19 + ''; 20 + 21 + nativeBuildInputs = [ tetex ]; 22 + enableParallelBuilding = true; 23 + 24 + makeFlags = [ "all" "doc" "CFLAGS=-O2" ]; 25 + 26 + installPhase = '' 27 + runHook preInstall 28 + mkdir -p $out/share/doc 29 + cp *.ps $out/share/doc 30 + install -Dm755 mmixal -t $out/bin 31 + install -Dm755 mmix -t $out/bin 32 + install -Dm755 mmotype -t $out/bin 33 + install -Dm755 mmmix -t $out/bin 34 + runHook postInstall 35 + ''; 36 + 37 + meta = with stdenv.lib; { 38 + description = "MMIX simulator and assembler"; 39 + homepage = "https://www-cs-faculty.stanford.edu/~knuth/mmix-news.html"; 40 + maintainers = with maintainers; [ siraben ]; 41 + platforms = platforms.unix; 42 + license = licenses.publicDomain; 43 + }; 44 + }
+2
pkgs/top-level/all-packages.nix
··· 5691 5691 5692 5692 mmake = callPackage ../tools/misc/mmake { }; 5693 5693 5694 + mmixware = callPackage ../development/tools/mmixware { }; 5695 + 5694 5696 modemmanager = callPackage ../tools/networking/modem-manager {}; 5695 5697 5696 5698 modem-manager-gui = callPackage ../applications/networking/modem-manager-gui {};