VMManager: Introduce names for used ResultCodes

This commit is contained in:
Yuri Kunde Schlesner 2015-07-17 22:34:50 -03:00
parent b464ef0e15
commit 889de81504
2 changed files with 11 additions and 6 deletions

View file

@ -167,15 +167,13 @@ ResultVal<VMManager::VMAIter> VMManager::CarveVMA(VAddr base, u32 size) {
VMAIter vma_handle = StripIterConstness(FindVMA(base)); VMAIter vma_handle = StripIterConstness(FindVMA(base));
if (vma_handle == vma_map.end()) { if (vma_handle == vma_map.end()) {
// Target address is outside the range managed by the kernel // Target address is outside the range managed by the kernel
return ResultCode(ErrorDescription::InvalidAddress, ErrorModule::OS, return ERR_INVALID_ADDRESS;
ErrorSummary::InvalidArgument, ErrorLevel::Usage); // 0xE0E01BF5
} }
VirtualMemoryArea& vma = vma_handle->second; VirtualMemoryArea& vma = vma_handle->second;
if (vma.type != VMAType::Free) { if (vma.type != VMAType::Free) {
// Region is already allocated // Region is already allocated
return ResultCode(ErrorDescription::InvalidAddress, ErrorModule::OS, return ERR_INVALID_ADDRESS_STATE;
ErrorSummary::InvalidState, ErrorLevel::Usage); // 0xE0A01BF5
} }
u32 start_in_vma = base - vma.base; u32 start_in_vma = base - vma.base;
@ -183,8 +181,7 @@ ResultVal<VMManager::VMAIter> VMManager::CarveVMA(VAddr base, u32 size) {
if (end_in_vma > vma.size) { if (end_in_vma > vma.size) {
// Requested allocation doesn't fit inside VMA // Requested allocation doesn't fit inside VMA
return ResultCode(ErrorDescription::InvalidAddress, ErrorModule::OS, return ERR_INVALID_ADDRESS_STATE;
ErrorSummary::InvalidState, ErrorLevel::Usage); // 0xE0A01BF5
} }
if (end_in_vma != vma.size) { if (end_in_vma != vma.size) {

View file

@ -14,6 +14,14 @@
namespace Kernel { namespace Kernel {
const ResultCode ERR_INVALID_ADDRESS{ // 0xE0E01BF5
ErrorDescription::InvalidAddress, ErrorModule::OS,
ErrorSummary::InvalidArgument, ErrorLevel::Usage};
const ResultCode ERR_INVALID_ADDRESS_STATE{ // 0xE0A01BF5
ErrorDescription::InvalidAddress, ErrorModule::OS,
ErrorSummary::InvalidState, ErrorLevel::Usage};
enum class VMAType : u8 { enum class VMAType : u8 {
/// VMA represents an unmapped region of the address space. /// VMA represents an unmapped region of the address space.
Free, Free,