> > > > 2. > > > > When a memory region is marked from not-present to present, > PageTableLib > > > expects > > > > caller to supply all memory attributes (including RW, NX, etc.) as the > > > > lib > > > implementation doesn't > > > > want to carry any default attributes.. > > > > Do you think the MemoryAttribute PPI should expect the same to caller? > > > > > > > > > > I'm not sure I follow. > > > > > > The PPI (as well as the UEFI protocol) can only operate on valid > > > mapping, and can only be used to manipulate RP/RO/XP. It cannot be > > > used to create mappings from scratch. > > When a range of memory is marked as "RP", X86 page table clears the > > "Present" bit for that range memory. > > "Present" bit is a master bit in X86 page table. When that bit is clear, all > > other bits ("Writable", "Non-Execution", etc.) are ignored by CPU. > > > > So, if caller clears the "RP" bit (setting "Present" bit in page table), > > that's an > > operation to map back some memory. > > X86 CpuPageTableLib requires all attributes be provided for mapping back > > some memory. > > > > > > > > Do you think this capability should be added? If so, I think it is > > > reasonable to require the caller to provide all attributes, and on ARM > > > this would have to include the memory cacheability type as we should > > > not provide a default for that either. > > > > Yes. I think this is required. Having this rule can help caller write > > robust code > > instead of depending on some default attributes in PPI/Protocol > implementation. > > > > I still don't follow. How does that work in the context of the > attribute mask? Can you given some examples?
OK. Let's reset the discussion. For example, one caller's code as below: // mark 0-4k as not-present MemoryAttrributePpi->SetMemoryAttribute (0, 4K, RP, RP); // Use Attribute/Mask pattern to set RP Another caller's code: // mark 0-4k as present * MemoryAttributePpi->SetMemoryAttribute (0, 4K, 0, RP); // Use Attribute/Mask pattern to clear RP Q1: Does the PPI support this usage? Q2: If it supports, what're the other attributes of 0-4k memory? Is XP set? Is RO set? -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#105488): https://edk2.groups.io/g/devel/message/105488 Mute This Topic: https://groups.io/mt/99131184/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/leave/9847357/21656/1706620634/xyzzy [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-