Annotation of kernel/machdep/i386/bios_asm.s, revision 1.1.1.1

1.1       root        1: /*
                      2:  * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
                      3:  *
                      4:  * @APPLE_LICENSE_HEADER_START@
                      5:  * 
                      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
                     12:  * this file.
                     13:  * 
                     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
                     20:  * under the License.
                     21:  * 
                     22:  * @APPLE_LICENSE_HEADER_END@
                     23:  */
                     24: 
                     25: /*
                     26:  * Copyright 1993 NeXT Computer, Inc.
                     27:  * All rights reserved.
                     28:  *
                     29:  * Harness for calling protected-mode BIOS functions.
                     30:  */
                     31: 
                     32: #import <machdep/i386/asm.h>
                     33: #import <assym.h>
                     34: 
                     35: #define data32 .byte 0x66
                     36: #define addr32 .byte 0x67
                     37: 
                     38: #define O_INT  0
                     39: #define O_EAX  4
                     40: #define O_EBX  8
                     41: #define O_ECX  12
                     42: #define O_EDX  16
                     43: #define O_EDI  20
                     44: #define O_ESI  24
                     45: #define O_EBP  28
                     46: #define O_CS   32
                     47: #define O_DS   34
                     48: #define O_ES   36
                     49: #define O_FLG  40
                     50: #define O_ADDR 44
                     51: 
                     52: .data
                     53: .align 2
                     54: save_es:
                     55:        .long 0
                     56: save_eax:
                     57:        .long 0
                     58: save_edx:
                     59:        .long 0
                     60: save_flag:
                     61:        .long 0
                     62: new_eax:
                     63:        .long 0
                     64: new_edx:
                     65:        .long 0
                     66: 
                     67: .text  
                     68: ENTRY(_bios32)
                     69:        enter   $0,$0
                     70:        pushal
                     71:        push %es
                     72:        push %fs
                     73:        push %gs
                     74:        pushf
                     75:        
                     76:        movl    8(%ebp), %edx           // address of save area
                     77:        
                     78:        movw    O_CS(%edx), %ax
                     79:        movw    %ax, save_seg
                     80:        movl    O_ADDR(%edx), %eax
                     81:        movl    %eax, save_addr
                     82:        movl    O_EBX(%edx), %ebx
                     83:        movl    O_ECX(%edx), %ecx
                     84:        movl    O_EDI(%edx), %edi
                     85:        movl    O_ESI(%edx), %esi
                     86:        movl    O_EBP(%edx), %ebp
                     87:        movl    %edx, save_edx
                     88:        movl    O_EAX(%edx), %eax
                     89:        movl    %eax, new_eax
                     90:        movl    O_EDX(%edx), %eax
                     91:        movl    %eax, new_edx
                     92:        movw    O_DS(%edx), %ax
                     93:        pushw   %ax
                     94: 
                     95:        movl    new_eax, %eax
                     96:        mov     new_edx, %edx
                     97:        popw    %ds
                     98: 
                     99:        cli
                    100:        .byte   0x9A                    // far jmp
                    101: save_addr:
                    102:        .long 0
                    103: save_seg:
                    104:        .word 0
                    105: 
                    106:        pushf
                    107:        mov     $KDSSEL, %eax
                    108:        mov     %ax, %ds
                    109: 
                    110: 
                    111:        movl    %eax, save_eax
                    112:        popl    %eax
                    113:        movw    %ax, save_flag
                    114:        movw    %es, %ax
                    115:        movw    %ax, save_es
                    116:        
                    117:        movl    %edx, new_edx           // save new edx before clobbering
                    118:        movl    save_edx, %edx
                    119:        movl    new_edx, %eax           // now move it into buffer
                    120:        movl    %eax, O_EDX(%edx)
                    121:        movl    save_eax, %eax
                    122:        movl    %eax, O_EAX(%edx)
                    123:        movw    save_es, %ax
                    124:        movw    %ax, O_ES(%edx)
                    125:        movw    save_flag, %ax
                    126:        movw    %ax, O_FLG(%edx)
                    127:        movl    %ebx, O_EBX(%edx)
                    128:        movl    %ecx, O_ECX(%edx)
                    129:        movl    %edi, O_EDI(%edx)
                    130:        movl    %esi, O_ESI(%edx)
                    131:        movl    %ebp, O_EBP(%edx)
                    132: 
                    133:        popf
                    134:        pop %gs
                    135:        pop %fs
                    136:        pop %es
                    137:        
                    138:        popal
                    139:        leave
                    140:        
                    141:        ret
                    142:        
                    143:        

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.