1 #ident "$Id: e820test.c,v 1.8 2004/12/14 22:46:25 hpa Exp $"
2 /* ----------------------------------------------------------------------- *
4 * Copyright 2001-2003 H. Peter Anvin - All Rights Reserved
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, Inc., 53 Temple Place Ste 330,
9 * Boston MA 02111-1307, USA; either version 2 of the License, or
10 * (at your option) any later version; incorporated herein by reference.
12 * ----------------------------------------------------------------------- */
17 * Test of INT 15:E820 canonicalization/manipulation routine
26 void *sys_bounce; /* Dummy */
28 extern void parse_mem(void);
29 extern uint32_t dos_mem, low_mem, high_mem;
31 void __attribute__((noreturn)) die(void)
36 void printranges(void) {
39 for ( i = 0 ; i < nranges ; i++ ) {
40 printf("%016llx %016llx %d\n",
42 ranges[i+1].start - ranges[i].start,
51 char line[BUFSIZ], *p;
56 while ( fgets(line, BUFSIZ, stdin) ) {
57 p = strchr(line, ':');
59 if ( sscanf(p, " %llx %llx %d", &start, &len, &type) == 3 ) {
61 printf("%016llx %016llx %d <-\n", start, len, type);
63 insertrange(start, len, type);
71 printf("DOS mem = %#10x (%u K)\n", dos_mem, dos_mem >> 10);
72 printf("Low mem = %#10x (%u K)\n", low_mem, low_mem >> 10);
73 printf("High mem = %#10x (%u K)\n", high_mem, high_mem >> 10);
76 /* Now, steal a chunk (2K) of DOS memory and make sure it registered OK */
77 insertrange(dos_mem-2048, 2048, 2); /* Type 2 = reserved */
83 printf("DOS mem = %#10x (%u K)\n", dos_mem, dos_mem >> 10);
84 printf("Low mem = %#10x (%u K)\n", low_mem, low_mem >> 10);
85 printf("High mem = %#10x (%u K)\n", high_mem, high_mem >> 10);