Changeset ad12b5ea in mainline for kernel/generic/src/mm/frame.c


Ignore:
Timestamp:
2011-11-20T16:53:04Z (14 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
2686705
Parents:
a55ddc64
Message:

Factor out the amd64/ia32 code which calculates the bounds of
a zone after considering the low/hich memory split to a new
generic function frame_adjust_zone_bounds().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/mm/frame.c

    ra55ddc64 rad12b5ea  
    12641264}
    12651265
     1266/** Adjust bounds of physical memory region according to low/high memory split.
     1267 *
     1268 * @param low[in]       If true, the adujstment is performed to make the region
     1269 *                      fit in the low memory. Otherwise the adjustment is
     1270 *                      performed to make the region fit in the high memory.
     1271 * @param basep[inout]  Pointer to a variable which contains the region's base
     1272 *                      address and which may receive the adjusted base address.
     1273 * @param sizep[inout]  Pointer to a variable which contains the region's size
     1274 *                      and which may receive the adjusted size.
     1275 * @retun               True if the region still exists even after the
     1276 *                      adjustment, false otherwise.
     1277 */
     1278bool frame_adjust_zone_bounds(bool low, uintptr_t *basep, size_t *sizep)
     1279{
     1280        uintptr_t limit = config.identity_size;
     1281
     1282        if (low) {
     1283                if (*basep > limit)
     1284                        return false;
     1285                if (*basep + *sizep > limit)
     1286                        *sizep = limit - *basep;
     1287        } else {
     1288                if (*basep + *sizep <= limit)
     1289                        return false;
     1290                if (*basep <= limit) {
     1291                        *sizep -= limit - *basep;
     1292                        *basep = limit;
     1293                }
     1294        }
     1295        return true;
     1296}
     1297
    12661298/** Return total size of all zones.
    12671299 *
Note: See TracChangeset for help on using the changeset viewer.