From 7b712748e94fadbcb9131c5c1b19caa3d360db5c Mon Sep 17 00:00:00 2001 From: Richard Braun Date: Mon, 3 Jun 2013 21:35:42 +0200 Subject: x86/tcb: new tcb_trace function This function dumps the stack trace of a thread from its TCB. In order to do that, the base pointer is now included in the TCB, along with the stack and instruction pointers. --- arch/x86/machine/tcb.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'arch/x86/machine/tcb.h') diff --git a/arch/x86/machine/tcb.h b/arch/x86/machine/tcb.h index 886237ee..bd0a793d 100644 --- a/arch/x86/machine/tcb.h +++ b/arch/x86/machine/tcb.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012 Richard Braun. + * Copyright (c) 2012, 2013 Richard Braun. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -31,6 +31,7 @@ * Architecture specific thread data. */ struct tcb { + unsigned long bp; unsigned long sp; unsigned long ip; }; @@ -81,6 +82,13 @@ tcb_switch(struct tcb *prev, struct tcb *next) tcb_context_switch(prev, next); } +/* + * Dump the stack trace of a TCB. + * + * The thread associated to the TCB should not be running. + */ +void tcb_trace(const struct tcb *tcb); + /* * Send a rescheduling interrupt to a remote processor. */ -- cgit v1.2.3