2 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
7 * Reserved. This file contains Original Code and/or Modifications of
8 * Original Code as defined in and that are subject to the Apple Public
9 * Source License Version 1.1 (the "License"). You may not use this file
10 * except in compliance with the License. Please obtain a copy of the
11 * License at http://www.apple.com/publicsource and read it before using
14 * The Original Code and all software distributed under the License are
15 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
16 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
17 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE OR NON- INFRINGEMENT. Please see the
19 * License for the specific language governing rights and limitations
22 * @APPLE_LICENSE_HEADER_END@
25 * Copyright 1993 NeXT Computer, Inc.
26 * All rights reserved.
28 * Harness for calling real-mode BIOS functions.
31 #include "legacy/asm.h"
33 #define data32 .byte 0x66
34 #define addr32 .byte 0x67
60 /*============================================================================
61 * Call real-mode BIOS INT functions.
68 movl 8(%ebp), %edx // address of save area
69 movb O_INT(%edx), %al // save int number
72 movl O_EBX(%edx), %ebx
73 movl O_ECX(%edx), %ecx
74 movl O_EDI(%edx), %edi
75 movl O_ESI(%edx), %esi
76 movl O_EBP(%edx), %ebp
78 movl O_EAX(%edx), %eax
80 movl O_EDX(%edx), %eax
85 call EXT(_prot_to_real)
103 popl %eax // actually pop %ax
105 movl %eax, save_flag // actually movw
108 movl %eax, save_es // actually movw
110 call EXT(_real_to_prot)
112 movl %edx, new_edx // save new edx before clobbering
114 movl new_edx, %eax // now move it into buffer
115 movl %eax, O_EDX(%edx)
117 movl %eax, O_EAX(%edx)
121 movw %ax, O_FLG(%edx)
122 movl %ebx, O_EBX(%edx)
123 movl %ecx, O_ECX(%edx)
124 movl %edi, O_EDI(%edx)
125 movl %esi, O_ESI(%edx)
126 movl %ebp, O_EBP(%edx)
133 /*============================================================================
134 * Determines the total system memory size using various BIOS Int 15 calls.
138 enter $0, $0 # create frame pointer (32 bit operand/stack)
139 pushal # save all registers
141 movl 8(%ebp), %ebx # push input structure pointer to stack
144 call EXT(_prot_to_real) # switch to real mode
146 ##################################################################
148 # Do not forget the opcode overrides, since the assembler
149 # does not know we have made a transition to 16-bit operation.
150 ##################################################################
153 movl $0xE801, %eax # Get memory size
160 movl $0xDA88, %eax # Get memory size
166 movb $0x8A, %ah # Get memory size
172 movb $0x88, %ah # Get memory size
178 xorl %edx, %edx # Error, cannot get memory size
184 pushl %eax # Push EAX to 32-bit stack
187 call EXT(_real_to_prot) # Back to protected mode. EAX is modified.
189 ##################################################################
190 # Back to protected mode.
191 ##################################################################
193 popl %eax # Pop EAX from stack
194 popl %ebx # Pop pointer to register structure
196 # Copy the result to the input structure pointed to by a pointer
197 # which is on top of the stack. Write register EAX and EDX to the
200 movl %eax, O_EAX(%ebx)
201 movl %edx, O_EDX(%ebx)
203 popal # restore all registers
204 leave # undo enter operator
215 movl $1024, %ebx # Add in 1M