mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-11-22 23:57:47 +00:00
hv: multi-arch reconstruct memory library
Split common and X86 arch specific codes. For arch without specific memory library,add common library to use. Tracked-On: #8794 Signed-off-by: Haicheng Li <haicheng.li@linux.intel.com> Co-developed-by: Haoyu Tang <haoyu.tang@intel.com> Signed-off-by: Haoyu Tang <haoyu.tang@intel.com> Signed-off-by: Wang, Yu1 <yu1.wang@intel.com> Acked-by: Wang, Yu1 <yu1.wang@intel.com>
This commit is contained in:
committed by
acrnsi-robot
parent
a93e9a401c
commit
7573e436a5
37
hypervisor/include/lib/memory.h
Normal file
37
hypervisor/include/lib/memory.h
Normal file
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright (C) 2025 Intel Corporation.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef MEMORY_LIB_H
|
||||
#define MEMORY_LIB_H
|
||||
#include <types.h>
|
||||
#include <asm/lib/memory.h>
|
||||
|
||||
#ifdef HAS_ARCH_MEMORY_LIB
|
||||
void *arch_memset(void *base, uint8_t v, size_t n);
|
||||
void arch_memcpy(void *d, const void *s, size_t slen);
|
||||
void arch_memcpy_backwards(void *d, const void *s, size_t slen);
|
||||
|
||||
static inline void *memset(void *base, uint8_t v, size_t n) {
|
||||
return arch_memset(base, v, n);
|
||||
}
|
||||
|
||||
static inline void memcpy(void *d, const void *s, size_t slen) {
|
||||
return arch_memcpy(d, s, slen);
|
||||
}
|
||||
|
||||
static inline void memcpy_backwards(void *d, const void *s, size_t slen) {
|
||||
return arch_memcpy_backwards(d, s, slen);
|
||||
}
|
||||
#else
|
||||
void *memset(void *base, uint8_t v, size_t n);
|
||||
void memcpy(void *d, const void *s, size_t slen);
|
||||
void memcpy_backwards(void *d, const void *s, size_t slen);
|
||||
#endif
|
||||
|
||||
int32_t memcpy_s(void *d, size_t dmax, const void *s, size_t slen);
|
||||
|
||||
|
||||
#endif /* MEMORY_LIB_H */
|
||||
Reference in New Issue
Block a user