summaryrefslogtreecommitdiffhomepage
path: root/src/internal/ntapi_context.h
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2015-07-27 04:01:18 -0400
committermidipix <writeonce@midipix.org>2015-07-27 04:01:18 -0400
commitdd89bb8ad4fe184a34b5dbdda237e640fc82121b (patch)
tree5e80d2da35f5892f92be29f57982b2708e6bd99b /src/internal/ntapi_context.h
parentdcdadc2702712fa750ed255ed1dfa354522797a0 (diff)
downloadntapi-dd89bb8ad4fe184a34b5dbdda237e640fc82121b.tar.bz2
ntapi-dd89bb8ad4fe184a34b5dbdda237e640fc82121b.tar.xz
entered advanced internal development stage.
Diffstat (limited to 'src/internal/ntapi_context.h')
-rw-r--r--src/internal/ntapi_context.h55
1 files changed, 55 insertions, 0 deletions
diff --git a/src/internal/ntapi_context.h b/src/internal/ntapi_context.h
new file mode 100644
index 0000000..4020158
--- /dev/null
+++ b/src/internal/ntapi_context.h
@@ -0,0 +1,55 @@
+/********************************************************/
+/* ntapi: Native API core library */
+/* Copyright (C) 2013,2014,2015 Z. Gilboa */
+/* Released under GPLv2 and GPLv3; see COPYING.NTAPI. */
+/********************************************************/
+
+#ifndef ___NTAPI_CONTEXT_H_
+#define ___NTAPI_CONTEXT_H_
+
+#if defined(__X86_MODEL)
+ /* csr port handle */
+ #define __GET_CSR_PORT_HANDLE_BY_LOGIC __ntapi_tt_get_csr_port_handle_addr_by_logic_i386
+
+ /* register names */
+ #define STACK_POINTER_REGISTER uc_esp
+ #define INSTRUCTION_POINTER_REGISTER uc_eip
+ #define FAST_CALL_ARG0 uc_ecx
+ #define FAST_CALL_ARG1 uc_edx
+
+ /* thread context initialization */
+ #define __INIT_CONTEXT(context) \
+ context.uc_context_flags = NT_CONTEXT_JUST_EVERYTHING; \
+ context.uc_seg_gs = 0x00; \
+ context.uc_seg_fs = 0x3b; \
+ context.uc_seg_es = 0x23; \
+ context.uc_seg_ds = 0x23; \
+ context.uc_seg_ss = 0x23; \
+ context.uc_seg_cs = 0x1b; \
+ context.uc_eflags = 0x200
+
+#elif defined (__X86_64_MODEL)
+ /* csr port handle */
+ #define __GET_CSR_PORT_HANDLE_BY_LOGIC __ntapi_tt_get_csr_port_handle_addr_by_logic_x86_64
+
+ /* register names */
+ #define STACK_POINTER_REGISTER uc_rsp
+ #define INSTRUCTION_POINTER_REGISTER uc_rip
+ #define FAST_CALL_ARG0 uc_rcx
+ #define FAST_CALL_ARG1 uc_rdx
+
+ /* thread context initialization */
+ #define __INIT_CONTEXT(context) \
+ context.uc_context_flags= NT_CONTEXT_JUST_EVERYTHING; \
+ context.uc_seg_cs = 0x33; \
+ context.uc_seg_ds = 0x2b; \
+ context.uc_seg_es = 0x2b; \
+ context.uc_seg_fs = 0x53; \
+ context.uc_seg_gs = 0x2b; \
+ context.uc_seg_ss = 0x2b; \
+ context.uc_eflags = 0x200; \
+ context.uc_mx_csr = 0x1f80
+
+#endif
+
+#endif