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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [lib/] [libcpu/] [i386/] [cpu_asm.S] - Blame information for rev 666

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

Line No. Rev Author Line
1 30 unneback
/*  cpu_asm.S
2
 *
3
 *  This file contains all assembly code for the Intel i386 IDT
4
 *  manipulation.
5
 *
6
 *  COPYRIGHT (c) 1998 valette@crf.canon.fr
7
 *
8
 *  The license and distribution terms for this file may be
9
 *  found in the file LICENSE in this distribution or at
10
 *  http://www.OARcorp.com/rtems/license.html.
11
 *
12
 *  $Id: cpu_asm.S,v 1.2 2001-09-27 12:01:22 chris Exp $
13
 */
14
 
15
#include 
16
 
17
BEGIN_CODE
18
/*
19
 * C callable function enabling to get easilly usable info from
20
 * the actual value of IDT register.
21
 *
22
extern void i386_get_info_from_IDTR (interrupt_gate_descriptor** table,
23
                                     unsigned* limit);
24
 */
25
PUBLIC (i386_get_info_from_IDTR)
26
PUBLIC (i386_set_IDTR)
27
PUBLIC (i386_get_info_from_GDTR)
28
PUBLIC (i386_set_GDTR)
29
 
30
SYM (i386_get_info_from_IDTR):
31
        movl    4(esp), ecx         /* get location where table address */
32
                                    /*    must be stored */
33
        movl    8(esp), edx         /* get location table size must be stored */
34
 
35
        subl    $6, esp             /* let room to prepare 48 bit IDTR */
36
 
37
        sidt    (esp)               /* get 48 bit IDTR value */
38
 
39
        movl    2(esp), eax         /* get base */
40
        movl    eax, (ecx)
41
 
42
        movzwl  (esp), eax          /* get limit */
43
        movl    eax, (edx)
44
 
45
        addl    $6, esp             /* restore %esp */
46
        ret
47
 
48
/*
49
 * C callable function enabling to change the value of IDT register. Must be called
50
 * with inmterrupt masked at processor level!!!.
51
 *
52
extern void i386_set_IDTR (interrupt_gate_descriptor* table,
53
                           unsigned limit);
54
 */
55
SYM (i386_set_IDTR):
56
 
57
        leal    4(esp), edx         /* load in edx address of input */
58
                                    /*    parameter "table" */
59
 
60
        movl    (edx), eax          /* load base into eax */
61
        movl    4(edx), ecx         /* load limit into ecx */
62
 
63
        movw    cx, (edx)           /* prepare 48 bit pointer */
64
        movl    eax, 2(edx)
65
 
66
        lidt    (edx)
67
 
68
        ret
69
/*
70
 *
71
 * C callable function enabling to get easilly usable info from
72
 * the actual value of GDT register.
73
extern void i386_get_info_from_GDTR (segment_descriptors** table,
74
                                     unsigned* limit);
75
 */
76
 
77
SYM (i386_get_info_from_GDTR):
78
        movl    4(esp), ecx         /* get location where table address */
79
                                    /*    must be stored */
80
        movl    8(esp), edx         /* get location table size must be stored */
81
 
82
        subl    $6, esp             /* let room to prepare 48 bit GDTR */
83
 
84
        sgdt    (esp)               /* get 48 bit GDTR value */
85
 
86
        movl    2(esp), eax         /* get base */
87
        movl    eax, (ecx)
88
 
89
        movzwl  (esp), eax          /* get limit */
90
        movl    eax, (edx)
91
 
92
        addl    $6, esp             /* restore %esp */
93
        ret
94
 
95
/*
96
 * C callable function enabling to change the value of GDT register.
97
 * Must be called with interrupts masked at processor level!!!.
98
 *   extern void i386_set_GDTR (segment_descriptors*, unsigned limit);
99
 */
100
SYM (i386_set_GDTR):
101
 
102
        leal    4(esp), edx         /* load in edx address of input */
103
                                    /*   parameter "table" */
104
 
105
        movl    (edx), eax          /* load base into eax */
106
        movl    4(edx), ecx         /* load limit into ecx */
107
 
108
        movw    cx, (edx)           /* prepare 48 bit pointer */
109
        movl    eax, 2(edx)
110
 
111
        lgdt    (edx)
112
 
113
        ret
114
 
115
END_CODE
116
 
117
END

powered by: WebSVN 2.1.0

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