···20202121static int detect_memory_e820(void)2222{2323+ int count = 0;2324 u32 next = 0;2425 u32 size, id;2526 u8 err;···3433 "=m" (*desc)3534 : "D" (desc), "a" (0xe820));36353737- if (err || id != SMAP)3636+ /* Some BIOSes stop returning SMAP in the middle of3737+ the search loop. We don't know exactly how the BIOS3838+ screwed up the map at that point, we might have a3939+ partial map, the full map, or complete garbage, so4040+ just return failure. */4141+ if (id != SMAP) {4242+ count = 0;4343+ break;4444+ }4545+4646+ if (err)3847 break;39484040- boot_params.e820_entries++;4949+ count++;4150 desc++;4242- } while (next && boot_params.e820_entries < E820MAX);5151+ } while (next && count < E820MAX);43524444- return boot_params.e820_entries;5353+ return boot_params.e820_entries = count;4554}46554756static int detect_memory_e801(void)···1008910190int detect_memory(void)10291{9292+ int err = -1;9393+10394 if (detect_memory_e820() > 0)104104- return 0;9595+ err = 0;1059610697 if (!detect_memory_e801())107107- return 0;9898+ err = 0;10899109109- return detect_memory_88();100100+ if (!detect_memory_88())101101+ err = 0;102102+103103+ return err;110104}