Index: kernel/generic/include/udebug/udebug.h
===================================================================
--- kernel/generic/include/udebug/udebug.h	(revision 0d21b534cf29b9b695f324a08426ec17d8c12aa5)
+++ kernel/generic/include/udebug/udebug.h	(revision 80487bc530704837cb7bf8a502bf18db19969479)
@@ -27,5 +27,5 @@
  */
 
-/** @addtogroup generic	
+/** @addtogroup generic
  * @{
  */
@@ -83,4 +83,15 @@
 UDEBUG_M_ARGS_READ,
 
+/** Read thread's userspace register state (istate_t).
+ *
+ * - ARG2 - thread identification
+ * - ARG3 - destination address in the caller's address space
+ *
+ * or, on error, retval will be
+ * - ENOENT - thread does not exist
+ * - EBUSY - register state not available
+ */
+UDEBUG_M_REGS_READ,
+
 /** Read the list of the debugged tasks's threads.
  *
@@ -122,5 +133,5 @@
 } udebug_method_t;
 
-				
+
 typedef enum {
 	UDEBUG_EVENT_FINISHED = 1,	/**< Debuging session has finished */
Index: kernel/generic/include/udebug/udebug_ops.h
===================================================================
--- kernel/generic/include/udebug/udebug_ops.h	(revision 0d21b534cf29b9b695f324a08426ec17d8c12aa5)
+++ kernel/generic/include/udebug/udebug_ops.h	(revision 80487bc530704837cb7bf8a502bf18db19969479)
@@ -49,4 +49,6 @@
 int udebug_args_read(thread_t *t, void **buffer);
 
+int udebug_regs_read(thread_t *t, void **buffer);
+
 int udebug_mem_read(unative_t uspace_addr, size_t n, void **buffer);
 
Index: kernel/generic/src/udebug/udebug_ipc.c
===================================================================
--- kernel/generic/src/udebug/udebug_ipc.c	(revision 0d21b534cf29b9b695f324a08426ec17d8c12aa5)
+++ kernel/generic/src/udebug/udebug_ipc.c	(revision 80487bc530704837cb7bf8a502bf18db19969479)
@@ -287,4 +287,45 @@
 	ipc_answer(&TASK->kb.box, call);
 }
+
+/** Receive a REGS_READ call.
+ *
+ * Reads the thread's register state (istate structure).
+ */
+static void udebug_receive_regs_read(call_t *call)
+{
+	thread_t *t;
+	unative_t uspace_addr;
+	unative_t to_copy;
+	void *buffer;
+	int rc;
+
+	t = (thread_t *) IPC_GET_ARG2(call->data);
+
+	rc = udebug_regs_read(t, &buffer);
+	if (rc < 0) {
+		IPC_SET_RETVAL(call->data, rc);
+		ipc_answer(&TASK->kb.box, call);
+		return;
+	}
+
+	/*
+	 * Make use of call->buffer to transfer data to caller's userspace
+	 */
+
+	uspace_addr = IPC_GET_ARG3(call->data);
+	to_copy = sizeof(istate_t);
+
+	IPC_SET_RETVAL(call->data, 0);
+	/* ARG1=dest, ARG2=size as in IPC_M_DATA_READ so that
+	   same code in process_answer() can be used 
+	   (no way to distinguish method in answer) */
+	IPC_SET_ARG1(call->data, uspace_addr);
+	IPC_SET_ARG2(call->data, to_copy);
+
+	call->buffer = buffer;
+
+	ipc_answer(&TASK->kb.box, call);
+}
+
 
 /** Process an MEM_READ call.
@@ -374,4 +415,7 @@
 		udebug_receive_args_read(call);
 		break;
+	case UDEBUG_M_REGS_READ:
+		udebug_receive_regs_read(call);
+		break;
 	case UDEBUG_M_MEM_READ:
 		udebug_receive_mem_read(call);
Index: kernel/generic/src/udebug/udebug_ops.c
===================================================================
--- kernel/generic/src/udebug/udebug_ops.c	(revision 0d21b534cf29b9b695f324a08426ec17d8c12aa5)
+++ kernel/generic/src/udebug/udebug_ops.c	(revision 80487bc530704837cb7bf8a502bf18db19969479)
@@ -449,5 +449,8 @@
  * this function will fail with an EINVAL error code.
  *
- * @param buffer	The buffer for storing thread hashes.
+ * @param t		Thread where call arguments are to be read.
+ * @param buffer	Place to store pointer to new buffer.
+ * @return		EOK on success, ENOENT if @a t is invalid, EINVAL
+ *			if thread state is not valid for this operation.
  */
 int udebug_args_read(thread_t *t, void **buffer)
