All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] minios: switch to C99 integer types
@ 2009-07-14 15:19 Christoph Egger
  2009-07-14 15:38 ` Keir Fraser
  2009-07-14 16:08 ` Stefano Stabellini
  0 siblings, 2 replies; 4+ messages in thread
From: Christoph Egger @ 2009-07-14 15:19 UTC (permalink / raw)
  To: xen-devel

[-- Attachment #1: Type: text/plain, Size: 456 bytes --]


Hi!

Attached patch switches minios to C99 integer types.
This is a necessary step to make minios build on NetBSD.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>


-- 
---to satisfy European Law for business letters:
Advanced Micro Devices GmbH
Karl-Hammerschmidt-Str. 34, 85609 Dornach b. Muenchen
Geschaeftsfuehrer: Thomas M. McCoy, Giuliano Meroni
Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen
Registergericht Muenchen, HRB Nr. 43632

[-- Attachment #2: xen_minios.diff --]
[-- Type: text/x-diff, Size: 20863 bytes --]

diff -r 82c6d0b8852e extras/mini-os/arch/ia64/common.c
--- a/extras/mini-os/arch/ia64/common.c	Mon Jul 13 16:50:53 2009 +0100
+++ b/extras/mini-os/arch/ia64/common.c	Tue Jul 14 19:03:17 2009 +0200
@@ -68,7 +68,7 @@ char boot_cmd_line[COMMAND_LINE_SIZE+1];
 
 
 void
-ia64_write_itr_i(ia64_pte_t* pteP, u32 reg, uint64_t vAddr,
+ia64_write_itr_i(ia64_pte_t* pteP, uint32_t reg, uint64_t vAddr,
 		  uint64_t ps, uint64_t pk)
 {
 	/* The virtual address. */
diff -r 82c6d0b8852e extras/mini-os/arch/ia64/time.c
--- a/extras/mini-os/arch/ia64/time.c	Mon Jul 13 16:50:53 2009 +0100
+++ b/extras/mini-os/arch/ia64/time.c	Tue Jul 14 19:03:17 2009 +0200
@@ -178,7 +178,7 @@ timer_interrupt(evtchn_port_t port, stru
 /*
  * monotonic_clock(): returns # of nanoseconds passed since time_init()
  */
-u64
+uint64_t
 monotonic_clock(void)
 {
 	uint64_t delta;
diff -r 82c6d0b8852e extras/mini-os/arch/x86/time.c
--- a/extras/mini-os/arch/x86/time.c	Mon Jul 13 16:50:53 2009 +0100
+++ b/extras/mini-os/arch/x86/time.c	Tue Jul 14 19:03:17 2009 +0200
@@ -46,15 +46,15 @@
 
 /* These are peridically updated in shared_info, and then copied here. */
 struct shadow_time_info {
-	u64 tsc_timestamp;     /* TSC at last update of time vals.  */
-	u64 system_timestamp;  /* Time, in nanosecs, since boot.    */
-	u32 tsc_to_nsec_mul;
-	u32 tsc_to_usec_mul;
+	uint64_t tsc_timestamp;     /* TSC at last update of time vals.  */
+	uint64_t system_timestamp;  /* Time, in nanosecs, since boot.    */
+	uint32_t tsc_to_nsec_mul;
+	uint32_t tsc_to_usec_mul;
 	int tsc_shift;
-	u32 version;
+	uint32_t version;
 };
 static struct timespec shadow_ts;
-static u32 shadow_ts_version;
+static uint32_t shadow_ts_version;
 
 static struct shadow_time_info shadow;
 
@@ -84,11 +84,11 @@ static inline int time_values_up_to_date
  * Scale a 64-bit delta by scaling and multiplying by a 32-bit fraction,
  * yielding a 64-bit result.
  */
-static inline u64 scale_delta(u64 delta, u32 mul_frac, int shift)
+static inline uint64_t scale_delta(uint64_t delta, uint32_t mul_frac, int shift)
 {
-	u64 product;
+	uint64_t product;
 #ifdef __i386__
-	u32 tmp1, tmp2;
+	uint32_t tmp1, tmp2;
 #endif
 
 	if ( shift < 0 )
@@ -106,11 +106,11 @@ static inline u64 scale_delta(u64 delta,
 		"xor  %5,%5    ; "
 		"adc  %5,%%edx ; "
 		: "=A" (product), "=r" (tmp1), "=r" (tmp2)
-		: "a" ((u32)delta), "1" ((u32)(delta >> 32)), "2" (mul_frac) );
+		: "a" ((uint32_t)delta), "1" ((uint32_t)(delta >> 32)), "2" (mul_frac) );
 #else
 	__asm__ (
 		"mul %%rdx ; shrd $32,%%rdx,%%rax"
-		: "=a" (product) : "0" (delta), "d" ((u64)mul_frac) );
+		: "=a" (product) : "0" (delta), "d" ((uint64_t)mul_frac) );
 #endif
 
 	return product;
@@ -119,7 +119,7 @@ static inline u64 scale_delta(u64 delta,
 
 static unsigned long get_nsec_offset(void)
 {
-	u64 now, delta;
+	uint64_t now, delta;
 	rdtscll(now);
 	delta = now - shadow.tsc_timestamp;
 	return scale_delta(delta, shadow.tsc_to_nsec_mul, shadow.tsc_shift);
@@ -151,10 +151,10 @@ static void get_time_values_from_xen(voi
  *		Note: This function is required to return accurate
  *		time even in the absence of multiple timer ticks.
  */
-u64 monotonic_clock(void)
+uint64_t monotonic_clock(void)
 {
-	u64 time;
-	u32 local_time_version;
+	uint64_t time;
+	uint32_t local_time_version;
 
 	do {
 		local_time_version = shadow.version;
@@ -185,7 +185,7 @@ static void update_wallclock(void)
 
 int gettimeofday(struct timeval *tv, void *tz)
 {
-    u64 nsec = monotonic_clock();
+    uint64_t nsec = monotonic_clock();
     nsec += shadow_ts.tv_nsec;
     
     
diff -r 82c6d0b8852e extras/mini-os/events.c
--- a/extras/mini-os/events.c	Mon Jul 13 16:50:53 2009 +0100
+++ b/extras/mini-os/events.c	Tue Jul 14 19:03:17 2009 +0200
@@ -28,7 +28,7 @@ typedef struct _ev_action_t {
 typedef struct _ev_action_t {
 	evtchn_handler_t handler;
 	void *data;
-    u32 count;
+    uint32_t count;
 } ev_action_t;
 
 static ev_action_t ev_actions[NR_EVS];
diff -r 82c6d0b8852e extras/mini-os/gnttab.c
--- a/extras/mini-os/gnttab.c	Mon Jul 13 16:50:53 2009 +0100
+++ b/extras/mini-os/gnttab.c	Tue Jul 14 19:03:17 2009 +0200
@@ -102,7 +102,7 @@ int
 int
 gnttab_end_access(grant_ref_t ref)
 {
-    u16 flags, nflags;
+    uint16_t flags, nflags;
 
     BUG_ON(ref >= NR_GRANT_ENTRIES || ref < NR_RESERVED_ENTRIES);
 
@@ -123,7 +123,7 @@ gnttab_end_transfer(grant_ref_t ref)
 gnttab_end_transfer(grant_ref_t ref)
 {
     unsigned long frame;
-    u16 flags;
+    uint16_t flags;
 
     BUG_ON(ref >= NR_GRANT_ENTRIES || ref < NR_RESERVED_ENTRIES);
 
diff -r 82c6d0b8852e extras/mini-os/hypervisor.c
--- a/extras/mini-os/hypervisor.c	Mon Jul 13 16:50:53 2009 +0100
+++ b/extras/mini-os/hypervisor.c	Tue Jul 14 19:03:17 2009 +0200
@@ -87,13 +87,13 @@ void force_evtchn_callback(void)
     };
 }
 
-inline void mask_evtchn(u32 port)
+inline void mask_evtchn(uint32_t port)
 {
     shared_info_t *s = HYPERVISOR_shared_info;
     synch_set_bit(port, &s->evtchn_mask[0]);
 }
 
-inline void unmask_evtchn(u32 port)
+inline void unmask_evtchn(uint32_t port)
 {
     shared_info_t *s = HYPERVISOR_shared_info;
     vcpu_info_t *vcpu_info = &s->vcpu_info[smp_processor_id()];
@@ -114,7 +114,7 @@ inline void unmask_evtchn(u32 port)
     }
 }
 
-inline void clear_evtchn(u32 port)
+inline void clear_evtchn(uint32_t port)
 {
     shared_info_t *s = HYPERVISOR_shared_info;
     synch_clear_bit(port, &s->evtchn_pending[0]);
diff -r 82c6d0b8852e extras/mini-os/include/arch/cc.h
--- a/extras/mini-os/include/arch/cc.h	Mon Jul 13 16:50:53 2009 +0100
+++ b/extras/mini-os/include/arch/cc.h	Tue Jul 14 19:03:17 2009 +0200
@@ -13,17 +13,17 @@
 #include <mini-os/os.h>
 #include <mini-os/types.h>
 #include <time.h>
-typedef  u8  u8_t;
-typedef  s8  s8_t;
-typedef u16 u16_t;
-typedef s16 s16_t;
-typedef u32 u32_t;
-typedef s32 s32_t;
-typedef u64 u64_t;
-typedef s64 s64_t;
+typedef uint8_t  u8_t;
+typedef int8_t   s8_t;
+typedef uint16_t u16_t;
+typedef int16_t  s16_t;
+typedef uint32_t u32_t;
+typedef int32_t  s32_t;
+typedef uint64_t u64_t;
+typedef int64_t  s64_t;
 typedef uintptr_t mem_ptr_t;
 
-typedef u16 u_short;
+typedef uint16_t u_short;
 
 /*   Compiler hints for packing lwip's structures - */
 #define PACK_STRUCT_FIELD(_x)  _x
diff -r 82c6d0b8852e extras/mini-os/include/fs.h
--- a/extras/mini-os/include/fs.h	Mon Jul 13 16:50:53 2009 +0100
+++ b/extras/mini-os/include/fs.h	Tue Jul 14 19:03:17 2009 +0200
@@ -11,13 +11,13 @@ struct fs_import
 struct fs_import 
 {
     domid_t dom_id;                 /* dom id of the exporting domain       */ 
-    u16 export_id;                  /* export id (exporting dom specific)   */
-    u16 import_id;                  /* import id (specific to this domain)  */ 
+    uint16_t export_id;             /* export id (exporting dom specific)   */
+    uint16_t import_id;             /* import id (specific to this domain)  */ 
     struct minios_list_head list;   /* list of all imports                  */
     unsigned int nr_entries;        /* Number of entries in rings & request
                                        array                                */
     struct fsif_front_ring ring;    /* frontend ring (contains shared ring) */
-    u32 gnt_refs[FSIF_RING_SIZE_PAGES];  /* grant references to the shared ring  */
+    uint32_t gnt_refs[FSIF_RING_SIZE_PAGES];  /* grant references to the shared ring  */
     evtchn_port_t local_port;       /* local event channel port             */
     char *backend;                  /* XenBus location of the backend       */
     struct fs_request *requests;    /* Table of requests                    */
diff -r 82c6d0b8852e extras/mini-os/include/hypervisor.h
--- a/extras/mini-os/include/hypervisor.h	Mon Jul 13 16:50:53 2009 +0100
+++ b/extras/mini-os/include/hypervisor.h	Tue Jul 14 19:03:17 2009 +0200
@@ -40,9 +40,9 @@ extern union start_info_union start_info
 /* hypervisor.c */
 void force_evtchn_callback(void);
 void do_hypervisor_callback(struct pt_regs *regs);
-void mask_evtchn(u32 port);
-void unmask_evtchn(u32 port);
-void clear_evtchn(u32 port);
+void mask_evtchn(uint32_t port);
+void unmask_evtchn(uint32_t port);
+void clear_evtchn(uint32_t port);
 
 extern int in_callback;
 
diff -r 82c6d0b8852e extras/mini-os/include/linux/types.h
--- a/extras/mini-os/include/linux/types.h	Mon Jul 13 16:50:53 2009 +0100
+++ b/extras/mini-os/include/linux/types.h	Tue Jul 14 19:03:17 2009 +0200
@@ -1,5 +1,5 @@
 #ifndef _LINUX_TYPES_H_
 #define _LINUX_TYPES_H_
 #include <mini-os/types.h>
-typedef u64 __u64;
+typedef uint64_t __u64;
 #endif /* _LINUX_TYPES_H_ */
diff -r 82c6d0b8852e extras/mini-os/include/sched.h
--- a/extras/mini-os/include/sched.h	Mon Jul 13 16:50:53 2009 +0100
+++ b/extras/mini-os/include/sched.h	Tue Jul 14 19:03:17 2009 +0200
@@ -20,7 +20,7 @@ struct thread
     thread_regs_t regs;
 #endif /* !defined(__ia64__) */
     struct minios_list_head thread_list;
-    u32 flags;
+    uint32_t flags;
     s_time_t wakeup_time;
 #ifdef HAVE_LIBC
     struct _reent reent;
@@ -54,6 +54,6 @@ void schedule(void);
 
 void wake(struct thread *thread);
 void block(struct thread *thread);
-void msleep(u32 millisecs);
+void msleep(uint32_t millisecs);
 
 #endif /* __SCHED_H__ */
diff -r 82c6d0b8852e extras/mini-os/include/time.h
--- a/extras/mini-os/include/time.h	Mon Jul 13 16:50:53 2009 +0100
+++ b/extras/mini-os/include/time.h	Tue Jul 14 19:03:17 2009 +0200
@@ -29,7 +29,7 @@
  * The other macros are for convenience to approximate short intervals
  * of real time into system time 
  */
-typedef s64 s_time_t;
+typedef int64_t s_time_t;
 #define NOW()                   ((s_time_t)monotonic_clock())
 #define SECONDS(_s)             (((s_time_t)(_s))  * 1000000000UL )
 #define TENTHS(_ts)             (((s_time_t)(_ts)) * 100000000UL )
@@ -57,7 +57,7 @@ void     fini_time(void);
 void     fini_time(void);
 s_time_t get_s_time(void);
 s_time_t get_v_time(void);
-u64      monotonic_clock(void);
+uint64_t monotonic_clock(void);
 void     block_domain(s_time_t until);
 
 #endif /* _MINIOS_TIME_H_ */
diff -r 82c6d0b8852e extras/mini-os/include/types.h
--- a/extras/mini-os/include/types.h	Mon Jul 13 16:50:53 2009 +0100
+++ b/extras/mini-os/include/types.h	Tue Jul 14 19:03:17 2009 +0200
@@ -20,20 +20,6 @@
 #ifndef _TYPES_H_
 #define _TYPES_H_
 #include <stddef.h>
-
-typedef signed char         s8;
-typedef unsigned char       u8;
-typedef signed short        s16;
-typedef unsigned short      u16;
-typedef signed int          s32;
-typedef unsigned int        u32;
-#ifdef __i386__
-typedef signed long long    s64;
-typedef unsigned long long  u64;
-#elif defined(__x86_64__) || defined(__ia64__)
-typedef signed long         s64;
-typedef unsigned long       u64;
-#endif
 
 /* FreeBSD compat types */
 #ifndef HAVE_LIBC
@@ -72,15 +58,22 @@ typedef unsigned long       uintptr_t;
 typedef unsigned long       uintptr_t;
 typedef long                intptr_t;
 #endif /* __i386__ || __x86_64__ */
-typedef  u8 uint8_t;
-typedef  s8 int8_t;
-typedef u16 uint16_t;
-typedef s16 int16_t;
-typedef u32 uint32_t;
-typedef s32 int32_t;
-typedef u64 uint64_t, uintmax_t;
-typedef s64 int64_t, intmax_t;
-typedef u64 off_t;
+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;
+#ifdef __i386__
+typedef   signed long long int64_t;
+typedef unsigned long long uint64_t;
+#elif defined(__x86_64__) || defined(__ia64__)
+typedef   signed long int64_t;
+typedef unsigned long uint64_t;
+#endif
+typedef uint64_t uintmax_t;
+typedef  int64_t intmax_t;
+typedef uint64_t off_t;
 #endif
 
 typedef intptr_t            ptrdiff_t;
diff -r 82c6d0b8852e extras/mini-os/include/x86/os.h
--- a/extras/mini-os/include/x86/os.h	Mon Jul 13 16:50:53 2009 +0100
+++ b/extras/mini-os/include/x86/os.h	Tue Jul 14 19:03:17 2009 +0200
@@ -445,7 +445,7 @@ static __inline__ unsigned long __ffs(un
                            : /* no outputs */ \
                            : "c" (msr), "a" (val1), "d" (val2))
 
-#define wrmsrl(msr,val) wrmsr(msr,(u32)((u64)(val)),((u64)(val))>>32)
+#define wrmsrl(msr,val) wrmsr(msr,(uint32_t)((uint64_t)(val)),((uint64_t)(val))>>32)
 
 
 #else /* ifdef __x86_64__ */
diff -r 82c6d0b8852e extras/mini-os/include/x86/x86_32/hypercall-x86_32.h
--- a/extras/mini-os/include/x86/x86_32/hypercall-x86_32.h	Mon Jul 13 16:50:53 2009 +0100
+++ b/extras/mini-os/include/x86/x86_32/hypercall-x86_32.h	Tue Jul 14 19:03:17 2009 +0200
@@ -174,7 +174,7 @@ HYPERVISOR_sched_op(
 
 static inline long
 HYPERVISOR_set_timer_op(
-	u64 timeout)
+	uint64_t timeout)
 {
 	unsigned long timeout_hi = (unsigned long)(timeout>>32);
 	unsigned long timeout_lo = (unsigned long)timeout;
@@ -197,7 +197,7 @@ HYPERVISOR_get_debugreg(
 
 static inline int
 HYPERVISOR_update_descriptor(
-	u64 ma, u64 desc)
+	uint64_t ma, uint64_t desc)
 {
 	return _hypercall4(int, update_descriptor, ma, ma>>32, desc, desc>>32);
 }
diff -r 82c6d0b8852e extras/mini-os/include/x86/x86_64/hypercall-x86_64.h
--- a/extras/mini-os/include/x86/x86_64/hypercall-x86_64.h	Mon Jul 13 16:50:53 2009 +0100
+++ b/extras/mini-os/include/x86/x86_64/hypercall-x86_64.h	Tue Jul 14 19:03:17 2009 +0200
@@ -178,7 +178,7 @@ HYPERVISOR_sched_op(
 
 static inline long
 HYPERVISOR_set_timer_op(
-	u64 timeout)
+	uint64_t timeout)
 {
 	return _hypercall1(long, set_timer_op, timeout);
 }
diff -r 82c6d0b8852e extras/mini-os/kernel.c
--- a/extras/mini-os/kernel.c	Mon Jul 13 16:50:53 2009 +0100
+++ b/extras/mini-os/kernel.c	Tue Jul 14 19:03:17 2009 +0200
@@ -49,7 +49,7 @@
 
 static struct netfront_dev *net_dev;
 
-u8 xen_features[XENFEAT_NR_SUBMAPS * 32];
+uint8_t xen_features[XENFEAT_NR_SUBMAPS * 32];
 
 void setup_xen_features(void)
 {
diff -r 82c6d0b8852e extras/mini-os/lib/math.c
--- a/extras/mini-os/lib/math.c	Mon Jul 13 16:50:53 2009 +0100
+++ b/extras/mini-os/lib/math.c	Tue Jul 14 19:03:17 2009 +0200
@@ -68,8 +68,8 @@
  * one or more of the following formats.
  */
 union uu {
-        s64            q;              /* as a (signed) quad */
-        s64            uq;             /* as an unsigned quad */
+        int64_t           q;              /* as a (signed) quad */
+        int64_t          uq;             /* as an unsigned quad */
         long           sl[2];          /* as two signed longs */
         unsigned long  ul[2];          /* as two unsigned longs */
 };
@@ -90,7 +90,7 @@ union uu {
 #ifndef HAVE_LIBC
 #define CHAR_BIT        8               /* number of bits in a char */
 #endif
-#define QUAD_BITS       (sizeof(s64) * CHAR_BIT)
+#define QUAD_BITS       (sizeof(int64_t) * CHAR_BIT)
 #define LONG_BITS       (sizeof(long) * CHAR_BIT)
 #define HALF_BITS       (sizeof(long) * CHAR_BIT / 2)
 
@@ -147,8 +147,8 @@ shl(register digit *p, register int len,
  * divisor are 4 `digits' in this base (they are shorter if they have
  * leading zeros).
  */
-u64
-__qdivrem(u64 uq, u64 vq, u64 *arq)
+uint64_t
+__qdivrem(uint64_t uq, uint64_t vq, uint64_t *arq)
 {
 	union uu tmp;
 	digit *u, *v, *q;
@@ -348,31 +348,31 @@ __qdivrem(u64 uq, u64 vq, u64 *arq)
  * Divide two signed quads.
  * ??? if -1/2 should produce -1 on this machine, this code is wrong
  */
-s64
-__divdi3(s64 a, s64 b)
+int64_t
+__divdi3(int64_t a, int64_t b)
 {
-	u64 ua, ub, uq;
+	uint64_t ua, ub, uq;
 	int neg;
 
 	if (a < 0)
-		ua = -(u64)a, neg = 1;
+		ua = -(uint64_t)a, neg = 1;
 	else
 		ua = a, neg = 0;
 	if (b < 0)
-		ub = -(u64)b, neg ^= 1;
+		ub = -(uint64_t)b, neg ^= 1;
 	else
 		ub = b;
-	uq = __qdivrem(ua, ub, (u64 *)0);
+	uq = __qdivrem(ua, ub, (uint64_t *)0);
 	return (neg ? -uq : uq);
 }
 
 /*
  * Divide two unsigned quads.
  */
-u64
-__udivdi3(u64 a, u64 b)
+uint64_t
+__udivdi3(uint64_t a, uint64_t b)
 {
-        return (__qdivrem(a, b, (u64 *)0));
+        return (__qdivrem(a, b, (uint64_t *)0));
 }
 
 
diff -r 82c6d0b8852e extras/mini-os/lib/sys.c
--- a/extras/mini-os/lib/sys.c	Mon Jul 13 16:50:53 2009 +0100
+++ b/extras/mini-os/lib/sys.c	Tue Jul 14 19:03:17 2009 +0200
@@ -1189,7 +1189,7 @@ int clock_gettime(clockid_t clk_id, stru
 	}
 	case CLOCK_REALTIME:
 	{
-	    u64 nsec = monotonic_clock();
+	    uint64_t nsec = monotonic_clock();
 
 	    tp->tv_sec = nsec / 1000000000ULL;
 	    tp->tv_nsec = nsec % 1000000000ULL;
diff -r 82c6d0b8852e extras/mini-os/lwip-arch.c
--- a/extras/mini-os/lwip-arch.c	Mon Jul 13 16:50:53 2009 +0100
+++ b/extras/mini-os/lwip-arch.c	Tue Jul 14 19:03:17 2009 +0200
@@ -20,7 +20,7 @@ void sys_init(void)
 
 /* Creates and returns a new semaphore. The "count" argument specifies
  * the initial state of the semaphore. */
-sys_sem_t sys_sem_new(u8_t count)
+sys_sem_t sys_sem_new(uint8_t count)
 {
     struct semaphore *sem = xmalloc(struct semaphore);
     sem->count = count;
@@ -50,13 +50,13 @@ void sys_sem_signal(sys_sem_t sem)
  * semaphore wasn't signaled within the specified time, the return value is
  * SYS_ARCH_TIMEOUT. If the thread didn't have to wait for the semaphore
  * (i.e., it was already signaled), the function may return zero. */
-u32_t sys_arch_sem_wait(sys_sem_t sem, u32_t timeout)
+uint32_t sys_arch_sem_wait(sys_sem_t sem, uint32_t timeout)
 {
     /* Slightly more complicated than the normal minios semaphore:
      * need to wake on timeout *or* signal */
     sys_prot_t prot;
-    s64_t then = NOW();
-    s64_t deadline;
+    int64_t then = NOW();
+    int64_t deadline;
 
     if (timeout == 0)
 	deadline = 0;
@@ -174,9 +174,9 @@ static void do_mbox_fetch(sys_mbox_t mbo
  * The return values are the same as for the sys_arch_sem_wait() function:
  * Number of milliseconds spent waiting or SYS_ARCH_TIMEOUT if there was a
  * timeout. */
-u32_t sys_arch_mbox_fetch(sys_mbox_t mbox, void **msg, u32_t timeout)
+uint32_t sys_arch_mbox_fetch(sys_mbox_t mbox, void **msg, uint32_t timeout)
 {
-    u32 rv;
+    uint32_t rv;
     if (mbox == SYS_MBOX_NULL)
         return SYS_ARCH_TIMEOUT;
 
@@ -199,7 +199,7 @@ u32_t sys_arch_mbox_fetch(sys_mbox_t mbo
  *     sys_arch_mbox_fetch(mbox,msg,1)
  * although this would introduce unnecessary delays. */
 
-u32_t sys_arch_mbox_tryfetch(sys_mbox_t mbox, void **msg) {
+uint32_t sys_arch_mbox_tryfetch(sys_mbox_t mbox, void **msg) {
     if (mbox == SYS_MBOX_NULL)
         return SYS_ARCH_TIMEOUT;
 
diff -r 82c6d0b8852e extras/mini-os/lwip-net.c
--- a/extras/mini-os/lwip-net.c	Mon Jul 13 16:50:53 2009 +0100
+++ b/extras/mini-os/lwip-net.c	Tue Jul 14 19:03:17 2009 +0200
@@ -207,7 +207,7 @@ netfront_input(struct netif *netif, unsi
     etharp_ip_input(netif, p);
 #endif
     /* skip Ethernet header */
-    pbuf_header(p, -(s16)sizeof(struct eth_hdr));
+    pbuf_header(p, -(int16_t)sizeof(struct eth_hdr));
     /* pass to network layer */
     if (tcpip_input(p, netif) == ERR_MEM)
       /* Could not store it, drop */
diff -r 82c6d0b8852e extras/mini-os/sched.c
--- a/extras/mini-os/sched.c	Mon Jul 13 16:50:53 2009 +0100
+++ b/extras/mini-os/sched.c	Tue Jul 14 19:03:17 2009 +0200
@@ -227,7 +227,7 @@ void block(struct thread *thread)
     clear_runnable(thread);
 }
 
-void msleep(u32 millisecs)
+void msleep(uint32_t millisecs)
 {
     struct thread *thread = get_current();
     thread->wakeup_time = NOW()  + MILLISECS(millisecs);
diff -r 82c6d0b8852e stubdom/pciutils.patch
--- a/stubdom/pciutils.patch	Mon Jul 13 16:50:53 2009 +0100
+++ b/stubdom/pciutils.patch	Tue Jul 14 19:03:17 2009 +0200
@@ -54,22 +54,22 @@ diff -urN pciutils-2.2.9.orig/lib/access
  all: $(PCILIB) $(PCILIBPC)
  
  $(PCILIB): $(OBJS)
---- pciutils-2.2.9.orig/lib/types.h	2007-09-03 09:44:15.000000000 +0100
-+++ pciutils-2.2.9/lib/types.h	2008-07-01 12:17:08.396156000 +0100
-@@ -17,9 +17,13 @@
- typedef DWORD u32;
- #elif defined(PCI_HAVE_STDINT_H)
- #include <stdint.h>
-+#ifdef PCI_OS_MINIOS
-+#include <types.h>
-+#else
+--- pciutils-2.2.9.orig/lib/types.h    2009-07-14 18:18:59.000000000 +0200
++++ pciutils-2.2.9/lib/types.h 2009-07-14 18:19:16.000000000 +0200
+@@ -20,10 +20,12 @@ typedef DWORD u32;
  typedef uint8_t u8;
  typedef uint16_t u16;
  typedef uint32_t u32;
-+#endif
++typedef uint64_t u64;
  #else
  typedef u_int8_t u8;
  typedef u_int16_t u16;
+ typedef u_int32_t u32;
++typedef u_int64_t u64;
+ #endif
+
+ #ifdef PCI_HAVE_64BIT_ADDRESS
+ 
 --- pciutils-2.2.9.orig/lib/minios.c	1970-01-01 01:00:00.000000000 +0100
 +++ pciutils-2.2.9/lib/minios.c	2008-07-01 12:31:40.554260000 +0100
 @@ -0,0 +1,113 @@
diff -r 82c6d0b8852e tools/include/xen-sys/MiniOS/privcmd.h
--- a/tools/include/xen-sys/MiniOS/privcmd.h	Mon Jul 13 16:50:53 2009 +0100
+++ b/tools/include/xen-sys/MiniOS/privcmd.h	Tue Jul 14 19:03:17 2009 +0200
@@ -5,12 +5,12 @@
 
 typedef struct privcmd_hypercall
 {
-	u64 op;
-	u64 arg[5];
+	uint64_t op;
+	uint64_t arg[5];
 } privcmd_hypercall_t;
 
 typedef struct privcmd_mmap_entry {
-	u64 mfn;
+	uint64_t mfn;
 } privcmd_mmap_entry_t; 
 
 #endif /* __MINIOS_PUBLIC_PRIVCMD_H__ */

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] minios: switch to C99 integer types
  2009-07-14 15:19 [PATCH] minios: switch to C99 integer types Christoph Egger
@ 2009-07-14 15:38 ` Keir Fraser
  2009-07-14 15:48   ` Samuel Thibault
  2009-07-14 16:08 ` Stefano Stabellini
  1 sibling, 1 reply; 4+ messages in thread
From: Keir Fraser @ 2009-07-14 15:38 UTC (permalink / raw)
  To: Christoph Egger, xen-devel@lists.xensource.com
  Cc: Samuel Thibault, Stefano Stabellini

I'd like an Ack from Stefano and/or Samuel on this one. This kind of dancing
around the standard headers is tricky.

 -- Keir

On 14/07/2009 16:19, "Christoph Egger" <Christoph.Egger@amd.com> wrote:

> 
> Hi!
> 
> Attached patch switches minios to C99 integer types.
> This is a necessary step to make minios build on NetBSD.
> 
> Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] minios: switch to C99 integer types
  2009-07-14 15:38 ` Keir Fraser
@ 2009-07-14 15:48   ` Samuel Thibault
  0 siblings, 0 replies; 4+ messages in thread
From: Samuel Thibault @ 2009-07-14 15:48 UTC (permalink / raw)
  To: Keir Fraser
  Cc: Christoph Egger, xen-devel@lists.xensource.com,
	Stefano Stabellini

Keir Fraser, le Tue 14 Jul 2009 16:38:48 +0100, a écrit :
> I'd like an Ack from Stefano and/or Samuel on this one. This kind of dancing
> around the standard headers is tricky.

He did it properly: in the stubdom case, he uses stdint.h from newlib,
else he defines them by hand, so although I haven't thoroughly checked
the patch nor compiled it I do agree on the dancing :)

Samuel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] minios: switch to C99 integer types
  2009-07-14 15:19 [PATCH] minios: switch to C99 integer types Christoph Egger
  2009-07-14 15:38 ` Keir Fraser
@ 2009-07-14 16:08 ` Stefano Stabellini
  1 sibling, 0 replies; 4+ messages in thread
From: Stefano Stabellini @ 2009-07-14 16:08 UTC (permalink / raw)
  To: Christoph Egger; +Cc: xen-devel@lists.xensource.com

On Tue, 14 Jul 2009, Christoph Egger wrote:
> 
> Hi!
> 
> Attached patch switches minios to C99 integer types.
> This is a necessary step to make minios build on NetBSD.
> 
> Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
> 

Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-07-14 16:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-14 15:19 [PATCH] minios: switch to C99 integer types Christoph Egger
2009-07-14 15:38 ` Keir Fraser
2009-07-14 15:48   ` Samuel Thibault
2009-07-14 16:08 ` Stefano Stabellini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.