Skip to content

Commit

Permalink
fix: lazy slide-info application for macOS intel DSC #478
Browse files Browse the repository at this point in the history
  • Loading branch information
blacktop committed May 29, 2024
1 parent 35de898 commit 184564c
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion pkg/dyld/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,9 @@ func (i CacheSlideInfo2) GetPageSize() uint32 {
return i.PageSize
}
func (i CacheSlideInfo2) SlidePointer(ptr uint64) uint64 {
if ptr > i.ValueAdd {
return ptr
}
if (ptr & ^i.DeltaMask) != 0 {
return (ptr & ^i.DeltaMask) + i.ValueAdd
}
Expand Down Expand Up @@ -353,6 +356,11 @@ func (i CacheSlideInfo3) GetPageSize() uint32 {
return i.PageSize
}
func (i CacheSlideInfo3) SlidePointer(ptr uint64) uint64 {
if ptr == 0 {
return 0
} else if (ptr & 0xFFF0_0000_0000_0000) == 0 {
return ptr
}
pointer := CacheSlidePointer3(ptr)
if pointer.Authenticated() {
return i.AuthValueAdd + pointer.OffsetFromSharedCacheBase()
Expand Down Expand Up @@ -504,8 +512,10 @@ func (i CacheSlideInfo4) GetPageSize() uint32 {
return i.PageSize
}
func (i CacheSlideInfo4) SlidePointer(ptr uint64) uint64 {
// if ptr > i.ValueAdd { FIXME: do I need to add this ?
// return ptr
// }
value := ptr & ^i.DeltaMask

if (value & 0xFFFF8000) == 0 {
// small positive non-pointer, use as-is
} else if (value & 0x3FFF8000) == 0x3FFF8000 {
Expand Down

0 comments on commit 184564c

Please sign in to comment.