diff options
Diffstat (limited to 'c/src/lib/libbsp/i386/shared/realmode_int/realmode_int.h')
-rw-r--r-- | c/src/lib/libbsp/i386/shared/realmode_int/realmode_int.h | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/c/src/lib/libbsp/i386/shared/realmode_int/realmode_int.h b/c/src/lib/libbsp/i386/shared/realmode_int/realmode_int.h new file mode 100644 index 0000000000..e5f80d0555 --- /dev/null +++ b/c/src/lib/libbsp/i386/shared/realmode_int/realmode_int.h @@ -0,0 +1,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 */ |