From dd6e02af5b8fa016fa112044838ef2f8b960fc9e Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Fri, 29 May 2009 15:10:28 -0700 Subject: Run Nindent on com32/modules/meminfo.c Automatically reformat com32/modules/meminfo.c using Nindent. Do this for all files except HDT, gPXE and externally maintained libraries (zlib, tinyjpeg, libpng). Signed-off-by: H. Peter Anvin --- com32/modules/meminfo.c | 157 ++++++++++++++++++++++++------------------------ 1 file changed, 79 insertions(+), 78 deletions(-) diff --git a/com32/modules/meminfo.c b/com32/modules/meminfo.c index e88c824c..6e24f355 100644 --- a/com32/modules/meminfo.c +++ b/com32/modules/meminfo.c @@ -23,103 +23,104 @@ #include struct e820_data { - uint64_t base; - uint64_t len; - uint32_t type; - uint32_t extattr; -} __attribute__((packed)); - -static const char * const e820_types[] = { - "usable", - "reserved", - "ACPI reclaim", - "ACPI NVS", - "unusable", + uint64_t base; + uint64_t len; + uint32_t type; + uint32_t extattr; +} __attribute__ ((packed)); + +static const char *const e820_types[] = { + "usable", + "reserved", + "ACPI reclaim", + "ACPI NVS", + "unusable", }; static void dump_e820(void) { - com32sys_t ireg, oreg; - struct e820_data ed; - uint32_t type; - - 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); - - memset(&ed, 0, sizeof ed); - ed.extattr = 1; - - do { - memcpy(__com32.cs_bounce, &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); - - if (oreg.ecx.l >= 24) { - /* ebx base length end type */ - printf("%8x %016llx %016llx %016llx %d [%x]", - ireg.ebx.l, ed.base, ed.len, ed.base+ed.len, ed.type, ed.extattr); - } else { - /* ebx base length end */ - printf("%8x %016llx %016llx %016llx %d [-]", - ireg.ebx.l, ed.base, ed.len, ed.base+ed.len, ed.type); - ed.extattr = 1; - } - - type = ed.type - 1; - if (type < sizeof(e820_types)/sizeof(e820_types[0])) - printf(" %s", e820_types[type]); - - putchar('\n'); - - ireg.ebx.l = oreg.ebx.l; - } while (ireg.ebx.l); + com32sys_t ireg, oreg; + struct e820_data ed; + uint32_t type; + + 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); + + memset(&ed, 0, sizeof ed); + ed.extattr = 1; + + do { + memcpy(__com32.cs_bounce, &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); + + if (oreg.ecx.l >= 24) { + /* ebx base length end type */ + printf("%8x %016llx %016llx %016llx %d [%x]", + ireg.ebx.l, ed.base, ed.len, ed.base + ed.len, ed.type, + ed.extattr); + } else { + /* ebx base length end */ + printf("%8x %016llx %016llx %016llx %d [-]", + ireg.ebx.l, ed.base, ed.len, ed.base + ed.len, ed.type); + ed.extattr = 1; + } + + type = ed.type - 1; + if (type < sizeof(e820_types) / sizeof(e820_types[0])) + printf(" %s", e820_types[type]); + + putchar('\n'); + + ireg.ebx.l = oreg.ebx.l; + } while (ireg.ebx.l); } static void dump_legacy(void) { - com32sys_t ireg, oreg; - uint16_t dosram = *(uint16_t *)0x413; - struct { uint16_t offs, seg; } * const ivt = (void *)0; + com32sys_t ireg, oreg; + uint16_t dosram = *(uint16_t *) 0x413; + struct { + uint16_t offs, seg; + } *const ivt = (void *)0; - memset(&ireg, 0, sizeof ireg); + memset(&ireg, 0, sizeof ireg); - __intcall(0x12, &ireg, &oreg); + __intcall(0x12, &ireg, &oreg); - printf("INT 15h = %04x:%04x DOS RAM: %dK (0x%05x) INT 12h: %dK (0x%05x)\n", - ivt[0x15].seg, ivt[0x15].offs, - dosram, dosram << 10, - oreg.eax.w[0], oreg.eax.w[0] << 10); + printf + ("INT 15h = %04x:%04x DOS RAM: %dK (0x%05x) INT 12h: %dK (0x%05x)\n", + ivt[0x15].seg, ivt[0x15].offs, dosram, dosram << 10, oreg.eax.w[0], + oreg.eax.w[0] << 10); - ireg.eax.b[1] = 0x88; - __intcall(0x15, &ireg, &oreg); + ireg.eax.b[1] = 0x88; + __intcall(0x15, &ireg, &oreg); - printf("INT 15 88: 0x%04x (%uK) ", - oreg.eax.w[0], oreg.eax.w[0]); + printf("INT 15 88: 0x%04x (%uK) ", oreg.eax.w[0], oreg.eax.w[0]); - ireg.eax.w[0] = 0xe801; - __intcall(0x15, &ireg, &oreg); + ireg.eax.w[0] = 0xe801; + __intcall(0x15, &ireg, &oreg); - printf("INT 15 E801: 0x%04x (%uK) 0x%04x (%uK)\n", - oreg.ecx.w[0], oreg.ecx.w[0], oreg.edx.w[0], oreg.edx.w[0] << 6); + printf("INT 15 E801: 0x%04x (%uK) 0x%04x (%uK)\n", + oreg.ecx.w[0], oreg.ecx.w[0], oreg.edx.w[0], oreg.edx.w[0] << 6); } int main(void) { - openconsole(&dev_null_r, &dev_stdcon_w); + openconsole(&dev_null_r, &dev_stdcon_w); - dump_legacy(); - dump_e820(); + dump_legacy(); + dump_e820(); - return 0; + return 0; } -- cgit v1.2.1