Subversion Repositories shark

Rev

Details | 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
/*      For accessing BIOS calls returning in Real Mode, or using VM86  */
23
 
24
#ifndef __LL_I386_X_BIOS_H__
25
#define __LL_I386_X_BIOS_H__
26
 
27
#include <ll/i386/defs.h>
28
BEGIN_DEF
29
 
30
#include <ll/i386/hw-data.h>
31
#include <ll/i386/hw-instr.h>
32
 
33
#define DOS_OFF(x)      ((DWORD)(x) & 0x000F)
34
#define DOS_SEG(x)      (((DWORD)(x) & 0xFFFF0) >> 4)
35
 
36
typedef union x_regs16 {
37
    struct {
38
        WORD ax __attribute__ ((packed));
39
        WORD bx __attribute__ ((packed));
40
        WORD cx __attribute__ ((packed));
41
        WORD dx __attribute__ ((packed));
42
        WORD si __attribute__ ((packed));
43
        WORD di __attribute__ ((packed));
44
        WORD cflag __attribute__ ((packed));
45
        WORD _pad __attribute__ ((packed));
46
    } x __attribute__ ((packed));
47
    struct {
48
        BYTE al,ah __attribute__ ((packed));
49
        BYTE bl,bh __attribute__ ((packed));
50
        BYTE cl,ch __attribute__ ((packed));
51
        BYTE dl,dh __attribute__ ((packed));
52
    } h __attribute__ ((packed));
53
} X_REGS16;
54
 
55
typedef struct x_sregs16 {
56
        WORD es __attribute__ ((packed));
57
        WORD cs __attribute__ ((packed));
58
        WORD ss __attribute__ ((packed));
59
        WORD ds __attribute__ ((packed));
60
} X_SREGS16;
61
 
62
typedef struct {
63
    /* The GDT linear address inheritable from X */
64
    DWORD GDT_base;
65
    /* These are used for BIOS calling  */
66
    X_REGS16 ir;
67
    X_REGS16 or;
68
    X_SREGS16 sr;
69
    DWORD irqno;
70
    /* This is the X version            */
71
    DWORD ver;
72
} X_CALLBIOS;
73
 
74
X_CALLBIOS * x_bios_address(void);
75
void X_meminfo(LIN_ADDR *b1,DWORD *s1,LIN_ADDR *b2,DWORD *s2);
76
void X_callBIOS(int service,X_REGS16 *in,X_REGS16 *out,X_SREGS16 *s);
77
void vm86_init();
78
int vm86_callBIOS(int service,X_REGS16 *in,X_REGS16 *out,X_SREGS16 *s);
79
 
80
END_DEF
81
 
82
#endif