@@ -24,13 +24,13 @@ void *GuardedPoolAllocator::map(size_t Size, const char *Name) const {
24
24
assert ((Size % State.PageSize ) == 0 );
25
25
zx_handle_t Vmo;
26
26
zx_status_t Status = _zx_vmo_create (Size , 0 , &Vmo);
27
- check (Status == ZX_OK, " Failed to create Vmo" );
27
+ checkWithErrorCode (Status == ZX_OK, " Failed to create Vmo" , Status );
28
28
_zx_object_set_property (Vmo, ZX_PROP_NAME, Name, strlen (Name));
29
29
zx_vaddr_t Addr;
30
30
Status = _zx_vmar_map (_zx_vmar_root_self (),
31
31
ZX_VM_PERM_READ | ZX_VM_PERM_WRITE | ZX_VM_ALLOW_FAULTS,
32
32
0 , Vmo, 0 , Size , &Addr);
33
- check (Status == ZX_OK, " Vmo mapping failed" );
33
+ checkWithErrorCode (Status == ZX_OK, " Vmo mapping failed" , Status );
34
34
_zx_handle_close (Vmo);
35
35
return reinterpret_cast <void *>(Addr);
36
36
}
@@ -40,7 +40,7 @@ void GuardedPoolAllocator::unmap(void *Ptr, size_t Size) const {
40
40
assert ((Size % State.PageSize ) == 0 );
41
41
zx_status_t Status = _zx_vmar_unmap (_zx_vmar_root_self (),
42
42
reinterpret_cast <zx_vaddr_t >(Ptr ), Size );
43
- check (Status == ZX_OK, " Vmo unmapping failed" );
43
+ checkWithErrorCode (Status == ZX_OK, " Vmo unmapping failed" , Status );
44
44
}
45
45
46
46
void *GuardedPoolAllocator::reserveGuardedPool (size_t Size ) {
@@ -50,7 +50,8 @@ void *GuardedPoolAllocator::reserveGuardedPool(size_t Size) {
50
50
_zx_vmar_root_self (),
51
51
ZX_VM_CAN_MAP_READ | ZX_VM_CAN_MAP_WRITE | ZX_VM_CAN_MAP_SPECIFIC, 0 ,
52
52
Size , &GuardedPagePoolPlatformData.Vmar , &Addr);
53
- check (Status == ZX_OK, " Failed to reserve guarded pool allocator memory" );
53
+ checkWithErrorCode (Status == ZX_OK,
54
+ " Failed to reserve guarded pool allocator memory" , Status);
54
55
_zx_object_set_property (GuardedPagePoolPlatformData.Vmar , ZX_PROP_NAME,
55
56
kGwpAsanGuardPageName , strlen (kGwpAsanGuardPageName ));
56
57
return reinterpret_cast <void *>(Addr);
@@ -59,8 +60,10 @@ void *GuardedPoolAllocator::reserveGuardedPool(size_t Size) {
59
60
void GuardedPoolAllocator::unreserveGuardedPool () {
60
61
const zx_handle_t Vmar = GuardedPagePoolPlatformData.Vmar ;
61
62
assert (Vmar != ZX_HANDLE_INVALID && Vmar != _zx_vmar_root_self ());
62
- check (_zx_vmar_destroy (Vmar) == ZX_OK, " Failed to destroy a vmar" );
63
- check (_zx_handle_close (Vmar) == ZX_OK, " Failed to close a vmar" );
63
+ zx_status_t Status = _zx_vmar_destroy (Vmar);
64
+ checkWithErrorCode (Status == ZX_OK, " Failed to destroy a vmar" , Status);
65
+ Status = _zx_handle_close (Vmar);
66
+ checkWithErrorCode (Status == ZX_OK, " Failed to close a vmar" , Status);
64
67
GuardedPagePoolPlatformData.Vmar = ZX_HANDLE_INVALID;
65
68
}
66
69
@@ -69,7 +72,7 @@ void GuardedPoolAllocator::allocateInGuardedPool(void *Ptr, size_t Size) const {
69
72
assert ((Size % State.PageSize ) == 0 );
70
73
zx_handle_t Vmo;
71
74
zx_status_t Status = _zx_vmo_create (Size , 0 , &Vmo);
72
- check (Status == ZX_OK, " Failed to create vmo" );
75
+ checkWithErrorCode (Status == ZX_OK, " Failed to create vmo" , Status );
73
76
_zx_object_set_property (Vmo, ZX_PROP_NAME, kGwpAsanAliveSlotName ,
74
77
strlen (kGwpAsanAliveSlotName ));
75
78
const zx_handle_t Vmar = GuardedPagePoolPlatformData.Vmar ;
@@ -81,7 +84,7 @@ void GuardedPoolAllocator::allocateInGuardedPool(void *Ptr, size_t Size) const {
81
84
ZX_VM_PERM_READ | ZX_VM_PERM_WRITE |
82
85
ZX_VM_ALLOW_FAULTS | ZX_VM_SPECIFIC,
83
86
Offset, Vmo, 0 , Size , &P);
84
- check (Status == ZX_OK, " Vmo mapping failed" );
87
+ checkWithErrorCode (Status == ZX_OK, " Vmo mapping failed" , Status );
85
88
_zx_handle_close (Vmo);
86
89
}
87
90
@@ -93,7 +96,7 @@ void GuardedPoolAllocator::deallocateInGuardedPool(void *Ptr,
93
96
assert (Vmar != ZX_HANDLE_INVALID && Vmar != _zx_vmar_root_self ());
94
97
const zx_status_t Status =
95
98
_zx_vmar_unmap (Vmar, reinterpret_cast <zx_vaddr_t >(Ptr ), Size );
96
- check (Status == ZX_OK, " Vmar unmapping failed" );
99
+ checkWithErrorCode (Status == ZX_OK, " Vmar unmapping failed" , Status );
97
100
}
98
101
99
102
size_t GuardedPoolAllocator::getPlatformPageSize () {
0 commit comments