Changeset c6e314a in mainline for kernel/arch/sparc64/src/mm


Ignore:
Timestamp:
2006-07-14T11:39:02Z (19 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
08a7802f
Parents:
10b890b
Message:

Change hw_map() on sparc64 to use virtual addresses that are
beyond the end of physical memory. It is beneficial in two
ways: first, physical memory is no longer being wasted by
otherwise necessary calls to frame_alloc() and, second,
virtual addresses for devices are now correctly allocated
and do not overlap with the 4M TLB-locked mapping for
kernel text and data.

Location:
kernel/arch/sparc64/src/mm
Files:
3 edited

Legend:

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

    r10b890b rc6e314a  
    3636#include <mm/frame.h>
    3737#include <arch/boot/boot.h>
     38#include <arch/types.h>
    3839#include <config.h>
    3940#include <align.h>
     41#include <macros.h>
     42
     43uintptr_t last_frame = NULL;
    4044
    4145/** Create memory zones according to information stored in bootinfo.
     
    5155
    5256        for (i = 0; i < bootinfo.memmap.count; i++) {
     57                uintptr_t start = bootinfo.memmap.zones[i].start;
     58                size_t size = bootinfo.memmap.zones[i].size;
    5359
    5460                /*
     
    5763                 */
    5864       
    59                 confdata = ADDR2PFN(bootinfo.memmap.zones[i].start);
     65                confdata = ADDR2PFN(start);
    6066                if (confdata == 0)
    6167                        confdata = 2;
    62                 zone_create(ADDR2PFN(bootinfo.memmap.zones[i].start),
    63                         SIZE2FRAMES(ALIGN_DOWN(bootinfo.memmap.zones[i].size, PAGE_SIZE)),
    64                         confdata, 0);
     68                zone_create(ADDR2PFN(start), SIZE2FRAMES(ALIGN_DOWN(size, FRAME_SIZE)), confdata, 0);
     69               
     70                last_frame = max(last_frame, start + ALIGN_UP(size, FRAME_SIZE));
    6571        }
    6672
  • kernel/arch/sparc64/src/mm/page.c

    r10b890b rc6e314a  
    2727 */
    2828
    29  /** @addtogroup sparc64mm     
     29/** @addtogroup sparc64mm       
    3030 * @{
    3131 */
     
    3737#include <genarch/mm/page_ht.h>
    3838#include <mm/frame.h>
     39#include <arch/mm/frame.h>
    3940#include <bitops.h>
    4041#include <debug.h>
     42#include <align.h>
    4143
    4244void page_arch_init(void)
     
    7375        else
    7476                order = (fnzb32(size - 1) + 1) - FRAME_WIDTH;
     77
     78        /*
     79         * Use virtual addresses that are beyond the limit of physical memory.
     80         * Thus, the physical address space will not be wasted by holes created
     81         * by frame_alloc().
     82         */
     83        ASSERT(last_frame);
     84        uintptr_t virtaddr = ALIGN_UP(last_frame, 1<<(order + FRAME_WIDTH));
     85        last_frame = ALIGN_UP(virtaddr + size, 1<<(order + FRAME_WIDTH));
    7586       
    76         uintptr_t virtaddr = (uintptr_t) frame_alloc(order, FRAME_KA);
    77 
    7887        for (i = 0; i < sizemap[order].count; i++)
    7988                dtlb_insert_mapping(virtaddr + i*sizemap[order].increment,
     
    8493}
    8594
    86  /** @}
     95/** @}
    8796 */
    88 
  • kernel/arch/sparc64/src/mm/tlb.c

    r10b890b rc6e314a  
    6060void tlb_arch_init(void)
    6161{
     62        /*
     63         * TLBs are actually initialized by
     64         * take_over_tlb_and_tt() early
     65         * in start.S.
     66         */
    6267}
    6368
Note: See TracChangeset for help on using the changeset viewer.