Skip to content

Commit

Permalink
2023-12-22
Browse files Browse the repository at this point in the history
  • Loading branch information
qtgolang committed Dec 22, 2023
1 parent a510437 commit 6e23b1f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Call/CALLLinux.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ func Call(address int, arg ...interface{}) int {
case 8:
ret = uintptr(C.LinuxCall8(addr, unsafe.Pointer(args[0]), unsafe.Pointer(args[1]), unsafe.Pointer(args[2]), unsafe.Pointer(args[3]), unsafe.Pointer(args[4]), unsafe.Pointer(args[5]), unsafe.Pointer(args[6]), unsafe.Pointer(args[7])))
break
case 9:
ret = uintptr(C.LinuxCall9(addr, unsafe.Pointer(args[0]), unsafe.Pointer(args[1]), unsafe.Pointer(args[2]), unsafe.Pointer(args[3]), unsafe.Pointer(args[4]), unsafe.Pointer(args[5]), unsafe.Pointer(args[6]), unsafe.Pointer(args[7]), unsafe.Pointer(args[8])))
break
case 10:
ret = uintptr(C.LinuxCall10(addr, unsafe.Pointer(args[0]), unsafe.Pointer(args[1]), unsafe.Pointer(args[2]), unsafe.Pointer(args[3]), unsafe.Pointer(args[4]), unsafe.Pointer(args[5]), unsafe.Pointer(args[6]), unsafe.Pointer(args[7]), unsafe.Pointer(args[8]), unsafe.Pointer(args[9])))
break
default:
return -1
}
Expand Down
8 changes: 8 additions & 0 deletions Call/LinuxCall.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ typedef int (*Fun5)(void *,void *,void *,void *,void *);
typedef int (*Fun6)(void *,void *,void *,void *,void *,void *);
typedef int (*Fun7)(void *,void *,void *,void *,void *,void *,void *);
typedef int (*Fun8)(void *,void *,void *,void *,void *,void *,void *,void *);
typedef int (*Fun9)(void *,void *,void *,void *,void *,void *,void *,void *,void *);
typedef int (*Fun10)(void *,void *,void *,void *,void *,void *,void *,void *,void *,void *);


int LinuxCall0(void * addr){
Expand Down Expand Up @@ -39,3 +41,9 @@ int LinuxCall7(void * addr, void * a1,void * a2,void * a3,void * a4,void * a5,vo
int LinuxCall8(void * addr, void * a1,void * a2,void * a3,void * a4,void * a5,void * a6,void * a7,void * a8){
return ((Fun8)addr)(a1,a2,a3,a4,a5,a6,a7,a8);
}
int LinuxCall9(void * addr, void * a1,void * a2,void * a3,void * a4,void * a5,void * a6,void * a7,void * a8,void * a9){
return ((Fun9)addr)(a1,a2,a3,a4,a5,a6,a7,a8,a9);
}
int LinuxCall10(void * addr, void * a1,void * a2,void * a3,void * a4,void * a5,void * a6,void * a7,void * a8,void * a9,void * a10){
return ((Fun10)addr)(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10);
}
2 changes: 2 additions & 0 deletions Call/LinuxCall.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ int LinuxCall5(void *,void *,void *,void *,void *,void *);
int LinuxCall6(void *,void *,void *,void *,void *,void *,void *);
int LinuxCall7(void *,void *,void *,void *,void *,void *,void *,void *);
int LinuxCall8(void *,void *,void *,void *,void *,void *,void *,void *,void *);
int LinuxCall9(void *,void *,void *,void *,void *,void *,void *,void *,void *,void *);
int LinuxCall10(void *,void *,void *,void *,void *,void *,void *,void *,void *,void *,void *);


#endif

0 comments on commit 6e23b1f

Please sign in to comment.