Added executable flag to memory segments in TDFs
This commit is contained in:
@@ -13,6 +13,7 @@ class MemorySegment
|
||||
public ?int $size = null;
|
||||
public ?int $pageSize = null;
|
||||
public ?string $access = null;
|
||||
public ?bool $executable = null;
|
||||
|
||||
/** @var MemorySegmentSection[] */
|
||||
public array $sections = [];
|
||||
@@ -25,7 +26,8 @@ class MemorySegment
|
||||
?int $size,
|
||||
?int $pageSize,
|
||||
?string $access,
|
||||
array $sections
|
||||
array $sections,
|
||||
?bool $executable
|
||||
) {
|
||||
$this->key = $key;
|
||||
$this->name = $name;
|
||||
@@ -35,6 +37,7 @@ class MemorySegment
|
||||
$this->pageSize = $pageSize;
|
||||
$this->access = $access;
|
||||
$this->sections = $sections;
|
||||
$this->executable = $executable;
|
||||
}
|
||||
|
||||
public function getSection(string $sectionId): ?MemorySegmentSection
|
||||
|
||||
@@ -533,7 +533,8 @@ class AtdfService
|
||||
$bootSectionSegment->size,
|
||||
[]
|
||||
)
|
||||
]
|
||||
],
|
||||
$appSectionSegment->executable
|
||||
)
|
||||
];
|
||||
}
|
||||
@@ -556,7 +557,8 @@ class AtdfService
|
||||
$this->stringService->tryStringToInt($attributes['size'] ?? null),
|
||||
$this->stringService->tryStringToInt($attributes['pagesize'] ?? null),
|
||||
$attributes['rw'] ?? null,
|
||||
[]
|
||||
[],
|
||||
isset($attributes['exec']) ? (bool) $attributes['exec'] : null
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -334,6 +334,10 @@ class ValidationService
|
||||
$failures[] = 'Size exceeds 32-bit unsigned integer';
|
||||
}
|
||||
|
||||
if ($segment->executable === null) {
|
||||
$failures[] = 'Missing executable';
|
||||
}
|
||||
|
||||
$processedSectionKeys = [];
|
||||
foreach ($segment->sections as $section) {
|
||||
$failures = array_merge($failures, $this->validateMemorySegmentSection($section));
|
||||
|
||||
@@ -144,7 +144,8 @@ class FromXmlService
|
||||
$this->stringService->tryStringToInt($attributes['size'] ?? null),
|
||||
$this->stringService->tryStringToInt($attributes['page-size'] ?? null),
|
||||
$attributes['access'] ?? null,
|
||||
[]
|
||||
[],
|
||||
isset($attributes['executable']) ? (bool) $attributes['executable'] : null
|
||||
);
|
||||
|
||||
foreach ($element->childNodes as $childNode) {
|
||||
|
||||
@@ -102,6 +102,8 @@ class ToXmlService
|
||||
$element->append($this->memorySegmentSectionToXml($segmentSection, $document));
|
||||
}
|
||||
|
||||
$element->setAttribute('executable',$memorySegment->executable ? '1' : '0');
|
||||
|
||||
return $element;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user