source: vendor/gcc/3.3.5/libjava/sysdep/ia64.c

Last change on this file was 2, checked in by bird, 22 years ago

Initial revision

  • Property cvs2svn:cvs-rev set to 1.1
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 2.6 KB
Line 
1/* Copyright (C) 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
2 2000 Free Software Foundation, Inc.
3
4This file is part of GNU CC.
5
6GNU CC is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 2, or (at your option)
9any later version.
10
11GNU CC is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with GNU CC; see the file COPYING. If not, write to
18the Free Software Foundation, 59 Temple Place - Suite 330,
19Boston, MA 02111-1307, USA. */
20
21/* As a special exception, if you link this library with other files,
22 some of which are compiled with GCC, to produce an executable,
23 this library does not by itself cause the resulting executable
24 to be covered by the GNU General Public License.
25 This exception does not however invalidate any other reasons why
26 the executable file might be covered by the GNU General Public License. */
27
28#include <stddef.h>
29#include <memory.h>
30
31#define IA64_UNWIND_INFO
32#include "ia64-frame.h"
33
34static int
35ia64_backtrace_helper (void **array, void *throw_pc,
36 ia64_frame_state *throw_frame,
37 ia64_frame_state *frame, void *bsp, int size)
38{
39 void *pc = NULL;
40 int frame_count = 0;
41 unwind_info_ptr *info;
42
43 asm volatile ("flushrs"); /* Make the local register stacks available. */
44
45 /* Start at our stack frame, get our state. */
46 info = build_ia64_frame_state (throw_pc, throw_frame, bsp, NULL);
47
48 memcpy (frame, throw_frame, sizeof (*frame));
49
50 while (info && frame_count < size)
51 {
52 pc = array[frame_count++] = get_real_reg_value (&frame->rp);
53 --pc;
54 bsp = calc_caller_bsp
55 ((long)get_real_reg_value (&frame->pfs), frame->my_bsp);
56 info = build_ia64_frame_state (pc, frame, bsp, NULL);
57 if (frame->rp.loc_type == IA64_UNW_LOC_TYPE_NONE) /* We've finished. */
58 break;
59 }
60
61 return frame_count;
62}
63
64int
65_Jv_ia64_backtrace (void **array, int size)
66{
67 ia64_frame_state my_frame;
68 ia64_frame_state originator; /* For the context handler is in. */
69 void *bsp;
70
71 /* Do any necessary initialization to access arbitrary stack frames.
72 This forces gcc to save memory in our stack frame for saved
73 registers. */
74 __builtin_unwind_init ();
75
76label_ia64:
77 bsp = __builtin_ia64_bsp ();
78
79 return ia64_backtrace_helper (array, &&label_ia64, &my_frame,
80 &originator, bsp, size);
81}
Note: See TracBrowser for help on using the repository browser.