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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rc203soc/] [sw/] [uClinux/] [include/] [asm-armnommu/] [proc-armo/] [processor.h] - Blame information for rev 1777

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1633 jcastillo
/*
2
 * linux/include/asm-arm/proc-arm2/processor.h
3
 *
4
 * Copyright (c) 1996 Russell King.
5
 *
6
 * Changelog:
7
 *  27-06-1996  RMK     Created
8
 *  10-10-1996  RMK     Brought up to date with SA110
9
 *  26-09-1996  RMK     Added 'EXTRA_THREAD_STRUCT*'
10
 *  28-09-1996  RMK     Moved start_thread into the processor dependencies
11
 */
12
#ifndef __ASM_PROC_PROCESSOR_H
13
#define __ASM_PROC_PROCESSOR_H
14
 
15
#ifdef __KERNEL__
16
 
17
#include <asm/assembler.h>
18
#include <linux/string.h>
19
 
20
#ifndef GFP_KERNEL
21
#define GFP_KERNEL 0x03
22
#endif
23
void * kmalloc(unsigned int size, int priority);
24
void kfree(void * obj);
25
 
26
#define KERNEL_STACK_SIZE 4096
27
 
28
extern __inline__ unsigned long alloc_kernel_stack(void)
29
{
30
    void *stk;
31
 
32
    stk = kmalloc (KERNEL_STACK_SIZE, GFP_KERNEL);
33
    if (stk)
34
        memzero (stk, KERNEL_STACK_SIZE);
35
    return (unsigned long)stk;
36
}
37
 
38
extern __inline__ void free_kernel_stack(unsigned long stk)
39
{
40
    if (stk)
41
        kfree((void *)stk);
42
}
43
 
44
/*
45
 * on arm2,3 wp does not work
46
 */
47
#define wp_works_ok 0
48
#define wp_works_ok__is_a_macro /* for versions in ksyms.c */
49
 
50
struct context_save_struct {
51
        unsigned long r4;
52
        unsigned long r5;
53
        unsigned long r6;
54
        unsigned long r7;
55
        unsigned long r8;
56
        unsigned long r9;
57
        unsigned long fp;
58
        unsigned long pc;
59
};
60
 
61
#define EXTRA_THREAD_STRUCT                     \
62
        struct context_save_struct *save;       \
63
        unsigned long   memmap;                 \
64
        unsigned long   memcmap[256];
65
 
66
#define EXTRA_THREAD_STRUCT_INIT                \
67
        0,                                       \
68
        (unsigned long) swapper_pg_dir,         \
69
        { 0, }
70
 
71
DECLARE_THREAD_STRUCT;
72
 
73
/*
74
 * Return saved PC of a blocked thread.
75
 */
76
extern __inline__ unsigned long thread_saved_pc (struct thread_struct *t)
77
{
78
        if (t->save)
79
                return t->save->pc & PCMASK;
80
        else
81
                return 0;
82
}
83
 
84
extern __inline__ unsigned long get_css_fp (struct thread_struct *t)
85
{
86
        if (t->save)
87
                return t->save->fp;
88
        else
89
                return 0;
90
}
91
 
92
asmlinkage void ret_from_sys_call(void) __asm__("_ret_from_sys_call");
93
 
94
extern __inline__ void copy_thread_css (struct context_save_struct *save)
95
{
96
        save->r4 =
97
        save->r5 =
98
        save->r6 =
99
        save->r7 =
100
        save->r8 =
101
        save->r9 =
102
        save->fp = 0;
103
        save->pc = ((unsigned long)ret_from_sys_call) | SVC26_MODE;
104
}
105
 
106
/*
107
 * A hack to get round the problem of declaring current &
108
 * flush_tlb_mm
109
 */
110
#define start_thread(regs,pc,sp) start_thread_setup(regs, pc, sp); flush_tlb_mm(current->mm)
111
 
112
extern __inline__ void start_thread_setup(struct pt_regs * regs, unsigned long pc, unsigned long sp)
113
{
114
        unsigned long *stack = (unsigned long *)sp;
115
 
116
        /* Initialise all registers to zero */
117
        memzero(regs->uregs, sizeof (regs->uregs));
118
        regs->ARM_pc = pc;              /* pc */
119
        regs->ARM_sp = sp;              /* sp */
120
        regs->ARM_r2 = stack[2];        /* r2 (envp) */
121
        regs->ARM_r1 = stack[1];        /* r1 (argv) */
122
        regs->ARM_r0 = stack[0]; /* r0 (argc) */
123
}
124
 
125
#endif
126
 
127
#endif

powered by: WebSVN 2.1.0

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