1 | ; $Id: guard-vcc.asm 95916 2022-07-28 14:29:03Z vboxsync $
|
---|
2 | ;; @file
|
---|
3 | ; IPRT - Control Flow Guard related Visual C++ support routines.
|
---|
4 | ;
|
---|
5 |
|
---|
6 | ;
|
---|
7 | ; Copyright (C) 2022 Oracle Corporation
|
---|
8 | ;
|
---|
9 | ; This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | ; available from http://www.alldomusa.eu.org. This file is free software;
|
---|
11 | ; you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | ; General Public License (GPL) as published by the Free Software
|
---|
13 | ; Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | ; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | ; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | ;
|
---|
17 | ; The contents of this file may alternatively be used under the terms
|
---|
18 | ; of the Common Development and Distribution License Version 1.0
|
---|
19 | ; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
20 | ; VirtualBox OSE distribution, in which case the provisions of the
|
---|
21 | ; CDDL are applicable instead of those of the GPL.
|
---|
22 | ;
|
---|
23 | ; You may elect to license modified versions of this file under the
|
---|
24 | ; terms and conditions of either the GPL or the CDDL or both.
|
---|
25 | ;
|
---|
26 |
|
---|
27 |
|
---|
28 |
|
---|
29 | ;*********************************************************************************************************************************
|
---|
30 | ;* Header Files *
|
---|
31 | ;*********************************************************************************************************************************
|
---|
32 | %include "iprt/asmdefs.mac"
|
---|
33 | %include "iprt/x86.mac"
|
---|
34 |
|
---|
35 |
|
---|
36 |
|
---|
37 | ;*********************************************************************************************************************************
|
---|
38 | ;* Global Variables *
|
---|
39 | ;*********************************************************************************************************************************
|
---|
40 |
|
---|
41 | ;
|
---|
42 | ; Points to a NOP icall checker by default.
|
---|
43 | ; The loader will replace this when we start advertising it in the load config.
|
---|
44 | ;
|
---|
45 | section .0000cfg rdata align=8
|
---|
46 |
|
---|
47 | GLOBALNAME __guard_check_icall_fptr
|
---|
48 | RTCCPTR_DEF NAME(__guard_check_icall_nop)
|
---|
49 |
|
---|
50 | %ifdef RT_ARCH_AMD64
|
---|
51 | GLOBALNAME __guard_dispatch_icall_fptr
|
---|
52 | RTCCPTR_DEF __guard_dispatch_icall_nop
|
---|
53 |
|
---|
54 | ; xfg stuff (haven't seen it generated or used yet).
|
---|
55 | GLOBALNAME __guard_xfg_check_icall_fptr
|
---|
56 | RTCCPTR_DEF __guard_check_icall_nop
|
---|
57 |
|
---|
58 | GLOBALNAME __guard_xfg_dispatch_icall_fptr
|
---|
59 | RTCCPTR_DEF __guard_xfg_dispatch_icall_nop
|
---|
60 |
|
---|
61 | GLOBALNAME __guard_xfg_table_dispatch_icall_fptr
|
---|
62 | RTCCPTR_DEF __guard_xfg_dispatch_icall_nop
|
---|
63 |
|
---|
64 | %endif
|
---|
65 |
|
---|
66 |
|
---|
67 | BEGINCODE
|
---|
68 | ;;
|
---|
69 | ; Check that doesn't do anything.
|
---|
70 | ;
|
---|
71 | ; This is for older windows versions which doesn't support call flow guard stuff.
|
---|
72 | ;
|
---|
73 | BEGINPROC __guard_check_icall_nop
|
---|
74 | ret
|
---|
75 | ENDPROC __guard_check_icall_nop
|
---|
76 |
|
---|
77 | %ifdef RT_ARCH_AMD64
|
---|
78 | ;;
|
---|
79 | ; Target function in RAX
|
---|
80 | ;
|
---|
81 | ; This is for older windows versions which doesn't support call flow guard stuff.
|
---|
82 | ;
|
---|
83 | BEGINPROC __guard_dispatch_icall_nop
|
---|
84 | jmp rax
|
---|
85 | ENDPROC __guard_dispatch_icall_nop
|
---|
86 | %endif
|
---|
87 |
|
---|
88 | %ifdef RT_ARCH_AMD64
|
---|
89 | ;;
|
---|
90 | ; Target function in RAX
|
---|
91 | ;
|
---|
92 | ; This is for windows versions which doesn't support extended call flow guard stuff.
|
---|
93 | ;
|
---|
94 | BEGINPROC __guard_xfg_dispatch_icall_nop
|
---|
95 | jmp [__guard_dispatch_icall_nop wrt RIP]
|
---|
96 | ENDPROC __guard_xfg_dispatch_icall_nop
|
---|
97 | %endif
|
---|
98 |
|
---|