Changeset 95498e5 in mainline


Ignore:
Timestamp:
2005-12-05T23:18:18Z (19 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
59b6a70
Parents:
eef75f6
Message:

Map all available frames of memory on ia32 and amd64 (ticket #10).

Location:
arch
Files:
6 edited

Legend:

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

    reef75f6 r95498e5  
    3030#define __amd64_FRAME_H__
    3131
     32#ifndef __ASM__
     33#include <arch/types.h>
     34#endif /* __ASM__ */
     35
    3236#define FRAME_SIZE              4096
    3337
    3438#ifndef __ASM__
     39extern __address last_frame;
    3540extern void frame_arch_init(void);
    36 #endif
     41#endif /* __ASM__ */
    3742
    3843#endif
  • arch/amd64/src/mm/page.c

    reef75f6 r95498e5  
    2727 */
    2828
     29#include <arch/mm/page.h>
     30#include <arch/mm/frame.h>
    2931#include <mm/page.h>
    3032#include <mm/frame.h>
    31 #include <arch/mm/page.h>
    3233#include <arch/interrupt.h>
    3334#include <arch/asm.h>
    3435#include <config.h>
    35 
    3636#include <memstr.h>
    37 
    3837
    3938__address bootstrap_dba;
     
    4241{
    4342        __address dba;
    44         count_t i;
     43        __address cur;
    4544
    4645        if (config.cpu_active == 1) {
     
    5352                 * PA2KA(identity) mapping for all frames.
    5453                 */
    55                 for (i = 0; i < config.memory_size/FRAME_SIZE; i++) {
    56                         page_mapping_insert(PA2KA(i * PAGE_SIZE), i * PAGE_SIZE, PAGE_CACHEABLE | PAGE_EXEC, KA2PA(dba));
     54                for (cur = 0; cur < last_frame; cur += FRAME_SIZE) {
     55                        page_mapping_insert(PA2KA(cur), cur, PAGE_CACHEABLE | PAGE_EXEC, KA2PA(dba));
    5756                }
    5857
  • arch/ia32/include/boot/memmap.h

    reef75f6 r95498e5  
    5656        __u64 size;
    5757        __u32 type;
    58         } __attribute__ ((packed));
     58} __attribute__ ((packed));
    5959
    6060extern struct e820memmap_ e820table[MEMMAP_E820_MAX_RECORDS];
     
    6262extern __u8 e820counter;
    6363
    64 extern __u32 e801memorysize; // size of memory in KB
     64extern __u32 e801memorysize; /**< Size of available memory in KB. */
    6565
    6666#endif
  • arch/ia32/include/mm/frame.h

    reef75f6 r95498e5  
    3535
    3636extern __address bootstrap_dba;
     37extern __address last_frame;
    3738
    3839extern void frame_arch_init(void);
  • arch/ia32/src/mm/frame.c

    reef75f6 r95498e5  
    3535#include <panic.h>
    3636#include <debug.h>
     37#include <align.h>
    3738
    3839size_t hardcoded_unmapped_ktext_size = 0;
    3940size_t hardcoded_unmapped_kdata_size = 0;
     41
     42__address last_frame = 0;
    4043
    4144void frame_arch_init(void)
     
    5457                for (i = 0; i < e820counter; i++) {
    5558                        if (e820table[i].type == MEMMAP_MEMORY_AVAILABLE) {
    56                                 zone_create_in_region(e820table[i].base_address,  e820table[i].size & ~(FRAME_SIZE-1));
    57                         }
     59                                zone_create_in_region(e820table[i].base_address, e820table[i].size & ~(FRAME_SIZE-1));
     60                                if (last_frame < ALIGN(e820table[i].base_address + e820table[i].size, FRAME_SIZE))
     61                                        last_frame = ALIGN(e820table[i].base_address + e820table[i].size, FRAME_SIZE);
     62                        }                       
    5863                }
    5964        }
  • arch/ia32/src/mm/page.c

    reef75f6 r95498e5  
    2727 */
    2828
     29#include <arch/mm/page.h>
     30#include <arch/mm/frame.h>
     31#include <mm/frame.h>
     32#include <mm/page.h>
    2933#include <arch/types.h>
    3034#include <config.h>
    3135#include <func.h>
    32 #include <mm/frame.h>
    33 #include <mm/page.h>
    34 #include <arch/mm/page.h>
    3536#include <arch/interrupt.h>
    3637#include <arch/asm.h>
     
    4546{
    4647        __address dba;
    47         __u32 i;
     48        __address cur;
    4849
    4950        if (config.cpu_active == 1) {
     
    5455               
    5556                /*
    56                  * PA2KA(identity) mapping for all frames.
     57                 * PA2KA(identity) mapping for all frames until last_frame.
    5758                 */
    58                 for (i = 0; i < config.memory_size/PAGE_SIZE; i++)
    59                         page_mapping_insert(PA2KA(i * PAGE_SIZE), i * PAGE_SIZE, PAGE_CACHEABLE, KA2PA(dba));
     59                for (cur = 0; cur < last_frame; cur += FRAME_SIZE)
     60                        page_mapping_insert(PA2KA(cur), cur, PAGE_CACHEABLE, KA2PA(dba));
    6061
    6162                trap_register(14, page_fault);
Note: See TracChangeset for help on using the changeset viewer.