@Test
	public void testReadvStdin() throws Exception {
		Address strHello;
		Address strWorld;
		try (Transaction tx = program.openTransaction("Initialize")) {
			Address data = space.getAddress(0x00400800);
			ByteBuffer buf = ByteBuffer.allocate(64).order(ByteOrder.LITTLE_ENDIAN);

			strHello = data.add(buf.position());
			buf.put(new byte[BYTES_HELLO.length]);
			Address endHello = data.add(buf.position());
			Address iov = data.add(buf.position());
			buf.putInt((int) strHello.getOffset());
			buf.putInt((int) endHello.subtract(strHello));
			int posIov1base = buf.position();
			buf.putInt(0);
			int posIov1len = buf.position();
			buf.putInt(0);
			strWorld = data.add(buf.position());
			buf.put(new byte[BYTES_WORLD.length]);
			Address endWorld = data.add(buf.position());
			// Backpatch
			buf.putInt(posIov1base, (int) strWorld.getOffset());
			buf.putInt(posIov1len, (int) endWorld.subtract(strWorld));

			asm.assemble(start,
				"MOV EAX," + Syscall.READV.number,
				"MOV EBX," + EmuUnixFileDescriptor.FD_STDIN,
				"LEA ECX,[0x" + iov + "]",
				"MOV EDX,2",
				"INT 0x80",
				"MOV EAX," + Syscall.EXIT.number,
				"MOV EBX,0",
				"INT 0x80");
			block.putBytes(data, buf.array());
		}

		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 readv and verify return value and actual output effect
		thread.stepInstruction(5);

		assertEquals(BYTES_HW.length,
			arithmetic.toLong(thread.getState().getVar(regEAX, Reason.INSPECT), Purpose.OTHER));
		assertArrayEquals(BYTES_HELLO, emu.getSharedState()
				.getVar(space, strHello.getOffset(), BYTES_HELLO.length, true, Reason.INSPECT));
		assertArrayEquals(BYTES_WORLD, emu.getSharedState()
				.getVar(space, strWorld.getOffset(), BYTES_WORLD.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