Line 100: |
Line 100: |
| ** This fixes the issue that pages were sometimes memset to zero unnecessarily, because they were already zero'd by some previous operation. | | ** This fixes the issue that pages were sometimes memset to zero unnecessarily, because they were already zero'd by some previous operation. |
| ** Newly allocated pages being all-zero is now a kernel invariant. | | ** Newly allocated pages being all-zero is now a kernel invariant. |
| + | * KPageTable::ChangePermissions was changed substantially. |
| + | ** Previously, it separated pages, iterated over mappings changing permissions as required (and invalidating + flushing cache if bool arg is true), then merged pages. |
| + | ** Now, the function has a lambda which iterates over all mappings, changing permissions as required and performing additional operations depending on a bitflag parameter. |
| + | ** First, the function separates pages. |
| + | ** Then if the input bool is false, this lambda is called with entry template = input entry template, bitflag parameter = 0. This changes all mappings to the new permissions. Pages are then merged, and the function returns. |
| + | ** Otherwise if the input bool is true, the lambda is called with entry template = input entry template & ~1 and bitflag parameter = 2. This changes all mappings to be invalid (as low bit of pte is zero). Bitflag & 2 causes entries to be merged during traversal. |
| + | ** Next, the scheduling lock is locked and immediately unlocked. This forces a reschedule. |
| + | ** Next, the lambda is called with entry template = input entry template, bitflag parameter = 1. This changes all mappings to new permissions, and flushes data cache on all new mappings. |
| + | ** Finally, mappings are merged, and the function returns. |
| <check back for more diffs later> | | <check back for more diffs later> |
| | | |