Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/hotspot/os/windows/gc/z/zMapper_windows.hpp
40948 views
1
/*
2
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation.
8
*
9
* This code is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12
* version 2 for more details (a copy is included in the LICENSE file that
13
* accompanied this code).
14
*
15
* You should have received a copy of the GNU General Public License version
16
* 2 along with this work; if not, write to the Free Software Foundation,
17
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18
*
19
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20
* or visit www.oracle.com if you need additional information or have any
21
* questions.
22
*/
23
24
#ifndef OS_WINDOWS_GC_Z_ZMAPPER_WINDOWS_HPP
25
#define OS_WINDOWS_GC_Z_ZMAPPER_WINDOWS_HPP
26
27
#include "memory/allocation.hpp"
28
#include "utilities/globalDefinitions.hpp"
29
30
#include <Windows.h>
31
32
class ZMapper : public AllStatic {
33
private:
34
// Create paging file mapping
35
static HANDLE create_paging_file_mapping(size_t size);
36
37
// Commit paging file mapping
38
static bool commit_paging_file_mapping(HANDLE file_handle, uintptr_t file_offset, size_t size);
39
40
// Map a view anywhere without a placeholder
41
static uintptr_t map_view_no_placeholder(HANDLE file_handle, uintptr_t file_offset, size_t size);
42
43
// Unmap a view without preserving a placeholder
44
static void unmap_view_no_placeholder(uintptr_t addr, size_t size);
45
46
// Commit memory covering the given virtual address range
47
static uintptr_t commit(uintptr_t addr, size_t size);
48
49
public:
50
// Reserve memory with a placeholder
51
static uintptr_t reserve(uintptr_t addr, size_t size);
52
53
// Unreserve memory
54
static void unreserve(uintptr_t addr, size_t size);
55
56
// Create and commit paging file mapping
57
static HANDLE create_and_commit_paging_file_mapping(size_t size);
58
59
// Close paging file mapping
60
static void close_paging_file_mapping(HANDLE file_handle);
61
62
// Create a shared AWE section
63
static HANDLE create_shared_awe_section();
64
65
// Reserve memory attached to the shared AWE section
66
static uintptr_t reserve_for_shared_awe(HANDLE awe_section, uintptr_t addr, size_t size);
67
68
// Unreserve memory attached to a shared AWE section
69
static void unreserve_for_shared_awe(uintptr_t addr, size_t size);
70
71
// Split a placeholder
72
//
73
// A view can only replace an entire placeholder, so placeholders need to be
74
// split and coalesced to be the exact size of the new views.
75
// [addr, addr + size) needs to be a proper sub-placeholder of an existing
76
// placeholder.
77
static void split_placeholder(uintptr_t addr, size_t size);
78
79
// Coalesce a placeholder
80
//
81
// [addr, addr + size) is the new placeholder. A sub-placeholder needs to
82
// exist within that range.
83
static void coalesce_placeholders(uintptr_t addr, size_t size);
84
85
// Map a view of the file handle and replace the placeholder covering the
86
// given virtual address range
87
static void map_view_replace_placeholder(HANDLE file_handle, uintptr_t file_offset, uintptr_t addr, size_t size);
88
89
// Unmap the view and reinstate a placeholder covering the given virtual
90
// address range
91
static void unmap_view_preserve_placeholder(uintptr_t addr, size_t size);
92
};
93
94
#endif // OS_WINDOWS_GC_Z_ZMAPPER_WINDOWS_HPP
95
96