blob: e5f80d055568c4d75e6eef8720fac51b93399dd1 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
/**
* @file realmode_int.h
*
* @ingroup i386_shared
*
* @brief Definitioins supporting real mode interrupt calls.
*/
/*
* Interface allows calling given interrupt number with content of the
* registers defined. For passing or receiving higher amounts of the data
* there is a buffer accessible from real mode available. Real mode pointer
* to this buffer is passed to the interrupt in the registers.
*
* Copyright (C) 2014 Jan Doležal (dolezj21@fel.cvut.cz)
* CTU in Prague.
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.org/license/LICENSE.
*/
#ifndef _REALMODE_INT_H
#define _REALMODE_INT_H
#include <libcpu/cpu.h>
#include <stdint.h>
#ifndef ASM /* ASM */
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* --- BIOS service interrupt number --- */
/* number of interrupt servicing video functions */
#define INTERRUPT_NO_VIDEO_SERVICES 0x10
typedef struct { /* used for passing parameters, fetching results and preserving values */
uint32_t reg_eax;
uint32_t reg_ebx;
uint32_t reg_ecx;
uint32_t reg_edx;
uint32_t reg_esi;
uint32_t reg_edi;
uint16_t reg_ds;
uint16_t reg_es;
uint16_t reg_fs;
uint16_t reg_gs;
} RTEMS_COMPILER_PACKED_ATTRIBUTE i386_realmode_interrupt_registers;
/**
* Provides position to real mode buffer. It is buffer
* accessible from real mode context - it is located below
* address ~0x100000 in order for it to be accessible
* This buffer is meant to be pointed to by segReg:GenPurpReg
* and through this get bigger portion of an information to/from
* interrupt service routine than just by using register.
*
* @param size pointer to variable, where the size of buffer
* will be filled
* @retval pointer to buffer
*/
extern void *i386_get_default_rm_buffer(uint16_t *size);
/**
* This function allows calling interrupts in real mode and to set processor
* registers as desired before interrupt call is made and to retrieve the
* registers content after call was made.
*
* @param interruptNumber interrupt number to be called
* @param ir pointer to structure containing registers to be passed to interrupt
* and to retrieve register content after call was made.
* @retval 0 call failed (GDT too small or pagin is on)
* 1 call successful
*/
extern int i386_real_interrupt_call(uint8_t interruptNumber, i386_realmode_interrupt_registers *ir);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* ASM */
#endif /* _REALMODE_INT_H */
|