Java Code Examples for com.sun.jna.Pointer#getLong()

The following examples show how to use com.sun.jna.Pointer#getLong() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ARM64SyscallHandler.java    From unidbg with Apache License 2.0 6 votes vote down vote up
private long clone(Emulator<?> emulator) {
    Arm64RegisterContext context = emulator.getContext();
    Pointer child_stack = context.getPointerArg(1);
    if (child_stack == null &&
            context.getPointerArg(2) == null) {
        // http://androidxref.com/6.0.1_r10/xref/bionic/libc/bionic/fork.cpp#47
        return fork(emulator); // vfork
    }

    long fn = context.getXLong(5);
    long arg = context.getXLong(6);
    if (child_stack != null && child_stack.getLong(-8) == fn && child_stack.getLong(-16) == arg) {
        // http://androidxref.com/6.0.1_r10/xref/bionic/libc/arch-arm/bionic/__bionic_clone.S#49
        return bionic_clone(emulator);
    } else {
        return pthread_clone(emulator);
    }
}
 
Example 2
Source File: ARM64SyscallHandler.java    From unidbg with Apache License 2.0 5 votes vote down vote up
private int nanosleep(Emulator<?> emulator) {
    RegisterContext context = emulator.getContext();
    Pointer req = context.getPointerArg(0);
    Pointer rem = context.getPointerArg(1);
    long tv_sec = req.getLong(0);
    long tv_nsec = req.getLong(8);
    if (log.isDebugEnabled()) {
        log.debug("nanosleep req=" + req + ", rem=" + rem + ", tv_sec=" + tv_sec + ", tv_nsec=" + tv_nsec);
    }
    try {
        Thread.sleep(tv_sec * 1000L + tv_nsec / 1000000L);
    } catch (InterruptedException ignored) {
    }
    return 0;
}
 
Example 3
Source File: SizeTByReference.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public SizeT getValue() {
  Pointer p = getPointer();
  return new SizeT(Native.SIZE_T_SIZE == 8 ? p.getLong(0) : p.getInt(0));
}