-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
31 changed files
with
440 additions
and
182 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[bits 32] | ||
extern main, __libc_start_main | ||
section .text | ||
_start: | ||
push main | ||
push edx | ||
push esi | ||
push edi | ||
call __libc_start_main | ||
mov ebx, 0xffff | ||
mov eax, 0 | ||
int 0x36 | ||
ud2 | ||
int 3 | ||
jmp $ |
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
add_binary(app-file) | ||
target_link_libraries(app-file misc magic) | ||
add_binary(file) | ||
target_link_libraries(file misc magic) |
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
|
||
#define SYSCALL_USE_INTERRPUT 0 | ||
|
||
#define PLOS_LOGGING 0 | ||
#define PLOS_LOGGING 2 | ||
|
||
#define PLOS_LOGGING_PRINTS 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
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 |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#pragma once | ||
#include <define.h> | ||
|
||
#define asm_get_flags() \ | ||
({ \ | ||
size_t flags; \ | ||
asm volatile("pushf\n\t" \ | ||
"pop %0\n\t" \ | ||
: "=r"(flags) \ | ||
:); \ | ||
flags; \ | ||
}) | ||
|
||
#define asm_set_flags(flags) \ | ||
({ \ | ||
asm volatile("push %0\n\t" \ | ||
"popf\n\t" \ | ||
: \ | ||
: "r"((size_t)(flags))); \ | ||
}) | ||
|
||
#define asm_is_sti (asm_get_flags() & (1 << 9)) | ||
|
||
#define asm_is_cli (!asm_is_sti) | ||
|
||
#define FLAGS_CF MASK(0) // 进位标志 | ||
#define FLAGS_PF MASK(2) // 奇偶标志 | ||
#define FLAGS_AF MASK(4) // 辅助进位标志 | ||
#define FLAGS_ZF MASK(6) // 零标志 | ||
#define FLAGS_SF MASK(7) // 符号标志 | ||
#define FLAGS_TF MASK(8) // 跟踪标志 | ||
#define FLAGS_IF MASK(9) // 中断允许标志 | ||
#define FLAGS_DF MASK(10) // 方向标志 | ||
#define FLAGS_OF MASK(11) // 溢出标志 | ||
#define FLAGS_IOPL_0 ((usize)0 << 12) | ||
#define FLAGS_IOPL_1 ((usize)1 << 12) | ||
#define FLAGS_IOPL_2 ((usize)2 << 12) | ||
#define FLAGS_IOPL_3 ((usize)3 << 12) | ||
|
||
typedef struct FLAGS { | ||
usize cf : 1; | ||
usize reserved_1 : 1; | ||
usize pf : 1; | ||
usize reserved_2 : 1; | ||
usize af : 1; | ||
usize reserved_3 : 1; | ||
usize zf : 1; | ||
usize sf : 1; | ||
usize tf : 1; | ||
usize if_ : 1; | ||
usize df : 1; | ||
usize of : 1; | ||
usize iopl : 2; | ||
usize nt : 1; | ||
usize reserved_4 : 1; | ||
usize rf : 1; | ||
usize vm : 1; | ||
usize ac : 1; | ||
usize vif : 1; | ||
usize vip : 1; | ||
usize id : 1; | ||
usize reserved_5 : 10; | ||
} FLAGS; |
Oops, something went wrong.