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

[Minios-devel] [UNIKRAFT PATCH 3/7] plat/kvm: Move declaration of some global variables to a header



We move the declaration of following global varibales to kernel.h:
extern void *_libkvmplat_pagetable;
extern void *_libkvmplat_heap_start;
extern void *_libkvmplat_stack_top;
extern void *_libkvmplat_mem_end;
extern void *_libkvmplat_dtb;
This will avoid using "extern" everywhere.

Signed-off-by: Wei Chen <wei.chen@xxxxxxx>
---
 plat/common/arm/pl011.c       |  3 +--
 plat/common/arm/time.c        |  2 +-
 plat/kvm/include/kvm/kernel.h | 47 +++++++++++++++++++++++++++++++++++
 plat/kvm/memory.c             |  8 +-----
 4 files changed, 50 insertions(+), 10 deletions(-)
 create mode 100644 plat/kvm/include/kvm/kernel.h

diff --git a/plat/common/arm/pl011.c b/plat/common/arm/pl011.c
index 206c0bf..f342bee 100644
--- a/plat/common/arm/pl011.c
+++ b/plat/common/arm/pl011.c
@@ -22,6 +22,7 @@
 #include <uk/plat/console.h>
 #include <uk/assert.h>
 #include <arm/cpu.h>
+#include <kvm/kernel.h>
 
 /* PL011 UART registers and masks*/
 /* Data register */
@@ -83,8 +84,6 @@ static uint64_t pl011_uart_bas = 0;
 #define PL011_REG_READ(r)      ioreg_read16(PL011_REG(r))
 #define PL011_REG_WRITE(r, v)  ioreg_write16(PL011_REG(r), v)
 
-extern void *_libkvmplat_dtb;
-
 static void init_pl011(uint64_t bas)
 {
        pl011_uart_bas = bas;
diff --git a/plat/common/arm/time.c b/plat/common/arm/time.c
index 583387b..b2c22fc 100644
--- a/plat/common/arm/time.c
+++ b/plat/common/arm/time.c
@@ -38,10 +38,10 @@
 #include <uk/plat/irq.h>
 #include <uk/bitops.h>
 #include <cpu.h>
+#include <kvm/kernel.h>
 
 static uint64_t boot_ticks;
 static uint32_t counter_freq;
-extern void *_libkvmplat_dtb;
 
 /*
  * Shift factor for counter scaling multiplier; referred to as S in the
diff --git a/plat/kvm/include/kvm/kernel.h b/plat/kvm/include/kvm/kernel.h
new file mode 100644
index 0000000..8e6ca3c
--- /dev/null
+++ b/plat/kvm/include/kvm/kernel.h
@@ -0,0 +1,47 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+/*
+ * Authors: Wei Chen <wei.chen@xxxxxxx>
+ *
+ * Copyright (c) 2018, Arm Ltd. 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.
+ */
+
+#ifndef __PLAT_KVM_KERNEL_H__
+#define __PLAT_KVM_KERNEL_H__
+
+/*
+ * Provided by setup.c
+ */
+extern void *_libkvmplat_pagetable;
+extern void *_libkvmplat_heap_start;
+extern void *_libkvmplat_stack_top;
+extern void *_libkvmplat_mem_end;
+extern void *_libkvmplat_dtb;
+
+#endif /* __PLAT_KVM_KERNEL_H__ */
diff --git a/plat/kvm/memory.c b/plat/kvm/memory.c
index a7b4d5e..6b64f8e 100644
--- a/plat/kvm/memory.c
+++ b/plat/kvm/memory.c
@@ -23,13 +23,7 @@
 #include <sys/types.h>
 #include <uk/plat/memory.h>
 #include <uk/assert.h>
-
-/*
- * Provided by setup.c
- */
-extern void *_libkvmplat_heap_start;
-extern void *_libkvmplat_stack_top;
-extern void *_libkvmplat_mem_end;
+#include <kvm/kernel.h>
 
 int ukplat_memregion_count(void)
 {
-- 
2.17.1


_______________________________________________
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®.