[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/8] Make qemu-palcode build environment standalone. NFC.
From: |
Jason Thorpe |
Subject: |
[PATCH 1/8] Make qemu-palcode build environment standalone. NFC. |
Date: |
Wed, 2 Jun 2021 20:53:10 -0700 |
Don't include system headers. Instead, provide standalone definitions
and declarations of types needed and functions used by the PALcode that
are compatible with the standard Alpha / GCC ABI.
Signed-off-by: Jason Thorpe <thorpej@me.com>
---
init.c | 2 --
memcpy.c | 2 +-
memset.c | 2 +-
printf.c | 4 +---
protos.h | 30 +++++++++++++++++++++++++-----
5 files changed, 28 insertions(+), 12 deletions(-)
diff --git a/init.c b/init.c
index b53bab6..429a9ad 100644
--- a/init.c
+++ b/init.c
@@ -18,8 +18,6 @@
along with this program; see the file COPYING. If not see
<http://www.gnu.org/licenses/>. */
-#include <string.h>
-#include <stddef.h>
#include "hwrpb.h"
#include "osf.h"
#include "ioport.h"
diff --git a/memcpy.c b/memcpy.c
index b6bbb74..9e1e913 100644
--- a/memcpy.c
+++ b/memcpy.c
@@ -8,7 +8,7 @@
* This is a reasonably optimized memcpy() routine.
*/
-#include <string.h>
+#include "protos.h"
/*
* Note that the C code is written to be optimized into good assembly. However,
diff --git a/memset.c b/memset.c
index e8481dc..f9b0a6d 100644
--- a/memset.c
+++ b/memset.c
@@ -19,7 +19,7 @@
<http://www.gnu.org/licenses/>. */
-#include <string.h>
+#include "protos.h"
void *memset(void *optr, int ival, unsigned long size)
{
diff --git a/printf.c b/printf.c
index 469b82c..0e1e128 100644
--- a/printf.c
+++ b/printf.c
@@ -18,10 +18,8 @@
along with this program; see the file COPYING. If not see
<http://www.gnu.org/licenses/>. */
-#include <stdarg.h>
-#include <stdbool.h>
-#include <string.h>
#include "console.h"
+#include "protos.h"
static int print_buf_pad(char *buf, int buflen, char *p, int width, int pad)
{
diff --git a/protos.h b/protos.h
index 3ed1381..0d90be8 100644
--- a/protos.h
+++ b/protos.h
@@ -21,11 +21,31 @@
#ifndef PROTOS_H
#define PROTOS_H 1
-#include <stdint.h>
-#include <stdbool.h>
-#include <stddef.h>
-#include <string.h>
-
+/* Stand-alone definitions for various types, compatible with
+ the Alpha Linux ABI and GCC. This eliminates dependencies
+ on external headers. */
+typedef unsigned char uint8_t;
+typedef unsigned short uint16_t;
+typedef unsigned int uint32_t;
+typedef unsigned long uint64_t;
+typedef unsigned long size_t;
+
+#define bool _Bool
+#define true 1
+#define false 0
+
+#define offsetof(type, member) __builtin_offsetof(type, member)
+
+typedef __builtin_va_list va_list;
+#define va_start(ap, last) __builtin_va_start((ap), (last))
+#define va_arg __builtin_va_arg
+#define va_end(ap) __builtin_va_end(ap)
+
+#define NULL ((void *)0)
+
+extern void *memset(void *, int, size_t);
+extern void *memcpy(void *, const void *, size_t);
+extern size_t strlen(const char *);
/*
* Call_Pal functions.
--
2.30.2
- [PATCH 0/8] PALcode fixes required to run NetBSD/alpha., Jason Thorpe, 2021/06/02
- [PATCH 3/8] Fix initialization of the hwrpb.hwrpb.cpuid field., Jason Thorpe, 2021/06/02
- [PATCH 1/8] Make qemu-palcode build environment standalone. NFC.,
Jason Thorpe <=
- [PATCH 2/8] Fix delivery of unaligned access exceptions., Jason Thorpe, 2021/06/02
- [PATCH 4/8] Make some PCI macros available to other files. NFC., Jason Thorpe, 2021/06/02
- [PATCH 5/8] Fix incorrect initialization of PCI BARs., Jason Thorpe, 2021/06/02
- [PATCH 6/8] Provide interrupt mapping information in PCI config registers., Jason Thorpe, 2021/06/02