Subversion Repositories shark

Rev

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

Rev Author Line No. Line
132 giacomo 1
/*
2
Linux Real Mode Interface - A library of DPMI-like functions for Linux.
3
 
4
Copyright (C) 1998 by Josh Vanderhoof
5
 
6
You are free to distribute and modify this file, as long as you
7
do not remove this copyright notice and clearly label modified
8
versions as being modified.
9
 
10
This software has NO WARRANTY.  Use it at your own risk.
11
*/
12
 
13
#include <stdio.h>
14
#include <string.h>
15
#include <sys/types.h>
16
#include <unistd.h>
17
#include <fcntl.h>
18
#include <stdlib.h>
19
 
20
#include <ll/i386/hw-data.h>
21
#include <ll/i386/x-dosmem.h>
22
 
23
#include "lrmi.h"
24
#include "libvga.h"
25
 
26
#include <kernel/log.h>
27
 
28
int
29
LRMI_init(void)
30
        {
326 giacomo 31
        //DOS_mem_init();
132 giacomo 32
        return 0;
33
        }
34
 
35
void *
36
LRMI_alloc_real(int size)
37
        {
38
        return DOS_alloc(size);
39
        }
40
 
41
void
42
LRMI_free_real(void *m, int s)
43
        {
44
        DOS_free(m,s);
45
        }
46
 
47
 
48
int LRMI_int(int i, struct LRMI_regs *r)
49
        {
50
 
51
        unsigned char p1,p2;
52
 
53
        X_REGS16 inregs, outregs;
54
        X_SREGS16 sregs;
55
 
185 giacomo 56
        memset(&inregs,0,sizeof(inregs));
190 giacomo 57
        memset(&sregs,0,sizeof(sregs));
185 giacomo 58
 
132 giacomo 59
        inregs.x.ax = r->eax;
60
        inregs.x.bx = r->ebx;
61
        inregs.x.cx = r->ecx;
62
        inregs.x.dx = r->edx;
63
        sregs.es = r->es;
189 giacomo 64
        sregs.es = r->ds;
132 giacomo 65
        inregs.x.di = r->edi;
66
 
67
#ifndef VM86
68
        p1 = inp(0x21);
69
        p2 = inp(0xA1);
70
        outp(0x21,0xFF);
71
        outp(0xA1,0xFF);
72
        X_callBIOS(i, &inregs, &outregs, &sregs);
73
        outp(0x21,p1);
74
        outp(0xA1,p2);
75
#else
76
        vm86_callBIOS(i, &inregs, &outregs, &sregs);
77
#endif
78
 
79
        r->eax = outregs.x.ax;
80
        r->ebx = outregs.x.bx;
81
        r->ecx = outregs.x.cx;
82
        r->edx = outregs.x.dx;
83
        r->esi = outregs.x.si;
84
        r->edi = outregs.x.di;
85
 
86
        return 1;
87
 
88
        }
89