mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-05 08:07:10 +07:00
d60a540ac5
Pull s390 updates from Heiko Carstens: "Since Martin is on vacation you get the s390 pull request for the v4.15 merge window this time from me. Besides a lot of cleanups and bug fixes these are the most important changes: - a new regset for runtime instrumentation registers - hardware accelerated AES-GCM support for the aes_s390 module - support for the new CEX6S crypto cards - support for FORTIFY_SOURCE - addition of missing z13 and new z14 instructions to the in-kernel disassembler - generate opcode tables for the in-kernel disassembler out of a simple text file instead of having to manually maintain those tables - fast memset16, memset32 and memset64 implementations - removal of named saved segment support - hardware counter support for z14 - queued spinlocks and queued rwlocks implementations for s390 - use the stack_depth tracking feature for s390 BPF JIT - a new s390_sthyi system call which emulates the sthyi (store hypervisor information) instruction - removal of the old KVM virtio transport - an s390 specific CPU alternatives implementation which is used in the new spinlock code" * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux: (88 commits) MAINTAINERS: add virtio-ccw.h to virtio/s390 section s390/noexec: execute kexec datamover without DAT s390: fix transactional execution control register handling s390/bpf: take advantage of stack_depth tracking s390: simplify transactional execution elf hwcap handling s390/zcrypt: Rework struct ap_qact_ap_info. s390/virtio: remove unused header file kvm_virtio.h s390: avoid undefined behaviour s390/disassembler: generate opcode tables from text file s390/disassembler: remove insn_to_mnemonic() s390/dasd: avoid calling do_gettimeofday() s390: vfio-ccw: Do not attempt to free no-op, test and tic cda. s390: remove named saved segment support s390/archrandom: Reconsider s390 arch random implementation s390/pci: do not require AIS facility s390/qdio: sanitize put_indicator s390/qdio: use atomic_cmpxchg s390/nmi: avoid using long-displacement facility s390: pass endianness info to sparse s390/decompressor: remove informational messages ...
167 lines
4.5 KiB
C
167 lines
4.5 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/*
|
|
* S390 version
|
|
* Copyright IBM Corp. 1999
|
|
* Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
|
|
*/
|
|
|
|
#ifndef _S390_STRING_H_
|
|
#define _S390_STRING_H_
|
|
|
|
#ifndef _LINUX_TYPES_H
|
|
#include <linux/types.h>
|
|
#endif
|
|
|
|
#define __HAVE_ARCH_MEMCHR /* inline & arch function */
|
|
#define __HAVE_ARCH_MEMCMP /* arch function */
|
|
#define __HAVE_ARCH_MEMCPY /* gcc builtin & arch function */
|
|
#define __HAVE_ARCH_MEMMOVE /* gcc builtin & arch function */
|
|
#define __HAVE_ARCH_MEMSCAN /* inline & arch function */
|
|
#define __HAVE_ARCH_MEMSET /* gcc builtin & arch function */
|
|
#define __HAVE_ARCH_MEMSET16 /* arch function */
|
|
#define __HAVE_ARCH_MEMSET32 /* arch function */
|
|
#define __HAVE_ARCH_MEMSET64 /* arch function */
|
|
#define __HAVE_ARCH_STRCAT /* inline & arch function */
|
|
#define __HAVE_ARCH_STRCMP /* arch function */
|
|
#define __HAVE_ARCH_STRCPY /* inline & arch function */
|
|
#define __HAVE_ARCH_STRLCAT /* arch function */
|
|
#define __HAVE_ARCH_STRLCPY /* arch function */
|
|
#define __HAVE_ARCH_STRLEN /* inline & arch function */
|
|
#define __HAVE_ARCH_STRNCAT /* arch function */
|
|
#define __HAVE_ARCH_STRNCPY /* arch function */
|
|
#define __HAVE_ARCH_STRNLEN /* inline & arch function */
|
|
#define __HAVE_ARCH_STRRCHR /* arch function */
|
|
#define __HAVE_ARCH_STRSTR /* arch function */
|
|
|
|
/* Prototypes for non-inlined arch strings functions. */
|
|
int memcmp(const void *s1, const void *s2, size_t n);
|
|
void *memcpy(void *dest, const void *src, size_t n);
|
|
void *memset(void *s, int c, size_t n);
|
|
void *memmove(void *dest, const void *src, size_t n);
|
|
int strcmp(const char *s1, const char *s2);
|
|
size_t strlcat(char *dest, const char *src, size_t n);
|
|
size_t strlcpy(char *dest, const char *src, size_t size);
|
|
char *strncat(char *dest, const char *src, size_t n);
|
|
char *strncpy(char *dest, const char *src, size_t n);
|
|
char *strrchr(const char *s, int c);
|
|
char *strstr(const char *s1, const char *s2);
|
|
|
|
#undef __HAVE_ARCH_STRCHR
|
|
#undef __HAVE_ARCH_STRNCHR
|
|
#undef __HAVE_ARCH_STRNCMP
|
|
#undef __HAVE_ARCH_STRPBRK
|
|
#undef __HAVE_ARCH_STRSEP
|
|
#undef __HAVE_ARCH_STRSPN
|
|
|
|
void *__memset16(uint16_t *s, uint16_t v, size_t count);
|
|
void *__memset32(uint32_t *s, uint32_t v, size_t count);
|
|
void *__memset64(uint64_t *s, uint64_t v, size_t count);
|
|
|
|
static inline void *memset16(uint16_t *s, uint16_t v, size_t count)
|
|
{
|
|
return __memset16(s, v, count * sizeof(v));
|
|
}
|
|
|
|
static inline void *memset32(uint32_t *s, uint32_t v, size_t count)
|
|
{
|
|
return __memset32(s, v, count * sizeof(v));
|
|
}
|
|
|
|
static inline void *memset64(uint64_t *s, uint64_t v, size_t count)
|
|
{
|
|
return __memset64(s, v, count * sizeof(v));
|
|
}
|
|
|
|
#if !defined(IN_ARCH_STRING_C) && (!defined(CONFIG_FORTIFY_SOURCE) || defined(__NO_FORTIFY))
|
|
|
|
static inline void *memchr(const void * s, int c, size_t n)
|
|
{
|
|
register int r0 asm("0") = (char) c;
|
|
const void *ret = s + n;
|
|
|
|
asm volatile(
|
|
"0: srst %0,%1\n"
|
|
" jo 0b\n"
|
|
" jl 1f\n"
|
|
" la %0,0\n"
|
|
"1:"
|
|
: "+a" (ret), "+&a" (s) : "d" (r0) : "cc", "memory");
|
|
return (void *) ret;
|
|
}
|
|
|
|
static inline void *memscan(void *s, int c, size_t n)
|
|
{
|
|
register int r0 asm("0") = (char) c;
|
|
const void *ret = s + n;
|
|
|
|
asm volatile(
|
|
"0: srst %0,%1\n"
|
|
" jo 0b\n"
|
|
: "+a" (ret), "+&a" (s) : "d" (r0) : "cc", "memory");
|
|
return (void *) ret;
|
|
}
|
|
|
|
static inline char *strcat(char *dst, const char *src)
|
|
{
|
|
register int r0 asm("0") = 0;
|
|
unsigned long dummy;
|
|
char *ret = dst;
|
|
|
|
asm volatile(
|
|
"0: srst %0,%1\n"
|
|
" jo 0b\n"
|
|
"1: mvst %0,%2\n"
|
|
" jo 1b"
|
|
: "=&a" (dummy), "+a" (dst), "+a" (src)
|
|
: "d" (r0), "0" (0) : "cc", "memory" );
|
|
return ret;
|
|
}
|
|
|
|
static inline char *strcpy(char *dst, const char *src)
|
|
{
|
|
register int r0 asm("0") = 0;
|
|
char *ret = dst;
|
|
|
|
asm volatile(
|
|
"0: mvst %0,%1\n"
|
|
" jo 0b"
|
|
: "+&a" (dst), "+&a" (src) : "d" (r0)
|
|
: "cc", "memory");
|
|
return ret;
|
|
}
|
|
|
|
static inline size_t strlen(const char *s)
|
|
{
|
|
register unsigned long r0 asm("0") = 0;
|
|
const char *tmp = s;
|
|
|
|
asm volatile(
|
|
"0: srst %0,%1\n"
|
|
" jo 0b"
|
|
: "+d" (r0), "+a" (tmp) : : "cc", "memory");
|
|
return r0 - (unsigned long) s;
|
|
}
|
|
|
|
static inline size_t strnlen(const char * s, size_t n)
|
|
{
|
|
register int r0 asm("0") = 0;
|
|
const char *tmp = s;
|
|
const char *end = s + n;
|
|
|
|
asm volatile(
|
|
"0: srst %0,%1\n"
|
|
" jo 0b"
|
|
: "+a" (end), "+a" (tmp) : "d" (r0) : "cc", "memory");
|
|
return end - s;
|
|
}
|
|
#else /* IN_ARCH_STRING_C */
|
|
void *memchr(const void * s, int c, size_t n);
|
|
void *memscan(void *s, int c, size_t n);
|
|
char *strcat(char *dst, const char *src);
|
|
char *strcpy(char *dst, const char *src);
|
|
size_t strlen(const char *s);
|
|
size_t strnlen(const char * s, size_t n);
|
|
#endif /* !IN_ARCH_STRING_C */
|
|
|
|
#endif /* __S390_STRING_H_ */
|