@Test
	public void testReadStdin() throws Exception {
		try (Transaction tx = program.openTransaction("Initialize")) {
			asm.assemble(start,
				"MOV EAX," + Syscall.READ.number,
				"MOV EBX," + EmuUnixFileDescriptor.FD_STDIN,
				"LEA ECX,[0x00400800]",
				"MOV EDX," + BYTES_HW.length,
				"INT 0x80",
				"MOV EAX," + Syscall.EXIT.number,
				"MOV EBX,0",
				"INT 0x80");
		}

		LinuxX86PcodeEmulator emu = prepareEmulator();
		PcodeThread<byte[]> thread = launchThread(emu, start);

		// Provide stdin via a byte array
		ByteArrayInputStream stdin = new ByteArrayInputStream(BYTES_HW);
		emu.syscalls.putDescriptor(EmuUnixFileDescriptor.FD_STDIN,
			new IOStreamEmuUnixFileHandle(emu, program.getCompilerSpec(), stdin, null));

		// Step through write and verify return value and actual output effect
		thread.stepInstruction(5);
		assertArrayEquals(arithmetic.fromConst(BYTES_HW.length, regEAX.getNumBytes()),
			thread.getState().getVar(regEAX, Reason.INSPECT));
		assertArrayEquals(BYTES_HW,
			emu.getSharedState().getVar(space, 0x00400800, BYTES_HW.length, true, Reason.INSPECT));

		stepGroupExit(thread);
	}
These are the linux_x86 system call numbers as of writing this test, but it doesn't
really matter as long as the user program and syscall library agree.
Ghidra/Features/SystemEmulation/src/test/java/ghidra/pcode/emu/linux/EmuLinuxX86SyscallUseropLibraryTest.java