backported vs2.1.x fix to irq handling, which caused incorrect scheduler behavior
[linux-2.6.git] / include / linux / vs_base.h
index a1d34b6..54ce343 100644 (file)
@@ -1,22 +1,24 @@
 #ifndef _VX_VS_BASE_H
 #define _VX_VS_BASE_H
 
-
 #include "vserver/context.h"
 
+#define VX_IRQ        0x4000
+#define VX_IRQ_MASK   0xF000
+#include <linux/hardirq.h>
 
 #define vx_task_xid(t) ((t)->xid)
 
 #define vx_current_xid() vx_task_xid(current)
 
-#define vx_check(c,m)  __vx_check(vx_current_xid(),c,m)
+#define vx_check(c,m)  __vx_check(vx_current_xid(),c,m|VX_IRQ)
 
 #define vx_weak_check(c,m)     ((m) ? vx_check(c,m) : 1)
 
 
 /*
  * check current context for ADMIN/WATCH and
- * optionally agains supplied argument
+ * optionally against supplied argument
  */
 static inline int __vx_check(xid_t cid, xid_t id, unsigned int mode)
 {
@@ -34,6 +36,9 @@ static inline int __vx_check(xid_t cid, xid_t id, unsigned int mode)
                        (id > 1) && (id < MIN_D_CONTEXT))
                        return 1;
        }
+       if ((mode & VX_IRQ) && (unlikely(in_interrupt())))
+               return 1;
+
        return (((mode & VX_ADMIN) && (cid == 0)) ||
                ((mode & VX_WATCH) && (cid == 1)) ||
                ((mode & VX_HOSTID) && (id == 0)));
@@ -98,6 +103,8 @@ static inline int __vx_check(xid_t cid, xid_t id, unsigned int mode)
        (current->vx_info && \
        (current->vx_info->vx_initpid == (n)))
 
+#define vx_capable(b,c) (capable(b) || \
+       ((current->euid == 0) && vx_ccaps(c)))
 
 #else
 #warning duplicate inclusion