Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 5 additions & 13 deletions ofrak_core/ofrak/core/memory_region.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from ofrak.core.addressable import Addressable
from ofrak.model.resource_model import index, ResourceAttributes
from ofrak.resource import Resource
from ofrak.service.error import OverlapError
from ofrak_type.error import NotFoundError
from ofrak_type.range import Range

Expand Down Expand Up @@ -122,18 +121,11 @@ async def create_child_region(
f"{hex(self.end_vaddr())}."
)

try:
return await self.resource.create_child_from_view(
child_mr,
data_range=Range(start_offset, end_offset),
additional_attributes=additional_attributes,
)
except OverlapError as e:
existing_child_vaddr = e.existing_child_node.model.range.start + self.virtual_address
existing_child_size = e.existing_child_node.model.range.length()
raise MemoryOverlapError(
child_mr, MemoryRegion(existing_child_vaddr, existing_child_size)
) from e
return await self.resource.create_child_from_view(
child_mr,
data_range=Range(start_offset, end_offset),
additional_attributes=additional_attributes,
)

@staticmethod
def get_mem_region_with_vaddr_from_sorted(vaddr: int, sorted_regions: Iterable["MemoryRegion"]):
Expand Down
7 changes: 0 additions & 7 deletions ofrak_core/ofrak/service/error.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,6 @@ class OutOfBoundError(DataServiceError):
pass


class OverlapError(DataServiceError):
def __init__(self, message, new_child_node: "DataNode", existing_child_node: "DataNode"): # type: ignore
super().__init__(message)
self.new_child_node = new_child_node
self.existing_child_node = existing_child_node


class PatchOverlapError(DataServiceError):
pass

Expand Down