patch-2.4.19 linux-2.4.19/include/asm-s390x/processor.h

Next file: linux-2.4.19/include/asm-s390x/ptrace.h
Previous file: linux-2.4.19/include/asm-s390x/pgtable.h
Back to the patch index
Back to the overall index

diff -urN linux-2.4.18/include/asm-s390x/processor.h linux-2.4.19/include/asm-s390x/processor.h
@@ -149,8 +149,8 @@
 }
 
 unsigned long get_wchan(struct task_struct *p);
-#define __KSTK_PTREGS(tsk) \
-	((struct pt_regs *)((unsigned long) tsk+THREAD_SIZE) - 1)
+#define __KSTK_PTREGS(tsk) ((struct pt_regs *) \
+        (((unsigned long) tsk + THREAD_SIZE - sizeof(struct pt_regs)) & -8L))
 #define KSTK_EIP(tsk)	(__KSTK_PTREGS(tsk)->psw.addr)
 #define KSTK_ESP(tsk)	(__KSTK_PTREGS(tsk)->gprs[15])
 
@@ -182,6 +182,43 @@
 #define PSW_PROBLEM_STATE       0x0001000000000000UL
 
 /*
+ * Set PSW mask to specified value, while leaving the
+ * PSW addr pointing to the next instruction.
+ */
+
+static inline void __load_psw_mask (unsigned long mask)
+{
+	unsigned long addr;
+
+	psw_t psw;
+	psw.mask = mask;
+
+	asm volatile (
+		"    larl  %0,1f\n"
+		"    stg   %0,8(%1)\n"
+		"    lpswe 0(%1)\n"
+		"1:"
+		: "=&d" (addr) : "a" (&psw) : "memory", "cc" );
+}
+
+/*
+ * Function to stop a processor until an interruption occured
+ */
+static inline void enabled_wait(void)
+{
+	unsigned long reg;
+	psw_t wait_psw;
+
+	wait_psw.mask = 0x0706000180000000;
+	asm volatile (
+		"    larl  %0,0f\n"
+		"    stg   %0,8(%1)\n"
+		"    lpswe 0(%1)\n"
+		"0:"
+		: "=&a" (reg) : "a" (&wait_psw) : "memory", "cc" );
+}
+
+/*
  * Function to drop a processor into disabled wait state
  */
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)