summaryrefslogtreecommitdiffhomepage
path: root/src/process/nt64
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/nt64
parentdcdadc2702712fa750ed255ed1dfa354522797a0 (diff)
downloadntapi-dd89bb8ad4fe184a34b5dbdda237e640fc82121b.tar.bz2
ntapi-dd89bb8ad4fe184a34b5dbdda237e640fc82121b.tar.xz
entered advanced internal development stage.
Diffstat (limited to 'src/process/nt64')
-rw-r--r--src/process/nt64/tt_fork_v1.s134
-rw-r--r--src/process/nt64/tt_fork_v1_x86_64.asm136
-rw-r--r--src/process/nt64/tt_fork_v2_x86_64.asm50
3 files changed, 320 insertions, 0 deletions
diff --git a/src/process/nt64/tt_fork_v1.s b/src/process/nt64/tt_fork_v1.s
new file mode 100644
index 0000000..5f09463
--- /dev/null
+++ b/src/process/nt64/tt_fork_v1.s
@@ -0,0 +1,134 @@
+##########################################################
+## 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_v1
+.global __tt_fork_child_entry_point
+.global __tt_fork_child_entry_point_adj
+
+__tt_fork_v1:
+__tt_fork_save_regs:
+ push %rbp
+ push %rcx
+ push %rdx
+ push %rbx
+ push %rsi
+ push %rdi
+ push %r8
+ push %r9
+ push %r10
+ push %r11
+ push %r12
+ push %r13
+ push %r14
+ push %r15
+
+ sub 0x40,%rsp
+
+ mov %rsp, %rdx
+ and $0xf, %rdx
+ test %rdx, %rdx
+ jne __tt_fork_impl_adj_call
+
+__tt_fork_impl_call:
+ mov %rsp, %rcx
+ call __tt_fork_impl_v1
+
+ add 0x40,%rsp
+
+ pop %r15
+ pop %r14
+ pop %r13
+ pop %r12
+ pop %r11
+ pop %r10
+ pop %r9
+ pop %r8
+ pop %rdi
+ pop %rsi
+ pop %rbx
+ pop %rdx
+ pop %rcx
+ pop %rbp
+
+ ret
+
+__tt_fork_impl_adj_call:
+ push %rdi
+
+ mov %rsp, %rcx
+ call __tt_fork_impl_v1
+
+ pop %rdi
+
+ add 0x40,%rsp
+
+ pop %r15
+ pop %r14
+ pop %r13
+ pop %r12
+ pop %r11
+ pop %r10
+ pop %r9
+ pop %r8
+ pop %rdi
+ pop %rsi
+ pop %rbx
+ pop %rdx
+ pop %rcx
+ pop %rbp
+
+ ret
+
+
+__tt_fork_child_entry_point:
+ xor %rax, %rax
+ mov %rcx, %rsp
+
+ add 0x40,%rsp
+
+ pop %r15
+ pop %r14
+ pop %r13
+ pop %r12
+ pop %r11
+ pop %r10
+ pop %r9
+ pop %r8
+ pop %rdi
+ pop %rsi
+ pop %rbx
+ pop %rdx
+ pop %rcx
+ pop %rbp
+
+ ret
+
+__tt_fork_child_entry_point_adj:
+ xor %rax, %rax
+ mov %rcx, %rsp
+
+ pop %rdi
+
+ add 0x40,%rsp
+
+ pop %r15
+ pop %r14
+ pop %r13
+ pop %r12
+ pop %r11
+ pop %r10
+ pop %r9
+ pop %r8
+ pop %rdi
+ pop %rsi
+ pop %rbx
+ pop %rdx
+ pop %rcx
+ pop %rbp
+
+ ret
diff --git a/src/process/nt64/tt_fork_v1_x86_64.asm b/src/process/nt64/tt_fork_v1_x86_64.asm
new file mode 100644
index 0000000..f79131e
--- /dev/null
+++ b/src/process/nt64/tt_fork_v1_x86_64.asm
@@ -0,0 +1,136 @@
+/********************************************************/
+/* ntapi: Native API core library */
+/* Copyright (C) 2013,2014,2015 Z. Gilboa */
+/* Released under GPLv2 and GPLv3; see COPYING.NTAPI. */
+/********************************************************/
+
+TITLE tt_fork_x86_64
+
+.data
+__tt_fork_impl_v1 PROTO C
+
+.code
+__tt_fork_v1 PROC
+ push rbp
+ push rcx
+ push rdx
+ push rbx
+ push rsi
+ push rdi
+ push r8
+ push r9
+ push r10
+ push r11
+ push r12
+ push r13
+ push r14
+ push r15
+
+ sub rsp, 40h
+
+ mov rdx, rsp
+ and rdx, 15
+ test rdx, rdx
+ jne __tt_fork_impl_adj_call
+
+ mov rcx, rsp
+ call __tt_fork_impl_v1
+
+ add rsp, 40h
+
+ pop r15
+ pop r14
+ pop r13
+ pop r12
+ pop r11
+ pop r10
+ pop r9
+ pop r8
+ pop rdi
+ pop rsi
+ pop rbx
+ pop rdx
+ pop rcx
+ pop rbp
+ ret
+__tt_fork_v1 ENDP
+
+__tt_fork_impl_adj_call PROC
+ push rdi
+
+ mov rcx, rsp
+ mov rdx, 1
+ call __tt_fork_impl_v1
+
+ pop rdi
+
+ add rsp, 40h
+
+ pop r15
+ pop r14
+ pop r13
+ pop r12
+ pop r11
+ pop r10
+ pop r9
+ pop r8
+ pop rdi
+ pop rsi
+ pop rbx
+ pop rdx
+ pop rcx
+ pop rbp
+ ret
+__tt_fork_impl_adj_call ENDP
+
+
+__tt_fork_child_entry_point PROC
+ xor rax, rax
+ mov rsp, rcx
+
+ add rsp, 40h
+
+ pop r15
+ pop r14
+ pop r13
+ pop r12
+ pop r11
+ pop r10
+ pop r9
+ pop r8
+ pop rdi
+ pop rsi
+ pop rbx
+ pop rdx
+ pop rcx
+ pop rbp
+ ret
+__tt_fork_child_entry_point ENDP
+
+
+__tt_fork_child_entry_point_adj PROC
+ xor rax, rax
+ mov rsp, rcx
+
+ pop rdi
+
+ add rsp, 40h
+
+ pop r15
+ pop r14
+ pop r13
+ pop r12
+ pop r11
+ pop r10
+ pop r9
+ pop r8
+ pop rdi
+ pop rsi
+ pop rbx
+ pop rdx
+ pop rcx
+ pop rbp
+ ret
+__tt_fork_child_entry_point_adj ENDP
+
+END
diff --git a/src/process/nt64/tt_fork_v2_x86_64.asm b/src/process/nt64/tt_fork_v2_x86_64.asm
new file mode 100644
index 0000000..cc6e353
--- /dev/null
+++ b/src/process/nt64/tt_fork_v2_x86_64.asm
@@ -0,0 +1,50 @@
+/********************************************************/
+/* ntapi: Native API core library */
+/* Copyright (C) 2013,2014,2015 Z. Gilboa */
+/* Released under GPLv2 and GPLv3; see COPYING.NTAPI. */
+/********************************************************/
+
+TITLE tt_fork_x86_64
+
+.data
+__tt_fork_impl_v2 PROTO C
+
+.code
+__tt_fork_v2 PROC
+ push rbp
+ push rcx
+ push rdx
+ push rbx
+ push rsi
+ push rdi
+ push r8
+ push r9
+ push r10
+ push r11
+ push r12
+ push r13
+ push r14
+ push r15
+
+ sub rsp, 40h
+ call __tt_fork_impl_v2
+ add rsp, 40h
+
+ pop r15
+ pop r14
+ pop r13
+ pop r12
+ pop r11
+ pop r10
+ pop r9
+ pop r8
+ pop rdi
+ pop rsi
+ pop rbx
+ pop rdx
+ pop rcx
+ pop rbp
+ ret
+__tt_fork_v2 ENDP
+
+END