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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [newlib/] [newlib/] [libc/] [sys/] [go32/] [dosmem.S] - Blame information for rev 39

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

Line No. Rev Author Line
1 39 lampret
/* DOSMEM.S */
2
/*
3
** Copyright (C) 1993 C.W. Sandmann
4
**
5
** This file may be freely distributed as long as the author's name remains.
6
** Extender environment independent way to set up Real area 1Mb access.
7
** Procedure takes a single argument %eax which contains the real area offset.
8
** After call, access may be made with "%gs:(%eax)"
9
*/
10
        .text
11
        .align  2
12
        .globl dosmemsetup
13
dosmemsetup:                            /* no params, expected ASM call only */
14
        pushl   %eax
15
        movzwl  __core_select,%eax
16
        testl   %eax,%eax
17
        je      old_go32                /* Image run with pre-DPMI extender */
18
        movw    %ax,%gs                 /* Use real area selector */
19
        popl    %eax                    /* Plus real offset */
20
        andl    $0x0fffffff,%eax        /* Clear any linear access bits */
21
        ret
22
        .align  2,0x90
23
old_go32:
24
        push    %ds
25
        pop     %gs                     /* Use arena selector */
26
        popl    %eax
27
        orl     $0xe0000000,%eax        /* Plus linear access area */
28
        ret
29
 
30
        .align  2
31
        .globl _dosmemget
32
_dosmemget:                             /* long offset, long len, long *buf */
33
        push    %gs
34
        movl    8(%esp),%eax            /* offset */
35
        call    dosmemsetup
36
        movl    12(%esp),%ecx           /* length */
37
        movl    16(%esp),%edx           /* arena offset */
38
        pushl   %esi
39
        pushl   %edi
40
        movl    %eax,%esi
41
        movl    %edx,%edi
42
        push    %ds
43
        push    %es
44
        push    %ds
45
        pop     %es
46
        push    %gs
47
        pop     %ds
48
        cld
49
        rep
50
        movsb                           /* move ECX bytes from Real area */
51
        pop     %es
52
        pop     %ds
53
        popl    %edi
54
        popl    %esi
55
        pop     %gs
56
        ret
57
 
58
        .align  2
59
        .globl _dosmemput
60
_dosmemput:                             /* long *buf, long len, long offset */
61
        push    %gs
62
        movl    16(%esp),%eax           /* offset */
63
        call    dosmemsetup
64
        movl    12(%esp),%ecx           /* length */
65
        movl    8(%esp),%edx            /* arena offset */
66
        pushl   %esi
67
        pushl   %edi
68
        movl    %eax,%edi
69
        movl    %edx,%esi
70
        push    %es
71
        push    %gs
72
        pop     %es
73
        cld
74
        rep
75
        movsb                           /* move ECX bytes to Real area */
76
        pop     %es
77
        popl    %edi
78
        popl    %esi
79
        pop     %gs
80
        ret
81
 
82
        .align  2                       /* 8(bp)    12(bp)   16(bp)    20(bp)    24(bp) */
83
        .globl  _movedata               /* src_sel, src_ofs, dest_sel, dest_ofs, len    */
84
_movedata:
85
        pushl   %ebp
86
        movl    %esp,%ebp
87
        pushw   %ds
88
        pushw   %es
89
        pushl   %esi
90
        pushl   %edi
91
 
92
        movl    8(%ebp),%eax
93
        movw    %ax,%ds
94
        movl    12(%ebp),%esi
95
 
96
        movl    16(%ebp),%eax
97
        movw    %ax,%es
98
        movl    20(%ebp),%edi
99
 
100
        movl    24(%ebp),%ecx
101
        pushl   %ecx
102
        shrl    $2,%ecx
103
        jcxz    no_big_move
104
        rep
105
        movsl
106
no_big_move:
107
        popl    %ecx
108
        andl    $3,%ecx
109
        jcxz    no_little_move
110
        rep
111
        movsb
112
no_little_move:
113
 
114
        popl    %edi
115
        popl    %esi
116
        popw    %es
117
        popw    %ds
118
        leave
119
        ret
120
 

powered by: WebSVN 2.1.0

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