summaryrefslogtreecommitdiffhomepage
path: root/src/process/nt32
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/process/nt32
parentdcdadc2702712fa750ed255ed1dfa354522797a0 (diff)
downloadntapi-dd89bb8ad4fe184a34b5dbdda237e640fc82121b.tar.bz2
ntapi-dd89bb8ad4fe184a34b5dbdda237e640fc82121b.tar.xz
entered advanced internal development stage.
Diffstat (limited to 'src/process/nt32')
-rw-r--r--src/process/nt32/tt_fork_v1.s60
-rw-r--r--src/process/nt32/tt_fork_v1_i386.c66
2 files changed, 126 insertions, 0 deletions
diff --git a/src/process/nt32/tt_fork_v1.s b/src/process/nt32/tt_fork_v1.s
new file mode 100644
index 0000000..2e2f01d
--- /dev/null
+++ b/src/process/nt32/tt_fork_v1.s
@@ -0,0 +1,60 @@
+##########################################################
+## ntapi: Native API core library ##
+## Copyright (C) 2013,2014,2015 Z. Gilboa ##
+## Released under GPLv2 and GPLv3; see COPYING.NTAPI. ##
+##########################################################
+
+.section .text
+
+.global ___tt_fork
+.global ___tt_fork_child_entry_point
+.global @__tt_fork_child_entry_point@4
+.global ___tt_fork_child_entry_point_adj
+.global @__tt_fork_child_entry_point_adj@4
+
+___tt_fork:
+___tt_fork_prolog:
+ push %ebp
+ mov %esp, %ebp
+
+___tt_fork_save_regs:
+ push %ecx
+ push %edx
+ push %ebx
+ push %esi
+ push %edi
+
+___tt_fork_impl_call:
+ mov %esp, %ecx
+ mov $0, %edx
+ call @__tt_fork_impl@8
+
+___tt_fork_restore_regs:
+ pop %edi
+ pop %esi
+ pop %ebx
+ pop %edx
+ pop %ecx
+
+___tt_fork_epilog:
+ mov %ebp, %esp
+ pop %ebp
+ ret
+
+___tt_fork_child_entry_point:
+@__tt_fork_child_entry_point@4:
+___tt_fork_child_entry_point_adj:
+@__tt_fork_child_entry_point_adj@4:
+ xor %eax, %eax
+ mov %ecx, %esp
+
+___tt_fork_child_restore_regs:
+ pop %edi
+ pop %esi
+ pop %ebx
+ pop %edx
+ pop %ecx
+
+___tt_fork_child_epilog:
+ pop %ebp
+ ret
diff --git a/src/process/nt32/tt_fork_v1_i386.c b/src/process/nt32/tt_fork_v1_i386.c
new file mode 100644
index 0000000..34b813e
--- /dev/null
+++ b/src/process/nt32/tt_fork_v1_i386.c
@@ -0,0 +1,66 @@
+/********************************************************/
+/* ntapi: Native API core library */
+/* Copyright (C) 2013,2014,2015 Z. Gilboa */
+/* Released under GPLv2 and GPLv3; see COPYING.NTAPI. */
+/********************************************************/
+
+#include <psxtypes/psxtypes.h>
+
+#if (__COMPILER__ == __MSVC__) && defined(__X86_MODEL)
+
+intptr_t __fastcall __tt_fork_impl(
+ __in uintptr_t saved_regs_stack_pointer,
+ __in uintptr_t stack_adjustment);
+
+int32_t __declspec(naked) __cdecl __tt_fork(void)
+{
+ __asm {
+ push ebp
+ mov ebp, esp
+
+ push ecx
+ push edx
+ push ebx
+ push esi
+ push edi
+
+ mov ecx, esp
+ call __tt_fork_impl
+
+ pop edi
+ pop esi
+ pop ebx
+ pop edx
+ pop ecx
+
+ mov esp, ebp
+ pop ebp
+ ret
+ };
+}
+
+void __declspec(naked) __fastcall __tt_fork_child_entry_point(uintptr_t esp_saved)
+{
+ __asm {
+ xor eax, eax
+ mov esp, ecx
+
+ pop edi
+ pop esi
+ pop ebx
+ pop edx
+ pop ecx
+
+ pop ebp
+ ret
+ };
+}
+
+void __declspec(naked) __fastcall __tt_fork_child_entry_point_adj(uintptr_t esp_saved)
+{
+ __asm {
+ jmp __tt_fork_child_entry_point
+ };
+}
+
+#endif