Thu Aug 23 19:01:22 2018 UTC ()
Fix LOADADDR on aarch64 and use memmove for bcopy instead of memcpy


(jmcneill)
diff -r1.3 -r1.4 src/sys/arch/evbarm/include/loadfile_machdep.h

cvs diff -r1.3 -r1.4 src/sys/arch/evbarm/include/loadfile_machdep.h (expand / switch to unified diff)

--- src/sys/arch/evbarm/include/loadfile_machdep.h 2018/08/21 20:13:13 1.3
+++ src/sys/arch/evbarm/include/loadfile_machdep.h 2018/08/23 19:01:22 1.4
@@ -1,27 +1,31 @@ @@ -1,27 +1,31 @@
1 1
2#if defined(__aarch64__) 2#if defined(__aarch64__)
3#define BOOT_ELF64 3#define BOOT_ELF64
4#else 4#else
5#define BOOT_ELF32 5#define BOOT_ELF32
6#endif 6#endif
7 7
8#define LOAD_KERNEL (LOAD_ALL & ~LOAD_TEXTA) 8#define LOAD_KERNEL (LOAD_ALL & ~LOAD_TEXTA)
9#define COUNT_KERNEL (COUNT_ALL & ~COUNT_TEXTA) 9#define COUNT_KERNEL (COUNT_ALL & ~COUNT_TEXTA)
10 10
 11#if defined(__aarch64__)
 12#define LOADADDR(a) ((((u_long)(a)) + offset) & 0x3fffffffff)
 13#else
11#define LOADADDR(a) (((u_long)(a))) 14#define LOADADDR(a) (((u_long)(a)))
 15#endif
12#define ALIGNENTRY(a) ((u_long)(a)) 16#define ALIGNENTRY(a) ((u_long)(a))
13#define READ(f, b, c) read((f), (void*)LOADADDR(b), (c)) 17#define READ(f, b, c) read((f), (void*)LOADADDR(b), (c))
14#define BCOPY(s, d, c) memcpy((void*)LOADADDR(d), (void*)(s), (c)) 18#define BCOPY(s, d, c) memmove((void*)LOADADDR(d), (void*)(s), (c))
15#define BZERO(d, c) memset((void*)LOADADDR(d), 0, (c)) 19#define BZERO(d, c) memset((void*)LOADADDR(d), 0, (c))
16#define WARN(a) do { \ 20#define WARN(a) do { \
17 (void)printf a; \ 21 (void)printf a; \
18 if (errno) \ 22 if (errno) \
19 (void)printf(": %s\n", \ 23 (void)printf(": %s\n", \
20 strerror(errno)); \ 24 strerror(errno)); \
21 else \ 25 else \
22 (void)printf("\n"); \ 26 (void)printf("\n"); \
23 } while(/* CONSTCOND */0) 27 } while(/* CONSTCOND */0)
24#define PROGRESS(a) (void)printf a 28#define PROGRESS(a) (void)printf a
25#define ALLOC(a) alloc(a) 29#define ALLOC(a) alloc(a)
26#define DEALLOC(a, b) dealloc(a, b) 30#define DEALLOC(a, b) dealloc(a, b)
27#define OKMAGIC(a) ((a) == ZMAGIC) 31#define OKMAGIC(a) ((a) == ZMAGIC)