1 /* ----------------------------------------------------------------------- *
3 * Copyright 2001-2003 H. Peter Anvin - All Rights Reserved
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, Inc., 53 Temple Place Ste 330,
8 * Boston MA 02111-1307, USA; either version 2 of the License, or
9 * (at your option) any later version; incorporated herein by reference.
11 * ----------------------------------------------------------------------- */
16 * Test of INT 15:E820 canonicalization/manipulation routine
25 void *sys_bounce
; /* Dummy */
27 extern void parse_mem(void);
28 extern uint32_t dos_mem
, low_mem
, high_mem
;
30 void __attribute__((noreturn
)) die(void)
35 void printranges(void) {
38 for ( i
= 0 ; i
< nranges
; i
++ ) {
39 printf("%016llx %016llx %d\n",
41 ranges
[i
+1].start
- ranges
[i
].start
,
50 char line
[BUFSIZ
], *p
;
55 while ( fgets(line
, BUFSIZ
, stdin
) ) {
56 p
= strchr(line
, ':');
58 if ( sscanf(p
, " %llx %llx %d", &start
, &len
, &type
) == 3 ) {
60 printf("%016llx %016llx %d <-\n", start
, len
, type
);
62 insertrange(start
, len
, type
);
70 printf("DOS mem = %#10x (%u K)\n", dos_mem
, dos_mem
>> 10);
71 printf("Low mem = %#10x (%u K)\n", low_mem
, low_mem
>> 10);
72 printf("High mem = %#10x (%u K)\n", high_mem
, high_mem
>> 10);
75 /* Now, steal a chunk (2K) of DOS memory and make sure it registered OK */
76 insertrange(dos_mem
-2048, 2048, 2); /* Type 2 = reserved */
82 printf("DOS mem = %#10x (%u K)\n", dos_mem
, dos_mem
>> 10);
83 printf("Low mem = %#10x (%u K)\n", low_mem
, low_mem
>> 10);
84 printf("High mem = %#10x (%u K)\n", high_mem
, high_mem
>> 10);