Index: uspace/lib/c/arch/ppc32/Makefile.inc
===================================================================
--- uspace/lib/c/arch/ppc32/Makefile.inc	(revision 33add3a8e1974ac8117cfbec11267a0c35a85660)
+++ uspace/lib/c/arch/ppc32/Makefile.inc	(revision d5955a53eec617134ad450413d1f304d4cfb6e70)
@@ -37,3 +37,6 @@
 	arch/$(UARCH)/src/stacktrace_asm.S
 
+ARCH_AUTOGENS_AG = \
+	arch/$(UARCH)/include/libarch/fibril_context.ag
+
 .PRECIOUS: arch/$(UARCH)/src/entry.o
Index: pace/lib/c/arch/ppc32/include/libarch/context_offset.h
===================================================================
--- uspace/lib/c/arch/ppc32/include/libarch/context_offset.h	(revision 33add3a8e1974ac8117cfbec11267a0c35a85660)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../../../../../../../kernel/arch/ppc32/include/arch/context_offset.h
Index: uspace/lib/c/arch/ppc32/include/libarch/fibril.h
===================================================================
--- uspace/lib/c/arch/ppc32/include/libarch/fibril.h	(revision 33add3a8e1974ac8117cfbec11267a0c35a85660)
+++ uspace/lib/c/arch/ppc32/include/libarch/fibril.h	(revision d5955a53eec617134ad450413d1f304d4cfb6e70)
@@ -37,4 +37,5 @@
 
 #include <sys/types.h>
+#include <libarch/fibril_context.h>
 
 #define SP_DELTA  16
@@ -53,32 +54,4 @@
 	} while (0)
 
-typedef struct {
-	uint32_t sp;
-	uint32_t pc;
-	
-	uint32_t tls;
-	uint32_t r13;
-	uint32_t r14;
-	uint32_t r15;
-	uint32_t r16;
-	uint32_t r17;
-	uint32_t r18;
-	uint32_t r19;
-	uint32_t r20;
-	uint32_t r21;
-	uint32_t r22;
-	uint32_t r23;
-	uint32_t r24;
-	uint32_t r25;
-	uint32_t r26;
-	uint32_t r27;
-	uint32_t r28;
-	uint32_t r29;
-	uint32_t r30;
-	uint32_t r31;
-	
-	uint32_t cr;
-} __attribute__ ((packed)) context_t;
-
 static inline uintptr_t context_get_fp(context_t *ctx)
 {
Index: uspace/lib/c/arch/ppc32/include/libarch/fibril_context.ag
===================================================================
--- uspace/lib/c/arch/ppc32/include/libarch/fibril_context.ag	(revision d5955a53eec617134ad450413d1f304d4cfb6e70)
+++ uspace/lib/c/arch/ppc32/include/libarch/fibril_context.ag	(revision d5955a53eec617134ad450413d1f304d4cfb6e70)
@@ -0,0 +1,134 @@
+# Copyright (c) 2014 Jakub Jermar 
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# - Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+# - Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in the
+#   documentation and/or other materials provided with the distribution.
+# - The name of the author may not be used to endorse or promote products
+#   derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+{
+        name : context,
+
+        includes : [
+                {
+                        include : <sys/types.h>
+                }
+        ],
+
+        members : [
+                {
+                        name : sp,
+                        type : uint32_t
+                },
+                {
+                        name : pc,
+                        type : uint32_t
+                },
+
+                {
+                        name : tls,
+                        type : uint32_t
+                },
+                {
+                        name : r13,
+                        type : uint32_t
+                },
+                {
+                        name : r14,
+                        type : uint32_t
+                },
+                {
+                        name : r15,
+                        type : uint32_t
+                },
+                {
+                        name : r16,
+                        type : uint32_t
+                },
+                {
+                        name : r17,
+                        type : uint32_t
+                },
+                {
+                        name : r18,
+                        type : uint32_t
+                },
+                {
+                        name : r19,
+                        type : uint32_t
+                },
+                {
+                        name : r20,
+                        type : uint32_t
+                },
+                {
+                        name : r21,
+                        type : uint32_t
+                },
+                {
+                        name : r22,
+                        type : uint32_t
+                },
+                {
+                        name : r23,
+                        type : uint32_t
+                },
+                {
+                        name : r24,
+                        type : uint32_t
+                },
+                {
+                        name : r25,
+                        type : uint32_t
+                },
+                {
+                        name : r26,
+                        type : uint32_t
+                },
+                {
+                        name : r27,
+                        type : uint32_t
+                },
+                {
+                        name : r28,
+                        type : uint32_t
+                },
+                {
+                        name : r29,
+                        type : uint32_t
+                },
+                {
+                        name : r30,
+                        type : uint32_t
+                },
+                {
+                        name : r31,
+                        type : uint32_t
+                },
+
+                {
+                        name : cr,
+                        type : uint32_t
+                }
+        ]
+}
+
Index: uspace/lib/c/arch/ppc32/src/fibril.S
===================================================================
--- uspace/lib/c/arch/ppc32/src/fibril.S	(revision 33add3a8e1974ac8117cfbec11267a0c35a85660)
+++ uspace/lib/c/arch/ppc32/src/fibril.S	(revision d5955a53eec617134ad450413d1f304d4cfb6e70)
@@ -33,14 +33,34 @@
 
 #include <libarch/regname.h>
-#include <libarch/context_offset.h>
+#include <libarch/fibril_context.h>
 
 context_save:
-	CONTEXT_SAVE_ARCH_CORE r3
+	stw sp, CONTEXT_OFFSET_SP(r3)
+	stw r2, CONTEXT_OFFSET_TLS(r3)
+	stw r13, CONTEXT_OFFSET_R13(r3)
+	stw r14, CONTEXT_OFFSET_R14(r3)
+	stw r15, CONTEXT_OFFSET_R15(r3)
+	stw r16, CONTEXT_OFFSET_R16(r3)
+	stw r17, CONTEXT_OFFSET_R17(r3)
+	stw r18, CONTEXT_OFFSET_R18(r3)
+	stw r19, CONTEXT_OFFSET_R19(r3)
+	stw r20, CONTEXT_OFFSET_R20(r3)
+	stw r21, CONTEXT_OFFSET_R21(r3)
+	stw r22, CONTEXT_OFFSET_R22(r3)
+	stw r23, CONTEXT_OFFSET_R23(r3)
+	stw r24, CONTEXT_OFFSET_R24(r3)
+	stw r25, CONTEXT_OFFSET_R25(r3)
+	stw r26, CONTEXT_OFFSET_R26(r3)
+	stw r27, CONTEXT_OFFSET_R27(r3)
+	stw r28, CONTEXT_OFFSET_R28(r3)
+	stw r29, CONTEXT_OFFSET_R29(r3)
+	stw r30, CONTEXT_OFFSET_R30(r3)
+	stw r31, CONTEXT_OFFSET_R31(r3)
 	
 	mflr r4
-	stw r4, OFFSET_PC(r3)
+	stw r4, CONTEXT_OFFSET_PC(r3)
 	
 	mfcr r4
-	stw r4, OFFSET_CR(r3)
+	stw r4, CONTEXT_OFFSET_CR(r3)
 	
 	# context_save returns 1
@@ -50,10 +70,30 @@
 
 context_restore:
-	CONTEXT_RESTORE_ARCH_CORE r3
+	lwz sp, CONTEXT_OFFSET_SP(r3)
+	lwz r2, CONTEXT_OFFSET_TLS(r3)
+	lwz r13, CONTEXT_OFFSET_R13(r3)
+	lwz r14, CONTEXT_OFFSET_R14(r3)
+	lwz r15, CONTEXT_OFFSET_R15(r3)
+	lwz r16, CONTEXT_OFFSET_R16(r3)
+	lwz r17, CONTEXT_OFFSET_R17(r3)
+	lwz r18, CONTEXT_OFFSET_R18(r3)
+	lwz r19, CONTEXT_OFFSET_R19(r3)
+	lwz r20, CONTEXT_OFFSET_R20(r3)
+	lwz r21, CONTEXT_OFFSET_R21(r3)
+	lwz r22, CONTEXT_OFFSET_R22(r3)
+	lwz r23, CONTEXT_OFFSET_R23(r3)
+	lwz r24, CONTEXT_OFFSET_R24(r3)
+	lwz r25, CONTEXT_OFFSET_R25(r3)
+	lwz r26, CONTEXT_OFFSET_R26(r3)
+	lwz r27, CONTEXT_OFFSET_R27(r3)
+	lwz r28, CONTEXT_OFFSET_R28(r3)
+	lwz r29, CONTEXT_OFFSET_R29(r3)
+	lwz r30, CONTEXT_OFFSET_R30(r3)
+	lwz r31, CONTEXT_OFFSET_R31(r3)
 	
-	lwz r4, OFFSET_CR(r3)
+	lwz r4, CONTEXT_OFFSET_CR(r3)
 	mtcr r4
 	
-	lwz r4, OFFSET_PC(r3)
+	lwz r4, CONTEXT_OFFSET_PC(r3)
 	mtlr r4
 	
