Fix mips build after introduction of MD definitions of atomic_load_64

and atomic_store_64.

The MD definitions are provided for LP64 only, while mips also uses
them for 32bit and n32.  Only define mips variants for 32bit and n32
and change the syntax to match common definitions.

Note that this commit does not fix 32bit asm implementation to follow
new KBI, this will be fixed later.  The functions are only used for 8
byte ddb accesses so the known bug does not prevent normal kernel
operations.

Sponsored by:	The FreeBSD Foundation
This commit is contained in:
kib 2017-12-21 23:39:00 +00:00
parent de4f3129c0
commit da006c3e5f
2 changed files with 15 additions and 14 deletions

View File

@ -342,20 +342,21 @@ atomic_store_rel_##WIDTH(__volatile uint##WIDTH##_t *p, uint##WIDTH##_t v)\
ATOMIC_STORE_LOAD(32)
ATOMIC_STORE_LOAD(64)
#if !defined(__mips_n64) && !defined(__mips_n32)
void atomic_store_64(__volatile uint64_t *, uint64_t *);
void atomic_load_64(__volatile uint64_t *, uint64_t *);
#else
void atomic_store_64(__volatile uint64_t *, uint64_t);
uint64_t atomic_load_64(__volatile uint64_t *);
#elif defined (__mips_n32)
static __inline void
atomic_store_64(__volatile uint64_t *p, uint64_t *v)
atomic_store_64(__volatile uint64_t *p, uint64_t v)
{
*p = *v;
*p = v;
}
static __inline void
atomic_load_64(__volatile uint64_t *p, uint64_t *v)
static __inline uint64_t
atomic_load_64(__volatile uint64_t *p)
{
*v = *p;
return (*p);
}
/* #else atomic_common.h definitions of atomic_load/store_64 are used */
#endif
#undef ATOMIC_STORE_LOAD

View File

@ -164,9 +164,9 @@ db_read_bytes(vm_offset_t addr, size_t size, char *data)
*(uint32_t *)data = *(uint32_t *)addr;
break;
case 8:
atomic_load_64((volatile u_int64_t *)addr,
(u_int64_t *)data);
break;
*(uint64_t *)data = atomic_load_64(
(void *)addr);
break;
}
} else {
char *src;
@ -207,9 +207,9 @@ db_write_bytes(vm_offset_t addr, size_t size, char *data)
*(uint32_t *)addr = *(uint32_t *)data;
break;
case 8:
atomic_store_64((volatile u_int64_t *)addr,
(u_int64_t *)data);
break;
atomic_store_64((uint64_t *)addr,
*(uint64_t *)data);
break;
}
} else {
char *dst;