1 /*
2  * Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved.
3  *
4  */
5 
6 #ifndef __XEN_VIRTUAL_REGION_H__
7 #define __XEN_VIRTUAL_REGION_H__
8 
9 #include <xen/list.h>
10 #include <xen/symbols.h>
11 
12 /*
13  * Despite it's name, this is a module(ish) description.
14  *
15  * There's one region for the runtime .text/etc, one region for .init during
16  * boot only, and one region per livepatch.
17  */
18 struct virtual_region
19 {
20     struct list_head list;
21 
22     const void *text_start;                /* .text virtual address start. */
23     const void *text_end;                  /* .text virtual address end. */
24 
25     const void *rodata_start;              /* .rodata virtual address start (optional). */
26     const void *rodata_end;                /* .rodata virtual address end. */
27 
28     /* If this is NULL the default lookup mechanism is used. */
29     symbols_lookup_t *symbols_lookup;
30 
31     struct {
32         const struct bug_frame *start, *stop; /* Pointers to array of bug frames. */
33     } frame[BUGFRAME_NR];
34 
35 #ifdef CONFIG_HAS_EX_TABLE
36     const struct exception_table_entry *ex;
37     const struct exception_table_entry *ex_end;
38 #endif
39 };
40 
41 const struct virtual_region *find_text_region(unsigned long addr);
42 void unregister_init_virtual_region(void);
43 void register_virtual_region(struct virtual_region *r);
44 void unregister_virtual_region(struct virtual_region *r);
45 
46 void relax_virtual_region_perms(void);
47 void tighten_virtual_region_perms(void);
48 
49 #endif /* __XEN_VIRTUAL_REGION_H__ */
50 
51 /*
52  * Local variables:
53  * mode: C
54  * c-file-style: "BSD"
55  * c-basic-offset: 4
56  * tab-width: 4
57  * indent-tabs-mode: nil
58  * End:
59  */
60