Changeset c6e314a in mainline


Ignore:
Timestamp:
2006-07-14T11:39:02Z (18 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
Files:
6 edited

Legend:

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

    r10b890b rc6e314a  
    137137               
    138138#ifdef CONFIG_SIMICS_FIX
    139                 /* Don't know why, but this addresses help */
     139                /* Don't know why, but these addresses help */
    140140                frame_mark_unavailable(0xd000 >> FRAME_WIDTH,3);
    141141#endif
  • kernel/arch/sparc64/include/mm/frame.h

    r10b890b rc6e314a  
    2727 */
    2828
    29  /** @addtogroup sparc64mm     
     29/** @addtogroup sparc64mm       
    3030 * @{
    3131 */
     
    4848        struct {
    4949                unsigned : 23;
    50                 uint64_t pfn : 28;         /**< Physical Frame Number. */
    51                 unsigned offset : 13;   /**< Offset. */
     50                uint64_t pfn : 28;      /**< Physical Frame Number. */
     51                unsigned offset : 13;   /**< Offset. */
    5252        } __attribute__ ((packed));
    5353};
     
    5555typedef union frame_address frame_address_t;
    5656
     57extern uintptr_t last_frame;
    5758extern void frame_arch_init(void);
    5859
     
    6263#endif
    6364
    64  /** @}
     65/** @}
    6566 */
    66 
  • 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
  • kernel/generic/src/mm/as.c

    r10b890b rc6e314a  
    15221522}
    15231523
    1524 /** Wrapper for as_area_resize. */
     1524/** Wrapper for as_area_resize(). */
    15251525unative_t sys_as_area_resize(uintptr_t address, size_t size, int flags)
    15261526{
     
    15281528}
    15291529
    1530 /** Wrapper for as_area_destroy. */
     1530/** Wrapper for as_area_destroy(). */
    15311531unative_t sys_as_area_destroy(uintptr_t address)
    15321532{
Note: See TracChangeset for help on using the changeset viewer.