1 /* $NetBSD: biosmemx.S,v 1.9 2008/10/14 14:18:11 ad Exp $ */
4 * Copyright (c) 1997, 1999
5 * Matthias Drochner. All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 #include <machine/asm.h>
33 /* int getextmem2(int buffer[2])
34 return: 0=OK, -1=error
35 buffer[0]: extmem kBytes below 16M (max 15M/1024)
36 buffer[1]: extmem above 16M, in 64k units
47 call _C_LABEL(prot_to_real)
57 jz 1f /* if zero use configured values */
58 movw %cx, %ax /* k below 16M (max 0x3c00 = 15MB) */
59 movw %dx, %bx /* 64k above 16M */
64 calll _C_LABEL(real_to_prot)
84 /* int getmementry(int *iterator, buffer[5])
85 return: 0=ok, else error
86 buffer[0]: start of memory chunk
87 buffer[2]: length (bytes)
100 movl 0(%eax), %ebx /* index */
101 movl $20, %ecx /* Buffer size */
102 movl $0x534d4150, %edx /* "SMAP" */
103 movl 12(%ebp), %edi /* buffer address */
105 call _C_LABEL(prot_to_real)
114 and $0xf, %di /* buffer addres now in ES:DI */
116 movl $0xe820, %eax /* Some BIOS check EAX value */
121 calll _C_LABEL(real_to_prot)
125 movl %ebx, 0(%eax) /* updated index */
138 return: 0=ok, else error
149 call _C_LABEL(prot_to_real)
156 calll _C_LABEL(real_to_prot)