#include <asm/domain.h>
 #include <asm/opcodes-virt.h>
 #include <asm/asm-offsets.h>
+#include <asm/page.h>
+#include <asm/thread_info.h>
 
 #define IOMEM(x)       (x)
 
  * Get current thread_info.
  */
        .macro  get_thread_info, rd
- ARM(  mov     \rd, sp, lsr #13        )
+ ARM(  mov     \rd, sp, lsr #THREAD_SIZE_ORDER + PAGE_SHIFT    )
  THUMB(        mov     \rd, sp                 )
- THUMB(        lsr     \rd, \rd, #13           )
-       mov     \rd, \rd, lsl #13
+ THUMB(        lsr     \rd, \rd, #THREAD_SIZE_ORDER + PAGE_SHIFT       )
+       mov     \rd, \rd, lsl #THREAD_SIZE_ORDER + PAGE_SHIFT
        .endm
 
 /*
 
 
 #include <linux/compiler.h>
 #include <asm/fpstate.h>
+#include <asm/page.h>
 
 #define THREAD_SIZE_ORDER      1
-#define THREAD_SIZE            8192
+#define THREAD_SIZE            (PAGE_SIZE << THREAD_SIZE_ORDER)
 #define THREAD_START_SP                (THREAD_SIZE - 8)
 
 #ifndef __ASSEMBLY__