Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 40c8c17 in mainline


Ignore:
Timestamp:
2011-11-26T21:37:40Z (10 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master
Children:
38ff925
Parents:
056ddc30
Message:

Replace multiple definitions of last_frame with config.physmem_end.
Do not duplicate code which calculates the end of physical memory.

Location:
kernel
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/amd64/include/mm/frame.h

    r056ddc30 r40c8c17  
    4343#include <typedefs.h>
    4444
    45 extern uintptr_t last_frame;
    4645extern void frame_low_arch_init(void);
    4746extern void frame_high_arch_init(void);
  • kernel/arch/amd64/src/mm/page.c

    r056ddc30 r40c8c17  
    6464               
    6565        /*
    66          * PA2KA(identity) mapping for all frames.
     66         * PA2KA(identity) mapping for all low-memory frames.
    6767         */
    68         for (cur = 0; cur < min(config.identity_size, last_frame);
     68        for (cur = 0; cur < min(config.identity_size, config.physmem_end);
    6969            cur += FRAME_SIZE)
    7070                page_mapping_insert(AS_KERNEL, PA2KA(cur), cur, identity_flags);
  • kernel/arch/arm32/include/mm/frame.h

    r056ddc30 r40c8c17  
    6161#endif
    6262
    63 extern uintptr_t last_frame;
    64 
    6563extern void frame_low_arch_init(void);
    6664extern void frame_high_arch_init(void);
  • kernel/arch/arm32/src/mm/frame.c

    r056ddc30 r40c8c17  
    4141#include <macros.h>
    4242
    43 // TODO: remove me
    44 /** Address of the last frame in the memory. */
    45 uintptr_t last_frame = 0;
    46 
    4743static void frame_common_arch_init(bool low)
    4844{
     
    7470void frame_low_arch_init(void)
    7571{
    76         uintptr_t mem_start;
    77         size_t mem_size;
    78 
    79         machine_get_memory_extents(&mem_start, &mem_size);
    80         // TODO: remove me
    81         last_frame = ALIGN_DOWN(mem_start + mem_size, FRAME_SIZE);
    82        
    8372        frame_common_arch_init(true);
    8473
  • kernel/arch/arm32/src/mm/page.c

    r056ddc30 r40c8c17  
    5858       
    5959        uintptr_t cur;
     60
    6061        /* Kernel identity mapping */
    6162        for (cur = PHYSMEM_START_ADDR;
    62             cur < min(config.identity_base, last_frame); cur += FRAME_SIZE)
     63            cur < min(config.identity_size, config.physmem_end);
     64            cur += FRAME_SIZE)
    6365                page_mapping_insert(AS_KERNEL, PA2KA(cur), cur, flags);
    6466       
  • kernel/arch/ia32/include/mm/frame.h

    r056ddc30 r40c8c17  
    4343#include <typedefs.h>
    4444
    45 extern uintptr_t last_frame;
    46 
    4745extern void frame_low_arch_init(void);
    4846extern void frame_high_arch_init(void);
  • kernel/arch/ia32/src/mm/frame.c

    r056ddc30 r40c8c17  
    4949size_t hardcoded_unmapped_kdata_size = 0;
    5050
    51 // XXX: remove me
    52 uintptr_t last_frame = 0;
    53 
    5451static void init_e820_memory(pfn_t minconf, bool low)
    5552{
     
    8582                                    ZONE_AVAILABLE | ZONE_HIGHMEM);
    8683                        }
    87                        
    88                         // XXX: remove me
    89                         if (last_frame < new_base + new_size)
    90                                 last_frame = new_base + new_size;
    9184                } else if ((e820table[i].type == MEMMAP_MEMORY_ACPI) ||
    9285                    (e820table[i].type == MEMMAP_MEMORY_NVS)) {
  • kernel/arch/ia32/src/mm/page.c

    r056ddc30 r40c8c17  
    6666       
    6767        /*
    68          * PA2KA(identity) mapping for all frames until last_frame.
     68         * PA2KA(identity) mapping for all low-memory frames.
    6969         */
    7070        page_table_lock(AS_KERNEL, true);
    71         for (cur = 0; cur < min(config.identity_size, last_frame);
     71        for (cur = 0; cur < min(config.identity_size, config.physmem_end);
    7272            cur += FRAME_SIZE) {
    7373                flags = PAGE_CACHEABLE | PAGE_WRITE;
    74                 if ((PA2KA(cur) >= config.base) && (PA2KA(cur) <
    75                     config.base + config.kernel_size))
     74                if ((PA2KA(cur) >= config.base) &&
     75                    (PA2KA(cur) < config.base + config.kernel_size))
    7676                        flags |= PAGE_GLOBAL;
    7777                page_mapping_insert(AS_KERNEL, PA2KA(cur), cur, flags);
  • kernel/arch/ia64/include/mm/frame.h

    r056ddc30 r40c8c17  
    4343#include <typedefs.h>
    4444
    45 extern uintptr_t last_frame;
    46 
    4745extern void frame_low_arch_init(void);
    4846extern void frame_high_arch_init(void);
  • kernel/arch/ia64/src/mm/frame.c

    r056ddc30 r40c8c17  
    5151#define MINCONF 1
    5252
    53 // XXX: remove me
    54 uintptr_t last_frame = 0;
    55 
    5653static void frame_common_arch_init(bool low)
    5754{
     
    6865                if (size > FRAME_SIZE)
    6966                        size -= abase - base;
    70 
    71                 // FIXME: remove me
    72                 if (abase + size > last_frame)
    73                         last_frame = abase + size;
    7467
    7568                if (!frame_adjust_zone_bounds(low, &abase, &size))
  • kernel/arch/ppc32/include/mm/frame.h

    r056ddc30 r40c8c17  
    4444#include <trace.h>
    4545
    46 extern uintptr_t last_frame;
    47 
    4846NO_TRACE static inline uint32_t physmem_top(void)
    4947{
  • kernel/arch/ppc32/src/mm/frame.c

    r056ddc30 r40c8c17  
    4040#include <print.h>
    4141
    42 // XXX: remove me
    43 uintptr_t last_frame = 0;
    44 
    4542memmap_t memmap;
    4643
     
    6764                size_t size = ALIGN_DOWN(memmap.zones[i].size -
    6865                    (base - ((uintptr_t) memmap.zones[i].start)), FRAME_SIZE);
    69                
    70                 // XXX: remove me
    71                 if (last_frame < ALIGN_UP(base + size, FRAME_SIZE))
    72                         last_frame = ALIGN_UP(base + size, FRAME_SIZE);
    7366               
    7467                if (!frame_adjust_zone_bounds(low, &base, &size))
  • kernel/arch/sparc64/include/mm/sun4u/frame.h

    r056ddc30 r40c8c17  
    7272typedef union frame_address frame_address_t;
    7373
    74 extern uintptr_t last_frame;
    7574extern uintptr_t end_of_identity;
    7675
  • kernel/arch/sparc64/include/mm/sun4v/frame.h

    r056ddc30 r40c8c17  
    4646#include <typedefs.h>
    4747
    48 extern uintptr_t last_frame;
    4948extern void frame_low_arch_init(void);
    5049extern void frame_high_arch_init(void);
  • kernel/arch/sparc64/src/mm/sun4u/frame.c

    r056ddc30 r40c8c17  
    4141#include <macros.h>
    4242
    43 // TODO: remove me
    44 uintptr_t last_frame = (uintptr_t) NULL;
    45 
    4643/** Create memory zones according to information stored in memmap.
    4744 *
     
    6663                    (base - ((uintptr_t) memmap.zones[i].start)), FRAME_SIZE);
    6764               
    68                 // TODO: remove me
    69                 last_frame = max(last_frame, base + size);
    70 
    7165                if (!frame_adjust_zone_bounds(low, &base, &size))
    7266                        continue;
     
    106100         */
    107101        frame_mark_unavailable(ADDR2PFN(KA2PA(PFN2ADDR(0))), 1);
    108        
    109         end_of_identity = PA2KA(last_frame);
     102
     103        /* PA2KA will work only on low-memory. */
     104        end_of_identity = PA2KA(config.physmem_end - FRAME_SIZE) + PAGE_SIZE;
    110105}
    111106
  • kernel/generic/include/config.h

    r056ddc30 r40c8c17  
    9595
    9696        bool non_identity_configured;   
     97
     98        /** End of physical memory. */
     99        uint64_t physmem_end;
    97100} config_t;
    98101
  • kernel/generic/src/main/main.c

    r056ddc30 r40c8c17  
    9191config_t config = {
    9292        .identity_configured = false,
    93         .non_identity_configured = false
     93        .non_identity_configured = false,
     94        .physmem_end = 0
    9495};
    9596
  • kernel/generic/src/mm/frame.c

    r056ddc30 r40c8c17  
    900900                 */
    901901                ASSERT(confframe != ADDR2PFN((uintptr_t ) NULL));
     902
     903                /* Update the known end of physical memory. */
     904                config.physmem_end = max(config.physmem_end, PFN2ADDR(start + count));
    902905               
    903906                /* If confframe is supposed to be inside our zone, then make sure
Note: See TracChangeset for help on using the changeset viewer.