@@ -481,4 +484,48 @@
 }
 
+/** Read the register state of the thread.
+ *
+ * The contents of the thread's istate structure are copied to a newly
+ * allocated buffer and a pointer to it is written to @a buffer. The size of
+ * the buffer will be sizeof(istate_t).
+ *
+ * Currently register state cannot be read if the thread is inside a system
+ * call (as opposed to an exception). This is an implementation limit.
+ *
+ * @param t		Thread whose state is to be read.
+ * @param buffer	Place to store pointer to new buffer.
+ * @return		EOK on success, ENOENT if @a t is invalid, EINVAL
+ *			if thread is not in valid state, EBUSY if istate
+ *			is not available.
+ */
+int udebug_regs_read(thread_t *t, void **buffer)
+{
+	istate_t *state, *state_buf;
+	int rc;
+
+	/* Prepare a buffer to hold the data. */
+	state_buf = malloc(sizeof(istate_t), 0);
+
+	/* On success, this will lock t->udebug.lock */
+	rc = _thread_op_begin(t, false);
+	if (rc != EOK) {
+		return rc;
+	}
+
+	state = t->udebug.uspace_state;
+	if (state == NULL) {
+		_thread_op_end(t);
+		return EBUSY;
+	}
+
+	/* Copy to the allocated buffer */
+	memcpy(state_buf, state, sizeof(istate_t));
+
+	_thread_op_end(t);
+
+	*buffer = (void *) state_buf;
+	return 0;
+}
+
 /** Read the memory of the debugged task.
  *
Index: uspace/app/taskdump/taskdump.c
===================================================================
--- uspace/app/taskdump/taskdump.c	(revision 0d21b534cf29b9b695f324a08426ec17d8c12aa5)
+++ uspace/app/taskdump/taskdump.c	(revision 80487bc530704837cb7bf8a502bf18db19969479)
@@ -41,4 +41,5 @@
 #include <task.h>
 #include <kernel/mm/as.h>
+#include <libarch/istate.h>
 #include <macros.h>
 #include <assert.h>
@@ -58,4 +59,5 @@
 static void print_syntax();
 static int threads_dump(void);
+static int thread_dump(uintptr_t thash);
 static int areas_dump(void);
 static int area_dump(as_area_info_t *area);
@@ -229,4 +231,6 @@
 	for (i = 0; i < n_threads; i++) {
 		printf(" [%d] hash: 0x%lx\n", 1+i, thash_buf[i]);
+
+		thread_dump(thash_buf[i]);
 	}
 	putchar('\n');
@@ -291,4 +295,26 @@
 }
 
+static int thread_dump(uintptr_t thash)
+{
+	istate_t istate;
+	uintptr_t pc, fp;
+	int rc;
+
+	rc = udebug_regs_read(phoneid, thash, &istate);
+	if (rc < 0) {
+		printf("Failed reading registers (%d).\n", rc);
+		return EIO;
+	}
+
+	pc = istate_get_pc(&istate);
+	fp = istate_get_fp(&istate);
+
+	printf("Thread 0x%lx crashed at PC 0x%lx. FP 0x%lx\n", thash, pc, fp);
+	printf("Istate hexdump:\n");
+	hex_dump(0, &istate, (sizeof(istate_t) + 15) & ~15);
+
+	return EOK;
+}
+
 static int area_dump(as_area_info_t *area)
 {
Index: uspace/lib/libc/arch/amd64/include/istate.h
===================================================================
--- uspace/lib/libc/arch/amd64/include/istate.h	(revision 80487bc530704837cb7bf8a502bf18db19969479)
+++ uspace/lib/libc/arch/amd64/include/istate.h	(revision 80487bc530704837cb7bf8a502bf18db19969479)
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2010 Jiri Svoboda
+ * 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.
+ */
+
+/** @addtogroup libcamd64
+ * @{
+ */
+/** @file
+ */
+
+#ifndef LIBC_amd64_ISTATE_H_
+#define LIBC_amd64_ISTATE_H_
+
+#include <sys/types.h>
+
+/** Interrupt context.
+ *
+ * This is a copy of the kernel definition with which it must be kept in sync.
+ */
+typedef struct istate {
+	uint64_t rax;
+	uint64_t rcx;
+	uint64_t rdx;
+	uint64_t rsi;
+	uint64_t rdi;
+	uint64_t r8;
+	uint64_t r9;
+	uint64_t r10;
+	uint64_t r11;
+	uint64_t rbp;
+	uint64_t error_word;
+	uint64_t rip;
+	uint64_t cs;
+	uint64_t rflags;
+	uint64_t stack[]; /* Additional data on stack */
+} istate_t;
+
+static inline uintptr_t istate_get_pc(istate_t *istate)
+{
+	return istate->rip;
+}
+
+static inline uintptr_t istate_get_fp(istate_t *istate)
+{
+	return istate->rbp;
+}
+
+#endif
+
+/** @}
+ */
Index: uspace/lib/libc/arch/arm32/include/istate.h
===================================================================
--- uspace/lib/libc/arch/arm32/include/istate.h	(revision 80487bc530704837cb7bf8a502bf18db19969479)
+++ uspace/lib/libc/arch/arm32/include/istate.h	(revision 80487bc530704837cb7bf8a502bf18db19969479)
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2010 Jiri Svoboda
+ * 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.
+ */
+
+/** @addtogroup libcarm32
+ * @{
+ */
+/** @file
+ */
+
+#ifndef LIBC_arm32__ISTATE_H_
+#define LIBC_arm32__ISTATE_H_
+
+#include <sys/types.h>
+
+/** Interrupt context.
+ *
+ * This is a copy of the kernel definition with which it must be kept in sync.
+ */
+typedef struct istate {
+	uint32_t spsr;
+	uint32_t sp;
+	uint32_t lr;
+
+	uint32_t r0;
+	uint32_t r1;
+	uint32_t r2;
+	uint32_t r3;
+	uint32_t r4;
+	uint32_t r5;
+	uint32_t r6;
+	uint32_t r7;
+	uint32_t r8;
+	uint32_t r9;
+	uint32_t r10;
+	uint32_t fp;
+	uint32_t r12;
+
+	uint32_t pc;
+} istate_t;
+
+static inline uintptr_t istate_get_pc(istate_t *istate)
+{
+	return istate->pc;
+}
+
+static inline uintptr_t istate_get_fp(istate_t *istate)
+{
+	return istate->fp;
+}
+
+#endif
+
+/** @}
+ */
Index: uspace/lib/libc/arch/ia32/include/istate.h
===================================================================
--- uspace/lib/libc/arch/ia32/include/istate.h	(revision 80487bc530704837cb7bf8a502bf18db19969479)
+++ uspace/lib/libc/arch/ia32/include/istate.h	(revision 80487bc530704837cb7bf8a502bf18db19969479)
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2010 Jiri Svoboda
+ * 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.
+ */
+
+/** @addtogroup debug
+ * @{
+ */
+/** @file
+ */
+
+#ifndef LIBC_ia32__ISTATE_H_
+#define LIBC_ia32__ISTATE_H_
+
+#include <sys/types.h>
+
+/** Interrupt context.
+ *
+ * This is a copy of the kernel definition with which it must be kept in sync.
+ */
+typedef struct istate {
+	uint32_t eax;
+	uint32_t ecx;
+	uint32_t edx;
+	uint32_t ebp;
+
+	uint32_t gs;
+	uint32_t fs;
+	uint32_t es;
+	uint32_t ds;
+
+	uint32_t error_word;
+	uint32_t eip;
+	uint32_t cs;
+	uint32_t eflags;
+	uint32_t stack[];
+} istate_t;
+
+static inline uintptr_t istate_get_pc(istate_t *istate)
+{
+	return istate->eip;
+}
+
+static inline uintptr_t istate_get_fp(istate_t *istate)
+{
+	return istate->ebp;
+}
+
+#endif
+
+/** @}
+ */
Index: uspace/lib/libc/arch/ia64/include/istate.h
===================================================================
--- uspace/lib/libc/arch/ia64/include/istate.h	(revision 80487bc530704837cb7bf8a502bf18db19969479)
+++ uspace/lib/libc/arch/ia64/include/istate.h	(revision 80487bc530704837cb7bf8a502bf18db19969479)
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2010 Jiri Svoboda
+ * 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.
+ */
+
+/** @addtogroup libcsparc64
+ * @{
+ */
+/** @file
+ */
+
+#ifndef LIBC_ia64_ISTATE_H_
+#define LIBC_ia64_ISTATE_H_
+
+#include <sys/types.h>
+
+/** Interrupt context.
+ *
+ * This is a copy of the kernel definition with which it must be kept in sync.
+ */
+typedef struct istate {
+	/* TODO */
+} istate_t;
+
+static inline uintptr_t istate_get_pc(istate_t *istate)
+{
+	/* TODO */
+	return 0;
+}
+
+static inline uintptr_t istate_get_fp(istate_t *istate)
+{
+	/* TODO */
+	return 0;
+}
+
+#endif
+
+/** @}
+ */
Index: uspace/lib/libc/arch/mips32/include/istate.h
===================================================================
--- uspace/lib/libc/arch/mips32/include/istate.h	(revision 80487bc530704837cb7bf8a502bf18db19969479)
+++ uspace/lib/libc/arch/mips32/include/istate.h	(revision 80487bc530704837cb7bf8a502bf18db19969479)
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2010 Jiri Svoboda
+ * 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.
+ */
+
+/** @addtogroup libcmips32
+ * @{
+ */
+/** @file
+ */
+
+#ifndef LIBC_mips32__ISTATE_H_
+#define LIBC_mips32__ISTATE_H_
+
+#include <sys/types.h>
+
+/** Interrupt context.
+ *
+ * This is a copy of the kernel definition with which it must be kept in sync.
+ */
+typedef struct istate {
+	uint32_t at;
+	uint32_t v0;
+	uint32_t v1;
+	uint32_t a0;
+	uint32_t a1;
+	uint32_t a2;
+	uint32_t a3;
+	uint32_t t0;
+	uint32_t t1;
+	uint32_t t2;
+	uint32_t t3;
+	uint32_t t4;
+	uint32_t t5;
+	uint32_t t6;
+	uint32_t t7;
+	uint32_t t8;
+	uint32_t t9;
+	uint32_t gp;
+	uint32_t sp;
+	uint32_t ra;
+
+	uint32_t lo;
+	uint32_t hi;
+
+	uint32_t status; /* cp0_status */
+	uint32_t epc; /* cp0_epc */
+	uint32_t k1; /* We use it as thread-local pointer */
+} istate_t;
+
+static inline uintptr_t istate_get_pc(istate_t *istate)
+{
+	return istate->epc;
+}
+
+static inline uintptr_t istate_get_fp(istate_t *istate)
+{
+	/* TODO */
+	return 0;
+}
+
+#endif
+
+/** @}
+ */
Index: uspace/lib/libc/arch/mips32eb/include/istate.h
===================================================================
--- uspace/lib/libc/arch/mips32eb/include/istate.h	(revision 80487bc530704837cb7bf8a502bf18db19969479)
+++ uspace/lib/libc/arch/mips32eb/include/istate.h	(revision 80487bc530704837cb7bf8a502bf18db19969479)
@@ -0,0 +1,1 @@
+../../mips32/include/istate.h
Index: uspace/lib/libc/arch/ppc32/include/istate.h
===================================================================
--- uspace/lib/libc/arch/ppc32/include/istate.h	(revision 80487bc530704837cb7bf8a502bf18db19969479)
+++ uspace/lib/libc/arch/ppc32/include/istate.h	(revision 80487bc530704837cb7bf8a502bf18db19969479)
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2010 Jiri Svoboda
+ * 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.
+ */
+
+/** @addtogroup libcppc32
+ * @{
+ */
+/** @file
+ */
+
+#ifndef LIBC_ppc32_ISTATE_H_
+#define LIBC_ppc32_ISTATE_H_
+
+#include <sys/types.h>
+
+/** Interrupt context.
+ *
+ * This is a copy of the kernel definition with which it must be kept in sync.
+ */
+typedef struct istate {
+	uint32_t r0;
+	uint32_t r2;
+	uint32_t r3;
+	uint32_t r4;
+	uint32_t r5;
+	uint32_t r6;
+	uint32_t r7;
+	uint32_t r8;
+	uint32_t r9;
+	uint32_t r10;
+	uint32_t r11;
+	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;
+	uint32_t pc;
+	uint32_t srr1;
+	uint32_t lr;
+	uint32_t ctr;
+	uint32_t xer;
+	uint32_t dar;
+	uint32_t r12;
+	uint32_t sp;
+} istate_t;
+
+static inline uintptr_t istate_get_pc(istate_t *istate)
+{
+	return istate->pc;
+}
+
+static inline uintptr_t istate_get_fp(istate_t *istate)
+{
+	return istate->sp;
+}
+
+#endif
+
+/** @}
+ */
Index: uspace/lib/libc/arch/sparc64/include/istate.h
===================================================================
--- uspace/lib/libc/arch/sparc64/include/istate.h	(revision 80487bc530704837cb7bf8a502bf18db19969479)
+++ uspace/lib/libc/arch/sparc64/include/istate.h	(revision 80487bc530704837cb7bf8a502bf18db19969479)
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2010 Jiri Svoboda
+ * 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.
+ */
+
+/** @addtogroup libcsparc64
+ * @{
+ */
+/** @file
+ */
+
+#ifndef LIBC_sparc64_ISTATE_H_
+#define LIBC_sparc64_ISTATE_H_
+
+#include <sys/types.h>
+
+/** Interrupt context.
+ *
+ * This is a copy of the kernel definition with which it must be kept in sync.
+ */
+typedef struct istate {
+	/* TODO */
+} istate_t;
+
+static inline uintptr_t istate_get_pc(istate_t *istate)
+{
+	/* TODO */
+	return 0;
+}
+
+static inline uintptr_t istate_get_fp(istate_t *istate)
+{
+	/* TODO */
+	return 0;
+}
+
+#endif
+
+/** @}
+ */
Index: uspace/lib/libc/generic/udebug.c
===================================================================
--- uspace/lib/libc/generic/udebug.c	(revision 0d21b534cf29b9b695f324a08426ec17d8c12aa5)
+++ uspace/lib/libc/generic/udebug.c	(revision 80487bc530704837cb7bf8a502bf18db19969479)
@@ -97,4 +97,10 @@
 }
 
+int udebug_regs_read(int phoneid, thash_t tid, void *buffer)
+{
+	return async_req_3_0(phoneid, IPC_M_DEBUG_ALL, UDEBUG_M_REGS_READ,
+	    tid, (sysarg_t)buffer);
+}
+
 int udebug_go(int phoneid, thash_t tid, udebug_event_t *ev_type,
     sysarg_t *val0, sysarg_t *val1)
Index: uspace/lib/libc/include/udebug.h
===================================================================
--- uspace/lib/libc/include/udebug.h	(revision 0d21b534cf29b9b695f324a08426ec17d8c12aa5)
+++ uspace/lib/libc/include/udebug.h	(revision 80487bc530704837cb7bf8a502bf18db19969479)
@@ -51,4 +51,5 @@
 int udebug_mem_read(int phoneid, void *buffer, uintptr_t addr, size_t n);
 int udebug_args_read(int phoneid, thash_t tid, sysarg_t *buffer);
+int udebug_regs_read(int phoneid, thash_t tid, void *buffer);
 int udebug_go(int phoneid, thash_t tid, udebug_event_t *ev_type,
 	sysarg_t *val0, sysarg_t *val1);
