mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Internal change
PiperOrigin-RevId: 507925165
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user