MCPcopy Create free account
hub / github.com/google/gapid / MapMemory

Method MapMemory

gapis/replay/builder/builder.go:569–586  ·  view source on GitHub ↗

MapMemory maps the memory range rng relative to the absolute pointer that is on the top of the stack. Any ObservedPointers that are used while the pointer is mapped will be automatically adjusted to the remapped address. The mapped memory range can be unmapped with a call to UnmapMemory.

(rng memory.Range)

Source from the content-addressed store, hash-verified

567// is mapped will be automatically adjusted to the remapped address.
568// The mapped memory range can be unmapped with a call to UnmapMemory.
569func (b *Builder) MapMemory(rng memory.Range) {
570 if ty := b.peekStack().ty; ty != protocol.Type_AbsolutePointer {
571 panic(fmt.Errorf("MapMemory can only map to absolute pointers. Got type: %v", ty))
572 }
573
574 // Allocate memory to hold the target mapped base address.
575 target := b.AllocateMemory(uint64(b.memoryLayout.GetPointer().GetSize()))
576 b.Store(target)
577
578 s := rng.Span()
579 i := interval.Merge(&b.mappedMemory, s, false)
580 if b.mappedMemory[i].Span() != s {
581 panic(fmt.Errorf("MapMemory range (%v) collides with existing mapped range (%v)",
582 rng, b.mappedMemory[i]))
583 }
584
585 b.mappedMemory[i].Target = target
586}
587
588// UnmapMemory unmaps the memory range rng that was previously mapped with a
589// call to MapMemory. If the memory range is not exactly a range previously

Callers 3

TestMapMemoryFunction · 0.80
mapMemoryMethod · 0.80
mapMemoryMethod · 0.80

Calls 6

peekStackMethod · 0.95
AllocateMemoryMethod · 0.95
StoreMethod · 0.95
MergeMethod · 0.80
GetSizeMethod · 0.45
SpanMethod · 0.45

Tested by 1

TestMapMemoryFunction · 0.64