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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [arch/] [sparc64/] [lib/] [mcount.S] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1275 phoenix
/*
2
 * Copyright (C) 2000 Anton Blanchard (anton@linuxcare.com)
3
 *
4
 * This file implements mcount(), which is used to collect profiling data.
5
 * This can also be tweaked for kernel stack overflow detection.
6
 */
7
 
8
#include 
9
#include 
10
 
11
#include 
12
#include 
13
 
14
/*
15
 * This is the main variant and is called by C code.  GCC's -pg option
16
 * automatically instruments every C function with a call to this.
17
 */
18
 
19
#ifdef CONFIG_STACK_DEBUG
20
 
21
#define OVSTACKSIZE     4096            /* lets hope this is enough */
22
 
23
        .data
24
        .align          8
25
panicstring:
26
        .asciz          "Stack overflow\n"
27
        .align          8
28
ovstack:
29
        .skip           OVSTACKSIZE
30
#endif
31
        .text
32
        .align 32
33
        .globl mcount
34
mcount:
35
#ifdef CONFIG_STACK_DEBUG
36
        /*
37
         * Check whether %sp is dangerously low.
38
         */
39
        ldub            [%g6 + AOFF_task_thread + AOFF_thread_fpdepth], %g1
40
        srl             %g1, 1, %g5
41
        add             %g5, 1, %g5
42
        sllx            %g5, 8, %g5                     ! each fpregs frame is 256b
43
        add             %g5, 192, %g5
44
        add             %g6, %g5, %g5                   ! where does task_struct+frame end?
45
        sub             %g5, STACK_BIAS, %g5
46
        cmp             %sp, %g5
47
        bg,pt           %xcc, 1f
48
         sethi          %hi(panicstring), %g5
49
        sethi           %hi(ovstack), %g7               ! cant move to panic stack fast enough
50
         or             %g7, %lo(ovstack), %g7
51
        add             %g7, OVSTACKSIZE, %g7
52
        sub             %g7, STACK_BIAS, %g7
53
        mov             %g7, %sp
54
        call            prom_printf
55
         or             %g5, %lo(panicstring), %o0
56
        call            prom_halt
57
         nop
58
#endif
59
1:      retl
60
         nop

powered by: WebSVN 2.1.0

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