Internal change

PiperOrigin-RevId: 507925165
This commit is contained in:
Andrei Vagin
2023-02-07 17:06:50 -08:00
committed by gVisor bot
parent 1da6444d05
commit 155b64e4d8
2 changed files with 21 additions and 0 deletions
+19
View File
@@ -1320,3 +1320,22 @@ func (mm *MemoryManager) EnableMembarrierRSeq() {
func (mm *MemoryManager) IsMembarrierRSeqEnabled() bool {
return mm.membarrierRSeqEnabled.Load() != 0
}
// FindVMAByName finds a vma with the specified name and returns its start address and offset.
func (mm *MemoryManager) FindVMAByName(ar hostarch.AddrRange, hint string) (hostarch.Addr, uint64, error) {
mm.mappingMu.RLock()
defer mm.mappingMu.RUnlock()
for vseg := mm.vmas.LowerBoundSegment(ar.Start); vseg.Ok(); vseg = vseg.NextSegment() {
start := vseg.Start()
if !ar.Contains(start) {
break
}
vma := vseg.ValuePtr()
if vma.hint == hint {
return start, vma.off, nil
}
}
return 0, 0, fmt.Errorf("could not find \"%s\" in %s", hint, ar)
}
+2
View File
@@ -176,6 +176,8 @@ type MemoryManager interface {
MMap(ctx context.Context, opts memmap.MMapOpts) (hostarch.Addr, error)
// AddressSpace returns the AddressSpace bound to mm.
AddressSpace() AddressSpace
// FindVMAByName finds a vma with the specified name.
FindVMAByName(ar hostarch.AddrRange, hint string) (hostarch.Addr, uint64, error)
}
// Context represents the execution context for a single thread.