Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
ReyunSecureSdk
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhanglei
ReyunSecureSdk
Commits
c06620d7
Commit
c06620d7
authored
Apr 01, 2021
by
Fear1ess
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
4/1
parent
b888a62d
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
501 additions
and
4 deletions
+501
-4
CMakeLists.txt
wandun/src/main/cpp/CMakeLists.txt
+5
-4
jni_helper.h
wandun/src/main/cpp/include/jni_helper.h
+158
-0
jni_helper.cpp
wandun/src/main/cpp/jni_helper.cpp
+333
-0
wd_syscall32.s
wandun/src/main/cpp/wd_syscall32.s
+1
-0
wd_syscall64.s
wandun/src/main/cpp/wd_syscall64.s
+4
-0
No files found.
wandun/src/main/cpp/CMakeLists.txt
View file @
c06620d7
...
...
@@ -5,11 +5,11 @@ project(Wandun)
include_directories
(
${
CMAKE_SOURCE_DIR
}
/include
)
if
(
${
CMAKE_ANDROID_ARCH_ABI
}
STREQUAL
"arm64-v8a"
)
set
(
OS
_DEPENDENDED_SRC
set
(
ARCH
_DEPENDENDED_SRC
wd_syscall64.s
)
elseif
(
${
CMAKE_ANDROID_ARCH_ABI
}
STREQUAL
"armeabi-v7a"
)
set
(
OS
_DEPENDENDED_SRC
set
(
ARCH
_DEPENDENDED_SRC
wd_syscall32.s
)
endif
()
...
...
@@ -17,8 +17,9 @@ endif()
add_library
(
wdun
SHARED
core.cpp
wd_syscall.cpp
${
OS_DEPENDENDED_SRC
}
wd_syscall.cpp
jni_helper.cpp
${
ARCH_DEPENDENDED_SRC
}
)
target_link_libraries
(
wdun log
)
...
...
wandun/src/main/cpp/include/jni_helper.h
0 → 100644
View file @
c06620d7
//
// Created by Fear1ess on 2021/4/1.
//
#ifndef REYUNSDK_JNI_HELPER_H
#define REYUNSDK_JNI_HELPER_H
#include <jni.h>
void
wdCheckException
(
JNIEnv
*
env
);
char
wdGetMethodRetType
(
const
char
*
sig
);
inline
char
wdGetFieldType
(
const
char
*
sig
)
{
return
*
sig
;
}
jvalue
wdGetStaticField
(
JNIEnv
*
env
,
const
char
*
clsName
,
const
char
*
fieldName
,
const
char
*
fieldSig
);
jvalue
wdGetField
(
JNIEnv
*
env
,
jobject
obj
,
const
char
*
fieldName
,
const
char
*
fieldSig
);
void
wdSetStaticField
(
JNIEnv
*
env
,
const
char
*
clsName
,
const
char
*
fieldName
,
const
char
*
fieldSig
,
jvalue
value
);
void
wdSetField
(
JNIEnv
*
env
,
jobject
obj
,
const
char
*
fieldName
,
const
char
*
fieldSig
,
jvalue
value
);
jobject
wdNewObject
(
JNIEnv
*
env
,
const
char
*
clsName
,
const
char
*
methodSig
,
...);
jvalue
wdCallStaticMethod
(
JNIEnv
*
env
,
const
char
*
clsName
,
const
char
*
methodName
,
const
char
*
methodSig
,
...);
jvalue
wdCallMethod
(
JNIEnv
*
env
,
jobject
obj
,
const
char
*
methodName
,
const
char
*
methodSig
,
...);
jboolean
wdCallStaticBooleanMethod
(
JNIEnv
*
env
,
const
char
*
clsName
,
const
char
*
methodName
,
const
char
*
methodSig
,
...);
inline
jboolean
wdGetStaticBooleanField
(
JNIEnv
*
env
,
const
char
*
clsName
,
const
char
*
fieldName
,
const
char
*
fieldSig
)
{
return
wdGetStaticField
(
env
,
clsName
,
fieldName
,
fieldSig
).
z
;
}
inline
jbyte
wdGetStaticByteField
(
JNIEnv
*
env
,
const
char
*
clsName
,
const
char
*
fieldName
,
const
char
*
fieldSig
)
{
return
wdGetStaticField
(
env
,
clsName
,
fieldName
,
fieldSig
).
b
;
}
inline
jchar
wdGetStaticCharField
(
JNIEnv
*
env
,
const
char
*
clsName
,
const
char
*
fieldName
,
const
char
*
fieldSig
)
{
return
wdGetStaticField
(
env
,
clsName
,
fieldName
,
fieldSig
).
c
;
}
inline
jshort
wdGetStaticShortField
(
JNIEnv
*
env
,
const
char
*
clsName
,
const
char
*
fieldName
,
const
char
*
fieldSig
)
{
return
wdGetStaticField
(
env
,
clsName
,
fieldName
,
fieldSig
).
s
;
}
inline
jint
wdGetStaticIntField
(
JNIEnv
*
env
,
const
char
*
clsName
,
const
char
*
fieldName
,
const
char
*
fieldSig
)
{
return
wdGetStaticField
(
env
,
clsName
,
fieldName
,
fieldSig
).
i
;
}
inline
jlong
wdGetStaticLongField
(
JNIEnv
*
env
,
const
char
*
clsName
,
const
char
*
fieldName
,
const
char
*
fieldSig
)
{
return
wdGetStaticField
(
env
,
clsName
,
fieldName
,
fieldSig
).
j
;
}
inline
jfloat
wdGetStaticFloatField
(
JNIEnv
*
env
,
const
char
*
clsName
,
const
char
*
fieldName
,
const
char
*
fieldSig
)
{
return
wdGetStaticField
(
env
,
clsName
,
fieldName
,
fieldSig
).
f
;
}
inline
jdouble
wdGetStaticDoubleField
(
JNIEnv
*
env
,
const
char
*
clsName
,
const
char
*
fieldName
,
const
char
*
fieldSig
)
{
return
wdGetStaticField
(
env
,
clsName
,
fieldName
,
fieldSig
).
d
;
}
inline
jobject
wdGetStaticObjectField
(
JNIEnv
*
env
,
const
char
*
clsName
,
const
char
*
fieldName
,
const
char
*
fieldSig
)
{
return
wdGetStaticField
(
env
,
clsName
,
fieldName
,
fieldSig
).
l
;
}
inline
jboolean
wdGetBooleanField
(
JNIEnv
*
env
,
jobject
obj
,
const
char
*
fieldName
,
const
char
*
fieldSig
)
{
return
wdGetField
(
env
,
obj
,
fieldName
,
fieldSig
).
z
;
}
inline
jbyte
wdGetByteField
(
JNIEnv
*
env
,
jobject
obj
,
const
char
*
fieldName
,
const
char
*
fieldSig
)
{
return
wdGetField
(
env
,
obj
,
fieldName
,
fieldSig
).
b
;
}
inline
jchar
wdGetCharField
(
JNIEnv
*
env
,
jobject
obj
,
const
char
*
fieldName
,
const
char
*
fieldSig
)
{
return
wdGetField
(
env
,
obj
,
fieldName
,
fieldSig
).
c
;
}
inline
jshort
wdGetShortField
(
JNIEnv
*
env
,
jobject
obj
,
const
char
*
fieldName
,
const
char
*
fieldSig
)
{
return
wdGetField
(
env
,
obj
,
fieldName
,
fieldSig
).
s
;
}
inline
jint
wdGetIntField
(
JNIEnv
*
env
,
jobject
obj
,
const
char
*
fieldName
,
const
char
*
fieldSig
)
{
return
wdGetField
(
env
,
obj
,
fieldName
,
fieldSig
).
i
;
}
inline
jlong
wdGetLongField
(
JNIEnv
*
env
,
jobject
obj
,
const
char
*
fieldName
,
const
char
*
fieldSig
)
{
return
wdGetField
(
env
,
obj
,
fieldName
,
fieldSig
).
j
;
}
inline
jfloat
wdGetFloatField
(
JNIEnv
*
env
,
jobject
obj
,
const
char
*
fieldName
,
const
char
*
fieldSig
)
{
return
wdGetField
(
env
,
obj
,
fieldName
,
fieldSig
).
f
;
}
inline
jdouble
wdGetDoubleField
(
JNIEnv
*
env
,
jobject
obj
,
const
char
*
fieldName
,
const
char
*
fieldSig
)
{
return
wdGetField
(
env
,
obj
,
fieldName
,
fieldSig
).
d
;
}
inline
jobject
wdGetObjectField
(
JNIEnv
*
env
,
jobject
obj
,
const
char
*
fieldName
,
const
char
*
fieldSig
)
{
return
wdGetField
(
env
,
obj
,
fieldName
,
fieldSig
).
l
;
}
inline
void
wdSetStaticBooleanField
(
JNIEnv
*
env
,
const
char
*
clsName
,
const
char
*
fieldName
,
const
char
*
fieldSig
,
jboolean
value
)
{
jvalue
j
=
{.
z
=
value
};
wdSetStaticField
(
env
,
clsName
,
fieldName
,
fieldSig
,
j
);
}
inline
void
wdSetStaticByteField
(
JNIEnv
*
env
,
const
char
*
clsName
,
const
char
*
fieldName
,
const
char
*
fieldSig
,
jbyte
value
)
{
jvalue
j
=
{.
b
=
value
};
wdSetStaticField
(
env
,
clsName
,
fieldName
,
fieldSig
,
j
);
}
inline
void
wdSetStaticCharField
(
JNIEnv
*
env
,
const
char
*
clsName
,
const
char
*
fieldName
,
const
char
*
fieldSig
,
jchar
value
)
{
jvalue
j
=
{.
c
=
value
};
wdSetStaticField
(
env
,
clsName
,
fieldName
,
fieldSig
,
j
);
}
inline
void
wdSetStaticShortField
(
JNIEnv
*
env
,
const
char
*
clsName
,
const
char
*
fieldName
,
const
char
*
fieldSig
,
jshort
value
)
{
jvalue
j
=
{.
s
=
value
};
wdSetStaticField
(
env
,
clsName
,
fieldName
,
fieldSig
,
j
);
}
inline
void
wdSetStaticIntField
(
JNIEnv
*
env
,
const
char
*
clsName
,
const
char
*
fieldName
,
const
char
*
fieldSig
,
jint
value
)
{
jvalue
j
=
{.
i
=
value
};
wdSetStaticField
(
env
,
clsName
,
fieldName
,
fieldSig
,
j
);
}
inline
void
wdSetStaticLongField
(
JNIEnv
*
env
,
const
char
*
clsName
,
const
char
*
fieldName
,
const
char
*
fieldSig
,
jlong
value
)
{
jvalue
j
=
{.
j
=
value
};
wdSetStaticField
(
env
,
clsName
,
fieldName
,
fieldSig
,
j
);
}
inline
void
wdSetStaticFloatField
(
JNIEnv
*
env
,
const
char
*
clsName
,
const
char
*
fieldName
,
const
char
*
fieldSig
,
jfloat
value
)
{
jvalue
j
=
{.
f
=
value
};
wdSetStaticField
(
env
,
clsName
,
fieldName
,
fieldSig
,
j
);
}
inline
void
wdSetStaticDoubleField
(
JNIEnv
*
env
,
const
char
*
clsName
,
const
char
*
fieldName
,
const
char
*
fieldSig
,
jdouble
value
)
{
jvalue
j
=
{.
d
=
value
};
wdSetStaticField
(
env
,
clsName
,
fieldName
,
fieldSig
,
j
);
}
inline
void
wdSetStaticObjectField
(
JNIEnv
*
env
,
const
char
*
clsName
,
const
char
*
fieldName
,
const
char
*
fieldSig
,
jobject
value
)
{
jvalue
j
=
{.
l
=
value
};
wdSetStaticField
(
env
,
clsName
,
fieldName
,
fieldSig
,
j
);
}
inline
void
wdSetBooleanField
(
JNIEnv
*
env
,
jobject
obj
,
const
char
*
fieldName
,
const
char
*
fieldSig
,
jboolean
value
)
{
jvalue
j
=
{.
z
=
value
};
wdSetField
(
env
,
obj
,
fieldName
,
fieldSig
,
j
);
}
inline
void
wdSetByteField
(
JNIEnv
*
env
,
jobject
obj
,
const
char
*
fieldName
,
const
char
*
fieldSig
,
jbyte
value
)
{
jvalue
j
=
{.
b
=
value
};
wdSetField
(
env
,
obj
,
fieldName
,
fieldSig
,
j
);
}
inline
void
wdSetCharField
(
JNIEnv
*
env
,
jobject
obj
,
const
char
*
fieldName
,
const
char
*
fieldSig
,
jchar
value
)
{
jvalue
j
=
{.
c
=
value
};
wdSetField
(
env
,
obj
,
fieldName
,
fieldSig
,
j
);
}
inline
void
wdSetShortField
(
JNIEnv
*
env
,
jobject
obj
,
const
char
*
fieldName
,
const
char
*
fieldSig
,
jshort
value
)
{
jvalue
j
=
{.
s
=
value
};
wdSetField
(
env
,
obj
,
fieldName
,
fieldSig
,
j
);
}
inline
void
wdSetIntField
(
JNIEnv
*
env
,
jobject
obj
,
const
char
*
fieldName
,
const
char
*
fieldSig
,
jint
value
)
{
jvalue
j
=
{.
i
=
value
};
wdSetField
(
env
,
obj
,
fieldName
,
fieldSig
,
j
);
}
inline
void
wdSetLongField
(
JNIEnv
*
env
,
jobject
obj
,
const
char
*
fieldName
,
const
char
*
fieldSig
,
jlong
value
)
{
jvalue
j
=
{.
j
=
value
};
wdSetField
(
env
,
obj
,
fieldName
,
fieldSig
,
j
);
}
inline
void
wdSetFloatField
(
JNIEnv
*
env
,
jobject
obj
,
const
char
*
fieldName
,
const
char
*
fieldSig
,
jfloat
value
)
{
jvalue
j
=
{.
f
=
value
};
wdSetField
(
env
,
obj
,
fieldName
,
fieldSig
,
j
);
}
inline
void
wdSetDoubleField
(
JNIEnv
*
env
,
jobject
obj
,
const
char
*
fieldName
,
const
char
*
fieldSig
,
jdouble
value
)
{
jvalue
j
=
{.
d
=
value
};
wdSetField
(
env
,
obj
,
fieldName
,
fieldSig
,
j
);
}
inline
void
wdSetObjectField
(
JNIEnv
*
env
,
jobject
obj
,
const
char
*
fieldName
,
const
char
*
fieldSig
,
jobject
value
)
{
jvalue
j
=
{.
l
=
value
};
wdSetField
(
env
,
obj
,
fieldName
,
fieldSig
,
j
);
}
#endif //REYUNSDK_JNI_HELPER_H
wandun/src/main/cpp/jni_helper.cpp
0 → 100644
View file @
c06620d7
//
// Created by Fear1ess on 2021/4/1.
//
#include <__clang_cuda_device_functions.h>
#include "jni_helper.h"
void
wdCheckException
(
JNIEnv
*
env
)
{
if
(
env
->
ExceptionOccurred
()
!=
nullptr
){
env
->
ExceptionDescribe
();
env
->
ExceptionClear
();
}
}
char
wdGetMethodRetType
(
const
char
*
sig
)
{
char
*
p
=
(
char
*
)
sig
;
// skip '()' to find out the return type
while
(
*
p
!=
')'
){
p
++
;
}
// skip ')'
p
++
;
return
*
p
;
}
jvalue
wdGetStaticField
(
JNIEnv
*
env
,
const
char
*
clsName
,
const
char
*
fieldName
,
const
char
*
fieldSig
)
{
jclass
cls
=
env
->
FindClass
(
clsName
);
jfieldID
fieldId
=
env
->
GetStaticFieldID
(
cls
,
fieldName
,
fieldSig
);
jvalue
value
;
memset
(
value
,
0
,
sizeof
(
jvalue
));
switch
(
wdGetMethodRetType
(
fieldSig
))
{
case
'['
:
case
'L'
:
value
.
l
=
env
->
GetStaticObjectField
(
cls
,
fieldId
);
break
;
case
'Z'
:
value
.
z
=
env
->
GetStaticBooleanField
(
cls
,
fieldId
);
break
;
case
'B'
:
value
.
b
=
env
->
GetStaticByteField
(
cls
,
fieldId
);
break
;
case
'C'
:
value
.
c
=
env
->
GetStaticCharField
(
cls
,
fieldId
);
break
;
case
'S'
:
value
.
s
=
env
->
GetStaticShortField
(
cls
,
fieldId
);
break
;
case
'I'
:
value
.
i
=
env
->
GetStaticIntField
(
cls
,
fieldId
);
break
;
case
'J'
:
value
.
j
=
env
->
GetStaticLongField
(
cls
,
fieldId
);
break
;
case
'F'
:
value
.
f
=
env
->
GetStaticFloatField
(
cls
,
fieldId
);
break
;
case
'D'
:
value
.
d
=
env
->
GetStaticDoubleField
(
cls
,
fieldId
);
break
;
default:
break
;
}
wdCheckException
(
env
);
env
->
DeleteLocalRef
(
cls
);
return
value
;
}
jvalue
wdGetField
(
JNIEnv
*
env
,
jobject
obj
,
const
char
*
fieldName
,
const
char
*
fieldSig
)
{
jclass
cls
=
env
->
GetObjectClass
(
obj
);
jfieldID
fieldId
=
env
->
GetFieldID
(
cls
,
fieldName
,
fieldSig
);
jvalue
value
;
memset
(
value
,
0
,
sizeof
(
jvalue
));
switch
(
wdGetMethodRetType
(
fieldSig
))
{
case
'['
:
case
'L'
:
value
.
l
=
env
->
GetObjectField
(
cls
,
fieldId
);
break
;
case
'Z'
:
value
.
z
=
env
->
GetBooleanField
(
cls
,
fieldId
);
break
;
case
'B'
:
value
.
b
=
env
->
GetByteField
(
cls
,
fieldId
);
break
;
case
'C'
:
value
.
c
=
env
->
GetCharField
(
cls
,
fieldId
);
break
;
case
'S'
:
value
.
s
=
env
->
GetShortField
(
cls
,
fieldId
);
break
;
case
'I'
:
value
.
i
=
env
->
GetIntField
(
cls
,
fieldId
);
break
;
case
'J'
:
value
.
j
=
env
->
GetLongField
(
cls
,
fieldId
);
break
;
case
'F'
:
value
.
f
=
env
->
GetFloatField
(
cls
,
fieldId
);
break
;
case
'D'
:
value
.
d
=
env
->
GetDoubleField
(
cls
,
fieldId
);
break
;
default:
break
;
}
wdCheckException
(
env
);
env
->
DeleteLocalRef
(
cls
);
return
value
;
}
void
wdSetStaticField
(
JNIEnv
*
env
,
const
char
*
clsName
,
const
char
*
fieldName
,
const
char
*
fieldSig
,
jvalue
value
)
{
jclass
cls
=
env
->
FindClass
(
clsName
);
jfieldID
fieldId
=
env
->
GetStaticFieldID
(
cls
,
fieldName
,
fieldSig
);
switch
(
wdGetMethodRetType
(
fieldSig
))
{
case
'['
:
case
'L'
:
env
->
SetStaticObjectField
(
cls
,
fieldId
,
value
.
l
);
break
;
case
'Z'
:
env
->
SetStaticBooleanField
(
cls
,
fieldId
,
value
.
z
);
break
;
case
'B'
:
env
->
SetStaticByteField
(
cls
,
fieldId
,
value
.
b
);
break
;
case
'C'
:
env
->
SetStaticCharField
(
cls
,
fieldId
,
value
.
c
);
break
;
case
'S'
:
env
->
SetStaticShortField
(
cls
,
fieldId
,
value
.
s
);
break
;
case
'I'
:
env
->
SetStaticIntField
(
cls
,
fieldId
,
value
.
i
);
break
;
case
'J'
:
env
->
SetStaticLongField
(
cls
,
fieldId
,
value
.
j
);
break
;
case
'F'
:
env
->
SetStaticFloatField
(
cls
,
fieldId
,
value
.
f
);
break
;
case
'D'
:
env
->
SetStaticDoubleField
(
cls
,
fieldId
,
value
.
d
);
break
;
default:
break
;
}
wdCheckException
(
env
);
env
->
DeleteLocalRef
(
cls
);
}
void
wdSetField
(
JNIEnv
*
env
,
jobject
obj
,
const
char
*
fieldName
,
const
char
*
fieldSig
,
jvalue
value
)
{
jclass
cls
=
env
->
GetObjectClass
(
cls
);
jfieldID
fieldId
=
env
->
GetFieldID
(
cls
,
fieldName
,
fieldSig
);
switch
(
wdGetMethodRetType
(
fieldSig
))
{
case
'['
:
case
'L'
:
env
->
SetObjectField
(
obj
,
fieldId
,
value
.
l
);
break
;
case
'Z'
:
env
->
SetBooleanField
(
cls
,
fieldId
,
value
.
z
);
break
;
case
'B'
:
env
->
SetByteField
(
cls
,
fieldId
,
value
.
b
);
break
;
case
'C'
:
env
->
SetCharField
(
cls
,
fieldId
,
value
.
c
);
break
;
case
'S'
:
env
->
SetShortField
(
cls
,
fieldId
,
value
.
s
);
break
;
case
'I'
:
env
->
SetIntField
(
cls
,
fieldId
,
value
.
i
);
break
;
case
'J'
:
env
->
SetLongField
(
cls
,
fieldId
,
value
.
j
);
break
;
case
'F'
:
env
->
SetFloatField
(
cls
,
fieldId
,
value
.
f
);
break
;
case
'D'
:
env
->
SetDoubleField
(
cls
,
fieldId
,
value
.
d
);
break
;
default:
break
;
}
wdCheckException
(
env
);
env
->
DeleteLocalRef
(
cls
);
}
jobject
wdNewObject
(
JNIEnv
*
env
,
const
char
*
clsName
,
const
char
*
methodSig
,
...)
{
jclass
cls
=
env
->
FindClass
(
clsName
);
jmethodID
methodId
=
env
->
GetMethodID
(
cls
,
"<init>"
,
methodSig
);
va_list
args
;
va_start
(
args
,
methodSig
);
jobject
res
=
nullptr
;
res
=
env
->
NewObjectV
(
cls
,
methodId
,
args
);
wdCheckException
(
env
);
va_end
(
args
);
env
->
DeleteLocalRef
(
cls
);
return
res
;
}
jvalue
wdCallStaticMethod
(
JNIEnv
*
env
,
const
char
*
clsName
,
const
char
*
methodName
,
const
char
*
methodSig
,
va_list
args
)
{
jclass
cls
=
env
->
FindClass
(
clsName
);
jmethodID
methodId
=
env
->
GetStaticMethodID
(
cls
,
methodName
,
methodSig
);
jvalue
value
;
memset
(
value
,
0
,
sizeof
(
jvalue
));
switch
(
wdGetMethodRetType
(
methodSig
))
{
case
'V'
:
env
->
CallStaticVoidMethodV
(
cls
,
methodId
,
args
);
break
;
case
'['
:
case
'L'
:
value
.
l
=
env
->
CallStaticObjectMethodV
(
cls
,
methodId
,
args
);
break
;
case
'Z'
:
value
.
z
=
env
->
CallStaticBooleanMethodV
(
cls
,
methodId
,
args
);
break
;
case
'B'
:
value
.
b
=
env
->
CallStaticByteMethodV
(
cls
,
methodId
,
args
);
break
;
case
'C'
:
value
.
c
=
env
->
CallStaticCharMethodV
(
cls
,
methodId
,
args
);
break
;
case
'S'
:
value
.
s
=
env
->
CallStaticShortMethodV
(
cls
,
methodId
,
args
);
break
;
case
'I'
:
value
.
i
=
env
->
CallStaticIntMethodV
(
cls
,
methodId
,
args
);
break
;
case
'J'
:
value
.
j
=
env
->
CallStaticLongMethodV
(
cls
,
methodId
,
args
);
break
;
case
'F'
:
value
.
f
=
env
->
CallStaticFloatMethodV
(
cls
,
methodId
,
args
);
break
;
case
'D'
:
value
.
d
=
env
->
CallStaticDoubleMethodV
(
cls
,
methodId
,
args
);
break
;
}
wdCheckException
(
env
);
env
->
DeleteLocalRef
(
cls
);
return
value
;
}
jvalue
wdCallMethod
(
JNIEnv
*
env
,
jobject
obj
,
const
char
*
methodName
,
const
char
*
methodSig
,
va_list
args
)
{
jclass
cls
=
env
->
GetObjectClass
(
obj
);
jmethodID
methodId
=
env
->
GetMethodID
(
cls
,
methodName
,
methodSig
);
jvalue
value
;
memset
(
value
,
0
,
sizeof
(
jvalue
));
switch
(
wdGetMethodRetType
(
methodSig
))
{
case
'V'
:
env
->
CallVoidMethodV
(
obj
,
methodId
,
args
);
break
;
case
'['
:
case
'L'
:
value
.
l
=
env
->
CallObjectMethodV
(
obj
,
methodId
,
args
);
break
;
case
'Z'
:
value
.
z
=
env
->
CallBooleanMethodV
(
obj
,
methodId
,
args
);
break
;
case
'B'
:
value
.
b
=
env
->
CallByteMethodV
(
obj
,
methodId
,
args
);
break
;
case
'C'
:
value
.
c
=
env
->
CallCharMethodV
(
obj
,
methodId
,
args
);
break
;
case
'S'
:
value
.
s
=
env
->
CallShortMethodV
(
obj
,
methodId
,
args
);
break
;
case
'I'
:
value
.
i
=
env
->
CallIntMethodV
(
obj
,
methodId
,
args
);
break
;
case
'J'
:
value
.
j
=
env
->
CallLongMethodV
(
obj
,
methodId
,
args
);
break
;
case
'F'
:
value
.
f
=
env
->
CallFloatMethodV
(
obj
,
methodId
,
args
);
break
;
case
'D'
:
value
.
d
=
env
->
CallDoubleMethodV
(
obj
,
methodId
,
args
);
break
;
}
wdCheckException
(
env
);
env
->
DeleteLocalRef
(
cls
);
return
value
;
}
jboolean
wdCallStaticBooleanMethod
(
JNIEnv
*
env
,
const
char
*
clsName
,
const
char
*
methodName
,
const
char
*
methodSig
,
...)
{
va_list
args
;
va_start
(
args
,
methodSig
);
jboolean
res
=
wdCallStaticMethod
(
env
,
clsName
,
methodName
,
methodSig
,
args
).
z
;
va_end
(
args
);
return
res
;
}
jbyte
wdCallStaticByteMethod
(
JNIEnv
*
env
,
const
char
*
clsName
,
const
char
*
methodName
,
const
char
*
methodSig
,
...)
{
va_list
args
;
va_start
(
args
,
methodSig
);
jboolean
res
=
wdCallStaticMethod
(
env
,
clsName
,
methodName
,
methodSig
,
args
).
b
;
va_end
(
args
);
return
res
;
}
jchar
wdCallStaticCharMethod
(
JNIEnv
*
env
,
const
char
*
clsName
,
const
char
*
methodName
,
const
char
*
methodSig
,
...)
{
va_list
args
;
va_start
(
args
,
methodSig
);
jchar
res
=
wdCallStaticMethod
(
env
,
clsName
,
methodName
,
methodSig
,
args
).
c
;
va_end
(
args
);
return
res
;
}
jshort
wdCallStaticShortMethod
(
JNIEnv
*
env
,
const
char
*
clsName
,
const
char
*
methodName
,
const
char
*
methodSig
,
...)
{
va_list
args
;
va_start
(
args
,
methodSig
);
jshort
res
=
wdCallStaticMethod
(
env
,
clsName
,
methodName
,
methodSig
,
args
).
s
;
va_end
(
args
);
return
res
;
}
jint
wdCallStaticIntMethod
(
JNIEnv
*
env
,
const
char
*
clsName
,
const
char
*
methodName
,
const
char
*
methodSig
,
...)
{
va_list
args
;
va_start
(
args
,
methodSig
);
jint
res
=
wdCallStaticMethod
(
env
,
clsName
,
methodName
,
methodSig
,
args
).
i
;
va_end
(
args
);
return
res
;
}
jlong
wdCallStaticlongMethod
(
JNIEnv
*
env
,
const
char
*
clsName
,
const
char
*
methodName
,
const
char
*
methodSig
,
...)
{
va_list
args
;
va_start
(
args
,
methodSig
);
jlong
res
=
wdCallStaticMethod
(
env
,
clsName
,
methodName
,
methodSig
,
args
).
j
;
va_end
(
args
);
return
res
;
}
wandun/src/main/cpp/wd_syscall32.s
View file @
c06620d7
//
// Created by Fear1ess on 2021/3/31.
//
.global wd_syscall32
.extern wd_set_errno
...
...
wandun/src/main/cpp/wd_syscall64.s
View file @
c06620d7
//
// Created by Fear1ess on 2021/3/31.
//
.global wd_syscall64
.extern wd_set_errno
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment