mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-04-28 19:54:01 +00:00
Per C11 standard (ISO/IEC 9899:2011): K.3.7.1.1 1. Copying shall not take place between objects that overlap; 2. If there is a runtime-constraint violation, the memcpy_s function stores zeros in the first s1max characters of the object; 3. The memcpy_s function returns zero if there was no runtime-constraint violation. Otherwise, a nonzero value is returned. Tracked-On: #4885 Signed-off-by: Victor Sun <victor.sun@intel.com> Reviewed-by: Yonghua Huang <yonghua.huang@intel.com> Reviewed-by: Yin Fengwei <fengwei.yin@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
46 lines
1.1 KiB
C
46 lines
1.1 KiB
C
/*
|
|
* Copyright (C) 2018 Intel Corporation. All rights reserved.
|
|
*
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
*/
|
|
|
|
#ifndef RTL_H
|
|
#define RTL_H
|
|
|
|
#include <types.h>
|
|
|
|
union u_qword {
|
|
struct {
|
|
uint32_t low;
|
|
uint32_t high;
|
|
} dwords;
|
|
|
|
uint64_t qword;
|
|
|
|
};
|
|
|
|
/* MACRO related to string */
|
|
#define ULONG_MAX ((uint64_t)(~0UL)) /* 0xFFFFFFFF */
|
|
#define LONG_MAX (ULONG_MAX >> 1U) /* 0x7FFFFFFF */
|
|
#define LONG_MIN (~LONG_MAX) /* 0x80000000 */
|
|
|
|
static inline bool is_space(char c)
|
|
{
|
|
return ((c == ' ') || (c == '\t'));
|
|
}
|
|
|
|
/* Function prototypes */
|
|
int32_t strcmp(const char *s1_arg, const char *s2_arg);
|
|
int32_t strncmp(const char *s1_arg, const char *s2_arg, size_t n_arg);
|
|
char *strncpy_s(char *d_arg, size_t dmax, const char *s_arg, size_t slen_arg);
|
|
char *strchr(char *s_arg, char ch);
|
|
size_t strnlen_s(const char *str_arg, size_t maxlen_arg);
|
|
void *memset(void *base, uint8_t v, size_t n);
|
|
int32_t memcpy_s(void *d, size_t dmax, const void *s, size_t slen);
|
|
int64_t strtol_deci(const char *nptr);
|
|
uint64_t strtoul_hex(const char *nptr);
|
|
char *strstr_s(const char *str1, size_t maxlen1,
|
|
const char *str2, size_t maxlen2);
|
|
|
|
#endif /* RTL_H */
|