Subversion Repositories shark

Rev

Rev 650 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 pj 1
/* Project:     OSLib
2
 * Description: The OS Construction Kit
3
 * Date:                1.6.2000
4
 * Idea by:             Luca Abeni & Gerardo Lamastra
5
 *
6
 * OSLib is an SO project aimed at developing a common, easy-to-use
7
 * low-level infrastructure for developing OS kernels and Embedded
8
 * Applications; it partially derives from the HARTIK project but it
9
 * currently is independently developed.
10
 *
11
 * OSLib is distributed under GPL License, and some of its code has
12
 * been derived from the Linux kernel source; also some important
13
 * ideas come from studying the DJGPP go32 extender.
14
 *
15
 * We acknowledge the Linux Community, Free Software Foundation,
16
 * D.J. Delorie and all the other developers who believe in the
17
 * freedom of software and ideas.
18
 *
19
 * For legalese, check out the included GPL license.
20
 */
21
 
22
/* System calls for X extender                          */
23
/* BIOS Call from X (Basic Reflection Service)          */
24
 
25
#include <ll/i386/hw-data.h>
26
#include <ll/i386/x-bios.h>
27
#include <ll/i386/mem.h>
28
 
313 giacomo 29
#include <ll/i386/advtimer.h>
30
#include <ll/i386/apic.h>
31
 
40 pj 32
FILE(X-BIOS);
2 pj 33
 
34
/* The interface between X (and 32 bit PM) and BIOS (which runs at 16 bits */
35
/* It works as int86() standard library call                               */
36
 
40 pj 37
void X_callBIOS(int service,X_REGS16 *in,X_REGS16 *out,X_SREGS16 *s)
2 pj 38
{
39
    /* Assembler gate JMP instruction */
660 giacomo 40
    extern unsigned char use_apic;
2 pj 41
    extern void _x_callBIOS(void);
42
    X_CALLBIOS *xbc = x_bios_address();
619 mauro 43
    DWORD msr1 = 0,msr2 = 0;
2 pj 44
 
45
    /* Send interrupt request & register through the X_Info structure */
83 pj 46
    xbc->_irqno = service;
47
    memcpy(&(xbc->_ir),in,sizeof(X_REGS16));
48
    memcpy(&(xbc->_sr),s,sizeof(X_SREGS16));
619 mauro 49
    if (use_apic) {
313 giacomo 50
      rdmsr(APIC_BASE_MSR,msr1,msr2);
51
      disable_APIC_timer();    
619 mauro 52
    }
2 pj 53
    /* Back to RM to execute the BIOS routine */
54
    _x_callBIOS();
55
 
56
    /* Get the return register values */
619 mauro 57
    if (use_apic) {
313 giacomo 58
      wrmsr(APIC_BASE_MSR,msr1,msr2);
59
      enable_APIC_timer();
619 mauro 60
    }
83 pj 61
    memcpy(out,&(xbc->_or),sizeof(X_REGS16));
62
    memcpy(s,&(xbc->_sr),sizeof(X_SREGS16));
2 pj 63
}