aboutsummaryrefslogtreecommitdiffstats
path: root/memdisk
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2008-10-10 12:48:18 -0700
committerH. Peter Anvin <hpa@zytor.com>2008-10-13 12:26:59 -0700
commitfb1635c7c11dda0bf9b99877dff4a70ab4ef7f1d (patch)
tree861dbe0045c93c97f9b718fe85681d63e7bea5e9 /memdisk
parent87befcd31d6c93d8fdd7e143b66f834280b69228 (diff)
downloadsyslinux.git-fb1635c7c11dda0bf9b99877dff4a70ab4ef7f1d.tar.gz
syslinux.git-fb1635c7c11dda0bf9b99877dff4a70ab4ef7f1d.tar.xz
syslinux.git-fb1635c7c11dda0bf9b99877dff4a70ab4ef7f1d.zip
memdisk: make the e820 code compile for debugging again
Make it possible to build e820test again, to debug the e820 code. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'memdisk')
-rw-r--r--memdisk/e820func.c7
-rw-r--r--memdisk/msetup.c23
2 files changed, 19 insertions, 11 deletions
diff --git a/memdisk/e820func.c b/memdisk/e820func.c
index a6896745..ccfc38ea 100644
--- a/memdisk/e820func.c
+++ b/memdisk/e820func.c
@@ -34,7 +34,7 @@ void e820map_init(void)
{
memset(ranges, 0, sizeof(ranges));
nranges = 1;
- ranges[1].type = -1;
+ ranges[1].type = -1U;
}
static void insertrange_at(int where, uint64_t start,
@@ -51,7 +51,7 @@ static void insertrange_at(int where, uint64_t start,
nranges++;
ranges[nranges].start = 0ULL;
- ranges[nranges].type = (uint32_t)-1;
+ ranges[nranges].type = -1U;
ranges[nranges].extattr = 0;
}
@@ -98,8 +98,7 @@ void insertrange(uint64_t start, uint64_t len, uint32_t type, uint32_t extattr)
oldtype = ranges[0].type;
oldattr = ranges[0].extattr;
while ( i < nranges ) {
- if ( ranges[i].type == oldtype &&
- ranges[i].extattr == oldattr ) {
+ if ( ranges[i].type == oldtype && ranges[i].extattr == oldattr ) {
i++;
} else {
oldtype = ranges[i].type;
diff --git a/memdisk/msetup.c b/memdisk/msetup.c
index f126d878..60149c3b 100644
--- a/memdisk/msetup.c
+++ b/memdisk/msetup.c
@@ -17,10 +17,21 @@
*/
#include <stdint.h>
-#include "memdisk.h"
-#include "conio.h"
+#ifdef TEST
+# include <string.h>
+# include <stdio.h>
+#else
+# include "memdisk.h"
+# include "conio.h"
+#endif
#include "e820.h"
+uint32_t dos_mem = 0; /* 0-1MB */
+uint32_t low_mem = 0; /* 1-16MB */
+uint32_t high_mem = 0; /* 16+ MB */
+
+#ifndef TEST
+
static inline int get_e820(void)
{
struct e820_info {
@@ -123,10 +134,6 @@ static inline int get_88(void)
return err;
}
-uint32_t dos_mem = 0; /* 0-1MB */
-uint32_t low_mem = 0; /* 1-16MB */
-uint32_t high_mem = 0; /* 16+ MB */
-
void get_mem(void)
{
if ( get_e820() ) {
@@ -140,6 +147,8 @@ void get_mem(void)
}
}
+#endif /* TEST */
+
#define PW(x) (1ULL << (x))
void parse_mem(void)
@@ -149,7 +158,7 @@ void parse_mem(void)
dos_mem = low_mem = high_mem = 0;
/* Derive "dos mem", "high mem", and "low mem" from the range array */
- for ( ep = ranges ; ep->type != -1 ; ep++ ) {
+ for ( ep = ranges ; ep->type != -1U ; ep++ ) {
if ( ep->type == 1 ) {
/* Only look at memory ranges */
if ( ep->start == 0 ) {