diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2008-07-04 17:47:11 +0100 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2008-07-04 17:47:11 +0100 |
commit | ce5c899f22106926ca50c153a600b537d08970bc (patch) | |
tree | e23cbd3e5901a3178957ee36b22f1277832858b2 /extras/mini-os/include | |
parent | 355b0469a8d017b80d9ce1078c90fe628c8b3bbe (diff) | |
download | xen-ce5c899f22106926ca50c153a600b537d08970bc.tar.gz xen-ce5c899f22106926ca50c153a600b537d08970bc.tar.bz2 xen-ce5c899f22106926ca50c153a600b537d08970bc.zip |
stubdom: use host's gcc
This makes stubdom use the host's gcc instead of downloading/compiling
binutils+gcc. That requires a bunch of changes and even uncovered a
few bugs, but saves a lot of time.
Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
Diffstat (limited to 'extras/mini-os/include')
-rw-r--r-- | extras/mini-os/include/ctype.h | 5 | ||||
-rw-r--r-- | extras/mini-os/include/errno.h | 5 | ||||
-rw-r--r-- | extras/mini-os/include/ia64/arch_spinlock.h | 2 | ||||
-rw-r--r-- | extras/mini-os/include/sys/lock.h | 52 | ||||
-rw-r--r-- | extras/mini-os/include/types.h | 9 | ||||
-rw-r--r-- | extras/mini-os/include/wait.h | 23 | ||||
-rw-r--r-- | extras/mini-os/include/waittypes.h | 26 | ||||
-rw-r--r-- | extras/mini-os/include/x86/arch_spinlock.h | 2 | ||||
-rw-r--r-- | extras/mini-os/include/xmalloc.h | 2 |
9 files changed, 100 insertions, 26 deletions
diff --git a/extras/mini-os/include/ctype.h b/extras/mini-os/include/ctype.h index ef8f5b61e5..ac0dd67a3c 100644 --- a/extras/mini-os/include/ctype.h +++ b/extras/mini-os/include/ctype.h @@ -1,6 +1,9 @@ #ifndef _CTYPE_H #define _CTYPE_H +#ifdef HAVE_LIBC +#include_next <ctype.h> +#else /* * NOTE! This ctype does not handle EOF like the standard C * library is required to. @@ -53,3 +56,5 @@ static inline unsigned char __toupper(unsigned char c) #define toupper(c) __toupper(c) #endif + +#endif diff --git a/extras/mini-os/include/errno.h b/extras/mini-os/include/errno.h index 2829420dd7..5c2b2f8fad 100644 --- a/extras/mini-os/include/errno.h +++ b/extras/mini-os/include/errno.h @@ -3,6 +3,8 @@ #include <errno-base.h> +typedef int error_t; + #define EDEADLK 35 /* Resource deadlock would occur */ #define ENAMETOOLONG 36 /* File name too long */ #define ENOLCK 37 /* No record locks available */ @@ -107,6 +109,9 @@ #define EOWNERDEAD 130 /* Owner died */ #define ENOTRECOVERABLE 131 /* State not recoverable */ + +#define EFTYPE 132 /* Inappropriate file type or format */ + #ifdef HAVE_LIBC #include <sched.h> extern int errno; diff --git a/extras/mini-os/include/ia64/arch_spinlock.h b/extras/mini-os/include/ia64/arch_spinlock.h index b9efe8a632..60712b54c9 100644 --- a/extras/mini-os/include/ia64/arch_spinlock.h +++ b/extras/mini-os/include/ia64/arch_spinlock.h @@ -27,7 +27,7 @@ #include "atomic.h" -#define ARCH_SPIN_LOCK_UNLOCKED (spinlock_t) { 0 } +#define ARCH_SPIN_LOCK_UNLOCKED { 0 } #define SPIN_LOCK_UNUSED 0 #define SPIN_LOCK_USED 1 diff --git a/extras/mini-os/include/sys/lock.h b/extras/mini-os/include/sys/lock.h new file mode 100644 index 0000000000..0757a749dd --- /dev/null +++ b/extras/mini-os/include/sys/lock.h @@ -0,0 +1,52 @@ +#ifndef _MINIOS_SYS_LOCK_H_ +#define _MINIOS_SYS_LOCK_H_ + +#ifdef HAVE_LIBC + +/* Due to inclusion loop, we can not include sched.h, so have to hide things */ + +#include <waittypes.h> + + +typedef struct { + int busy; + struct wait_queue_head wait; +} _LOCK_T; + +#define __LOCK_INIT(class,lock) \ + class _LOCK_T lock = { .wait = __WAIT_QUEUE_HEAD_INITIALIZER(lock.wait) } +int ___lock_init(_LOCK_T *lock); +int ___lock_acquire(_LOCK_T *lock); +int ___lock_try_acquire(_LOCK_T *lock); +int ___lock_release(_LOCK_T *lock); +int ___lock_close(_LOCK_T *lock); +#define __lock_init(__lock) ___lock_init(&__lock) +#define __lock_acquire(__lock) ___lock_acquire(&__lock) +#define __lock_release(__lock) ___lock_release(&__lock) +#define __lock_try_acquire(__lock) ___lock_try_acquire(&__lock) +#define __lock_close(__lock) 0 + + +typedef struct { + struct thread *owner; + int count; + struct wait_queue_head wait; +} _LOCK_RECURSIVE_T; + +#define __LOCK_INIT_RECURSIVE(class, lock) \ + class _LOCK_RECURSIVE_T lock = { .wait = __WAIT_QUEUE_HEAD_INITIALIZER((lock).wait) } + +int ___lock_init_recursive(_LOCK_RECURSIVE_T *lock); +int ___lock_acquire_recursive(_LOCK_RECURSIVE_T *lock); +int ___lock_try_acquire_recursive(_LOCK_RECURSIVE_T *lock); +int ___lock_release_recursive(_LOCK_RECURSIVE_T *lock); +int ___lock_close_recursive(_LOCK_RECURSIVE_T *lock); +#define __lock_init_recursive(__lock) ___lock_init_recursive(&__lock) +#define __lock_acquire_recursive(__lock) ___lock_acquire_recursive(&__lock) +#define __lock_release_recursive(__lock) ___lock_release_recursive(&__lock) +#define __lock_try_acquire_recursive(__lock) ___lock_try_acquire_recursive(&__lock) +#define __lock_close_recursive(__lock) 0 + +#endif + +#endif /* _MINIOS_SYS_LOCK_H_ */ diff --git a/extras/mini-os/include/types.h b/extras/mini-os/include/types.h index bf34373637..8d0d6f8ea9 100644 --- a/extras/mini-os/include/types.h +++ b/extras/mini-os/include/types.h @@ -36,9 +36,11 @@ typedef unsigned long u64; #endif /* FreeBSD compat types */ +#ifndef HAVE_LIBC typedef unsigned char u_char; typedef unsigned int u_int; typedef unsigned long u_long; +#endif #ifdef __i386__ typedef long long quad_t; typedef unsigned long long u_quad_t; @@ -79,11 +81,14 @@ typedef s32 int32_t; typedef u64 uint64_t, uintmax_t; typedef s64 int64_t, intmax_t; typedef u64 off_t; +#endif +typedef intptr_t ptrdiff_t; -#define INT_MAX ((int)(~0U>>1)) -#define UINT_MAX (~0U) +#ifndef HAVE_LIBC typedef long ssize_t; #endif +typedef unsigned long size_t; + #endif /* _TYPES_H_ */ diff --git a/extras/mini-os/include/wait.h b/extras/mini-os/include/wait.h index 2947d33150..6519a4db89 100644 --- a/extras/mini-os/include/wait.h +++ b/extras/mini-os/include/wait.h @@ -2,29 +2,8 @@ #define __WAIT_H__ #include <sched.h> -#include <list.h> -#include <lib.h> #include <os.h> - -struct wait_queue -{ - struct thread *thread; - struct list_head thread_list; -}; - -struct wait_queue_head -{ - /* TODO - lock required? */ - struct list_head thread_list; -}; - -#define DECLARE_WAIT_QUEUE_HEAD(name) \ - struct wait_queue_head name = \ - { .thread_list = { &(name).thread_list, &(name).thread_list} } - -#define __WAIT_QUEUE_HEAD_INITIALIZER(name) { \ - .thread_list = { &(name).thread_list, &(name).thread_list } } - +#include <waittypes.h> #define DEFINE_WAIT(name) \ struct wait_queue name = { \ diff --git a/extras/mini-os/include/waittypes.h b/extras/mini-os/include/waittypes.h new file mode 100644 index 0000000000..fd5806348f --- /dev/null +++ b/extras/mini-os/include/waittypes.h @@ -0,0 +1,26 @@ +#ifndef __WAITTYPE_H__ +#define __WAITTYPE_H__ + +#include <list.h> + +struct thread; +struct wait_queue +{ + struct thread *thread; + struct list_head thread_list; +}; + +struct wait_queue_head +{ + /* TODO - lock required? */ + struct list_head thread_list; +}; + +#define DECLARE_WAIT_QUEUE_HEAD(name) \ + struct wait_queue_head name = \ + { .thread_list = { &(name).thread_list, &(name).thread_list} } + +#define __WAIT_QUEUE_HEAD_INITIALIZER(name) { \ + .thread_list = { &(name).thread_list, &(name).thread_list } } + +#endif diff --git a/extras/mini-os/include/x86/arch_spinlock.h b/extras/mini-os/include/x86/arch_spinlock.h index b711fe473c..59c2fb9b26 100644 --- a/extras/mini-os/include/x86/arch_spinlock.h +++ b/extras/mini-os/include/x86/arch_spinlock.h @@ -7,7 +7,7 @@ #include "os.h" -#define ARCH_SPIN_LOCK_UNLOCKED (spinlock_t) { 1 } +#define ARCH_SPIN_LOCK_UNLOCKED { 1 } /* * Simple spin lock operations. There are two variants, one clears IRQ's diff --git a/extras/mini-os/include/xmalloc.h b/extras/mini-os/include/xmalloc.h index e168a84f88..13b242e21e 100644 --- a/extras/mini-os/include/xmalloc.h +++ b/extras/mini-os/include/xmalloc.h @@ -11,6 +11,8 @@ #else +#include <limits.h> + #define DEFAULT_ALIGN (sizeof(unsigned long)) #define malloc(size) _xmalloc(size, DEFAULT_ALIGN) #define free(ptr) xfree(ptr) |