Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:23:51

0001 /**
0002  * @file
0003  * @ingroup mips_limits
0004  * @brief Definition of machine and system dependent address limits.
0005  */
0006 
0007 /*
0008  * limits.h - definition of machine & system dependent address limits
0009  *
0010  *                   THIS SOFTWARE IS NOT COPYRIGHTED
0011  *
0012  *  The following software is offered for use in the public domain.
0013  *  There is no warranty with regard to this software or its performance
0014  *  and the user must accept the software "AS IS" with all faults.
0015  *
0016  *  THE CONTRIBUTORS DISCLAIM ANY WARRANTIES, EXPRESS OR IMPLIED, WITH
0017  *  REGARD TO THIS SOFTWARE INCLUDING BUT NOT LIMITED TO THE WARRANTIES
0018  *  OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
0019  */
0020 
0021 #ifndef _MEMLIMITS_H_
0022 #define _MEMLIMITS_H_
0023 
0024 /*
0025  * The macros in this file are specific to a given implementation.
0026  * The general rules for their construction are as follows:
0027  *
0028  * 1.) is_readable(addr,length) should be true if and only if the
0029  *     region starting at the given virtual address can be read
0030  *     _without_ causing an exception or other fatal error.  Note
0031  *     that the stub will use the strictest alignment satisfied
0032  *     by _both_ addr and length (e.g., if both are divisible by
0033  *     8 then the region will be read in double-word chunks).
0034  *
0035  * 2.) is_writeable(addr,length) should be true if and only if the
0036  *     region starting at the given virtual address can be written
0037  *     _without_ causing an exception or other fatal error.  Note
0038  *     that the stub will use the strictest alignment satisfied
0039  *     by _both_ addr and length (e.g., if both are divisible by
0040  *     8 then the region will be written in double-word chunks).
0041  *
0042  * 3.) is-steppable(ptr) whould be true if and only if ptr is the
0043  *     address of a writeable region of memory which may contain
0044  *     an executable instruction.  At a minimum this requires that
0045  *     ptr be word-aligned (divisible by 4) and not point to EPROM
0046  *     or memory-mapped I/O.
0047  *
0048  * Note: in order to satisfy constraints related to cacheability
0049  * of certain memory subsystems it may be necessary for regions
0050  * of kseg0 and kseg1 which map to the same physical addresses
0051  * to have different readability and/or writeability attributes.
0052  */
0053 
0054 /**
0055  * @defgroup mips_limits Address Limits
0056  * @ingroup RTEMSBSPsMIPSShared
0057  * @brief Address Limits
0058  */
0059 
0060 
0061 /*
0062 #define K0_LIMIT_FOR_READ  (K0BASE+0x18000000)
0063 #define K1_LIMIT_FOR_READ  (K1BASE+K1SIZE)
0064 
0065 #define is_readable(addr,length) \
0066  (((K0BASE <= addr) && ((addr + length) <= K0_LIMIT_FOR_READ)) \
0067   || ((K1BASE <= addr) && ((addr + length) <= K1_LIMIT_FOR_READ)))
0068 
0069 #define K0_LIMIT_FOR_WRITE (K0BASE+0x08000000)
0070 #define K1_LIMIT_FOR_WRITE (K1BASE+0x1e000000)
0071 
0072 #define is_writeable(addr,length) \
0073  (((K0BASE <= addr) && ((addr + length) <= K0_LIMIT_FOR_WRITE)) \
0074   || ((K1BASE <= addr) && ((addr + length) <= K1_LIMIT_FOR_WRITE)))
0075 
0076 #define K0_LIMIT_FOR_STEP  (K0BASE+0x08000000)
0077 #define K1_LIMIT_FOR_STEP  (K1BASE+0x08000000)
0078 
0079 #define is_steppable(ptr) \
0080  ((((int)ptr & 0x3) == 0) \
0081   && (((K0BASE <= (int)ptr) && ((int)ptr < K0_LIMIT_FOR_STEP)) \
0082       || ((K1BASE <= (int)ptr) && ((int)ptr < K1_LIMIT_FOR_STEP))))
0083 
0084 struct memseg
0085 {
0086       unsigned begin, end, opts;
0087 };
0088 
0089 #define MEMOPT_READABLE   1
0090 #define MEMOPT_WRITEABLE  2
0091 
0092 #define NUM_MEMSEGS     10
0093 
0094 int add_memsegment(unsigned,unsigned,int);
0095 int is_readable(unsigned,unsigned);
0096 int is_writeable(unsigned,unsigned);
0097 int is_steppable(unsigned);
0098 */
0099 
0100 #endif  /* _MEMLIMITS_H_ */