-
Notifications
You must be signed in to change notification settings - Fork 152
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement assembly functions using inline
__asm
This avoids having to rely on MASM.
- Loading branch information
1 parent
16298c1
commit 0f04540
Showing
7 changed files
with
57 additions
and
82 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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,26 @@ | ||
#include "detect486.h" | ||
|
||
__declspec(naked) int is_cpu_486_or_newer(void) | ||
{ | ||
__asm { | ||
pushfd | ||
pop eax | ||
mov ebx, eax | ||
xor eax, 40000h ; toggle the AC bit in EFLAGS (only available in 486 or newer) | ||
push eax | ||
popfd | ||
pushfd | ||
pop eax | ||
cmp eax, ebx | ||
jz is_386 | ||
push ebx | ||
popfd | ||
xor eax, eax | ||
inc eax | ||
ret | ||
|
||
is_386: | ||
xor eax, eax | ||
ret | ||
} | ||
} |
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,10 +1,6 @@ | ||
#ifndef DETECT_486 | ||
#define DETECT_486 | ||
|
||
#ifndef STDCALL | ||
#define STDCALL __stdcall | ||
#endif | ||
|
||
int STDCALL is_cpu_486_or_newer(void); | ||
int is_cpu_486_or_newer(void); | ||
|
||
#endif // DETECT_486 |
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