Lines Matching refs:context

116 …   RegisterInner(peripheral, methods, contextRegistration, context: contextRegistration.Initiator);  in Register()
126 …Registration) => RegisterInner(peripheral, methods, contextRegistration, context: contextRegistrat… in Register()
131 …Registration) => RegisterInner(peripheral, methods, contextRegistration, context: contextRegistrat… in Register()
160 …xt(IBusPeripheral peripheral, BusRangeRegistration newRegistration, ICPU context, Func<IEnumerable… in MoveRegistrationWithinContext() argument
162 if(context == null && !TryFindCurrentThreadCPUAndId(out context, out var _)) in MoveRegistrationWithinContext()
167 …var busRegisteredEntries = peripheralsCollectionByContext[context].Peripherals.Where(x => x.Periph… in MoveRegistrationWithinContext()
189 if(IsAddressRangeLocked(busRegistered.RegistrationPoint.Range, context)) in MoveRegistrationWithinContext()
193 UnregisterAccessFlags(busRegistered.RegistrationPoint, context); in MoveRegistrationWithinContext()
194 peripheralsCollectionByContext.WithStateCollection(context, null, collection => in MoveRegistrationWithinContext()
201 AddMappingsForPeripheral(peripheral, newRegistration, context); in MoveRegistrationWithinContext()
206 foreach(var cpu in GetCPUsForContext<ICPUWithMappedMemory>(context)) in MoveRegistrationWithinContext()
411 …public bool TryConvertStateToUlongForContext(IPeripheral context, IContextState cpuStateObj, out u… in TryConvertStateToUlongForContext() argument
414 if(!(context is IPeripheralWithTransactionState peripheralWithTransactionState) in TryConvertStateToUlongForContext()
427 private IEnumerable<ICPU> GetCPUsForContext(IPeripheral context) in GetCPUsForContext() argument
429 return GetCPUs().Where(x => context == null || x == context); in GetCPUsForContext()
432 private IEnumerable<T> GetCPUsForContext<T>(IPeripheral context)
435 return GetCPUsForContext(context).OfType<T>();
510 public void UnregisterFromAddress(ulong address, ICPU context = null) in UnregisterFromAddress() argument
512 var busRegisteredPeripheral = WhatIsAt(address, context); in UnregisterFromAddress()
551 public IBusRegistered<IBusPeripheral> WhatIsAt(ulong address, IPeripheral context = null) in WhatIsAt() argument
553 …return GetAccessiblePeripheralsForContext(context).FirstOrDefault(x => x.RegistrationPoint.Range.C… in WhatIsAt()
556 public IPeripheral WhatPeripheralIsAt(ulong address, IPeripheral context = null) in WhatPeripheralIsAt() argument
558 var registered = WhatIsAt(address, context); in WhatPeripheralIsAt()
566 public IBusRegistered<MappedMemory> FindMemory(ulong address, ICPU context = null) in FindMemory() argument
568 return GetAccessiblePeripheralsForContext(context) in FindMemory()
574 public bool IsMemory(ulong address, ICPU context = null) in IsMemory() argument
576 return GetAccessiblePeripheralsForContext(context) in IsMemory()
580 public IEnumerable<IBusRegistered<IMapped>> GetMappedPeripherals(IPeripheral context = null) in GetMappedPeripherals() argument
582 return GetAccessiblePeripheralsForContext(context) in GetMappedPeripherals()
587 …le<IBusRegistered<IBusPeripheral>> GetRegistrationsForPeripheralType<T>(IPeripheral context = null) in GetRegistrationsForPeripheralType() argument
589 return GetAccessiblePeripheralsForContext(context) in GetRegistrationsForPeripheralType()
593 …ic IEnumerable<IBusRegistered<IBusPeripheral>> GetRegisteredPeripherals(IPeripheral context = null) in GetRegisteredPeripherals() argument
595 return GetAccessiblePeripheralsForContext(context); in GetRegisteredPeripherals()
604 …int count, byte[] destination, int startIndex, bool onlyMemory = false, IPeripheral context = null) in ReadBytes() argument
606 using(SetLocalContext(context)) in ReadBytes()
608 var targets = FindTargets(address, checked((ulong)count), context); in ReadBytes()
627 …nation[checked((ulong)startIndex) + target.SourceIndex + i] = ReadByte(target.Offset + i, context); in ReadBytes()
634 …lic byte[] ReadBytes(ulong address, int count, bool onlyMemory = false, IPeripheral context = null) in ReadBytes() argument
637 ReadBytes(address, count, result, 0, onlyMemory, context); in ReadBytes()
641 public byte[] ReadBytes(long offset, int count, IPeripheral context = null) in ReadBytes() argument
643 return ReadBytes((ulong)offset, count, context: context); in ReadBytes()
646 …c void WriteBytes(byte[] bytes, ulong address, bool onlyMemory = false, IPeripheral context = null) in WriteBytes() argument
648 WriteBytes(bytes, address, bytes.Length, onlyMemory, context); in WriteBytes()
651 … ulong address, int startingIndex, long count, bool onlyMemory = false, IPeripheral context = null) in WriteBytes() argument
653 using(SetLocalContext(context)) in WriteBytes()
655 var targets = FindTargets(address, checked((ulong)count), context); in WriteBytes()
681 …Bytes(byte[] bytes, ulong address, long count, bool onlyMemory = false, IPeripheral context = null) in WriteBytes() argument
683 WriteBytes(bytes, address, 0, count, onlyMemory, context); in WriteBytes()
686 …oid WriteBytes(long offset, byte[] array, int startingIndex, int count, IPeripheral context = null) in WriteBytes() argument
688 WriteBytes(array, (ulong)offset, startingIndex, count, context: context); in WriteBytes()
691 public void ZeroRange(Range range, IPeripheral context = null) in ZeroRange() argument
697 … WriteBytes(zeroBlock, range.StartAddress + i * (ulong)zeroBlock.Length, context: context); in ZeroRange()
699 …ddress + blocksNo * (ulong)zeroBlock.Length, (int)range.Size % zeroBlock.Length, context: context); in ZeroRange()
705 …mbolsFrom(IELF elf, bool useVirtualAddress = false, ulong? textAddress = null, ICPU context = null) in LoadSymbolsFrom() argument
707 GetOrCreateLookup(context).LoadELF(elf, useVirtualAddress, textAddress); in LoadSymbolsFrom()
711 public void ClearSymbols(ICPU context = null) in ClearSymbols() argument
713 RemoveLookup(context); in ClearSymbols()
717 public void AddSymbol(Range address, string name, bool isThumb = false, ICPU context = null) in AddSymbol() argument
721 GetOrCreateLookup(context).InsertSymbol(name, address.StartAddress, address.Size); in AddSymbol()
752 WriteBytes(toLoad, uImage.LoadAddress, context: cpu); in LoadUImage()
794 …tAllSymbolAddresses(string symbolName, out IEnumerable<ulong> symbolAddresses, ICPU context = null) in TryGetAllSymbolAddresses() argument
796 var result = GetLookup(context).TryGetSymbolsByName(symbolName, out var symbols); in TryGetAllSymbolAddresses()
801 public IEnumerable<ulong> GetAllSymbolAddresses(string symbolName, ICPU context = null) in GetAllSymbolAddresses() argument
803 if(!TryGetAllSymbolAddresses(symbolName, out var symbolAddresses, context)) in GetAllSymbolAddresses()
810 public string FindSymbolAt(ulong offset, ICPU context = null) in FindSymbolAt() argument
812 if(!TryFindSymbolAt(offset, out var name, out var _, context)) in FindSymbolAt()
819 … public bool TryFindSymbolAt(ulong offset, out string name, out Symbol symbol, ICPU context = null) in TryFindSymbolAt() argument
823 if(!GetLookup(context).TryGetSymbolByAddress(offset, out symbol)) in TryFindSymbolAt()
844 …edSegment segment, IBusPeripheral owner, bool relative = true, ICPUWithMappedMemory context = null) in MapMemory() argument
849 foreach(var registrationPoint in GetRegistrationPoints(owner, context)) in MapMemory()
851 … var wrapper = FromRegistrationPointToSegmentWrapper(segment, registrationPoint, context); in MapMemory()
861 … AddMappings(new [] { new MappedSegmentWrapper(segment, 0, long.MaxValue, context) }, owner); in MapMemory()
865 public void UnmapMemory(Range range, ICPU context = null) in UnmapMemory() argument
869 foreach(var cpu in GetCPUsForContext<ICPUWithMappedMemory>(context)) in UnmapMemory()
975 …merable<BusRangeRegistration> GetRegistrationPoints(IBusPeripheral peripheral, ICPU context = null) in GetRegistrationPoints() argument
977 return GetAccessiblePeripheralsForContext(context) in GetRegistrationPoints()
986 TryGetCurrentCPU(out var context); in GetRegistrationPoints()
987 return GetRegistrationPoints(peripheral, context); in GetRegistrationPoints()
1052 public void SetAddressRangeLocked(Range range, bool locked, IPeripheral context = null) in SetAddressRangeLocked() argument
1057 …ocked ? lockedRangesCollectionByContext[context].ContainsWholeRange(range) : !IsAddressRangeLocked… in SetAddressRangeLocked()
1064 RelockRange(range, locked, context); in SetAddressRangeLocked()
1066 … lockedRangesCollectionByContext.WithStateCollection(context, stateMask: null, collection => in SetAddressRangeLocked()
1097 public bool IsAddressRangeLocked(Range range, IPeripheral context = null) in IsAddressRangeLocked() argument
1100 …return (lockedRangesCollectionByContext.TryGetValue(context, initiatorState: null, out var collect… in IsAddressRangeLocked()
1151 public SymbolLookup GetLookup(ICPU context = null) in GetLookup() argument
1153 if(context == null in GetLookup()
1154 || !localLookups.TryGetValue(context, out var cpuLookup)) in GetLookup()
1225 private SymbolLookup GetOrCreateLookup(ICPU context) in GetOrCreateLookup() argument
1227 if(context == null) in GetOrCreateLookup()
1232 if(!localLookups.TryGetValue(context, out var lookup)) in GetOrCreateLookup()
1235 localLookups[context] = lookup; in GetOrCreateLookup()
1241 private void RemoveLookup(ICPU context = null) in RemoveLookup() argument
1243 if(context == null) in RemoveLookup()
1249 localLookups.Remove(context); in RemoveLookup()
1259 ….SelectMany(context => peripheralsCollectionByContext.GetAllStateKeys(context).Select(stateMask =>… in UnregisterInner()
1261 …peripheralsCollectionByContext.WithStateCollection(pair.context, stateMask: pair.stateMask, collec… in UnregisterInner()
1266 foreach(var stateMask in peripheralsCollectionByContext.GetAllStateKeys(context: null)) in UnregisterInner()
1268 … peripheralsCollectionByContext.WithStateCollection(context: null, stateMask, collection => in UnregisterInner()
1307 TryGetCurrentCPU(out var context); in GetPeripheralsForCurrentCPU()
1308 return GetAccessiblePeripheralsForContext(context); in GetPeripheralsForCurrentCPU()
1315 …gistered<IBusPeripheral>> GetAccessiblePeripheralsForContext(IPeripheral context, ulong? initiator… in GetAccessiblePeripheralsForContext() argument
1317 … var locals = peripheralsCollectionByContext.GetValue(context, initiatorState).Peripherals; in GetAccessiblePeripheralsForContext()
1318 … return context != null ? locals.Concat(peripheralsCollectionByContext[null].Peripherals) : locals; in GetAccessiblePeripheralsForContext()
1663 …eral, PeripheralAccessMethods methods, BusRangeRegistration registrationPoint, IPeripheral context) in RegisterInner() argument
1670 if(context != null) in RegisterInner()
1672 AddContextKeys(context); in RegisterInner()
1676 …var busRegisteredInContext = peripheralsCollectionByContext.GetValue(context, stateMask?.State).Pe… in RegisterInner()
1687 if(IsAddressRangeLocked(registrationPoint.Range, context)) in RegisterInner()
1690 if(!CanRangeBeLocked(registrationPoint.Range, context, out var _, out var __)) in RegisterInner()
1702 peripheralsCollectionByContext.WithStateCollection(context, stateMask, collection => in RegisterInner()
1708 AddMappingsForPeripheral(peripheral, registrationPoint, context); in RegisterInner()
1711 if(IsAddressRangeLocked(registrationPoint.Range, context)) in RegisterInner()
1714 RelockRange(registrationPoint.Range, true, context); in RegisterInner()
1731 private void RelockRange(Range range, bool locked, IPeripheral context) in RelockRange() argument
1738 … if(!CanRangeBeLocked(range, context, out var mappedInRange, out var onlyPartiallyInRange)) in RelockRange()
1762 …private bool CanRangeBeLocked(Range range, IPeripheral context, out IEnumerable<IBusRegistered<IMa… in CanRangeBeLocked() argument
1764 …mappedInRange = GetMappedPeripherals(context).Where(x => x.RegistrationPoint.Range.Intersects(rang… in CanRangeBeLocked()
1770 …merable<PeripheralLookupResult> FindTargets(ulong address, ulong count, IPeripheral context = null) in FindTargets() argument
1778 var what = WhatIsAt(currentPosition, context); in FindTargets()
1784 …var nextPeripheral = GetAccessiblePeripheralsForContext(context).OrderBy(x => x.RegistrationPoint.… in FindTargets()
1919 …rPeripheral(IBusPeripheral peripheral, BusRangeRegistration registrationPoint, IPeripheral context) in AddMappingsForPeripheral() argument
1926 var cpuWithMappedMemory = context as ICPUWithMappedMemory; in AddMappingsForPeripheral()
1932 private void UnregisterAccessFlags(BusRangeRegistration registrationPoint, ICPU context) in UnregisterAccessFlags() argument
1934 foreach(var cpu in GetCPUsForContext<ICPUWithMappedMemory>(context)) in UnregisterAccessFlags()
2048 private IDisposable SetLocalContext(IPeripheral context, ulong? initiatorState = null) in SetLocalContext() argument
2050 return threadLocalContext.Initialize(context, initiatorState); in SetLocalContext()
2071 …apper(IMappedSegment segment, BusRangeRegistration registrationPoint, ICPUWithMappedMemory context) in FromRegistrationPointToSegmentWrapper() argument
2079 …er(segment, registrationPoint.Range.StartAddress - registrationPoint.Offset, desiredSize, context); in FromRegistrationPointToSegmentWrapper()
2135 … public void WithStateCollection(IPeripheral context, StateMask? stateMask, Action<TValue> action) in WithStateCollection() argument
2137 var collection = context == null ? globalValue : cpuLocalValues[context]; in WithStateCollection()
2157 public IEnumerable<StateMask> GetAllStateKeys(IPeripheral context) in GetAllStateKeys() argument
2159 return (context == null ? globalValue : cpuLocalValues[context]).Keys; in GetAllStateKeys()
2271 …pedSegment wrappedSegment, ulong peripheralOffset, ulong maximumSize, ICPUWithMappedMemory context) in MappedSegmentWrapper() argument
2276 this.context = context; in MappedSegmentWrapper()
2287 StartingOffset, Size, OriginalStartingOffset, PeripheralOffset, context); in ToString()
2294 return context;
2366 private readonly ICPUWithMappedMemory context; field in Antmicro.Renode.Peripherals.Bus.SystemBus.MappedSegmentWrapper
2387 context = new ThreadLocal<Tuple<IPeripheral, ulong?>>(() => null, true); in ThreadLocalContext()
2397 var previousContext = context.Value; in Initialize()
2398 context.Value = Tuple.Create(cpu, initiatorState); in Initialize()
2401 context.Value = previousContext; in Initialize()
2407 context.Dispose(); in Dispose()
2410 public bool InUse => context.Value != null;
2411 public IPeripheral Initiator => context.Value.Item1;
2412 public ulong? InitiatorState => context.Value.Item2;
2414 private readonly ThreadLocal<Tuple<IPeripheral, ulong?>> context; field in Antmicro.Renode.Peripherals.Bus.SystemBus.ThreadLocalContext