Bitdefender Hypervisor Memory Introspection
uninit.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020 Bitdefender
3  * SPDX-License-Identifier: Apache-2.0
4  */
5 #include "uninit.h"
6 #include "../common.h"
7 
9 struct data _data __section(".adata") __aligned(1) = { 0 };
10 
12 void uninit (void)
18 {
19  unsigned long ptr = (unsigned long)(_data.args.module_alloc_ptr);
20 
21  int ret = _data.func.change_page_attr_set_clr(&ptr, 0x3, _data.args.mask_set, _data.args.mask_clr, 0, 0, 0);
22  if (ret)
23  {
24  breakpoint_1(_data.token.error, ret);
25  return;
26  }
27 
28  _data.func.vfree(_data.args.module_alloc_ptr);
29  _data.func.vfree(_data.args.vmalloc_ptr);
30 
31 
32  breakpoint_1(_data.token.completion, ret);
33 }
34 
35 __fn_naked __section(".start")
36 void trampoline(void)
44 {
45  uninit();
46 
47  __exit;
48 }
49 
50 
__fn_naked void trampoline(void)
The trampoline of the agent.
Definition: uninit.c:36
#define __fn_naked
Definition: common.h:79
#define __exit
Generates the exit asm-code for agents.
Definition: common.h:120
#define __section(S)
Definition: common.h:76
#define breakpoint_1(token, p1)
Hypercall using 1 argument.
Definition: common.h:177
#define __default_fn_attr
Definition: common.h:78
struct data _data __aligned(1)
The section used for this agent is .adata'.
Definition: kthread.c:14
__default_fn_attr void uninit(void)
Deallocate the memory regions previously allocated.
Definition: uninit.c:12