summaryrefslogtreecommitdiffstats
path: root/qemu/roms/openhackware/src/libc/include
diff options
context:
space:
mode:
Diffstat (limited to 'qemu/roms/openhackware/src/libc/include')
-rw-r--r--qemu/roms/openhackware/src/libc/include/ctype.h113
-rw-r--r--qemu/roms/openhackware/src/libc/include/endian.h514
-rw-r--r--qemu/roms/openhackware/src/libc/include/errno.h62
-rw-r--r--qemu/roms/openhackware/src/libc/include/fcntl.h33
-rw-r--r--qemu/roms/openhackware/src/libc/include/stddef.h38
-rw-r--r--qemu/roms/openhackware/src/libc/include/stdint.h74
-rw-r--r--qemu/roms/openhackware/src/libc/include/stdio.h43
-rw-r--r--qemu/roms/openhackware/src/libc/include/stdlib.h50
-rw-r--r--qemu/roms/openhackware/src/libc/include/string.h90
-rw-r--r--qemu/roms/openhackware/src/libc/include/strings.h27
-rw-r--r--qemu/roms/openhackware/src/libc/include/unistd.h43
11 files changed, 1087 insertions, 0 deletions
diff --git a/qemu/roms/openhackware/src/libc/include/ctype.h b/qemu/roms/openhackware/src/libc/include/ctype.h
new file mode 100644
index 000000000..09309c163
--- /dev/null
+++ b/qemu/roms/openhackware/src/libc/include/ctype.h
@@ -0,0 +1,113 @@
+/*
+ * <ctype.h>
+ *
+ * Open Hack'Ware BIOS POSIX like ctype definitions
+ *
+ * Copyright (c) 2004-2005 Jocelyn Mayer
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License V2
+ * as published by the Free Software Foundation
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#if !defined (__OHW_CTYPE_H__)
+#define __OHW_CTYPE_H__
+
+/* Beware that those routines only support ASCII */
+static inline int islower (int c)
+{
+ return c >= 'a' && c <= 'z';
+}
+
+static inline int isupper (int c)
+{
+ return c >= 'A' && c <= 'Z';
+}
+
+static inline int isalpha (int c)
+{
+ return islower(c) || isupper(c);
+}
+
+static inline int isdigit (int c)
+{
+ return c >= '0' && c <= '9';
+}
+
+static inline int isalnum (int c)
+{
+ return isalpha(c) || isdigit(c);
+}
+
+static inline int isxdigit (int c)
+{
+ return isdigit(c) || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F');
+}
+
+static inline int isspace (int c)
+{
+ return c == ' ' || c == '\f' || c == '\n' || c == '\r' ||
+ c == '\t' || c == '\v';
+}
+
+static inline int isgraph (int c)
+{
+ return (c >= 0x21 && c <= 0x7E) || (c >= 0xA1 && c <= 0xFF);
+}
+
+static inline int isprint (int c)
+{
+ return isgraph(c) && c != ' ';
+}
+
+static inline int ispunct (int c)
+{
+ return isprint(c) && !isalpha(c) && !isspace(c);
+}
+
+static inline int isblank (int c)
+{
+ return c == ' ' || c == '\t';
+}
+
+static inline int iscntrl (int c)
+{
+ return !isprint(c);
+}
+
+static inline int isascii (int c)
+{
+ return (c & 0x80) == 0;
+}
+
+static inline int tolower (int c)
+{
+ if (isupper(c))
+ c |= 0x20;
+
+ return c;
+}
+
+static inline int toupper (int c)
+{
+ if (islower(c))
+ c &= ~0x20;
+
+ return c;
+}
+
+static inline int toascii (int c)
+{
+ return c & ~0x80;
+}
+
+#endif /* !defined (__OHW_CTYPE_H__) */
diff --git a/qemu/roms/openhackware/src/libc/include/endian.h b/qemu/roms/openhackware/src/libc/include/endian.h
new file mode 100644
index 000000000..d0ec79712
--- /dev/null
+++ b/qemu/roms/openhackware/src/libc/include/endian.h
@@ -0,0 +1,514 @@
+/*
+ * <endian.h>
+ *
+ * Open Hack'Ware BIOS: provides all common endianness conversions functions
+ *
+ * Copyright (c) 2004-2005 Jocelyn Mayer
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License V2
+ * as published by the Free Software Foundation
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+/*
+ * This file provides:
+ * void cpu_to_be16p (uint16_t *outp, uint16_t in);
+ * void cpu_to_be32p (uint32_t *outp, uint32_t in);
+ * void cpu_to_be64p (uint64_t *outp, uint64_t in);
+ * void cpu_to_le16p (uint16_t *outp, uint16_t in);
+ * void cpu_to_le32p (uint32_t *outp, uint32_t in);
+ * void cpu_to_le64p (uint64_t *outp, uint64_t in);
+ * void endian_to_cpu16p (uint16_t *outp, uint16_t in, endian_t endian);
+ * void endian_to_cpu32p (uint32_t *outp, uint32_t in, endian_t endian);
+ * void endian_to_cpu64p (uint64_t *outp, uint64_t in, endian_t endian);
+ * void cpu16_to_endianp (uint16_t *outp, uint16_t in, endian_t endian);
+ * void cpu32_to_endianp (uint32_t *outp, uint32_t in, endian_t endian);
+ * void cpu64_to_endianp (uint64_t *outp, uint64_t in, endian_t endian);
+ *
+ */
+
+#if !defined (__OHW_ENDIAN_H__)
+#define __OHW_ENDIAN_H__
+
+#include <stdint.h>
+
+typedef enum endian_t endian_t;
+enum endian_t {
+ ENDIAN_1234 = 0,
+ ENDIAN_4321,
+ ENDIAN_3412,
+ ENDIAN_2143,
+};
+
+/* Generic endian conversion functions */
+static inline void generic_cpu_swap16p (uint16_t *outp, uint16_t in)
+{
+ *outp = ((in & 0xFF00) >> 8) | ((in & 0x00FF) << 8);
+}
+
+static inline void generic_cpu_swap32p (uint32_t *outp, uint32_t in)
+{
+ *outp = ((in & 0xFF000000) >> 24) | ((in & 0x00FF0000) >> 8) |
+ ((in & 0x0000FF00) << 8) | ((in & 0x000000FF) << 24);
+}
+
+static inline void generic_cpu_swap64p (uint64_t *outp, uint64_t in)
+{
+ *outp = ((in & 0xFF00000000000000ULL) >> 56) |
+ ((in & 0x00FF000000000000ULL) >> 40) |
+ ((in & 0x0000FF0000000000ULL) >> 24) |
+ ((in & 0x000000FF00000000ULL) >> 8) |
+ ((in & 0x00000000FF000000ULL) << 8) |
+ ((in & 0x0000000000FF0000ULL) << 24) |
+ ((in & 0x000000000000FF00ULL) << 40) |
+ ((in & 0x00000000000000FFULL) << 56);
+}
+
+static inline void generic_cpu_swap64p_32 (uint64_t *outp, uint64_t in)
+{
+ uint32_t *_outp = (uint32_t *)outp;
+
+ generic_cpu_swap32p(_outp, in);
+ generic_cpu_swap32p(_outp + 1, in >> 32);
+}
+
+#if defined (__i386__)
+
+#define __CPU_ENDIAN_4321__
+#define __CPU_LENGTH_32__
+
+#elif defined (__x86_64__)
+
+#define __CPU_ENDIAN_4321__
+#define __CPU_LENGTH_64__
+
+#elif defined (__powerpc__) || defined (_ARCH_PPC)
+
+#define __CPU_ENDIAN_1234__
+#define __CPU_LENGTH_32__
+
+#define __HAVE_CPU_SWAP16P__
+static inline void cpu_swap16p (uint16_t *outp, uint16_t in)
+{
+ __asm__ __volatile__ ("sthbrx %4, 0(%3)");
+}
+
+#define __HAVE_CPU_SWAP32P__
+static inline void cpu_swap32p (uint32_t *outp, uint32_t in)
+{
+ __asm__ __volatile__ ("stwbrx %4, 0(%3)");
+}
+
+#define __HAVE_CPU_SWAP64P__
+static inline void cpu_swap64p (uint64_t *outp, uint64_t in)
+{
+ return generic_cpu_swap64p_32(outp, in);
+}
+
+#else
+
+#error "unsupported CPU architecture"
+
+#endif
+
+/* Use generic swap function if no cpu specific were provided */
+#if !defined (__HAVE_CPU_SWAP16P__)
+static inline void cpu_swap16p (uint16_t *outp, uint16_t in)
+{
+ generic_cpu_swap16p(outp, in);
+}
+#endif
+
+#if !defined (__HAVE_CPU_SWAP32P__)
+static inline void cpu_swap32p (uint32_t *outp, uint32_t in)
+{
+ generic_cpu_swap32p(outp, in);
+}
+#endif
+
+#if !defined (__HAVE_CPU_SWAP64P__)
+static inline void cpu_swap64p (uint64_t *outp, uint64_t in)
+{
+#if defined (__CPU_LENGTH_64__)
+ generic_cpu_swap64p(outp, in);
+#elif defined (__CPU_LENGTH_32__)
+ generic_cpu_swap64p_32(outp, in);
+#else
+#error "Don't know how to make 64 bits swapping on this arch"
+#endif
+}
+#endif
+
+static inline void cpu_nswap16p (uint16_t *outp, uint16_t in)
+{
+ *outp = in;
+}
+
+static inline void cpu_nswap32p (uint32_t *outp, uint32_t in)
+{
+ *outp = in;
+}
+
+static inline void cpu_nswap64p (uint64_t *outp, uint64_t in)
+{
+ *outp = in;
+}
+
+static inline void _endian_be16_p (uint16_t *outp, uint16_t in,
+ endian_t endian)
+{
+ switch (endian) {
+ case ENDIAN_4321:
+ case ENDIAN_2143:
+ cpu_swap16p(outp, in);
+ break;
+ case ENDIAN_1234:
+ case ENDIAN_3412:
+ cpu_nswap16p(outp, in);
+ break;
+ }
+}
+
+static inline void _endian_be32_p (uint32_t *outp, uint32_t in,
+ endian_t endian)
+{
+ switch (endian) {
+ case ENDIAN_4321:
+ cpu_swap32p(outp, in);
+ break;
+ case ENDIAN_1234:
+ cpu_nswap32p(outp, in);
+ break;
+ case ENDIAN_2143:
+ /* TODO */
+ break;
+ case ENDIAN_3412:
+ /* TODO */
+ break;
+ }
+}
+
+static inline void _endian_be64_p (uint64_t *outp, uint64_t in,
+ endian_t endian)
+{
+ switch (endian) {
+ case ENDIAN_4321:
+ cpu_swap64p(outp, in);
+ break;
+ case ENDIAN_1234:
+ cpu_nswap64p(outp, in);
+ break;
+ case ENDIAN_2143:
+ /* TODO */
+ break;
+ case ENDIAN_3412:
+ /* TODO */
+ break;
+ }
+}
+
+static inline void _endian_le16_p (uint16_t *outp, uint16_t in,
+ endian_t endian)
+{
+ switch (endian) {
+ case ENDIAN_4321:
+ case ENDIAN_2143:
+ cpu_nswap16p(outp, in);
+ break;
+ case ENDIAN_1234:
+ case ENDIAN_3412:
+ cpu_swap16p(outp, in);
+ break;
+ }
+}
+
+static inline void _endian_le32_p (uint32_t *outp, uint32_t in,
+ endian_t endian)
+{
+ switch (endian) {
+ case ENDIAN_4321:
+ cpu_nswap32p(outp, in);
+ break;
+ case ENDIAN_1234:
+ cpu_swap32p(outp, in);
+ break;
+ case ENDIAN_2143:
+ /* TODO */
+ break;
+ case ENDIAN_3412:
+ /* TODO */
+ break;
+ }
+}
+
+static inline void _endian_le64_p (uint64_t *outp, uint64_t in,
+ endian_t endian)
+{
+ switch (endian) {
+ case ENDIAN_4321:
+ cpu_nswap64p(outp, in);
+ break;
+ case ENDIAN_1234:
+ cpu_swap64p(outp, in);
+ break;
+ case ENDIAN_2143:
+ /* TODO */
+ break;
+ case ENDIAN_3412:
+ /* TODO */
+ break;
+ }
+}
+
+static inline void endian_to_be16p (uint16_t *outp, uint16_t in,
+ endian_t endian)
+{
+ _endian_be16_p(outp, in, endian);
+}
+
+static inline void endian_to_be32p (uint32_t *outp, uint32_t in,
+ endian_t endian)
+{
+ _endian_be32_p(outp, in, endian);
+}
+
+static inline void endian_to_be64p (uint64_t *outp, uint64_t in,
+ endian_t endian)
+{
+ _endian_be64_p(outp, in, endian);
+}
+
+static inline void endian_to_le16p (uint16_t *outp, uint16_t in,
+ endian_t endian)
+{
+ _endian_le16_p(outp, in, endian);
+}
+
+static inline void endian_to_le32p (uint32_t *outp, uint32_t in,
+ endian_t endian)
+{
+ _endian_le32_p(outp, in, endian);
+}
+
+static inline void endian_to_le64p (uint64_t *outp, uint64_t in,
+ endian_t endian)
+{
+ _endian_le64_p(outp, in, endian);
+}
+
+static inline void be16_to_endianp (uint16_t *outp, uint16_t in,
+ endian_t endian)
+{
+ _endian_be16_p(outp, in, endian);
+}
+
+static inline void be32_to_endianp (uint32_t *outp, uint32_t in,
+ endian_t endian)
+{
+ _endian_be32_p(outp, in, endian);
+}
+
+static inline void be64_to_endianp (uint64_t *outp, uint64_t in,
+ endian_t endian)
+{
+ _endian_be64_p(outp, in, endian);
+}
+
+static inline void le16_to_endianp (uint16_t *outp, uint16_t in,
+ endian_t endian)
+{
+ _endian_le16_p(outp, in, endian);
+}
+
+static inline void le32_to_endianp (uint32_t *outp, uint32_t in,
+ endian_t endian)
+{
+ _endian_le32_p(outp, in, endian);
+}
+
+static inline void le64_to_endianp (uint64_t *outp, uint64_t in,
+ endian_t endian)
+{
+ _endian_le64_p(outp, in, endian);
+}
+
+#if defined (__CPU_ENDIAN_4321__)
+
+static inline void cpu_to_be16p (uint16_t *outp, uint16_t in)
+{
+ cpu_swap16p(outp, in);
+}
+
+static inline void cpu_to_be32p (uint32_t *outp, uint32_t in)
+{
+ cpu_swap32p(outp, in);
+}
+
+static inline void cpu_to_be64p (uint64_t *outp, uint64_t in)
+{
+ cpu_swap64p(outp, in);
+}
+
+static inline void cpu_to_le16p (uint16_t *outp, uint16_t in)
+{
+ cpu_nswap16p(outp, in);
+}
+
+static inline void cpu_to_le32p (uint32_t *outp, uint32_t in)
+{
+ cpu_nswap32p(outp, in);
+}
+
+static inline void cpu_to_le64p (uint64_t *outp, uint64_t in)
+{
+ cpu_nswap64p(outp, in);
+}
+
+static inline void be16_to_cpup (uint16_t *outp, uint16_t in)
+{
+ cpu_swap16p(outp, in);
+}
+
+static inline void be32_to_cpup (uint32_t *outp, uint32_t in)
+{
+ cpu_swap32p(outp, in);
+}
+
+static inline void be64_to_cpup (uint64_t *outp, uint64_t in)
+{
+ cpu_swap64p(outp, in);
+}
+
+static inline void le16_to_cpup (uint16_t *outp, uint16_t in)
+{
+ cpu_nswap16p(outp, in);
+}
+
+static inline void le32_to_cpup (uint32_t *outp, uint32_t in)
+{
+ cpu_nswap32p(outp, in);
+}
+
+static inline void le64_to_cpup (uint64_t *outp, uint64_t in)
+{
+ cpu_nswap64p(outp, in);
+}
+
+static inline void endian_to_cpu16p (uint16_t *outp, uint16_t in,
+ endian_t endian)
+{
+ endian_to_le16p(outp, in, endian);
+}
+
+static inline void endian_to_cpu32p (uint32_t *outp, uint32_t in,
+ endian_t endian)
+{
+ endian_to_le32p(outp, in, endian);
+}
+
+static inline void endian_to_cpu64p (uint64_t *outp, uint64_t in,
+ endian_t endian)
+{
+ endian_to_le64p(outp, in, endian);
+}
+
+static inline void cpu16_to_endianp (uint16_t *outp, uint16_t in,
+ endian_t endian)
+{
+ le16_to_endianp(outp, in, endian);
+}
+
+static inline void cpu32_to_endianp (uint32_t *outp, uint32_t in,
+ endian_t endian)
+{
+ le32_to_endianp(outp, in, endian);
+}
+
+static inline void cpu64_to_endianp (uint64_t *outp, uint64_t in,
+ endian_t endian)
+{
+ le64_to_endianp(outp, in, endian);
+}
+
+#elif defined (__CPU_ENDIAN_1234__)
+
+static inline void cpu_to_be16p (uint16_t *outp, uint16_t in)
+{
+ cpu_nswap16p(outp, in);
+}
+
+static inline void cpu_to_be32p (uint32_t *outp, uint32_t in)
+{
+ cpu_nswap32p(outp, in);
+}
+
+static inline void cpu_to_be64p (uint64_t *outp, uint64_t in)
+{
+ cpu_nswap64p(outp, in);
+}
+
+static inline void cpu_to_le16p (uint16_t *outp, uint16_t in)
+{
+ cpu_swap16p(outp, in);
+}
+
+static inline void cpu_to_le32p (uint32_t *outp, uint32_t in)
+{
+ cpu_swap32p(outp, in);
+}
+
+static inline void cpu_to_le64p (uint64_t *outp, uint64_t in)
+{
+ cpu_swap64p(outp, in);
+}
+
+static inline void endian_to_cpu16p (uint16_t *outp, uint16_t in,
+ endian_t endian)
+{
+ endian_to_be16p(outp, in, endian);
+}
+
+static inline void endian_to_cpu32p (uint32_t *outp, uint32_t in,
+ endian_t endian)
+{
+ endian_to_be32p(outp, in, endian);
+}
+
+static inline void endian_to_cpu64p (uint64_t *outp, uint64_t in,
+ endian_t endian)
+{
+ endian_to_be64p(outp, in, endian);
+}
+
+static inline void cpu16_to_endianp (uint16_t *outp, uint16_t in,
+ endian_t endian)
+{
+ be16_to_endianp(outp, in, endian);
+}
+
+static inline void cpu32_to_endianp (uint32_t *outp, uint32_t in,
+ endian_t endian)
+{
+ be32_to_endianp(outp, in, endian);
+}
+
+static inline void cpu64_to_endianp (uint64_t *outp, uint64_t in,
+ endian_t endian)
+{
+ be64_to_endianp(outp, in, endian);
+}
+
+#else /* 2143 / 3412 */
+/* TODO */
+#error "TODO"
+#endif
+
+#endif /* !defined (__OHW_ENDIAN_H__) */
diff --git a/qemu/roms/openhackware/src/libc/include/errno.h b/qemu/roms/openhackware/src/libc/include/errno.h
new file mode 100644
index 000000000..f6242a581
--- /dev/null
+++ b/qemu/roms/openhackware/src/libc/include/errno.h
@@ -0,0 +1,62 @@
+/*
+ * <errno.h>
+ *
+ * Open Hack'Ware BIOS errno management
+ *
+ * Copyright (c) 2004-2005 Jocelyn Mayer
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License V2
+ * as published by the Free Software Foundation
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+#if !defined (__OHW_ERRNO_H__)
+#define __OHW_ERRNO_H__
+
+struct task {
+ int errno;
+};
+
+extern struct task cur_task;
+
+void *get_current_stack (void);
+
+static inline int *errno_location (void)
+{
+ /* XXX: to fix */
+#if 0
+ struct task *taskp;
+
+ taskp = get_current_stack();
+
+ return &taskp->errno;
+#else
+ return &cur_task.errno;
+#endif
+}
+
+static inline void set_errno (int errnum)
+{
+ *(errno_location()) = errnum;
+}
+
+static inline int get_errno (void)
+{
+ return *(errno_location());
+}
+
+#define errno get_errno()
+
+enum {
+ ENOMEM,
+};
+
+#endif /* !defined (__OHW_ERRNO_H__) */
diff --git a/qemu/roms/openhackware/src/libc/include/fcntl.h b/qemu/roms/openhackware/src/libc/include/fcntl.h
new file mode 100644
index 000000000..d55c477b0
--- /dev/null
+++ b/qemu/roms/openhackware/src/libc/include/fcntl.h
@@ -0,0 +1,33 @@
+/*
+ * <fcntl.h>
+ *
+ * Open Hack'Ware BIOS: subset of POSIX fcntl definitions
+ *
+ * Copyright (c) 2004-2005 Jocelyn Mayer
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License V2
+ * as published by the Free Software Foundation
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#if !defined (__OHW_FCNTL_H__)
+#define __OHW_FCNTL_H__
+
+enum {
+ O_RDONLY = 0x0001,
+ O_WRONLY = 0x0002,
+ O_RDWR = 0x0003,
+ O_CREAT = 0x0010,
+ O_EXCL = 0x0020,
+};
+
+#endif /* !defined (__OHW_FCNTL_H__) */
diff --git a/qemu/roms/openhackware/src/libc/include/stddef.h b/qemu/roms/openhackware/src/libc/include/stddef.h
new file mode 100644
index 000000000..0e973eb15
--- /dev/null
+++ b/qemu/roms/openhackware/src/libc/include/stddef.h
@@ -0,0 +1,38 @@
+/*
+ * <stddef.h>
+ *
+ * Open Hack'Ware BIOS: subset of POSIX standard definitions
+ *
+ * Copyright (c) 2004-2005 Jocelyn Mayer
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License V2
+ * as published by the Free Software Foundation
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#if !defined (__OHW_STDDEF_H__)
+#define __OHW_STDDEF_H__
+
+#include <stdint.h>
+
+typedef signed long ptrdiff_t;
+typedef unsigned long size_t;
+typedef signed long ssize_t;
+typedef signed long off_t;
+
+/* We use unicode UCS-4 as the standard character set */
+typedef uint32_t wchar_t;
+
+/* XXX: to be moveed elsewhere */
+typedef uint32_t mode_t;
+
+#endif /* !defined (__OHW_STDDEF_H__) */
diff --git a/qemu/roms/openhackware/src/libc/include/stdint.h b/qemu/roms/openhackware/src/libc/include/stdint.h
new file mode 100644
index 000000000..1efd3b3fd
--- /dev/null
+++ b/qemu/roms/openhackware/src/libc/include/stdint.h
@@ -0,0 +1,74 @@
+/*
+ * <stdint.h>
+ *
+ * Open Hack'Ware BIOS: arch dependent basic types
+ *
+ * Copyright (c) 2004-2005 Jocelyn Mayer
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License V2
+ * as published by the Free Software Foundation
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#if !defined (__OHW_STDINT_H__)
+#define __OHW_STDINT_H__
+
+#if defined (__i386__)
+
+typedef unsigned char uint8_t;
+typedef signed char int8_t;
+typedef unsigned short uint16_t;
+typedef signed short int16_t;
+typedef unsigned int uint32_t;
+typedef signed int int32_t;
+typedef unsigned long long uint64_t;
+typedef signed long long int64_t;
+
+#elif defined (__x86_64__)
+
+typedef unsigned char uint8_t;
+typedef signed char int8_t;
+typedef unsigned short uint16_t;
+typedef signed short int16_t;
+typedef unsigned int uint32_t;
+typedef signed int int32_t;
+typedef unsigned long uint64_t;
+typedef signed long int64_t;
+
+#elif defined (__powerpc__) || defined (_ARCH_PPC)
+
+typedef unsigned char uint8_t;
+typedef signed char int8_t;
+typedef unsigned short uint16_t;
+typedef signed short int16_t;
+typedef unsigned int uint32_t;
+typedef signed int int32_t;
+typedef unsigned long long uint64_t;
+typedef signed long long int64_t;
+
+#elif defined (__powerpc64__) || defined (_ARCH_PPC64)
+
+typedef unsigned char uint8_t;
+typedef signed char int8_t;
+typedef unsigned short uint16_t;
+typedef signed short int16_t;
+typedef unsigned int uint32_t;
+typedef signed int int32_t;
+typedef unsigned long uint64_t;
+typedef signed long int64_t;
+#else
+
+#error "unsupported CPU architecture"
+
+#endif
+
+#endif /* !defined (__OHW_STDINT_H__) */
diff --git a/qemu/roms/openhackware/src/libc/include/stdio.h b/qemu/roms/openhackware/src/libc/include/stdio.h
new file mode 100644
index 000000000..f6bca8657
--- /dev/null
+++ b/qemu/roms/openhackware/src/libc/include/stdio.h
@@ -0,0 +1,43 @@
+/*
+ * <stdio.h>
+ *
+ * Open Hack'Ware BIOS: subset of POSIX stdio definitions
+ *
+ * Copyright (c) 2004-2005 Jocelyn Mayer
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License V2
+ * as published by the Free Software Foundation
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#if !defined (__OHW_STDIO_H__)
+#define __OHW_STDIO_H__
+
+/* va_list is defined here */
+#include <stdarg.h>
+/* size_t is defined here */
+#include <stddef.h>
+
+#define EOF ((int)-1)
+
+int printf (const char *format, ...);
+int dprintf (const char *format, ...);
+int sprintf (char *str, const char *format, ...);
+int snprintf (char *str, size_t size, const char *format, ...);
+int vprintf (const char *format, va_list ap);
+int vdprintf (const char *format, va_list ap);
+int vsprintf (char *str, const char *format, va_list ap);
+int vsnprintf (char *str, size_t size, const char *format, va_list ap);
+
+int rename (const char *oldpath, const char *newpath);
+
+#endif /* !defined (__OHW_STDIO_H__) */
diff --git a/qemu/roms/openhackware/src/libc/include/stdlib.h b/qemu/roms/openhackware/src/libc/include/stdlib.h
new file mode 100644
index 000000000..d0fab6cd0
--- /dev/null
+++ b/qemu/roms/openhackware/src/libc/include/stdlib.h
@@ -0,0 +1,50 @@
+/*
+ * <stdlib.h>
+ *
+ * Open Hack'Ware BIOS: subset of POSIX stdlib definitions
+ *
+ * Copyright (c) 2004-2005 Jocelyn Mayer
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License V2
+ * as published by the Free Software Foundation
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#if !defined (__OHW_STDLIB_H__)
+#define __OHW_STDLIB_H__
+
+#define NULL ((void *)0)
+
+/* size_t is declared here */
+#include <stddef.h>
+
+void *malloc (size_t size);
+void free (void *ptr);
+void *realloc (void *ptr, size_t size);
+
+/* memset is declared here */
+#include <string.h>
+
+static inline void *calloc (size_t nmemb, size_t size)
+{
+ void *ret;
+
+ ret = malloc(nmemb * size);
+ if (ret != NULL)
+ memset(ret, 0, nmemb * size);
+
+ return ret;
+}
+
+int mkstemp (char *template);
+
+#endif /* !defined (__OHW_STDLIB_H__) */
diff --git a/qemu/roms/openhackware/src/libc/include/string.h b/qemu/roms/openhackware/src/libc/include/string.h
new file mode 100644
index 000000000..a2c4e0ea5
--- /dev/null
+++ b/qemu/roms/openhackware/src/libc/include/string.h
@@ -0,0 +1,90 @@
+/*
+ * <string.h>
+ *
+ * Open Hack'Ware BIOS: subset of POSIX string definitions
+ *
+ * Copyright (c) 2004-2005 Jocelyn Mayer
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License V2
+ * as published by the Free Software Foundation
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#if !defined (__OHW_STRING_H__)
+#define __OHW_STRING_H__
+
+/* size_t is declared here */
+#include <stddef.h>
+
+void *memcpy (void *dest, const void *src, size_t n);
+void *memccpy (void *dest, const void *src, int c, size_t n);
+void *mempcpy (void *dest, const void *src, size_t n);
+void *memmove (void *dest, const void *src, size_t n);
+void *memcmove (void *dest, const void *src, int c, size_t n);
+void *mempmove (void *dest, const void *src, size_t n);
+void *memset (void *s, int c, size_t n);
+int memcmp (const void *s1, const void *s2, size_t n);
+void *memchr (const void *s, int c, size_t n);
+void *rawmemchr (const void *s, int c);
+void *memrchr (const void *s, int c, size_t n);
+void *memmem (const void *haystack, size_t haystacklen,
+ const void *needle, size_t neddlelen);
+void *strcpy (char *dest, const char *src);
+void *strncpy (char *dest, const char *src, size_t n);
+char *strdup (const char *s);
+char *strndup (const char *s, size_t n);
+void *stpcpy (char *dest, const char *src);
+void *stpncpy (char *dest, const char *src, size_t n);
+char *strcat (char *dest, const char *src);
+char *strncat (char *dest, const char *src, size_t n);
+int strcmp (const char *s1, const char *s2);
+int strcasecmp (const char *s1, const char *s2);
+int strncmp (const char *s1, const char *s2, size_t n);
+int strncasecmp (const char *s1, const char *s2, size_t n);
+char *strchr (const char *s, int c);
+char *strchrnul (const char *s, int c);
+char *strrchr (const char *s, int c);
+char *strstr (const char *haystack, const char *needle);
+char *strcasestr (const char *haystack, const char *needle);
+#if 0 // TODO
+size_t strspn (const char *s, const char *accept);
+size_t strcspn (const char *s, const char *reject);
+char *strpbrk (const char *s, const char *accept);
+char *strtok (char *s, const char *delim);
+char *strtok_r (char *s, const char *delim, char **ptrptr);
+char *strsep (char **stringp, const char *delim);
+#endif // TODO
+char *basename (char *path);
+char *dirname (char *path);
+size_t strlen (const char *s);
+size_t strnlen (const char *s, size_t maxlen);
+
+#if 0
+static inline int ffs (int value)
+{
+ int tmp;
+
+ __asm__ __volatile__ ("cntlzw %0, %1" : "=r" (tmp) : "r" (value));
+
+ return 32 - tmp;
+}
+#endif
+
+static inline int ffs (int value)
+{
+ return __builtin_ffs(value);
+}
+
+int ffsl (long i);
+int ffsll (long long i);
+
+#endif /* !defined (__OHW_STRING_H__) */
diff --git a/qemu/roms/openhackware/src/libc/include/strings.h b/qemu/roms/openhackware/src/libc/include/strings.h
new file mode 100644
index 000000000..64c2cfd75
--- /dev/null
+++ b/qemu/roms/openhackware/src/libc/include/strings.h
@@ -0,0 +1,27 @@
+/*
+ * <strings.h>
+ *
+ * Open Hack'Ware BIOS: Fake header for POSIX compatibility
+ *
+ * Copyright (c) 2004-2005 Jocelyn Mayer
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License V2
+ * as published by the Free Software Foundation
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#if !defined (__OHW_STRINGS_H__)
+#define __OHW_STRINGS_H__
+
+#include <string.h>
+
+#endif /* !defined (__OHW_STRINGS_H__) */
diff --git a/qemu/roms/openhackware/src/libc/include/unistd.h b/qemu/roms/openhackware/src/libc/include/unistd.h
new file mode 100644
index 000000000..4199a0323
--- /dev/null
+++ b/qemu/roms/openhackware/src/libc/include/unistd.h
@@ -0,0 +1,43 @@
+/*
+ * <unistd.h>
+ *
+ * Open Hack'Ware BIOS: subset of POSIX unistd definitions
+ *
+ * Copyright (c) 2004-2005 Jocelyn Mayer
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License V2
+ * as published by the Free Software Foundation
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#if !defined (__OHW_UNISTD_H__)
+#define __OHW_UNISTD_H__
+
+/* size_t is defined here */
+/* mode_t is defined here (SHOULD NOT !) */
+/* off_t is defined here */
+#include <stddef.h>
+
+int open (const char *pathname, int flags, mode_t mode);
+int close (int fd);
+ssize_t read (int fd, void *buf, size_t count);
+ssize_t write (int fd, const void *buf, size_t count);
+enum {
+ SEEK_SET = 0x01,
+ SEEK_CUR = 0x02,
+ SEEK_END = 0x03,
+};
+off_t lseek (int fd, off_t offset, int whence);
+int truncate (const char *path, off_t length);
+int ftruncate (int fd, off_t length);
+
+#endif /* !defined (__OHW_UNISTD_H__) */