forked from RPCS3/rpcs3
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace most returns with CHECK_ASSERTION
Also fix some Seek methods return types being unsigned, while returning negative errors. Added the CHECK_ASSERTION macro checks in a couple more places. Simplified CHECK_ASSERTION macro usage.
- Loading branch information
Showing
14 changed files
with
159 additions
and
394 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,22 @@ | ||
#pragma once | ||
|
||
// Failure codes for the functions | ||
enum | ||
{ | ||
VM_SUCCESS = 0, | ||
VM_FAILURE = -1, | ||
}; | ||
|
||
namespace memory_helper | ||
{ | ||
/** | ||
* Reserve size bytes of virtual memory and returns it. | ||
* The memory should be commited before usage. | ||
* | ||
* Returns the base address of the allocated region of pages, if successful. | ||
* Returns (void*)VM_FAILURE, if unsuccessful. | ||
*/ | ||
void* reserve_memory(size_t size); | ||
|
||
/** | ||
* Commit page_size bytes of virtual memory starting at pointer. | ||
* That is, bake reserved memory with physical memory. | ||
* pointer should belong to a range of reserved memory. | ||
* | ||
* Returns VM_SUCCESS, if successful. | ||
* Returns VM_FAILURE, if unsuccessful. | ||
*/ | ||
s32 commit_page_memory(void* pointer, size_t page_size); | ||
void commit_page_memory(void* pointer, size_t page_size); | ||
|
||
/** | ||
* Free memory alloced via reserve_memory. | ||
* | ||
* Returns VM_SUCCESS, if successful. | ||
* Returns VM_FAILURE, if unsuccessful. | ||
*/ | ||
s32 free_reserved_memory(void* pointer, size_t size); | ||
void free_reserved_memory(void* pointer, size_t size); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.