Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:23:40

0001 /**
0002  * @file
0003  *
0004  * @ingroup RTEMSBSPsI386
0005  *
0006  * @brief Definitioins supporting real mode interrupt calls.
0007  *
0008  * Interface allows calling given interrupt number with content of the
0009  * registers defined. For passing or receiving higher amounts of the data
0010  * there is a buffer accessible from real mode available. Real mode pointer
0011  * to this buffer is passed to the interrupt in the registers.
0012  */
0013 
0014 /*
0015  * Copyright (C) 2014  Jan Doležal (dolezj21@fel.cvut.cz)
0016  *                     CTU in Prague.
0017  *
0018  *  The license and distribution terms for this file may be
0019  *  found in the file LICENSE in this distribution or at
0020  *  http://www.rtems.org/license/LICENSE.
0021  */
0022 
0023 #ifndef _REALMODE_INT_H
0024 #define _REALMODE_INT_H
0025 
0026 #include <rtems/score/cpu.h>
0027 #include <stdint.h>
0028 
0029 #ifndef ASM /* ASM */
0030 
0031 #ifdef __cplusplus
0032 extern "C" {
0033 #endif /* __cplusplus */
0034 
0035 /* --- BIOS service interrupt number --- */
0036 /* number of interrupt servicing video functions */
0037 #define INTERRUPT_NO_VIDEO_SERVICES 0x10
0038 
0039 /**
0040  * @brief Used for passing and retrieving registers content to/from real mode
0041  * interrupt call.
0042  */
0043 typedef struct {
0044     uint32_t reg_eax;
0045     uint32_t reg_ebx;
0046     uint32_t reg_ecx;
0047     uint32_t reg_edx;
0048     uint32_t reg_esi;
0049     uint32_t reg_edi;
0050     uint16_t reg_ds;
0051     uint16_t reg_es;
0052     uint16_t reg_fs;
0053     uint16_t reg_gs;
0054 } RTEMS_PACKED i386_realmode_interrupt_registers;
0055 
0056 /**
0057  * @brief Returns buffer and its size usable with real mode interrupt call.
0058  *
0059  * Provides position to real mode buffer. It is buffer
0060  * accessible from real mode context - it is located below
0061  * address ~0x100000 in order for it to be accessible
0062  * This buffer is meant to be pointed to by segReg:GenPurpReg
0063  * and through this get bigger portion of an information to/from
0064  * interrupt service routine than just by using register.
0065  *
0066  * @param[out] size pointer to variable, where the size of buffer
0067  *             will be filled
0068  * @retval pointer to buffer
0069  */
0070 extern void *i386_get_default_rm_buffer(uint16_t *size);
0071 
0072 /**
0073  * @brief Call to real mode interrupt with specified int NO and processor
0074  * registers.
0075  *
0076  * This function allows calling interrupts in real mode and to set processor
0077  * registers as desired before interrupt call is made and to retrieve the
0078  * registers content after call was made.
0079  *
0080  * @param[in] interrupt_number interrupt number to be called
0081  * @param[in] ir pointer to structure containing registers to be passed to
0082  *            interrupt and to retrieve register content after call was made.
0083  * @retval  0 call failed (GDT too small or pagin is on)
0084  * @retval  1 call successful
0085  */
0086 extern int i386_real_interrupt_call(
0087     uint8_t interrupt_number,
0088     i386_realmode_interrupt_registers *ir
0089 );
0090 
0091 #ifdef __cplusplus
0092 }
0093 #endif /* __cplusplus */
0094 
0095 #endif /* ASM */
0096 
0097 #endif /* _REALMODE_INT_H */