Annotation of Gnu-Mach/i386/pc/i16/i16_bios.h, revision 1.1.1.1

1.1       root        1: /* 
                      2:  * Copyright (c) 1995-1994 The University of Utah and
                      3:  * the Computer Systems Laboratory at the University of Utah (CSL).
                      4:  * All rights reserved.
                      5:  *
                      6:  * Permission to use, copy, modify and distribute this software is hereby
                      7:  * granted provided that (1) source code retains these copyright, permission,
                      8:  * and disclaimer notices, and (2) redistributions including binaries
                      9:  * reproduce the notices in supporting documentation, and (3) all advertising
                     10:  * materials mentioning features or use of this software display the following
                     11:  * acknowledgement: ``This product includes software developed by the
                     12:  * Computer Systems Laboratory at the University of Utah.''
                     13:  *
                     14:  * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS
                     15:  * IS" CONDITION.  THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF
                     16:  * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
                     17:  *
                     18:  * CSL requests users of this software to return to [email protected] any
                     19:  * improvements that they make and grant CSL redistribution rights.
                     20:  *
                     21:  *      Author: Bryan Ford, University of Utah CSL
                     22:  */
                     23: #ifndef _I16_BIOS_H_
                     24: #define _I16_BIOS_H_
                     25: 
                     26: #include <mach/inline.h>
                     27: 
                     28: 
                     29: MACH_INLINE void i16_bios_putchar(int c)
                     30: {
                     31:        asm volatile("int $0x10" : : "a" (0x0e00 | (c & 0xff)), "b" (0x07));
                     32: }
                     33: 
                     34: MACH_INLINE int i16_bios_getchar()
                     35: {
                     36:        int c;
                     37:        asm volatile("int $0x16" : "=a" (c) : "a" (0x0000));
                     38:        c &= 0xff;
                     39:        return c;
                     40: }
                     41: 
                     42: MACH_INLINE void i16_bios_warm_boot(void)
                     43: {
                     44:        asm volatile("
                     45:                cli
                     46:                movw    $0x40,%ax
                     47:                movw    %ax,%ds
                     48:                movw    $0x1234,0x72
                     49:                ljmp    $0xffff,$0x0000
                     50:        ");
                     51: }
                     52: 
                     53: MACH_INLINE void i16_bios_cold_boot(void)
                     54: {
                     55:        asm volatile("
                     56:                cli
                     57:                movw    $0x40,%ax
                     58:                movw    %ax,%ds
                     59:                movw    $0x0000,0x72
                     60:                ljmp    $0xffff,$0x0000
                     61:        ");
                     62: }
                     63: 
                     64: MACH_INLINE unsigned char i16_bios_copy_ext_mem(
                     65:        unsigned src_la, unsigned dest_la, unsigned short word_count)
                     66: {
                     67:        char buf[48];
                     68:        unsigned short i, rc;
                     69: 
                     70:        /* Initialize the descriptor structure.  */
                     71:        for (i = 0; i < sizeof(buf); i++)
                     72:                buf[i] = 0;
                     73:        *((unsigned short*)(buf+0x10)) = 0xffff; /* source limit */
                     74:        *((unsigned long*)(buf+0x12)) = src_la; /* source linear address */
                     75:        *((unsigned char*)(buf+0x15)) = 0x93; /* source access rights */
                     76:        *((unsigned short*)(buf+0x18)) = 0xffff; /* dest limit */
                     77:        *((unsigned long*)(buf+0x1a)) = dest_la; /* dest linear address */
                     78:        *((unsigned char*)(buf+0x1d)) = 0x93; /* dest access rights */
                     79: 
                     80: #if 0
                     81:        i16_puts("buf:");
                     82:        for (i = 0; i < sizeof(buf); i++)
                     83:                i16_writehexb(buf[i]);
                     84:        i16_puts("");
                     85: #endif
                     86: 
                     87:        /* Make the BIOS call to perform the copy.  */
                     88:        asm volatile("
                     89:                int     $0x15
                     90:        " : "=a" (rc)
                     91:          : "a" ((unsigned short)0x8700),
                     92:            "c" (word_count),
                     93:            "S" ((unsigned short)(unsigned)buf));
                     94: 
                     95:        return rc >> 8;
                     96: }
                     97: 
                     98: #endif _I16_BIOS_H_

unix.superglobalmegacorp.com

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