[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Minios-devel] [UNIKRAFT PATCH 04/13] include: Reorganize base include folder to reflect CPU family schema



We modify the Unikraft's base include folder to reflect the CPU
family schema in this patch. Unikraft has the foresigh to wrap
different architectures' headers to arch/*.h. So, after folder
reorganization, we just update the include paths in arch/*.h is
enough.

Signed-off-by: Wei Chen <Wei.Chen@xxxxxxx>
---
 include/uk/arch/arm/arm/atomic.h      | 64 ++++++++++++++++++++++++++++++
 include/uk/arch/arm/arm/intsizes.h    | 45 +++++++++++++++++++++
 include/uk/arch/arm/arm/lcpu.h        | 59 ++++++++++++++++++++++++++++
 include/uk/arch/arm/arm/limits.h      | 45 +++++++++++++++++++++
 include/uk/arch/arm/arm/types.h       | 35 +++++++++++++++++
 include/uk/arch/arm/atomic.h          | 64 ------------------------------
 include/uk/arch/arm/intsizes.h        | 45 ---------------------
 include/uk/arch/arm/lcpu.h            | 59 ----------------------------
 include/uk/arch/arm/limits.h          | 45 ---------------------
 include/uk/arch/arm/types.h           | 35 -----------------
 include/uk/arch/atomic.h              |  8 ++--
 include/uk/arch/lcpu.h                |  8 ++--
 include/uk/arch/limits.h              | 16 ++++----
 include/uk/arch/types.h               | 16 ++++----
 include/uk/arch/x86/x86_64/atomic.h   | 45 +++++++++++++++++++++
 include/uk/arch/x86/x86_64/intsizes.h | 45 +++++++++++++++++++++
 include/uk/arch/x86/x86_64/lcpu.h     | 73 +++++++++++++++++++++++++++++++++++
 include/uk/arch/x86/x86_64/limits.h   | 46 ++++++++++++++++++++++
 include/uk/arch/x86/x86_64/types.h    | 38 ++++++++++++++++++
 include/uk/arch/x86_64/atomic.h       | 45 ---------------------
 include/uk/arch/x86_64/intsizes.h     | 45 ---------------------
 include/uk/arch/x86_64/lcpu.h         | 73 -----------------------------------
 include/uk/arch/x86_64/limits.h       | 46 ----------------------
 include/uk/arch/x86_64/types.h        | 38 ------------------
 24 files changed, 519 insertions(+), 519 deletions(-)
 create mode 100644 include/uk/arch/arm/arm/atomic.h
 create mode 100644 include/uk/arch/arm/arm/intsizes.h
 create mode 100644 include/uk/arch/arm/arm/lcpu.h
 create mode 100644 include/uk/arch/arm/arm/limits.h
 create mode 100644 include/uk/arch/arm/arm/types.h
 delete mode 100644 include/uk/arch/arm/atomic.h
 delete mode 100644 include/uk/arch/arm/intsizes.h
 delete mode 100644 include/uk/arch/arm/lcpu.h
 delete mode 100644 include/uk/arch/arm/limits.h
 delete mode 100644 include/uk/arch/arm/types.h
 create mode 100644 include/uk/arch/x86/x86_64/atomic.h
 create mode 100644 include/uk/arch/x86/x86_64/intsizes.h
 create mode 100644 include/uk/arch/x86/x86_64/lcpu.h
 create mode 100644 include/uk/arch/x86/x86_64/limits.h
 create mode 100644 include/uk/arch/x86/x86_64/types.h
 delete mode 100644 include/uk/arch/x86_64/atomic.h
 delete mode 100644 include/uk/arch/x86_64/intsizes.h
 delete mode 100644 include/uk/arch/x86_64/lcpu.h
 delete mode 100644 include/uk/arch/x86_64/limits.h
 delete mode 100644 include/uk/arch/x86_64/types.h

diff --git a/include/uk/arch/arm/arm/atomic.h b/include/uk/arch/arm/arm/atomic.h
new file mode 100644
index 0000000..9d54eea
--- /dev/null
+++ b/include/uk/arch/arm/arm/atomic.h
@@ -0,0 +1,64 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+/*
+ * Port from Mini-OS: include/arm/os.h
+ */
+/*
+ * Copyright (c) 2009 Citrix Systems, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef __UKARCH_ATOMIC_H__
+#error Do not include this header directly
+#endif
+
+/**
+ * ukarch_find_lsbit - find first (lowest) set bit in word.
+ * @word: The word to search
+ *
+ * Undefined if no bit exists, so code should check against 0 first.
+ */
+static inline unsigned long ukarch_find_lsbit(unsigned long word)
+{
+       int clz;
+
+       /* xxxxx10000 = word
+        * xxxxx01111 = word - 1
+        * 0000011111 = word ^ (word - 1)
+        *      4     = 31 - clz(word ^ (word - 1))
+        */
+
+       __asm__("sub r0, %[word], #1\n"
+               "eor r0, r0, %[word]\n"
+               "clz %[clz], r0\n"
+               :
+               /* Outputs: */
+               [clz] "=r"(clz)
+               :
+               /* Inputs: */
+               [word] "r"(word)
+               :
+               /* Clobbers: */
+               "r0");
+
+       return 31 - clz;
+}
diff --git a/include/uk/arch/arm/arm/intsizes.h 
b/include/uk/arch/arm/arm/intsizes.h
new file mode 100644
index 0000000..5b36c4b
--- /dev/null
+++ b/include/uk/arch/arm/arm/intsizes.h
@@ -0,0 +1,45 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+/*
+ * Authors: Simon Kuenzer <simon.kuenzer@xxxxxxxxx>
+ *
+ *
+ * Copyright (c) 2017, NEC Europe Ltd., NEC Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the copyright holder nor the names of its
+ *    contributors may be used to endorse or promote products derived from
+ *    this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY.
+ */
+
+#if ((!defined __UKARCH_TYPES_H__) && (!defined __UKARCH_LIMITS_H__))
+#error Do not include this header directly
+#endif
+
+#define __C_IS_8     /* char */
+#define __S_IS_16    /* short */
+#define __I_IS_32    /* int */
+#define __L_IS_32    /* long */
+#define __LL_IS_64   /* long long */
+#define __PTR_IS_32 /* void * */
diff --git a/include/uk/arch/arm/arm/lcpu.h b/include/uk/arch/arm/arm/lcpu.h
new file mode 100644
index 0000000..cdeffc3
--- /dev/null
+++ b/include/uk/arch/arm/arm/lcpu.h
@@ -0,0 +1,59 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+/*
+ * Copyright (c) 2009, Citrix Systems, Inc.
+ * Copyright (c) 2017, NEC Europe Ltd., NEC Corporation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef __UKARCH_LCPU_H__
+#error Do not include this header directly
+#endif
+
+struct __regs {
+       unsigned long r0;
+       unsigned long r1;
+       unsigned long r2;
+       unsigned long r3;
+       unsigned long r4;
+       unsigned long r5;
+       unsigned long r6;
+       unsigned long r7;
+       unsigned long r8;
+       unsigned long r9;
+       unsigned long r10;
+       unsigned long r11;
+       unsigned long r12;
+};
+
+/* We probably only need "dmb" here, but we'll start by being paranoid. */
+#ifndef mb
+#define mb() __asm__("dsb" : : : "memory")
+#endif
+
+#ifndef rmb
+#define rmb() __asm__("dsb" : : : "memory")
+#endif
+
+#ifndef wmb
+#define wmb() __asm__("dsb" : : : "memory")
+#endif
diff --git a/include/uk/arch/arm/arm/limits.h b/include/uk/arch/arm/arm/limits.h
new file mode 100644
index 0000000..085761c
--- /dev/null
+++ b/include/uk/arch/arm/arm/limits.h
@@ -0,0 +1,45 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+/*
+ * Copyright (c) 2009, Citrix Systems, Inc.
+ * Copyright (c) 2017, NEC Europe Ltd., NEC Corporation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef __UKARCH_LIMITS_H__
+#error Do not include this header directly
+#endif
+
+#define __PAGE_SHIFT           12
+
+#ifdef __ASSEMBLY__
+#define __PAGE_SIZE            (1 << __PAGE_SHIFT)
+#define __PAGE_MASK            (~((__PAGE_SIZE) - 1))
+#else
+#define __PAGE_SIZE            (1ULL << __PAGE_SHIFT)
+#define __PAGE_MASK            (~((__PAGE_SIZE) - 1))
+#endif
+
+#define __STACK_SIZE_PAGE_ORDER        2
+#define __STACK_SIZE           (__PAGE_SIZE * (1 << __STACK_SIZE_PAGE_ORDER))
+
+#define __WORDSIZE             32
diff --git a/include/uk/arch/arm/arm/types.h b/include/uk/arch/arm/arm/types.h
new file mode 100644
index 0000000..e745c0c
--- /dev/null
+++ b/include/uk/arch/arm/arm/types.h
@@ -0,0 +1,35 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright (c) 2002-2003, K A Fraser & R Neugebauer
+ * Copyright (c) 2005, Grzegorz Milos, Intel Research Cambridge
+ *
+ * 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 __UKARCH_TYPES_H__
+#error Do not include this header directly
+#endif
+
+#ifndef __ASSEMBLY__
+
+struct __pte { unsigned long pte_low, pte_high; };
+#define npte(x) ({ unsigned long long _x = (x); \
+                ((pte_t) {(unsigned long)(_x), (unsigned long)(_x>>32)}); })
+
+#endif /* !__ASSEMBLY__ */
diff --git a/include/uk/arch/arm/atomic.h b/include/uk/arch/arm/atomic.h
deleted file mode 100644
index 9d54eea..0000000
--- a/include/uk/arch/arm/atomic.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* SPDX-License-Identifier: BSD-2-Clause */
-/*
- * Port from Mini-OS: include/arm/os.h
- */
-/*
- * Copyright (c) 2009 Citrix Systems, Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef __UKARCH_ATOMIC_H__
-#error Do not include this header directly
-#endif
-
-/**
- * ukarch_find_lsbit - find first (lowest) set bit in word.
- * @word: The word to search
- *
- * Undefined if no bit exists, so code should check against 0 first.
- */
-static inline unsigned long ukarch_find_lsbit(unsigned long word)
-{
-       int clz;
-
-       /* xxxxx10000 = word
-        * xxxxx01111 = word - 1
-        * 0000011111 = word ^ (word - 1)
-        *      4     = 31 - clz(word ^ (word - 1))
-        */
-
-       __asm__("sub r0, %[word], #1\n"
-               "eor r0, r0, %[word]\n"
-               "clz %[clz], r0\n"
-               :
-               /* Outputs: */
-               [clz] "=r"(clz)
-               :
-               /* Inputs: */
-               [word] "r"(word)
-               :
-               /* Clobbers: */
-               "r0");
-
-       return 31 - clz;
-}
diff --git a/include/uk/arch/arm/intsizes.h b/include/uk/arch/arm/intsizes.h
deleted file mode 100644
index 5b36c4b..0000000
--- a/include/uk/arch/arm/intsizes.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause */
-/*
- * Authors: Simon Kuenzer <simon.kuenzer@xxxxxxxxx>
- *
- *
- * Copyright (c) 2017, NEC Europe Ltd., NEC Corporation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the copyright holder nor the names of its
- *    contributors may be used to endorse or promote products derived from
- *    this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY.
- */
-
-#if ((!defined __UKARCH_TYPES_H__) && (!defined __UKARCH_LIMITS_H__))
-#error Do not include this header directly
-#endif
-
-#define __C_IS_8     /* char */
-#define __S_IS_16    /* short */
-#define __I_IS_32    /* int */
-#define __L_IS_32    /* long */
-#define __LL_IS_64   /* long long */
-#define __PTR_IS_32 /* void * */
diff --git a/include/uk/arch/arm/lcpu.h b/include/uk/arch/arm/lcpu.h
deleted file mode 100644
index cdeffc3..0000000
--- a/include/uk/arch/arm/lcpu.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* SPDX-License-Identifier: BSD-2-Clause */
-/*
- * Copyright (c) 2009, Citrix Systems, Inc.
- * Copyright (c) 2017, NEC Europe Ltd., NEC Corporation.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef __UKARCH_LCPU_H__
-#error Do not include this header directly
-#endif
-
-struct __regs {
-       unsigned long r0;
-       unsigned long r1;
-       unsigned long r2;
-       unsigned long r3;
-       unsigned long r4;
-       unsigned long r5;
-       unsigned long r6;
-       unsigned long r7;
-       unsigned long r8;
-       unsigned long r9;
-       unsigned long r10;
-       unsigned long r11;
-       unsigned long r12;
-};
-
-/* We probably only need "dmb" here, but we'll start by being paranoid. */
-#ifndef mb
-#define mb() __asm__("dsb" : : : "memory")
-#endif
-
-#ifndef rmb
-#define rmb() __asm__("dsb" : : : "memory")
-#endif
-
-#ifndef wmb
-#define wmb() __asm__("dsb" : : : "memory")
-#endif
diff --git a/include/uk/arch/arm/limits.h b/include/uk/arch/arm/limits.h
deleted file mode 100644
index 085761c..0000000
--- a/include/uk/arch/arm/limits.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* SPDX-License-Identifier: BSD-2-Clause */
-/*
- * Copyright (c) 2009, Citrix Systems, Inc.
- * Copyright (c) 2017, NEC Europe Ltd., NEC Corporation.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef __UKARCH_LIMITS_H__
-#error Do not include this header directly
-#endif
-
-#define __PAGE_SHIFT           12
-
-#ifdef __ASSEMBLY__
-#define __PAGE_SIZE            (1 << __PAGE_SHIFT)
-#define __PAGE_MASK            (~((__PAGE_SIZE) - 1))
-#else
-#define __PAGE_SIZE            (1ULL << __PAGE_SHIFT)
-#define __PAGE_MASK            (~((__PAGE_SIZE) - 1))
-#endif
-
-#define __STACK_SIZE_PAGE_ORDER        2
-#define __STACK_SIZE           (__PAGE_SIZE * (1 << __STACK_SIZE_PAGE_ORDER))
-
-#define __WORDSIZE             32
diff --git a/include/uk/arch/arm/types.h b/include/uk/arch/arm/types.h
deleted file mode 100644
index e745c0c..0000000
--- a/include/uk/arch/arm/types.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* SPDX-License-Identifier: MIT */
-/*
- * Copyright (c) 2002-2003, K A Fraser & R Neugebauer
- * Copyright (c) 2005, Grzegorz Milos, Intel Research Cambridge
- *
- * 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 __UKARCH_TYPES_H__
-#error Do not include this header directly
-#endif
-
-#ifndef __ASSEMBLY__
-
-struct __pte { unsigned long pte_low, pte_high; };
-#define npte(x) ({ unsigned long long _x = (x); \
-                ((pte_t) {(unsigned long)(_x), (unsigned long)(_x>>32)}); })
-
-#endif /* !__ASSEMBLY__ */
diff --git a/include/uk/arch/atomic.h b/include/uk/arch/atomic.h
index 331bd81..e7f46bb 100644
--- a/include/uk/arch/atomic.h
+++ b/include/uk/arch/atomic.h
@@ -37,16 +37,16 @@ extern "C" {
 #endif
 
 #ifdef __X86_32__
-#include <uk/arch/x86/atomic.h>
+#include <uk/arch/x86/x86/atomic.h>
 #endif
 #ifdef __X86_64__
-#include <uk/arch/x86_64/atomic.h>
+#include <uk/arch/x86/x86_64/atomic.h>
 #endif
 #ifdef __ARM_32__
-#include <uk/arch/arm/atomic.h>
+#include <uk/arch/arm/arm/atomic.h>
 #endif
 #ifdef __ARM_64__
-#include <uk/arch/arm64/atomic.h>
+#include <uk/arch/arm/arm64/atomic.h>
 #endif
 
 /**
diff --git a/include/uk/arch/lcpu.h b/include/uk/arch/lcpu.h
index ea780f7..a9e10d2 100644
--- a/include/uk/arch/lcpu.h
+++ b/include/uk/arch/lcpu.h
@@ -43,16 +43,16 @@ extern "C" {
 #endif
 
 #ifdef __X86_32__
-#include <uk/arch/x86/lcpu.h>
+#include <uk/arch/x86/x86/lcpu.h>
 #endif
 #ifdef __X86_64__
-#include <uk/arch/x86_64/lcpu.h>
+#include <uk/arch/x86/x86_64/lcpu.h>
 #endif
 #ifdef __ARM_32__
-#include <uk/arch/arm/lcpu.h>
+#include <uk/arch/arm/arm/lcpu.h>
 #endif
 #ifdef __ARM_64__
-#include <uk/arch/arm64/lcpu.h>
+#include <uk/arch/arm/arm64/lcpu.h>
 #endif
 
 #ifndef likely
diff --git a/include/uk/arch/limits.h b/include/uk/arch/limits.h
index 81694d9..a0683ad 100644
--- a/include/uk/arch/limits.h
+++ b/include/uk/arch/limits.h
@@ -37,31 +37,31 @@
 #define __UKARCH_LIMITS_H__
 
 #ifdef __X86_32__
-#include <uk/arch/x86/limits.h>
+#include <uk/arch/x86/x86/limits.h>
 #endif
 #ifdef __X86_64__
-#include <uk/arch/x86_64/limits.h>
+#include <uk/arch/x86/x86_64/limits.h>
 #endif
 #ifdef __ARM_32__
-#include <uk/arch/arm/limits.h>
+#include <uk/arch/arm/arm/limits.h>
 #endif
 #ifdef __ARM_64__
-#include <uk/arch/arm64/limits.h>
+#include <uk/arch/arm/arm64/limits.h>
 #endif
 
 #ifndef __ASSEMBLY__
 
 #ifdef __X86_32__
-#include <uk/arch/x86/intsizes.h>
+#include <uk/arch/x86/x86/intsizes.h>
 #endif
 #ifdef __X86_64__
-#include <uk/arch/x86_64/intsizes.h>
+#include <uk/arch/x86/x86_64/intsizes.h>
 #endif
 #ifdef __ARM_32__
-#include <uk/arch/arm/intsizes.h>
+#include <uk/arch/arm/arm/intsizes.h>
 #endif
 #ifdef __ARM_64__
-#include <uk/arch/arm64/intsizes.h>
+#include <uk/arch/arm/arm64/intsizes.h>
 #endif
 
 #if (defined __C_IS_8)
diff --git a/include/uk/arch/types.h b/include/uk/arch/types.h
index e8d7726..dd07803 100644
--- a/include/uk/arch/types.h
+++ b/include/uk/arch/types.h
@@ -41,20 +41,20 @@ extern "C" {
 #endif
 
 #ifdef __X86_32__
-#include <uk/arch/x86/intsizes.h>
-#include <uk/arch/x86/types.h>
+#include <uk/arch/x86/x86/intsizes.h>
+#include <uk/arch/x86/x86/types.h>
 #endif
 #ifdef __X86_64__
-#include <uk/arch/x86_64/intsizes.h>
-#include <uk/arch/x86_64/types.h>
+#include <uk/arch/x86/x86_64/intsizes.h>
+#include <uk/arch/x86/x86_64/types.h>
 #endif
 #ifdef __ARM_32__
-#include <uk/arch/arm/intsizes.h>
-#include <uk/arch/arm/types.h>
+#include <uk/arch/arm/arm/intsizes.h>
+#include <uk/arch/arm/arm/types.h>
 #endif
 #ifdef __ARM_64__
-#include <uk/arch/arm64/intsizes.h>
-#include <uk/arch/arm64/types.h>
+#include <uk/arch/arm/arm64/intsizes.h>
+#include <uk/arch/arm/arm64/types.h>
 #endif
 
 #ifndef __ASSEMBLY__
diff --git a/include/uk/arch/x86/x86_64/atomic.h 
b/include/uk/arch/x86/x86_64/atomic.h
new file mode 100644
index 0000000..985c388
--- /dev/null
+++ b/include/uk/arch/x86/x86_64/atomic.h
@@ -0,0 +1,45 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+/*
+ * Port from Mini-OS: include/x86/os.h
+ */
+/*
+ * Copyright (c) 2009 Citrix Systems, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+#ifndef __UKARCH_ATOMIC_H__
+#error Do not include this header directly
+#endif
+
+/**
+ * ukarch_find_lsbit - find first (lowest) set bit in word.
+ * @word: The word to search
+ *
+ * Undefined if no bit exists, so code should check against 0 first.
+ */
+static inline unsigned long ukarch_find_lsbit(unsigned long word)
+{
+       __asm__("bsfq %1,%0"
+               :"=r" (word)
+               :"rm" (word));
+       return word;
+}
diff --git a/include/uk/arch/x86/x86_64/intsizes.h 
b/include/uk/arch/x86/x86_64/intsizes.h
new file mode 100644
index 0000000..e3ef510
--- /dev/null
+++ b/include/uk/arch/x86/x86_64/intsizes.h
@@ -0,0 +1,45 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+/*
+ * Authors: Simon Kuenzer <simon.kuenzer@xxxxxxxxx>
+ *
+ *
+ * Copyright (c) 2017, NEC Europe Ltd., NEC Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the copyright holder nor the names of its
+ *    contributors may be used to endorse or promote products derived from
+ *    this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY.
+ */
+
+#if ((!defined __UKARCH_TYPES_H__) && (!defined __UKARCH_LIMITS_H__))
+#error Do not include this header directly
+#endif
+
+#define __C_IS_8    /* char */
+#define __S_IS_16   /* short */
+#define __I_IS_32   /* int */
+#define __L_IS_64   /* long */
+#define __LL_IS_64  /* long long */
+#define __PTR_IS_64 /* void * */
diff --git a/include/uk/arch/x86/x86_64/lcpu.h 
b/include/uk/arch/x86/x86_64/lcpu.h
new file mode 100644
index 0000000..cd667e5
--- /dev/null
+++ b/include/uk/arch/x86/x86_64/lcpu.h
@@ -0,0 +1,73 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+/*
+ * Authors: Grzegorz Milos <gm281@xxxxxxxxx>
+ *          Simon Kuenzer <simon.kuenzer@xxxxxxxxx>
+ *
+ * Copyright (c) 2005, Grzegorz Milos, Intel Research Cambridge
+ * Copyright (c) 2017, NEC Europe Ltd., NEC Corporation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef __UKARCH_LCPU_H__
+#error Do not include this header directly
+#endif
+
+struct __regs {
+       unsigned long r15;
+       unsigned long r14;
+       unsigned long r13;
+       unsigned long r12;
+       unsigned long rbp;
+       unsigned long rbx;
+/* arguments: non interrupts/non tracing syscalls only save upto here*/
+       unsigned long r11;
+       unsigned long r10;
+       unsigned long r9;
+       unsigned long r8;
+       unsigned long rax;
+       unsigned long rcx;
+       unsigned long rdx;
+       unsigned long rsi;
+       unsigned long rdi;
+       unsigned long orig_rax;
+/* end of arguments */
+/* cpu exception frame or undefined */
+       unsigned long rip;
+       unsigned long cs;
+       unsigned long eflags;
+       unsigned long rsp;
+       unsigned long ss;
+/* top of stack page */
+};
+
+#ifndef mb
+#define mb()    __asm__ __volatile__ ("mfence" : : : "memory")
+#endif
+
+#ifndef rmb
+#define rmb()   __asm__ __volatile__ ("lfence" : : : "memory")
+#endif
+
+#ifndef wmb
+#define wmb()   __asm__ __volatile__ ("sfence" : : : "memory")
+#endif
diff --git a/include/uk/arch/x86/x86_64/limits.h 
b/include/uk/arch/x86/x86_64/limits.h
new file mode 100644
index 0000000..a969bd1
--- /dev/null
+++ b/include/uk/arch/x86/x86_64/limits.h
@@ -0,0 +1,46 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+/*
+ * Copyright (c) 2009, Citrix Systems, Inc.
+ * Copyright (c) 2017, NEC Europe Ltd., NEC Corporation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef __UKARCH_LIMITS_H__
+#error Do not include this header directly
+#endif
+
+#define __PAGE_SHIFT           12
+
+#ifdef __ASSEMBLY__
+#define __PAGE_SIZE            (1 << __PAGE_SHIFT)
+#define __PAGE_MASK            (~((__PAGE_SIZE) - 1))
+#else
+#define __PAGE_SIZE            (1ULL << __PAGE_SHIFT)
+#define __PAGE_MASK            (~((__PAGE_SIZE) - 1))
+#endif
+
+#define __STACK_SIZE_PAGE_ORDER        4
+#define __STACK_SIZE           (__PAGE_SIZE * (1 << __STACK_SIZE_PAGE_ORDER))
+
+#define __WORDSIZE             64
+#define __WORDSIZE_COMPAT32    1
diff --git a/include/uk/arch/x86/x86_64/types.h 
b/include/uk/arch/x86/x86_64/types.h
new file mode 100644
index 0000000..5547b37
--- /dev/null
+++ b/include/uk/arch/x86/x86_64/types.h
@@ -0,0 +1,38 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright (c) 2002-2003, K A Fraser & R Neugebauer
+ * Copyright (c) 2005, Grzegorz Milos, Intel Research Cambridge
+ *
+ * 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 __UKARCH_TYPES_H__
+#error Do not include this header directly
+#endif
+
+#ifndef __ASSEMBLY__
+
+struct __pte { unsigned long pte; };
+#define npte(x) ((struct __pte) { (x) })
+
+#define _WORD ".quad"
+
+#else
+#define _WORD .quad
+#endif /* !__ASSEMBLY__ */
diff --git a/include/uk/arch/x86_64/atomic.h b/include/uk/arch/x86_64/atomic.h
deleted file mode 100644
index 985c388..0000000
--- a/include/uk/arch/x86_64/atomic.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* SPDX-License-Identifier: BSD-2-Clause */
-/*
- * Port from Mini-OS: include/x86/os.h
- */
-/*
- * Copyright (c) 2009 Citrix Systems, Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-#ifndef __UKARCH_ATOMIC_H__
-#error Do not include this header directly
-#endif
-
-/**
- * ukarch_find_lsbit - find first (lowest) set bit in word.
- * @word: The word to search
- *
- * Undefined if no bit exists, so code should check against 0 first.
- */
-static inline unsigned long ukarch_find_lsbit(unsigned long word)
-{
-       __asm__("bsfq %1,%0"
-               :"=r" (word)
-               :"rm" (word));
-       return word;
-}
diff --git a/include/uk/arch/x86_64/intsizes.h 
b/include/uk/arch/x86_64/intsizes.h
deleted file mode 100644
index e3ef510..0000000
--- a/include/uk/arch/x86_64/intsizes.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause */
-/*
- * Authors: Simon Kuenzer <simon.kuenzer@xxxxxxxxx>
- *
- *
- * Copyright (c) 2017, NEC Europe Ltd., NEC Corporation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the copyright holder nor the names of its
- *    contributors may be used to endorse or promote products derived from
- *    this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY.
- */
-
-#if ((!defined __UKARCH_TYPES_H__) && (!defined __UKARCH_LIMITS_H__))
-#error Do not include this header directly
-#endif
-
-#define __C_IS_8    /* char */
-#define __S_IS_16   /* short */
-#define __I_IS_32   /* int */
-#define __L_IS_64   /* long */
-#define __LL_IS_64  /* long long */
-#define __PTR_IS_64 /* void * */
diff --git a/include/uk/arch/x86_64/lcpu.h b/include/uk/arch/x86_64/lcpu.h
deleted file mode 100644
index cd667e5..0000000
--- a/include/uk/arch/x86_64/lcpu.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/* SPDX-License-Identifier: BSD-2-Clause */
-/*
- * Authors: Grzegorz Milos <gm281@xxxxxxxxx>
- *          Simon Kuenzer <simon.kuenzer@xxxxxxxxx>
- *
- * Copyright (c) 2005, Grzegorz Milos, Intel Research Cambridge
- * Copyright (c) 2017, NEC Europe Ltd., NEC Corporation.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef __UKARCH_LCPU_H__
-#error Do not include this header directly
-#endif
-
-struct __regs {
-       unsigned long r15;
-       unsigned long r14;
-       unsigned long r13;
-       unsigned long r12;
-       unsigned long rbp;
-       unsigned long rbx;
-/* arguments: non interrupts/non tracing syscalls only save upto here*/
-       unsigned long r11;
-       unsigned long r10;
-       unsigned long r9;
-       unsigned long r8;
-       unsigned long rax;
-       unsigned long rcx;
-       unsigned long rdx;
-       unsigned long rsi;
-       unsigned long rdi;
-       unsigned long orig_rax;
-/* end of arguments */
-/* cpu exception frame or undefined */
-       unsigned long rip;
-       unsigned long cs;
-       unsigned long eflags;
-       unsigned long rsp;
-       unsigned long ss;
-/* top of stack page */
-};
-
-#ifndef mb
-#define mb()    __asm__ __volatile__ ("mfence" : : : "memory")
-#endif
-
-#ifndef rmb
-#define rmb()   __asm__ __volatile__ ("lfence" : : : "memory")
-#endif
-
-#ifndef wmb
-#define wmb()   __asm__ __volatile__ ("sfence" : : : "memory")
-#endif
diff --git a/include/uk/arch/x86_64/limits.h b/include/uk/arch/x86_64/limits.h
deleted file mode 100644
index a969bd1..0000000
--- a/include/uk/arch/x86_64/limits.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/* SPDX-License-Identifier: BSD-2-Clause */
-/*
- * Copyright (c) 2009, Citrix Systems, Inc.
- * Copyright (c) 2017, NEC Europe Ltd., NEC Corporation.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef __UKARCH_LIMITS_H__
-#error Do not include this header directly
-#endif
-
-#define __PAGE_SHIFT           12
-
-#ifdef __ASSEMBLY__
-#define __PAGE_SIZE            (1 << __PAGE_SHIFT)
-#define __PAGE_MASK            (~((__PAGE_SIZE) - 1))
-#else
-#define __PAGE_SIZE            (1ULL << __PAGE_SHIFT)
-#define __PAGE_MASK            (~((__PAGE_SIZE) - 1))
-#endif
-
-#define __STACK_SIZE_PAGE_ORDER        4
-#define __STACK_SIZE           (__PAGE_SIZE * (1 << __STACK_SIZE_PAGE_ORDER))
-
-#define __WORDSIZE             64
-#define __WORDSIZE_COMPAT32    1
diff --git a/include/uk/arch/x86_64/types.h b/include/uk/arch/x86_64/types.h
deleted file mode 100644
index 5547b37..0000000
--- a/include/uk/arch/x86_64/types.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/* SPDX-License-Identifier: MIT */
-/*
- * Copyright (c) 2002-2003, K A Fraser & R Neugebauer
- * Copyright (c) 2005, Grzegorz Milos, Intel Research Cambridge
- *
- * 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 __UKARCH_TYPES_H__
-#error Do not include this header directly
-#endif
-
-#ifndef __ASSEMBLY__
-
-struct __pte { unsigned long pte; };
-#define npte(x) ((struct __pte) { (x) })
-
-#define _WORD ".quad"
-
-#else
-#define _WORD .quad
-#endif /* !__ASSEMBLY__ */
-- 
2.7.4


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.