summaryrefslogtreecommitdiffhomepage
path: root/src/seh
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2017-01-16 02:32:54 +0000
committermidipix <writeonce@midipix.org>2017-01-16 01:52:23 -0500
commitcd4191db5ebcb3ca96c5d5eb4336eddd895445bf (patch)
treec4dd168fbb5ef6536671a6ff9c65599b925449a0 /src/seh
parentdf4a224d9c3615b3b160432855b5862d2dc69157 (diff)
downloadntapi-cd4191db5ebcb3ca96c5d5eb4336eddd895445bf.tar.bz2
ntapi-cd4191db5ebcb3ca96c5d5eb4336eddd895445bf.tar.xz
daemon initialization: establish SEH frames for the daemon and internal thread.
Diffstat (limited to 'src/seh')
-rw-r--r--src/seh/nt32/ntapi_tt_seh_frame.s21
-rw-r--r--src/seh/nt64/ntapi_tt_seh_frame.s43
-rw-r--r--src/seh/ntapi_tt_seh_frame.c0
3 files changed, 64 insertions, 0 deletions
diff --git a/src/seh/nt32/ntapi_tt_seh_frame.s b/src/seh/nt32/ntapi_tt_seh_frame.s
new file mode 100644
index 0000000..d301217
--- /dev/null
+++ b/src/seh/nt32/ntapi_tt_seh_frame.s
@@ -0,0 +1,21 @@
+##########################################################
+## ntapi: Native API core library ##
+## Copyright (C) 2013--2017 Z. Gilboa ##
+## Released under GPLv2 and GPLv3; see COPYING.NTAPI. ##
+##########################################################
+
+.section .text
+
+.global ___ntapi_tt_seh_frame
+
+ .def ___ntapi_tt_seh_frame; .scl 3; .type 32; .endef
+
+___ntapi_tt_seh_frame:
+ movl 16(%esp),%eax
+ jmp *%eax
+
+ .section .got$___ntapi_tt_seh_frame,"r"
+ .global __imp____ntapi_tt_seh_frame
+__imp____ntapi_tt_seh_frame:
+ .long ___ntapi_tt_seh_frame
+ .linkonce discard
diff --git a/src/seh/nt64/ntapi_tt_seh_frame.s b/src/seh/nt64/ntapi_tt_seh_frame.s
new file mode 100644
index 0000000..cd4a681
--- /dev/null
+++ b/src/seh/nt64/ntapi_tt_seh_frame.s
@@ -0,0 +1,43 @@
+##########################################################
+## ntapi: Native API core library ##
+## Copyright (C) 2013--2017 Z. Gilboa ##
+## Released under GPLv2 and GPLv3; see COPYING.NTAPI. ##
+##########################################################
+
+.section .text
+
+.global __ntapi_tt_seh_frame
+
+ .def __ntapi_tt_seh_frame; .scl 3; .type 32; .endef
+ .def __seh_trap; .scl 3; .type 32; .endef
+
+__seh_trap:
+ nop
+ jmp __seh_trap
+
+ .seh_proc __ntapi_tt_seh_frame
+__ntapi_tt_seh_frame:
+ .seh_endprologue
+
+.__init_frame_begin:
+ .seh_handler __seh_trap, @except
+ .seh_handlerdata
+ .long 1
+ .long .__init_frame_begin,.__init_frame_end,__seh_trap,.__init_frame_end
+ .text
+
+ subq $40, %rsp
+ call *%r9
+ addq $40, %rsp
+
+ nop
+.__init_frame_end:
+ ret
+
+ .seh_endproc
+
+ .section .got$__ntapi_tt_seh_frame,"r"
+ .global __imp___ntapi_tt_seh_frame
+__imp___ntapi_tt_seh_frame:
+ .quad __ntapi_tt_seh_frame
+ .linkonce discard
diff --git a/src/seh/ntapi_tt_seh_frame.c b/src/seh/ntapi_tt_seh_frame.c
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/seh/ntapi_tt_seh_frame.c