|
@@ -135,10 +135,9 @@ static unsigned int extmemsize ( void ) {
|
135
|
135
|
* Get e820 memory map
|
136
|
136
|
*
|
137
|
137
|
* @v memmap Memory map to fill in
|
138
|
|
- * @v entries Maximum number of entries in memory map
|
139
|
138
|
* @ret rc Return status code
|
140
|
139
|
*/
|
141
|
|
-static int meme820 ( struct memory_region *memmap, unsigned int entries ) {
|
|
140
|
+static int meme820 ( struct memory_map *memmap ) {
|
142
|
141
|
unsigned int index = 0;
|
143
|
142
|
uint32_t next = 0;
|
144
|
143
|
uint32_t smap;
|
|
@@ -170,10 +169,12 @@ static int meme820 ( struct memory_region *memmap, unsigned int entries ) {
|
170
|
169
|
if ( e820buf.type != E820_TYPE_RAM )
|
171
|
170
|
continue;
|
172
|
171
|
|
173
|
|
- memmap[index].start = e820buf.start;
|
174
|
|
- memmap[index].end = e820buf.start + e820buf.len;
|
|
172
|
+ memmap->regions[index].start = e820buf.start;
|
|
173
|
+ memmap->regions[index].end = e820buf.start + e820buf.len;
|
175
|
174
|
index++;
|
176
|
|
- } while ( ( index < entries ) && ( next != 0 ) );
|
|
175
|
+ } while ( ( next != 0 ) &&
|
|
176
|
+ ( index < ( sizeof ( memmap->regions ) /
|
|
177
|
+ sizeof ( memmap->regions[0] ) ) ) );
|
177
|
178
|
return 0;
|
178
|
179
|
}
|
179
|
180
|
|
|
@@ -181,25 +182,24 @@ static int meme820 ( struct memory_region *memmap, unsigned int entries ) {
|
181
|
182
|
* Get memory map
|
182
|
183
|
*
|
183
|
184
|
* @v memmap Memory map to fill in
|
184
|
|
- * @v entries Maximum number of entries in memory map (minimum 2)
|
185
|
185
|
*/
|
186
|
|
-void get_memmap ( struct memory_region *memmap, unsigned int entries ) {
|
|
186
|
+void get_memmap ( struct memory_map *memmap ) {
|
187
|
187
|
unsigned int basemem, extmem;
|
188
|
188
|
int rc;
|
189
|
189
|
|
190
|
190
|
/* Clear memory map */
|
191
|
|
- memset ( memmap, 0, ( entries * sizeof ( *memmap ) ) );
|
|
191
|
+ memset ( memmap, 0, sizeof ( *memmap ) );
|
192
|
192
|
|
193
|
193
|
/* Get base and extended memory sizes */
|
194
|
194
|
basemem = basememsize();
|
195
|
195
|
extmem = extmemsize();
|
196
|
196
|
|
197
|
197
|
/* Try INT 15,e820 first */
|
198
|
|
- if ( ( rc = meme820 ( memmap, entries ) ) == 0 )
|
|
198
|
+ if ( ( rc = meme820 ( memmap ) ) == 0 )
|
199
|
199
|
return;
|
200
|
200
|
|
201
|
201
|
/* Fall back to constructing a map from basemem and extmem sizes */
|
202
|
|
- memmap[0].end = ( basemem * 1024 );
|
203
|
|
- memmap[1].start = 0x100000;
|
204
|
|
- memmap[1].end = 0x100000 + ( extmem * 1024 );
|
|
202
|
+ memmap->regions[0].end = ( basemem * 1024 );
|
|
203
|
+ memmap->regions[1].start = 0x100000;
|
|
204
|
+ memmap->regions[1].end = 0x100000 + ( extmem * 1024 );
|
205
|
205
|
}
|