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

Subversion Repositories or1k_soc_on_altera_embedded_dev_kit

[/] [or1k_soc_on_altera_embedded_dev_kit/] [trunk/] [linux-2.6/] [linux-2.6.24/] [include/] [asm-or32/] [or32-hf.h] - Blame information for rev 7

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 7 xianfeng
/*
2
 * or32 helper functions
3
 *
4
 */
5
 
6
#ifndef _OR32_OR32_HF_H
7
#define _OR32_OR32_HF_H
8
 
9
#include <linux/kernel.h>
10
#include <linux/module.h>
11
#include <linux/sched.h>
12
 
13
extern int __phx_signal__;
14
#define phx_signal(fmt, args...)                                \
15
        if (__phx_signal__)                                     \
16
            printk("__SIGN__ :: %s: %d: %s() :: " fmt "\n",     \
17
                           __FILE__, __LINE__, __FUNCTION__, ##args);
18
 
19
extern int __phx_warn__;
20
#define phx_warn(fmt, args...)                                  \
21
        if (__phx_warn__)                                       \
22
            printk("__WARN__ :: %s: %d: %s() :: " fmt "\n",     \
23
                           __FILE__, __LINE__, __FUNCTION__, ##args);
24
 
25
extern int __phx_mmu__;
26
#define phx_mmu(fmt, args...)                                   \
27
        if (__phx_mmu__)                                        \
28
            printk("__xMMU__ :: %s: %d: %s() :: " fmt "\n",     \
29
                           __FILE__, __LINE__, __FUNCTION__, ##args);
30
 
31
#define __PHX_DEBUG__
32
#ifdef __PHX_DEBUG__
33
extern int __phx_debug__;
34
# define phx_printk(fmt, args...)                               \
35
        if (__phx_debug__)                                      \
36
            printk("__PHX__ :: %s: %d: %s() :: " fmt "\n",      \
37
                           __FILE__, __LINE__, __FUNCTION__, ##args);
38
#else /* __PHX_DEBUG__ */
39
# define phx_printk(fmt, args...)
40
#endif /* __PHX_DEBUG__ */
41
 
42
 
43
#include <asm/processor.h>        // pt_regs
44
 
45
static __inline__ void check_stack(struct pt_regs *regs, const char *file,
46
                                   const char *function, int line)
47
{
48
#ifdef CONFIG_DEBUG_STACKOVERFLOW
49
        unsigned long esp;
50
        extern void show_registers(struct pt_regs *regs);
51
 
52
        __asm__ __volatile__ ("l.addi %0,r1,0" : "=r" (esp));
53
        if(unlikely((esp & ~(TASK_SIZE - 1)) != (current_thread_info()->ksp & ~(TASK_SIZE - 1)))) {
54
                printk("%s:%d: %s(): stack switch, old: %lx, new: %lx\n",
55
                       file, line, function,
56
                       current_thread_info()->ksp, esp);
57
                show_registers(regs);
58
                show_stack(NULL, (unsigned long *)esp);
59
                __asm__ __volatile__("l.nop 1");
60
        }
61
 
62
        esp &= TASK_SIZE - 1;
63
        if (unlikely(esp < (sizeof(struct task_struct) + 1024))) {
64
 
65
                printk("%s:%d: %s(): stack overflow: %ld\n",
66
                       file, line, function,
67
                       esp - sizeof(struct task_struct));
68
                __asm__ __volatile__ ("l.addi %0,r1,%1" : "=r" (esp) : "K" (0));
69
                show_registers(regs);
70
                show_stack(NULL, (unsigned long *)esp);
71
                __asm__ __volatile__("l.nop 1");
72
        }
73
#endif
74
}
75
 
76
#endif /* _OR32_OR32_HF_H */

powered by: WebSVN 2.1.0

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