added 2.6.29.6 aldebaran kernel
[nao-ulib.git] / kernel / 2.6.29.6-aldebaran-rt / arch / ia64 / include / asm / rse.h
blob02830a3b0196dba7e7f658fc6b23ef55fd4d19d0
1 #ifndef _ASM_IA64_RSE_H
2 #define _ASM_IA64_RSE_H
4 /*
5 * Copyright (C) 1998, 1999 Hewlett-Packard Co
6 * Copyright (C) 1998, 1999 David Mosberger-Tang <davidm@hpl.hp.com>
8 * Register stack engine related helper functions. This file may be
9 * used in applications, so be careful about the name-space and give
10 * some consideration to non-GNU C compilers (though __inline__ is
11 * fine).
14 static __inline__ unsigned long
15 ia64_rse_slot_num (unsigned long *addr)
17 return (((unsigned long) addr) >> 3) & 0x3f;
21 * Return TRUE if ADDR is the address of an RNAT slot.
23 static __inline__ unsigned long
24 ia64_rse_is_rnat_slot (unsigned long *addr)
26 return ia64_rse_slot_num(addr) == 0x3f;
30 * Returns the address of the RNAT slot that covers the slot at
31 * address SLOT_ADDR.
33 static __inline__ unsigned long *
34 ia64_rse_rnat_addr (unsigned long *slot_addr)
36 return (unsigned long *) ((unsigned long) slot_addr | (0x3f << 3));
40 * Calculate the number of registers in the dirty partition starting at BSPSTORE and
41 * ending at BSP. This isn't simply (BSP-BSPSTORE)/8 because every 64th slot stores
42 * ar.rnat.
44 static __inline__ unsigned long
45 ia64_rse_num_regs (unsigned long *bspstore, unsigned long *bsp)
47 unsigned long slots = (bsp - bspstore);
49 return slots - (ia64_rse_slot_num(bspstore) + slots)/0x40;
53 * The inverse of the above: given bspstore and the number of
54 * registers, calculate ar.bsp.
56 static __inline__ unsigned long *
57 ia64_rse_skip_regs (unsigned long *addr, long num_regs)
59 long delta = ia64_rse_slot_num(addr) + num_regs;
61 if (num_regs < 0)
62 delta -= 0x3e;
63 return addr + num_regs + delta/0x3f;
66 #endif /* _ASM_IA64_RSE_H */