biosmemx.S revision 1.1.2.2 1 1.1.2.2 thorpej /* $NetBSD: biosmemx.S,v 1.1.2.2 1997/08/23 07:09:35 thorpej Exp $ */
2 1.1.2.2 thorpej
3 1.1.2.2 thorpej /*
4 1.1.2.2 thorpej * Copyright (c) 1997
5 1.1.2.2 thorpej * Matthias Drochner. All rights reserved.
6 1.1.2.2 thorpej *
7 1.1.2.2 thorpej * Redistribution and use in source and binary forms, with or without
8 1.1.2.2 thorpej * modification, are permitted provided that the following conditions
9 1.1.2.2 thorpej * are met:
10 1.1.2.2 thorpej * 1. Redistributions of source code must retain the above copyright
11 1.1.2.2 thorpej * notice, this list of conditions and the following disclaimer.
12 1.1.2.2 thorpej * 2. Redistributions in binary form must reproduce the above copyright
13 1.1.2.2 thorpej * notice, this list of conditions and the following disclaimer in the
14 1.1.2.2 thorpej * documentation and/or other materials provided with the distribution.
15 1.1.2.2 thorpej * 3. All advertising materials mentioning features or use of this software
16 1.1.2.2 thorpej * must display the following acknowledgement:
17 1.1.2.2 thorpej * This product includes software developed for the NetBSD Project
18 1.1.2.2 thorpej * by Matthias Drochner.
19 1.1.2.2 thorpej * 4. The name of the author may not be used to endorse or promote products
20 1.1.2.2 thorpej * derived from this software without specific prior written permission.
21 1.1.2.2 thorpej *
22 1.1.2.2 thorpej * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
23 1.1.2.2 thorpej * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24 1.1.2.2 thorpej * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25 1.1.2.2 thorpej * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
26 1.1.2.2 thorpej * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
27 1.1.2.2 thorpej * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 1.1.2.2 thorpej * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 1.1.2.2 thorpej * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 1.1.2.2 thorpej * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
31 1.1.2.2 thorpej * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 1.1.2.2 thorpej *
33 1.1.2.2 thorpej */
34 1.1.2.2 thorpej
35 1.1.2.2 thorpej #include <machine/asm.h>
36 1.1.2.2 thorpej
37 1.1.2.2 thorpej #define data32 .byte 0x66
38 1.1.2.2 thorpej
39 1.1.2.2 thorpej .text
40 1.1.2.2 thorpej
41 1.1.2.2 thorpej /* int getextmem2(int buffer[2])
42 1.1.2.2 thorpej return: 0=OK, -1=error
43 1.1.2.2 thorpej buffer[0]: extmem kBytes below 16M (max 15M/1024)
44 1.1.2.2 thorpej buffer[1]: extmem above 16M, in 64k units
45 1.1.2.2 thorpej */
46 1.1.2.2 thorpej ENTRY(getextmem2)
47 1.1.2.2 thorpej pushl %ebp
48 1.1.2.2 thorpej movl %esp,%ebp
49 1.1.2.2 thorpej pushl %ebx
50 1.1.2.2 thorpej pushl %ecx
51 1.1.2.2 thorpej pushl %edx
52 1.1.2.2 thorpej push %esi
53 1.1.2.2 thorpej push %edi
54 1.1.2.2 thorpej
55 1.1.2.2 thorpej call _C_LABEL(prot_to_real)
56 1.1.2.2 thorpej
57 1.1.2.2 thorpej data32
58 1.1.2.2 thorpej movl $0xe801, %eax
59 1.1.2.2 thorpej int $0x15
60 1.1.2.2 thorpej jc err2
61 1.1.2.2 thorpej
62 1.1.2.2 thorpej data32
63 1.1.2.2 thorpej movl $0, %ecx
64 1.1.2.2 thorpej jmp ok2
65 1.1.2.2 thorpej err2:
66 1.1.2.2 thorpej data32
67 1.1.2.2 thorpej movl $-1, %ecx
68 1.1.2.2 thorpej ok2:
69 1.1.2.2 thorpej data32
70 1.1.2.2 thorpej movl %eax, %edx
71 1.1.2.2 thorpej
72 1.1.2.2 thorpej data32
73 1.1.2.2 thorpej call _C_LABEL(real_to_prot)
74 1.1.2.2 thorpej
75 1.1.2.2 thorpej movl 8(%ebp), %eax
76 1.1.2.2 thorpej movl %edx, (%eax)
77 1.1.2.2 thorpej movl %ebx, 4(%eax)
78 1.1.2.2 thorpej
79 1.1.2.2 thorpej movl %ecx, %eax
80 1.1.2.2 thorpej
81 1.1.2.2 thorpej pop %edi
82 1.1.2.2 thorpej pop %esi
83 1.1.2.2 thorpej popl %edx
84 1.1.2.2 thorpej popl %ecx
85 1.1.2.2 thorpej popl %ebx
86 1.1.2.2 thorpej popl %ebp
87 1.1.2.2 thorpej ret
88 1.1.2.2 thorpej
89 1.1.2.2 thorpej /* int getmementry(int iterator, buffer[5])
90 1.1.2.2 thorpej return: new iterator, 0=end of list or error
91 1.1.2.2 thorpej buffer[0]: start of memory chunk
92 1.1.2.2 thorpej buffer[2]: length (bytes)
93 1.1.2.2 thorpej buffer[4]: type
94 1.1.2.2 thorpej */
95 1.1.2.2 thorpej ENTRY(getmementry)
96 1.1.2.2 thorpej pushl %ebp
97 1.1.2.2 thorpej movl %esp,%ebp
98 1.1.2.2 thorpej pushl %ebx
99 1.1.2.2 thorpej pushl %ecx
100 1.1.2.2 thorpej pushl %edx
101 1.1.2.2 thorpej push %esi
102 1.1.2.2 thorpej push %edi
103 1.1.2.2 thorpej
104 1.1.2.2 thorpej movl 8(%ebp), %ebx
105 1.1.2.2 thorpej movl $20, %ecx
106 1.1.2.2 thorpej movl $0x534d4150, %edx # "SMAP"
107 1.1.2.2 thorpej movl 12(%ebp), %edi
108 1.1.2.2 thorpej
109 1.1.2.2 thorpej call _C_LABEL(prot_to_real)
110 1.1.2.2 thorpej
111 1.1.2.2 thorpej data32
112 1.1.2.2 thorpej movl $0xe820, %eax
113 1.1.2.2 thorpej int $0x15
114 1.1.2.2 thorpej
115 1.1.2.2 thorpej jnc ok
116 1.1.2.2 thorpej data32
117 1.1.2.2 thorpej movl $0, %ebx
118 1.1.2.2 thorpej
119 1.1.2.2 thorpej ok:
120 1.1.2.2 thorpej data32
121 1.1.2.2 thorpej call _C_LABEL(real_to_prot)
122 1.1.2.2 thorpej
123 1.1.2.2 thorpej movl %ebx, %eax
124 1.1.2.2 thorpej
125 1.1.2.2 thorpej pop %edi
126 1.1.2.2 thorpej pop %esi
127 1.1.2.2 thorpej popl %edx
128 1.1.2.2 thorpej popl %ecx
129 1.1.2.2 thorpej popl %ebx
130 1.1.2.2 thorpej popl %ebp
131 1.1.2.2 thorpej ret
132