private void checkMachineTypeValidity(boolean readingAsLittleEndian) {

		machineTypeValid = true;
		pageSize = 4096;
		final short machtype = (short) ((a_magic >> 16) & 0xFF);
		final String readEndianness = readingAsLittleEndian ? "LE" : "BE";

		switch (machtype) {
			/**
			 * Motorola 68K family
			 */
			case UnixAoutMachineType.M_68010:
				languageSpec = "68000:BE:32:MC68010";
				break;
			case UnixAoutMachineType.M_68020:
				languageSpec = "68000:BE:32:MC68020";
				break;
			case UnixAoutMachineType.M_M68K_NETBSD:
				pageSize = 8192;
			case UnixAoutMachineType.M_M68K4K_NETBSD:
				isNetBSD = true;
				languageSpec = "68000:BE:32:default";
				break;

			/**
			 * SPARC family
			 */
			case UnixAoutMachineType.M_SPARC_NETBSD:
				isNetBSD = true;
			case UnixAoutMachineType.M_SPARC:
			case UnixAoutMachineType.M_SPARCLET:
				isSparc = true;
				pageSize = 8192;
				languageSpec = "sparc:BE:32:default";
				break;
			case UnixAoutMachineType.M_SPARC64_NETBSD:
				isNetBSD = true;
				isSparc = true;
				languageSpec = "sparc:BE:64:default";
				break;

			/**
			 * MIPS family
			 */
			case UnixAoutMachineType.M_PMAX_NETBSD:
				isNetBSD = true;
			case UnixAoutMachineType.M_MIPS1:
			case UnixAoutMachineType.M_MIPS2:
			case UnixAoutMachineType.M_R3000:
				languageSpec = "MIPS:LE:32:default";
				break;
			case UnixAoutMachineType.M_MIPS:
				languageSpec = "MIPS:BE:32:default";
				break;

			/**
			 * National Semiconductor NS32000 family
			 */
			case UnixAoutMachineType.M_532_NETBSD:
				isNetBSD = true;
			case UnixAoutMachineType.M_NS32032:
			case UnixAoutMachineType.M_NS32532:
				languageSpec = "UNKNOWN:LE:32:default";
				break;

			/**
			 * x86 family
			 */
			case UnixAoutMachineType.M_386_NETBSD:
				isNetBSD = true;
			case UnixAoutMachineType.M_386:
			case UnixAoutMachineType.M_386_DYNIX:
				compilerSpec = "gcc";
				languageSpec = "x86:LE:32:default";
				break;
			case UnixAoutMachineType.M_X86_64_NETBSD:
				compilerSpec = "gcc";
				languageSpec = "x86:LE:64:default";
				break;

			/**
			 * ARM family
			 */
			case UnixAoutMachineType.M_ARM6_NETBSD:
				isNetBSD = true;
			case UnixAoutMachineType.M_ARM:
				languageSpec = "ARM:" + readEndianness + ":32:default";
				break;
			case UnixAoutMachineType.M_AARCH64:
				languageSpec = "AARCH64:" + readEndianness + ":64:default";
				break;

			/**
			 * RISC family
			 */
			case UnixAoutMachineType.M_OR1K:
				languageSpec = "UNKNOWN:BE:32:default";
				break;
			case UnixAoutMachineType.M_RISCV:
				languageSpec = "RISCV:LE:32:default";
				break;
			case UnixAoutMachineType.M_HPPA_OPENBSD:
				languageSpec = "pa-risc:BE:32:default";
				break;

			/**
			 * PowerPC family
			 */
			case UnixAoutMachineType.M_POWERPC_NETBSD:
				isNetBSD = true;
				languageSpec = "PowerPC:" + readEndianness + ":32:default";
				break;
			case UnixAoutMachineType.M_POWERPC64:
				languageSpec = "PowerPC:" + readEndianness + ":64:default";
				break;

			/**
			 * SuperH family
			 * NOTE: It's unclear if there is support for SuperH SH-3 or SH-5 cores;
			 * the primary SuperH language seems to support SH-1 and SH-2 variants
			 * and the alternative is the SuperH4 language.
			 */
			case UnixAoutMachineType.M_SH3:
			case UnixAoutMachineType.M_SH5_32:
				languageSpec = "SuperH:BE:32:default";
				break;
			case UnixAoutMachineType.M_SH5_64:
				languageSpec = "SuperH:BE:64:default";
				break;

			/**
			 * VAX family
			 */
			case UnixAoutMachineType.M_VAX_NETBSD:
				pageSize = 512;
			case UnixAoutMachineType.M_VAX4K_NETBSD:
				isNetBSD = true;
				languageSpec = "UNKNOWN:LE:32:default";
				break;

			/**
			 * Other
			 */
			case UnixAoutMachineType.M_CRIS:
				languageSpec = "UNKNOWN:LE:32:default";
				break;
			case UnixAoutMachineType.M_ALPHA_NETBSD:
				isNetBSD = true;
			case UnixAoutMachineType.M_IA64:
				languageSpec = "UNKNOWN:" + readEndianness + ":64:default";
				break;
			case UnixAoutMachineType.M_29K:
			case UnixAoutMachineType.M_88K_OPENBSD:
				languageSpec = "UNKNOWN:" + readEndianness + ":32:default";
				break;
			case UnixAoutMachineType.M_UNKNOWN:
				languageSpec = "UNKNOWN:" + readEndianness + ":32:default";
				break;
			default:
				machineTypeValid = false;
		}

		// Check that the detected architecture's endianness matches the endianness
		// with which we're reading the file; if there's a mismatch, clear the
		// machineTypeValid flag because this was evidently a false reading.
		if (machineTypeValid) {
			String[] languageTokens = languageSpec.split(":");
			if ((languageTokens.length < 2) ||
				!languageTokens[1].equalsIgnoreCase(readEndianness)) {
				machineTypeValid = false;
			}
		}
	}
Checks the magic word in the header for a known machine type ID, and sets the
languageSpec string accordingly.
Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/unixaout/UnixAoutHeader.java