Subversion Repositories shark

Rev

Rev 132 | Rev 189 | Go to most recent revision | 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
        {
31
        DOS_mem_init();
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));
57
 
132 giacomo 58
        inregs.x.ax = r->eax;
59
        inregs.x.bx = r->ebx;
60
        inregs.x.cx = r->ecx;
61
        inregs.x.dx = r->edx;
62
        sregs.es = r->es;
63
        inregs.x.di = r->edi;
64
 
65
#ifndef VM86
66
        p1 = inp(0x21);
67
        p2 = inp(0xA1);
68
        outp(0x21,0xFF);
69
        outp(0xA1,0xFF);
70
        X_callBIOS(i, &inregs, &outregs, &sregs);
71
        outp(0x21,p1);
72
        outp(0xA1,p2);
73
#else
74
        vm86_callBIOS(i, &inregs, &outregs, &sregs);
75
#endif
76
 
77
        r->eax = outregs.x.ax;
78
        r->ebx = outregs.x.bx;
79
        r->ecx = outregs.x.cx;
80
        r->edx = outregs.x.dx;
81
        r->esi = outregs.x.si;
82
        r->edi = outregs.x.di;
83
 
84
        return 1;
85
 
86
        }
87