-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update: windows PE arm64 exit syscall now work!
- Loading branch information
Showing
8 changed files
with
70 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ | |
|
||
#include <stdint.h> | ||
|
||
typedef uint32_t Operand; | ||
typedef int64_t Operand; | ||
|
||
typedef uint32_t Inst; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// | ||
// Created by Park Yu on 2024/11/21. | ||
// | ||
#include "linux_syscall.h" | ||
|
||
void initLinuxArm64ProgramStart() { | ||
emitLabel("_start"); | ||
binaryOp2(INST_MOV, 1, X29, 0, true); | ||
binaryOp2(INST_MOV, 1, X30, 0, true); | ||
binaryOpBranch(INST_BL, UNUSED, "main"); | ||
//keep the "main" ret value in X0 | ||
binaryOp2(INST_MOV, 1, X8, SYS_EXIT, true); | ||
binaryOpSvc(INST_SVC, 0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// | ||
// Created by Park Yu on 2024/11/21. | ||
// | ||
#include "windows_syscall.h" | ||
|
||
void initWindowsArm64ProgramStart() { | ||
emitLabel("_start"); | ||
binaryOp2(INST_MOV, 1, X29, 0, true); | ||
binaryOp2(INST_MOV, 1, X30, 0, true); | ||
binaryOpBranch(INST_BL, UNUSED, "main"); | ||
//keep the "main" ret value in X0 | ||
binaryOp2(INST_MOV, 1, X1, X0, false); | ||
binaryOp2(INST_MOV, 1, X0, INVALID_HANDLE_VALUE, true); | ||
binaryOpSvc(INST_SVC, NtTerminateProcess); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// | ||
// Created by Park Yu on 2024/10/17. | ||
// | ||
|
||
#ifndef PCC_LINUX_WINDOWS_SYSCALL_H | ||
#define PCC_LINUX_WINDOWS_SYSCALL_H | ||
|
||
#include "binary_arm64.h" | ||
#include "register_arm64.h" | ||
|
||
enum WindowsArm64SysCallNumber { | ||
NtWriteFile = 8, | ||
NtTerminateProcess = 44, | ||
NtTerminateThread = 83, | ||
// 根据需要添加其他系统调用 | ||
}; | ||
|
||
//00 00 80 92 | ||
|
||
#define INVALID_HANDLE_VALUE -1 | ||
|
||
void initWindowsArm64ProgramStart(); | ||
|
||
#endif //PCC_LINUX_WINDOWS_SYSCALL_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters