Subversion Repositories HelenOS

Rev

Rev 4344 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4344 Rev 4346
Line 38... Line 38...
38
#include <interrupt.h>
38
#include <interrupt.h>
39
#include <mm/frame.h>
39
#include <mm/frame.h>
40
#include <mm/asid.h>
40
#include <mm/asid.h>
41
#include <config.h>
41
#include <config.h>
42
#include <arch/drivers/msim.h>
42
#include <arch/drivers/msim.h>
43
#include <arch/drivers/serial.h>
-
 
44
#include <print.h>
43
#include <print.h>
45
 
44
 
46
#define ZERO_PAGE_MASK      TLB_PAGE_MASK_256K
45
#define ZERO_PAGE_MASK    TLB_PAGE_MASK_256K
47
#define ZERO_FRAMES         2048
46
#define ZERO_FRAMES       2048
48
#define ZERO_PAGE_WIDTH     18  /* 256K */
47
#define ZERO_PAGE_WIDTH   18  /* 256K */
49
#define ZERO_PAGE_SIZE      (1 << ZERO_PAGE_WIDTH)
48
#define ZERO_PAGE_SIZE    (1 << ZERO_PAGE_WIDTH)
50
#define ZERO_PAGE_ASID      ASID_INVALID
49
#define ZERO_PAGE_ASID    ASID_INVALID
51
#define ZERO_PAGE_TLBI      0
50
#define ZERO_PAGE_TLBI    0
52
#define ZERO_PAGE_ADDR      0
51
#define ZERO_PAGE_ADDR    0
53
#define ZERO_PAGE_OFFSET    (ZERO_PAGE_SIZE / sizeof(uint32_t) - 1)
52
#define ZERO_PAGE_OFFSET  (ZERO_PAGE_SIZE / sizeof(uint32_t) - 1)
54
#define ZERO_PAGE_VALUE     (((volatile uint32_t *) ZERO_PAGE_ADDR)[ZERO_PAGE_OFFSET])
53
#define ZERO_PAGE_VALUE   (((volatile uint32_t *) ZERO_PAGE_ADDR)[ZERO_PAGE_OFFSET])
55
 
54
 
-
 
55
#define ZERO_PAGE_VALUE_KSEG1(frame) \
56
#define ZERO_PAGE_VALUE_KSEG1(frame) (((volatile uint32_t *) (0xa0000000 + (frame << ZERO_PAGE_WIDTH)))[ZERO_PAGE_OFFSET])
56
    (((volatile uint32_t *) (0xa0000000 + (frame << ZERO_PAGE_WIDTH)))[ZERO_PAGE_OFFSET])
57
 
57
 
58
#define MAX_REGIONS         32
58
#define MAX_REGIONS  32
59
 
59
 
60
typedef struct {
60
typedef struct {
61
    pfn_t start;
61
    pfn_t start;
62
    pfn_t count;
62
    pfn_t count;
63
} phys_region_t;
63
} phys_region_t;
64
 
64
 
65
static count_t phys_regions_count = 0;
65
static count_t phys_regions_count = 0;
66
static phys_region_t phys_regions[MAX_REGIONS];
66
static phys_region_t phys_regions[MAX_REGIONS];
67
 
67
 
68
 
-
 
69
/** Check whether frame is available
68
/** Check whether frame is available
70
 *
69
 *
71
 * Returns true if given frame is generally available for use.
70
 * Returns true if given frame is generally available for use.
72
 * Returns false if given frame is used for physical memory
71
 * Returns false if given frame is used for physical memory
73
 * mapped devices and cannot be used.
72
 * mapped devices and cannot be used.
Line 82... Line 81...
82
   
81
   
83
    /* MSIM device (dkeyboard) */
82
    /* MSIM device (dkeyboard) */
84
    if (frame == (KA2PA(MSIM_KBD_ADDRESS) >> ZERO_PAGE_WIDTH))
83
    if (frame == (KA2PA(MSIM_KBD_ADDRESS) >> ZERO_PAGE_WIDTH))
85
        return false;
84
        return false;
86
#endif
85
#endif
87
 
86
   
88
#ifdef MACHINE_simics
-
 
89
    /* Simics device (serial line) */
-
 
90
    if (frame == (KA2PA(SERIAL_ADDRESS) >> ZERO_PAGE_WIDTH))
-
 
91
        return false;
-
 
92
#endif
-
 
93
 
-
 
94
#if defined(MACHINE_lgxemul) || defined(MACHINE_bgxemul)
87
#if defined(MACHINE_lgxemul) || defined(MACHINE_bgxemul)
95
    /* gxemul devices */
88
    /* gxemul devices */
96
    if (overlaps(frame << ZERO_PAGE_WIDTH, ZERO_PAGE_SIZE,
89
    if (overlaps(frame << ZERO_PAGE_WIDTH, ZERO_PAGE_SIZE,
97
        0x10000000, MB2SIZE(256)))
90
        0x10000000, MB2SIZE(256)))
98
        return false;
91
        return false;