#include <stdio.h>
#include <stdlib.h>
#include <setjmp.h>
#include <memory.h>
Go to the source code of this file.
|
| #define | KERNEL_ASM_H |
| |
| #define | PROTO(proc) |
| |
| #define | EXTERN(proc) |
| |
| #define | MAX_MEMORY_LEN 100 |
| |
| #define | PROC(proc_name) |
| |
| #define | ENDP |
| |
| #define | PUSH(param) |
| |
| #define | POP(param) |
| |
| #define | MOVL(dst, src) |
| |
| #define | ADD(dst, src) |
| |
| #define | SUB(dst, src) |
| |
| #define | MUL(dst, src) |
| |
| #define | DIV(dst, src) |
| |
| #define | JMP(lbl) |
| |
| #define | CMP(p1, p2) |
| |
| #define | JZ(lbl) |
| |
| #define | JNZ(lbl) |
| |
| #define | INC(param) |
| |
| #define | DEC(param) |
| |
| #define | LEA(dst, src) |
| |
| #define | SETL(dst, src) |
| |
| #define | GETL(dst, src) |
| |
| #define | CALL(proc) |
| |
| #define | INVOKE(proc) |
| |
| #define | RETURN() |
| |
| #define | RET() |
| |
| #define | LOOP(index, start, end) |
| |
| #define | ENDLOOP(index) |
| |
| #define | EXIT() |
| |
| #define | PROC_NAKED(proc_name) |
| |
| #define | ENDP_NAKED |
| |
|
| typedef const char * | STRING |
| |
| typedef unsigned char | BYTE |
| |
| typedef unsigned short | WORD |
| |
| typedef unsigned long | DWORD |
| |
| typedef unsigned long long | QWORD |
| |
| typedef QWORD | INT |
| |
◆ ADD
◆ CALL
Value: { \
static jmp_buf _ip; \
static jmp_buf _ipArray[10]; \
if (setjmp(_ip) == 0) \
{ \
memcpy(_ipArray[ip++], &_ip, sizeof(jmp_buf)); \
PUSH(ip); \
proc(); \
} \
}
Definition at line 174 of file kernel_asm.h.
◆ CMP
◆ DEC
◆ DIV
◆ ENDLOOP
◆ ENDP
Value: _end_proc: \
proc_retn(); \
return 0; \
}
Definition at line 73 of file kernel_asm.h.
◆ ENDP_NAKED
Value: _end_proc: \
return 0; \
}
Definition at line 230 of file kernel_asm.h.
◆ EXIT
◆ EXTERN
◆ GETL
| #define GETL |
( |
| dst, |
|
|
| src ) |
◆ INC
◆ INVOKE
Value: { \
CALL(proc); \
POP(n); \
}
Definition at line 187 of file kernel_asm.h.
◆ JMP
◆ JNZ
◆ JZ
◆ KERNEL_ASM_H
◆ LEA
Value: { \
(dst) = (void *)(src); \
}
Definition at line 158 of file kernel_asm.h.
◆ LOOP
| #define LOOP |
( |
| index, |
|
|
| start, |
|
|
| end ) |
◆ MAX_MEMORY_LEN
| #define MAX_MEMORY_LEN 100 |
◆ MOVL
| #define MOVL |
( |
| dst, |
|
|
| src ) |
◆ MUL
◆ POP
◆ PROC
| #define PROC |
( |
| proc_name | ) |
|
Value: static int proc_name##DTCASE() \
{ \
proc_init();
Definition at line 68 of file kernel_asm.h.
◆ PROC_NAKED
| #define PROC_NAKED |
( |
| proc_name | ) |
|
◆ PROTO
◆ PUSH
◆ RET
Value: { \
static jmp_buf _ip; \
static jmp_buf _ipArray[]; \
POP(ip); \
memcpy(&_ip, _ipArray[ip - 1], sizeof(jmp_buf)); \
longjmp(_ip, a); \
}
Definition at line 199 of file kernel_asm.h.
◆ RETURN
◆ SETL
| #define SETL |
( |
| dst, |
|
|
| src ) |
◆ SUB
◆ BYTE
| typedef unsigned char BYTE |
◆ DWORD
| typedef unsigned long DWORD |
◆ INT
◆ QWORD
| typedef unsigned long long QWORD |
◆ STRING
◆ WORD
| typedef unsigned short WORD |
◆ FLAG
| Enumerator |
|---|
| FLAG_SIGNED | |
| FLAG_ZERO | |
Definition at line 61 of file kernel_asm.h.