aboutsummaryrefslogtreecommitdiffstats
path: root/com32/modules/meminfo.c
diff options
context:
space:
mode:
Diffstat (limited to 'com32/modules/meminfo.c')
-rw-r--r--com32/modules/meminfo.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/com32/modules/meminfo.c b/com32/modules/meminfo.c
index 96006d4c..00d0e14d 100644
--- a/com32/modules/meminfo.c
+++ b/com32/modules/meminfo.c
@@ -42,27 +42,32 @@ static void dump_e820(void)
com32sys_t ireg, oreg;
struct e820_data ed;
uint32_t type;
+ void *low_ed;
+
+ low_ed = lmalloc(sizeof ed);
+ if (!low_ed)
+ return;
memset(&ireg, 0, sizeof ireg);
ireg.eax.w[0] = 0xe820;
ireg.edx.l = 0x534d4150;
ireg.ecx.l = sizeof(struct e820_data);
- ireg.edi.w[0] = OFFS(__com32.cs_bounce);
- ireg.es = SEG(__com32.cs_bounce);
+ ireg.edi.w[0] = OFFS(low_ed);
+ ireg.es = SEG(low_ed);
memset(&ed, 0, sizeof ed);
ed.extattr = 1;
do {
- memcpy(__com32.cs_bounce, &ed, sizeof ed);
+ memcpy(low_ed, &ed, sizeof ed);
__intcall(0x15, &ireg, &oreg);
if (oreg.eflags.l & EFLAGS_CF ||
oreg.eax.l != 0x534d4150 || oreg.ecx.l < 20)
break;
- memcpy(&ed, __com32.cs_bounce, sizeof ed);
+ memcpy(&ed, low_ed, sizeof ed);
if (oreg.ecx.l >= 24) {
/* ebx base length end type */
@@ -84,6 +89,8 @@ static void dump_e820(void)
ireg.ebx.l = oreg.ebx.l;
} while (ireg.ebx.l);
+
+ free(low_ed);
}
static void dump_legacy(void)
@@ -115,10 +122,9 @@ static void dump_legacy(void)
oreg.ecx.w[0], oreg.ecx.w[0], oreg.edx.w[0], oreg.edx.w[0] << 6);
}
-int main(void)
+int main(int argc, char **argv)
{
dump_legacy();
dump_e820();
-
return 0;
}