OpenCores
URL https://opencores.org/ocsvn/scarts/scarts/trunk

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [libjava/] [sysdep/] [ia64.c] - Blame information for rev 14

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 14 jlechner
/* Copyright (C) 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
2
   2000 Free Software Foundation, Inc.
3
 
4
This file is part of GNU CC.
5
 
6
GNU CC is free software; you can redistribute it and/or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation; either version 2, or (at your option)
9
any later version.
10
 
11
GNU CC is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
GNU General Public License for more details.
15
 
16
You should have received a copy of the GNU General Public License
17
along with GNU CC; see the file COPYING.  If not, write to
18
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
19
Boston, MA 02110-1301, 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
 
34
static int
35
ia64_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
 
64
int
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
 
76
label_ia64:
77
  bsp = __builtin_ia64_bsp ();
78
 
79
  return ia64_backtrace_helper (array, &&label_ia64, &my_frame,
80
                                &originator, bsp, size);
81
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.