-
Notifications
You must be signed in to change notification settings - Fork 5
/
qwt-chkstk.patch
73 lines (71 loc) · 2.28 KB
/
qwt-chkstk.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
--- a/qubes-core-agent-windows-mm_a2aea339/Makefile 2019-06-05 03:37:28.000000000 +0000
+++ b/qubes-core-agent-windows-mm_a2aea339/Makefile 2019-06-07 13:39:04.234629240 +0000
@@ -38,8 +38,8 @@
$(OUTDIR_ANY)/service-policy.cfg: src/service-policy/service-policy.cfg
cp $^ $@
-$(OUTDIR)/relocate-dir.exe: $(wildcard src/relocate-dir/*.c)
- $(CC) $^ $(CFLAGS) -I$(DDK_PATH) -e NtProcessStartup -Wl,--subsystem,native -L $(OUTDIR) -lntdll -nostdlib -D__INTRINSIC_DEFINED__InterlockedAdd64 -fstack-check -Wl,--stack,16777216 -mno-stack-arg-probe -municode -Wl,--no-insert-timestamp -o $@
+$(OUTDIR)/relocate-dir.exe: $(wildcard src/relocate-dir/*.c) src/relocate-dir/chkstk.S
+ $(CC) $^ $(CFLAGS) -I$(DDK_PATH) -e NtProcessStartup -Wl,--subsystem,native -L $(OUTDIR) -lntdll -nostdlib -D__INTRINSIC_DEFINED__InterlockedAdd64 -municode -Wl,--no-insert-timestamp -o $@
$(RPC_FILES): $(OUTDIR_ANY)/qubes-rpc/%: src/qrexec-services/%
cp $^ $@
--- a/qubes-core-agent-windows-mm_a2aea339/src/relocate-dir/chkstk.S 1970-01-01 00:00:00.000000000 +0000
+++ b/qubes-core-agent-windows-mm_a2aea339/src/relocate-dir/chkstk.S 2019-06-07 13:45:30.139518751 +0000
@@ -0,0 +1,57 @@
+#include "assembly.h"
+
+// _chkstk routine
+// This routine is windows specific
+// http://msdn.microsoft.com/en-us/library/ms648426.aspx
+
+#ifdef __i386__
+
+.text
+.balign 4
+DEFINE_COMPILERRT_FUNCTION(__chkstk_ms)
+ push %ecx
+ push %eax
+ cmp $0x1000,%eax
+ lea 12(%esp),%ecx
+ jb 1f
+2:
+ sub $0x1000,%ecx
+ orl $0,(%ecx)
+ sub $0x1000,%eax
+ cmp $0x1000,%eax
+ ja 2b
+1:
+ sub %eax,%ecx
+ orl $0,(%ecx)
+ pop %eax
+ pop %ecx
+ ret
+END_COMPILERRT_FUNCTION(__chkstk_ms)
+
+#endif // __i386__
+
+#ifdef __x86_64__
+
+.text
+.balign 4
+DEFINE_COMPILERRT_FUNCTION(___chkstk_ms)
+ push %rcx
+ push %rax
+ cmp $0x1000,%rax
+ lea 24(%rsp),%rcx
+ jb 1f
+2:
+ sub $0x1000,%rcx
+ orl $0,(%rcx)
+ sub $0x1000,%rax
+ cmp $0x1000,%rax
+ ja 2b
+1:
+ sub %rax,%rcx
+ orl $0,(%rcx)
+ pop %rax
+ pop %rcx
+ ret
+END_COMPILERRT_FUNCTION(___chkstk_ms)
+
+#endif // __x86_64__