|
@@ -69,59 +69,6 @@ void dbg_hex_dump_da ( unsigned long dispaddr, const void *data,
|
69
|
69
|
}
|
70
|
70
|
}
|
71
|
71
|
|
72
|
|
-#define GUARD_SYMBOL ( ( 'M' << 24 ) | ( 'I' << 16 ) | ( 'N' << 8 ) | 'E' )
|
73
|
|
-/* Fill a region with guard markers. We use a 4-byte pattern to make
|
74
|
|
- * it less likely that check_region will find spurious 1-byte regions
|
75
|
|
- * of non-corruption.
|
76
|
|
- */
|
77
|
|
-void guard_region ( void *region, size_t len ) {
|
78
|
|
- uint32_t offset = 0;
|
79
|
|
-
|
80
|
|
- len &= ~0x03;
|
81
|
|
- for ( offset = 0; offset < len ; offset += 4 ) {
|
82
|
|
- *((uint32_t *)(region + offset)) = GUARD_SYMBOL;
|
83
|
|
- }
|
84
|
|
-}
|
85
|
|
-
|
86
|
|
-/* Check a region that has been guarded with guard_region() for
|
87
|
|
- * corruption.
|
88
|
|
- */
|
89
|
|
-int check_region ( void *region, size_t len ) {
|
90
|
|
- uint8_t corrupted = 0;
|
91
|
|
- uint8_t in_corruption = 0;
|
92
|
|
- uint32_t offset = 0;
|
93
|
|
- uint32_t test = 0;
|
94
|
|
-
|
95
|
|
- len &= ~0x03;
|
96
|
|
- for ( offset = 0; offset < len ; offset += 4 ) {
|
97
|
|
- test = *((uint32_t *)(region + offset)) = GUARD_SYMBOL;
|
98
|
|
- if ( ( in_corruption == 0 ) &&
|
99
|
|
- ( test != GUARD_SYMBOL ) ) {
|
100
|
|
- /* Start of corruption */
|
101
|
|
- if ( corrupted == 0 ) {
|
102
|
|
- corrupted = 1;
|
103
|
|
- printf ( "Region %p-%p (physical %#lx-%#lx) "
|
104
|
|
- "corrupted\n",
|
105
|
|
- region, region + len,
|
106
|
|
- virt_to_phys ( region ),
|
107
|
|
- virt_to_phys ( region + len ) );
|
108
|
|
- }
|
109
|
|
- in_corruption = 1;
|
110
|
|
- printf ( "--- offset %#x ", offset );
|
111
|
|
- } else if ( ( in_corruption != 0 ) &&
|
112
|
|
- ( test == GUARD_SYMBOL ) ) {
|
113
|
|
- /* End of corruption */
|
114
|
|
- in_corruption = 0;
|
115
|
|
- printf ( "to offset %#x", offset );
|
116
|
|
- }
|
117
|
|
-
|
118
|
|
- }
|
119
|
|
- if ( in_corruption != 0 ) {
|
120
|
|
- printf ( "to offset %#zx (end of region)\n", len-1 );
|
121
|
|
- }
|
122
|
|
- return corrupted;
|
123
|
|
-}
|
124
|
|
-
|
125
|
72
|
/**
|
126
|
73
|
* Maximum number of separately coloured message streams
|
127
|
74
|
*
|