@Test
	public void testOpenWriteClose() throws Exception {
		try (Transaction tx = program.openTransaction("Initialize")) {
			asm.assemble(start,
				"MOV RAX," + Syscall.OPEN.number,
				"LEA RDI,[0x00400880]",
				"MOV RSI," + (AbstractEmuLinuxSyscallUseropLibrary.O_WRONLY |
					AbstractEmuLinuxSyscallUseropLibrary.O_CREAT),
				"MOV RDX," + (0600),
				"SYSCALL",
				"MOV RBP, RAX",

				"MOV RAX," + Syscall.WRITE.number,
				"MOV RDI,RBP",
				"LEA RSI,[0x00400800]",
				"MOV RDX," + BYTES_HW.length,
				"SYSCALL",

				"MOV RAX," + Syscall.CLOSE.number,
				"MOV RDI,RBP",

				"MOV RAX," + Syscall.GROUP_EXIT.number,
				"MOV RDI,0",
				"SYSCALL");
			block.putBytes(space.getAddress(0x00400800), BYTES_HW);
			block.putBytes(space.getAddress(0x00400880), "myfile\0".getBytes());
		}

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

		EmuUnixFile<byte[]> file = fs.getFile("myfile");
		byte[] bytes = new byte[BYTES_HW.length];
		file.read(arithmetic, arithmetic.fromConst(0, 8), bytes);
		assertArrayEquals(BYTES_HW, bytes);
	}
These are a subset of the linux_amd64 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/EmuLinuxAmd64SyscallUseropLibraryTest.java