RTEMS  5.1
memlimits.h
Go to the documentation of this file.
1 
7 /*
8  * limits.h - definition of machine & system dependent address limits
9  *
10  * THIS SOFTWARE IS NOT COPYRIGHTED
11  *
12  * The following software is offered for use in the public domain.
13  * There is no warranty with regard to this software or its performance
14  * and the user must accept the software "AS IS" with all faults.
15  *
16  * THE CONTRIBUTORS DISCLAIM ANY WARRANTIES, EXPRESS OR IMPLIED, WITH
17  * REGARD TO THIS SOFTWARE INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19  */
20 
21 #ifndef _MEMLIMITS_H_
22 #define _MEMLIMITS_H_
23 
24 /*
25  * The macros in this file are specific to a given implementation.
26  * The general rules for their construction are as follows:
27  *
28  * 1.) is_readable(addr,length) should be true if and only if the
29  * region starting at the given virtual address can be read
30  * _without_ causing an exception or other fatal error. Note
31  * that the stub will use the strictest alignment satisfied
32  * by _both_ addr and length (e.g., if both are divisible by
33  * 8 then the region will be read in double-word chunks).
34  *
35  * 2.) is_writeable(addr,length) should be true if and only if the
36  * region starting at the given virtual address can be written
37  * _without_ causing an exception or other fatal error. Note
38  * that the stub will use the strictest alignment satisfied
39  * by _both_ addr and length (e.g., if both are divisible by
40  * 8 then the region will be written in double-word chunks).
41  *
42  * 3.) is-steppable(ptr) whould be true if and only if ptr is the
43  * address of a writeable region of memory which may contain
44  * an executable instruction. At a minimum this requires that
45  * ptr be word-aligned (divisible by 4) and not point to EPROM
46  * or memory-mapped I/O.
47  *
48  * Note: in order to satisfy constraints related to cacheability
49  * of certain memory subsystems it may be necessary for regions
50  * of kseg0 and kseg1 which map to the same physical addresses
51  * to have different readability and/or writeability attributes.
52  */
53 
61 /*
62 #define K0_LIMIT_FOR_READ (K0BASE+0x18000000)
63 #define K1_LIMIT_FOR_READ (K1BASE+K1SIZE)
64 
65 #define is_readable(addr,length) \
66  (((K0BASE <= addr) && ((addr + length) <= K0_LIMIT_FOR_READ)) \
67  || ((K1BASE <= addr) && ((addr + length) <= K1_LIMIT_FOR_READ)))
68 
69 #define K0_LIMIT_FOR_WRITE (K0BASE+0x08000000)
70 #define K1_LIMIT_FOR_WRITE (K1BASE+0x1e000000)
71 
72 #define is_writeable(addr,length) \
73  (((K0BASE <= addr) && ((addr + length) <= K0_LIMIT_FOR_WRITE)) \
74  || ((K1BASE <= addr) && ((addr + length) <= K1_LIMIT_FOR_WRITE)))
75 
76 #define K0_LIMIT_FOR_STEP (K0BASE+0x08000000)
77 #define K1_LIMIT_FOR_STEP (K1BASE+0x08000000)
78 
79 #define is_steppable(ptr) \
80  ((((int)ptr & 0x3) == 0) \
81  && (((K0BASE <= (int)ptr) && ((int)ptr < K0_LIMIT_FOR_STEP)) \
82  || ((K1BASE <= (int)ptr) && ((int)ptr < K1_LIMIT_FOR_STEP))))
83 
84 struct memseg
85 {
86  unsigned begin, end, opts;
87 };
88 
89 #define MEMOPT_READABLE 1
90 #define MEMOPT_WRITEABLE 2
91 
92 #define NUM_MEMSEGS 10
93 
94 int add_memsegment(unsigned,unsigned,int);
95 int is_readable(unsigned,unsigned);
96 int is_writeable(unsigned,unsigned);
97 int is_steppable(unsigned);
98 */
99 
100 #endif /* _MEMLIMITS_H_ */