aboutsummaryrefslogtreecommitdiffstats
path: root/memdisk
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2009-05-29 15:10:36 -0700
committerH. Peter Anvin <hpa@zytor.com>2009-05-29 15:10:36 -0700
commitcdfc1aa1537dddbf2ebbc3d7fa9f3bf79ee45990 (patch)
treef184b9d759e4da4c4c47912607aee075b59108bc /memdisk
parent51788c891d17224c10c620e8e2085717f95bef73 (diff)
downloadsyslinux.git-cdfc1aa1537dddbf2ebbc3d7fa9f3bf79ee45990.tar.gz
syslinux.git-cdfc1aa1537dddbf2ebbc3d7fa9f3bf79ee45990.tar.xz
syslinux.git-cdfc1aa1537dddbf2ebbc3d7fa9f3bf79ee45990.zip
Run Nindent on memdisk/msetup.c
Automatically reformat memdisk/msetup.c using Nindent. Do this for all files except HDT, gPXE and externally maintained libraries (zlib, tinyjpeg, libpng). Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'memdisk')
-rw-r--r--memdisk/msetup.c201
1 files changed, 101 insertions, 100 deletions
diff --git a/memdisk/msetup.c b/memdisk/msetup.c
index e5111174..adb35f90 100644
--- a/memdisk/msetup.c
+++ b/memdisk/msetup.c
@@ -26,153 +26,154 @@
#endif
#include "e820.h"
-uint32_t dos_mem = 0; /* 0-1MB */
-uint32_t low_mem = 0; /* 1-16MB */
+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 {
- uint64_t base;
- uint64_t len;
- uint32_t type;
- } *buf = sys_bounce;
- uint32_t copied;
- int range_count = 0;
- com32sys_t regs;
-
- memset(&regs, 0, sizeof regs);
- memset(buf, 0, sizeof *buf);
-
- do {
- regs.eax.l = 0x0000e820;
- regs.ecx.l = sizeof(*buf);
- regs.edx.l = 0x534d4150;
- regs.edi.w[0] = OFFS(buf);
- regs.es = SEG(buf);
+ struct e820_info {
+ uint64_t base;
+ uint64_t len;
+ uint32_t type;
+ } *buf = sys_bounce;
+ uint32_t copied;
+ int range_count = 0;
+ com32sys_t regs;
- syscall(0x15, &regs, &regs);
- copied = (regs.eflags.l & 1) ? 0 : regs.ecx.l;
+ memset(&regs, 0, sizeof regs);
+ memset(buf, 0, sizeof *buf);
+
+ do {
+ regs.eax.l = 0x0000e820;
+ regs.ecx.l = sizeof(*buf);
+ regs.edx.l = 0x534d4150;
+ regs.edi.w[0] = OFFS(buf);
+ regs.es = SEG(buf);
- if ( regs.eax.l != 0x534d4150 || copied < 20 )
- break;
+ syscall(0x15, &regs, &regs);
+ copied = (regs.eflags.l & 1) ? 0 : regs.ecx.l;
- printf("e820: %08x%08x %08x%08x %d\n",
- (uint32_t)(buf->base >> 32), (uint32_t)buf->base,
- (uint32_t)(buf->len >> 32), (uint32_t)buf->len,
- buf->type);
+ if (regs.eax.l != 0x534d4150 || copied < 20)
+ break;
- insertrange(buf->base, buf->len, buf->type);
- range_count++;
+ printf("e820: %08x%08x %08x%08x %d\n",
+ (uint32_t) (buf->base >> 32), (uint32_t) buf->base,
+ (uint32_t) (buf->len >> 32), (uint32_t) buf->len, buf->type);
- } while ( regs.ebx.l );
+ insertrange(buf->base, buf->len, buf->type);
+ range_count++;
- return !range_count;
+ } while (regs.ebx.l);
+
+ return !range_count;
}
static inline void get_dos_mem(void)
{
- com32sys_t regs;
+ com32sys_t regs;
- memset(&regs, 0, sizeof regs);
- syscall(0x12, &regs, &regs);
- insertrange(0, (uint64_t)((uint32_t)regs.eax.w[0] << 10), 1);
- printf(" DOS: %d K\n", regs.eax.w[0]);
+ memset(&regs, 0, sizeof regs);
+ syscall(0x12, &regs, &regs);
+ insertrange(0, (uint64_t) ((uint32_t) regs.eax.w[0] << 10), 1);
+ printf(" DOS: %d K\n", regs.eax.w[0]);
}
static inline int get_e801(void)
{
- int err;
- com32sys_t regs;
+ int err;
+ com32sys_t regs;
- memset(&regs, 0, sizeof regs);
+ memset(&regs, 0, sizeof regs);
- regs.eax.w[0] = 0xe801;
- syscall(0x15, &regs, &regs);
+ regs.eax.w[0] = 0xe801;
+ syscall(0x15, &regs, &regs);
- if ( !(err = regs.eflags.l & 1) ) {
- if ( regs.eax.w[0] ) {
- insertrange(0x100000, (uint64_t)((uint32_t)regs.eax.w[0] << 10), 1);
+ if (!(err = regs.eflags.l & 1)) {
+ if (regs.eax.w[0]) {
+ insertrange(0x100000, (uint64_t) ((uint32_t) regs.eax.w[0] << 10),
+ 1);
+ }
+ if (regs.ebx.w[0]) {
+ insertrange(0x1000000, (uint64_t) ((uint32_t) regs.ebx.w[0] << 16),
+ 1);
+ }
+
+ printf("e801: %04x %04x\n", regs.eax.w[0], regs.ebx.w[0]);
}
- if ( regs.ebx.w[0] ) {
- insertrange(0x1000000, (uint64_t)((uint32_t)regs.ebx.w[0] << 16), 1);
- }
-
- printf("e801: %04x %04x\n", regs.eax.w[0], regs.ebx.w[0]);
- }
- return err;
+ return err;
}
static inline int get_88(void)
{
- com32sys_t regs;
- int err;
+ com32sys_t regs;
+ int err;
- memset(&regs, 0, sizeof regs);
+ memset(&regs, 0, sizeof regs);
- regs.eax.b[1] = 0x88;
- syscall(0x15, &regs, &regs);
+ regs.eax.b[1] = 0x88;
+ syscall(0x15, &regs, &regs);
+ if (!(err = regs.eflags.l & 1)) {
+ if (regs.eax.w[0]) {
+ insertrange(0x100000, (uint64_t) ((uint32_t) regs.eax.w[0] << 10),
+ 1);
+ }
- if ( !(err = regs.eflags.l & 1) ) {
- if ( regs.eax.w[0] ) {
- insertrange(0x100000, (uint64_t)((uint32_t)regs.eax.w[0] << 10), 1);
+ printf(" 88: %04x\n", regs.eax.w[0]);
}
- printf(" 88: %04x\n", regs.eax.w[0]);
- }
-
- return err;
+ return err;
}
void get_mem(void)
{
- if ( get_e820() ) {
- get_dos_mem();
- if ( get_e801() ) {
- if ( get_88() ) {
- puts("MEMDISK: Unable to obtain memory map\n");
- die();
- }
+ if (get_e820()) {
+ get_dos_mem();
+ if (get_e801()) {
+ if (get_88()) {
+ puts("MEMDISK: Unable to obtain memory map\n");
+ die();
+ }
+ }
}
- }
}
-#endif /* TEST */
+#endif /* TEST */
#define PW(x) (1ULL << (x))
void parse_mem(void)
{
- struct e820range *ep;
-
- dos_mem = low_mem = high_mem = 0;
-
- /* Derive "dos mem", "high mem", and "low mem" from the range array */
- for ( ep = ranges ; ep->type != -1U ; ep++ ) {
- if ( ep->type == 1 ) {
- /* Only look at memory ranges */
- if ( ep->start == 0 ) {
- if ( ep[1].start > PW(20) )
- dos_mem = PW(20);
- else
- dos_mem = ep[1].start;
- }
- if ( ep->start <= PW(20) && ep[1].start > PW(20) ) {
- if ( ep[1].start > PW(24) )
- low_mem = PW(24) - PW(20);
- else
- low_mem = ep[1].start - PW(20);
- }
- if ( ep->start <= PW(24) && ep[1].start > PW(24) ) {
- if ( ep[1].start > PW(32) )
- high_mem = PW(32) - PW(24);
- else
- high_mem = ep[1].start - PW(24);
- }
+ struct e820range *ep;
+
+ dos_mem = low_mem = high_mem = 0;
+
+ /* Derive "dos mem", "high mem", and "low mem" from the range array */
+ for (ep = ranges; ep->type != -1U; ep++) {
+ if (ep->type == 1) {
+ /* Only look at memory ranges */
+ if (ep->start == 0) {
+ if (ep[1].start > PW(20))
+ dos_mem = PW(20);
+ else
+ dos_mem = ep[1].start;
+ }
+ if (ep->start <= PW(20) && ep[1].start > PW(20)) {
+ if (ep[1].start > PW(24))
+ low_mem = PW(24) - PW(20);
+ else
+ low_mem = ep[1].start - PW(20);
+ }
+ if (ep->start <= PW(24) && ep[1].start > PW(24)) {
+ if (ep[1].start > PW(32))
+ high_mem = PW(32) - PW(24);
+ else
+ high_mem = ep[1].start - PW(24);
+ }
+ }
}
- }
}