diff options
author | Visa Hankala <visa@cvs.openbsd.org> | 2020-11-17 16:33:45 +0000 |
---|---|---|
committer | Visa Hankala <visa@cvs.openbsd.org> | 2020-11-17 16:33:45 +0000 |
commit | 2c0851cc1e672d235c5cbe16f36bde8cb4020b86 (patch) | |
tree | 765846cc69cb2457ac4e1111cc2acb48cda7519a /sys/arch/loongson | |
parent | 5467e46d9effc89cfce82e364261ddb6e3bd10c9 (diff) |
Ensure proper alignment of memory map entries, needed with clang.
gcc has generated unaligned loads with the original code.
Diffstat (limited to 'sys/arch/loongson')
-rw-r--r-- | sys/arch/loongson/loongson/machdep.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/sys/arch/loongson/loongson/machdep.c b/sys/arch/loongson/loongson/machdep.c index 6718bda4134..fc04f842f80 100644 --- a/sys/arch/loongson/loongson/machdep.c +++ b/sys/arch/loongson/loongson/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.91 2020/09/01 02:22:52 gnezdo Exp $ */ +/* $OpenBSD: machdep.c,v 1.92 2020/11/17 16:33:44 visa Exp $ */ /* * Copyright (c) 2009, 2010, 2014 Miodrag Vallat. @@ -352,9 +352,9 @@ loongson_identify(const char *version, int envtype) int loongson_efi_setup(void) { + struct pmon_env_mem_entry entry; const struct pmon_env_cpu *cpuenv; const struct pmon_env_mem *mem; - const struct pmon_env_mem_entry *entry; paddr_t fp, lp; uint32_t i, ncpus, seg = 0; @@ -385,13 +385,13 @@ loongson_efi_setup(void) mem = pmon_get_env_mem(); physmem = 0; for (i = 0; i < mem->nentries && seg < MAXMEMSEGS; i++) { - entry = &mem->mem_map[i]; - if (entry->node != 0 || - (entry->type != PMON_MEM_SYSTEM_LOW && - entry->type != PMON_MEM_SYSTEM_HIGH)) + memcpy(&entry, &mem->mem_map[i], sizeof(entry)); + if (entry.node != 0 || + (entry.type != PMON_MEM_SYSTEM_LOW && + entry.type != PMON_MEM_SYSTEM_HIGH)) continue; - fp = atop(entry->address); - lp = atop(entry->address + (entry->size << 20)); + fp = atop(entry.address); + lp = atop(entry.address + (entry.size << 20)); if (lp > atop(pfn_to_pad(PG_FRAME)) + 1) lp = atop(pfn_to_pad(PG_FRAME)) + 1; if (fp >= lp) |