@Before
	public void setUp() throws Exception {
		program = createDefaultProgram("HelloSyscalls", "x86:LE:64:default", "gcc", this);
		language = (SleighLanguage) program.getLanguage();
		arithmetic = BytesPcodeArithmetic.forLanguage(language);

		regRAX = program.getRegister("RAX");
		space = program.getAddressFactory().getDefaultAddressSpace();
		start = space.getAddress(0x00400000);
		size = 0x1000;

		try (Transaction tx = program.openTransaction("Initialize")) {
			block = program.getMemory()
					.createInitializedBlock(".text", start, size, (byte) 0, TaskMonitor.DUMMY,
						false);

			// Fulfill requirements for the syscall userop library:
			// 1) The "/pointer" data type exists, so it knows the machine word size
			program.getDataTypeManager()
					.resolve(PointerDataType.dataType, DataTypeConflictHandler.DEFAULT_HANDLER);
			// 2) Create the syscall space and add those we'll be using
			Address startOther = program.getAddressFactory()
					.getAddressSpace(SpaceNames.OTHER_SPACE_NAME)
					.getAddress(0);
			MemoryBlock blockSyscall = program.getMemory()
					.createUninitializedBlock(SYSCALL_SPACE_NAME, startOther, 0x10000, true);
			blockSyscall.setPermissions(true, false, true);

			placeSyscall(0, "syscall0", "__stdcall");
			placeSyscall(1, "syscall1", "syscall");

			asm = Assemblers.getAssembler(program);
		}
	}
A library with two 4-argument syscalls.

<p>
For x86:LE:64:default:gcc, the storage for the 4th argument varies by calling convention. For
__stdcall, it's RCX. For syscall, it's R10. Both syscalls just return the 4th argument. Thus,
it's possible to detect whether the emulator heeds conventions by binding each to a different
convention, then invoking them with distinct values placed in RCX and R10 and verifying that
the correct value shows in RAX, the return register.
Ghidra/Features/SystemEmulation/src/test/java/ghidra/pcode/emu/sys/EmuAmd64SyscallUseropLibraryTest.java