Subversion Repositories shark

Rev

Rev 313 | 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 */
40
    extern void _x_callBIOS(void);
41
    X_CALLBIOS *xbc = x_bios_address();
451 giacomo 42
    #ifdef __APIC__
43
      DWORD msr1 = 0,msr2 = 0;
44
    #endif
2 pj 45
 
46
    /* Send interrupt request & register through the X_Info structure */
83 pj 47
    xbc->_irqno = service;
48
    memcpy(&(xbc->_ir),in,sizeof(X_REGS16));
49
    memcpy(&(xbc->_sr),s,sizeof(X_SREGS16));
313 giacomo 50
    #ifdef __APIC__
51
      rdmsr(APIC_BASE_MSR,msr1,msr2);
52
      disable_APIC_timer();    
53
    #endif
2 pj 54
    /* Back to RM to execute the BIOS routine */
55
    _x_callBIOS();
56
 
57
    /* Get the return register values */
313 giacomo 58
    #ifdef __APIC__
59
      wrmsr(APIC_BASE_MSR,msr1,msr2);
60
      enable_APIC_timer();
61
    #endif
83 pj 62
    memcpy(out,&(xbc->_or),sizeof(X_REGS16));
63
    memcpy(s,&(xbc->_sr),sizeof(X_SREGS16));
2 pj 64
}