source: rtems/c/src/lib/libbsp/i386/shared/realmode_int/realmode_int.h @ dda25b1

5
Last change on this file since dda25b1 was bc792bb, checked in by Sebastian Huber <sebastian.huber@…>, on 10/16/15 at 06:26:44

basdefs.h: Add and use RTEMS_PACKED

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