Changeset c6f1908e in mainline


Ignore:
Timestamp:
2011-11-15T00:08:46Z (12 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
19c8030
Parents:
8bdcffa
Message:

Add arm32 versions of frame_low/high_arch_init().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/arm32/src/mm/frame.c

    r8bdcffa rc6f1908e  
    4141#include <macros.h>
    4242
     43// TODO: remove me
    4344/** Address of the last frame in the memory. */
    4445uintptr_t last_frame = 0;
    4546
    46 /** Creates memory zones. */
     47/** Create low memory zones. */
    4748void frame_low_arch_init(void)
    4849{
    49         uintptr_t mem_start, mem_size;
    50         uintptr_t first_frame;
    51         uintptr_t num_frames;
     50        uintptr_t mem_start, mem_end, mem_size;
    5251
    5352        machine_get_memory_extents(&mem_start, &mem_size);
    54         first_frame = ALIGN_UP(mem_start, FRAME_SIZE);
     53        // TODO: remove me
    5554        last_frame = ALIGN_DOWN(mem_start + mem_size, FRAME_SIZE);
    56         num_frames = (last_frame - first_frame) >> FRAME_WIDTH;
    5755       
    58         /* All memory as one zone */
    59         zone_create(first_frame >> FRAME_WIDTH, num_frames,
    60             BOOT_PAGE_TABLE_START_FRAME + BOOT_PAGE_TABLE_SIZE_IN_FRAMES, 0);
     56        mem_start = ALIGN_UP(mem_start, FRAME_SIZE);
     57        mem_end = min(ALIGN_DOWN(mem_start + mem_size, FRAME_SIZE),
     58            config.identity_size);
     59
     60        zone_create(ADDR2PFN(mem_start), SIZE2FRAMES(mem_end - mem_start),
     61            BOOT_PAGE_TABLE_START_FRAME + BOOT_PAGE_TABLE_SIZE_IN_FRAMES,
     62            ZONE_AVAILABLE | ZONE_LOWMEM);
    6163       
    6264        /* blacklist boot page table */
     
    6769}
    6870
     71/** Create high memory zones. */
    6972void frame_high_arch_init(void)
    7073{
     74        uintptr_t mem_start, mem_end, mem_size;
     75        size_t frames;
     76        uintptr_t conf;
     77
     78        machine_get_memory_extents(&mem_start, &mem_size);
     79
     80        mem_end = ALIGN_DOWN(mem_start + mem_size, FRAME_SIZE);
     81        if (mem_end <= config.identity_size) {
     82                /* There is no high memory to init. */
     83                return;
     84        }
     85
     86        frames = SIZE2FRAMES(mem_end - config.identity_size);
     87        conf = zone_external_conf_alloc(frames);
     88
     89        zone_create(ADDR2PFN(config.identity_size), frames, conf,
     90            ZONE_AVAILABLE);
    7191}
    7292
Note: See TracChangeset for help on using the changeset viewer.