Projects
Eulaceura:Mainline:GA
userspace-rcu
_service:obs_scm:add-loongarch.patch
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:obs_scm:add-loongarch.patch of Package userspace-rcu
diff --git a/include/Makefile.am b/include/Makefile.am index 3f92cc3..5c042fd 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -16,6 +16,7 @@ nobase_include_HEADERS = \ urcu/arch/sparc64.h \ urcu/arch/tile.h \ urcu/arch/x86.h \ + urcu/arch/loongarch.h \ urcu/assert.h \ urcu/call-rcu.h \ urcu/cds.h \ @@ -76,6 +77,7 @@ nobase_include_HEADERS = \ urcu/uatomic/sparc64.h \ urcu/uatomic/tile.h \ urcu/uatomic/x86.h \ + urcu/uatomic/loongarch.h \ urcu/urcu-bp.h \ urcu/urcu-futex.h \ urcu/urcu.h \ diff --git a/include/urcu/arch.h b/include/urcu/arch.h index 620743c..e42267a 100644 --- a/include/urcu/arch.h +++ b/include/urcu/arch.h @@ -157,6 +157,11 @@ #define URCU_ARCH_RISCV 1 #include <urcu/arch/riscv.h> +#elif defined(__loongarch__) || (_loongarch64) + +#define URCU_ARCH_LOONGARCH 1 +#include <urcu/arch/loongarch.h> + #else #error "Cannot build: unrecognized architecture, see <urcu/arch.h>." #endif diff --git a/include/urcu/arch/loongarch.h b/include/urcu/arch/loongarch.h new file mode 100644 index 0000000..865bbb5 --- /dev/null +++ b/include/urcu/arch/loongarch.h @@ -0,0 +1,50 @@ +#ifndef _URCU_ARCH_LOONGARCH_H +#define _URCU_ARCH_LOONGARCH_H + +/* + * arch/loongarch.h: definitions for the LOONGARCH architecture + * + * Copyright (c) 2022 Loongson Technology Corporation Limited + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include <urcu/compiler.h> +#include <urcu/config.h> +#include <urcu/syscall-compat.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stdlib.h> +#include <sys/time.h> + +/* + * On Linux, define the membarrier system call number if not yet available in + * the system headers. loongarch64 implements asm-generic/unistd.h system call + * numbers. + */ +#if (defined(__linux__) && !defined(__NR_membarrier)) +#define __NR_membarrier 283 +#endif + +#ifdef __cplusplus +} +#endif + +#include <urcu/arch/generic.h> + +#endif /* _URCU_ARCH_LOONGARCH_H */ diff --git a/include/urcu/uatomic.h b/include/urcu/uatomic.h index 2fb5fd4..e1ff44d 100644 --- a/include/urcu/uatomic.h +++ b/include/urcu/uatomic.h @@ -51,6 +51,8 @@ #include <urcu/uatomic/m68k.h> #elif defined(URCU_ARCH_RISCV) #include <urcu/uatomic/riscv.h> +#elif defined(URCU_ARCH_LOONGARCH) +#include <urcu/uatomic/loongarch.h> #else #error "Cannot build: unrecognized architecture, see <urcu/arch.h>." #endif diff --git a/include/urcu/uatomic/loongarch.h b/include/urcu/uatomic/loongarch.h new file mode 100644 index 0000000..e0fb2a6 --- /dev/null +++ b/include/urcu/uatomic/loongarch.h @@ -0,0 +1,44 @@ +/* + * Atomic exchange operations for the LOONGARCH architecture. Let GCC do it. + * + * Copyright (c) 2022 Loongson Technology Corporation Limited + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#ifndef _URCU_ARCH_UATOMIC_LOONGARCH_H +#define _URCU_ARCH_UATOMIC_LOONGARCH_H + +#include <urcu/compiler.h> +#include <urcu/system.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#define UATOMIC_HAS_ATOMIC_BYTE +#define UATOMIC_HAS_ATOMIC_SHORT + +#ifdef __cplusplus +} +#endif + +#include <urcu/uatomic/generic.h> + +#endif /* _URCU_ARCH_UATOMIC_LOONGARCH_H */ -- 2.27.0
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2