VirtualBox

Changeset 44877 in vbox for trunk/src/VBox/Devices


Ignore:
Timestamp:
Feb 28, 2013 9:22:52 PM (12 years ago)
Author:
vboxsync
Message:

DevVGA.cpp: More cleanups.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Graphics/DevVGA.cpp

    r44876 r44877  
    4646
    4747/* WARNING!!! All defines that affect VGAState should be placed to DevVGA.h !!!
    48  *            NEVER place them here as this would lead to VGAState inconsistency
     48 *            NEVER place them here as this would lead to VGASTATE inconsistency
    4949 *            across different .cpp files !!!
    5050 */
     
    5959
    6060#ifdef VBOX_WITH_HGSMI
    61 #define PCIDEV_2_VGASTATE(pPciDev)    ((VGAState *)((uintptr_t)pPciDev - RT_OFFSETOF(VGAState, Dev)))
     61#define PCIDEV_2_VGASTATE(pPciDev)    ((PVGASTATE)((uintptr_t)pPciDev - RT_OFFSETOF(VGASTATE, Dev)))
    6262#endif /* VBOX_WITH_HGSMI */
    6363/** Converts a vga adaptor state pointer to a device instance pointer. */
     
    305305 * @param   offVRAM     The VRAM offset of the page to set.
    306306 */
    307 DECLINLINE(void) vga_set_dirty(VGAState *pThis, RTGCPHYS offVRAM)
     307DECLINLINE(void) vga_set_dirty(PVGASTATE pThis, RTGCPHYS offVRAM)
    308308{
    309309    AssertMsg(offVRAM < pThis->vram_size, ("offVRAM = %p, pThis->vram_size = %p\n", offVRAM, pThis->vram_size));
     
    320320 * @param   offVRAM     The VRAM offset of the page to check.
    321321 */
    322 DECLINLINE(bool) vga_is_dirty(VGAState *pThis, RTGCPHYS offVRAM)
     322DECLINLINE(bool) vga_is_dirty(PVGASTATE pThis, RTGCPHYS offVRAM)
    323323{
    324324    AssertMsg(offVRAM < pThis->vram_size, ("offVRAM = %p, pThis->vram_size = %p\n", offVRAM, pThis->vram_size));
     
    333333 * @param   offVRAMEnd      Offset into the VRAM buffer of the last page - exclusive.
    334334 */
    335 DECLINLINE(void) vga_reset_dirty(VGAState *pThis, RTGCPHYS offVRAMStart, RTGCPHYS offVRAMEnd)
     335DECLINLINE(void) vga_reset_dirty(PVGASTATE pThis, RTGCPHYS offVRAMStart, RTGCPHYS offVRAMEnd)
    336336{
    337337    Assert(offVRAMStart < pThis->vram_size);
     
    463463 * Unless the CRTC is horribly misprogrammed, vsync implies vblank.
    464464 */
    465 static void vga_update_retrace_state(VGAState *pThis)
     465static void vga_update_retrace_state(PVGASTATE pThis)
    466466{
    467467    unsigned        htotal_cclks, vtotal_lines, chars_per_sec;
     
    539539}
    540540
    541 static uint8_t vga_retrace(VGAState *pThis)
     541static uint8_t vga_retrace(PVGASTATE pThis)
    542542{
    543543    vga_retrace_s   *r = &pThis->retrace_state;
     
    572572}
    573573
    574 int vga_ioport_invalid(VGAState *pThis, uint32_t addr)
     574int vga_ioport_invalid(PVGASTATE pThis, uint32_t addr)
    575575{
    576576    if (pThis->msr & MSR_COLOR_EMULATION) {
     
    583583}
    584584
    585 static uint32_t vga_ioport_read(void *opaque, uint32_t addr)
    586 {
    587     VGAState *pThis = (VGAState*)opaque;
     585static uint32_t vga_ioport_read(PVGASTATE pThis, uint32_t addr)
     586{
    588587    int val, index;
    589588
     
    667666}
    668667
    669 static void vga_ioport_write(void *opaque, uint32_t addr, uint32_t val)
    670 {
    671     VGAState *pThis = (VGAState*)opaque;
     668static void vga_ioport_write(PVGASTATE pThis, uint32_t addr, uint32_t val)
     669{
    672670    int index;
    673671
     
    827825
    828826#ifdef CONFIG_BOCHS_VBE
    829 static uint32_t vbe_ioport_read_index(void *opaque, uint32_t addr)
    830 {
    831     VGAState *pThis = (VGAState*)opaque;
     827static uint32_t vbe_ioport_read_index(PVGASTATE pThis, uint32_t addr)
     828{
    832829    uint32_t val = pThis->vbe_index;
    833830    NOREF(addr);
     
    835832}
    836833
    837 static uint32_t vbe_ioport_read_data(void *opaque, uint32_t addr)
    838 {
    839     VGAState *pThis = (VGAState*)opaque;
     834static uint32_t vbe_ioport_read_data(PVGASTATE pThis, uint32_t addr)
     835{
    840836    uint32_t val;
    841837    NOREF(addr);
     
    913909#endif
    914910
    915 static void recalculate_data(VGAState *pThis, bool fVirtHeightOnly)
     911static void recalculate_data(PVGASTATE pThis, bool fVirtHeightOnly)
    916912{
    917913    uint16_t cBPP        = pThis->vbe_regs[VBE_DISPI_INDEX_BPP];
     
    952948}
    953949
    954 static void vbe_ioport_write_index(void *opaque, uint32_t addr, uint32_t val)
    955 {
    956     VGAState *pThis = (VGAState*)opaque;
     950static void vbe_ioport_write_index(PVGASTATE pThis, uint32_t addr, uint32_t val)
     951{
    957952    pThis->vbe_index = val;
    958953    NOREF(addr);
    959954}
    960955
    961 static int vbe_ioport_write_data(void *opaque, uint32_t addr, uint32_t val)
    962 {
    963     VGAState *pThis = (VGAState*)opaque;
     956static int vbe_ioport_write_data(PVGASTATE pThis, uint32_t addr, uint32_t val)
     957{
    964958    uint32_t max_bank;
    965959    NOREF(addr);
     
    11781172
    11791173/* called for accesses between 0xa0000 and 0xc0000 */
    1180 static uint32_t vga_mem_readb(void *opaque, target_phys_addr_t addr, int *prc)
    1181 {
    1182     VGAState *pThis = (VGAState*)opaque;
     1174static uint32_t vga_mem_readb(PVGASTATE pThis, target_phys_addr_t addr, int *prc)
     1175{
    11831176    int memory_map_mode, plane;
    11841177    uint32_t ret;
     
    12591252
    12601253/* called for accesses between 0xa0000 and 0xc0000 */
    1261 static int vga_mem_writeb(void *opaque, target_phys_addr_t addr, uint32_t val)
    1262 {
    1263     VGAState *pThis = (VGAState*)opaque;
     1254static int vga_mem_writeb(PVGASTATE pThis, target_phys_addr_t addr, uint32_t val)
     1255{
    12641256    int memory_map_mode, plane, write_mode, b, func_select, mask;
    12651257    uint32_t write_mask, bit_mask, set_mask;
     
    14521444#if defined(IN_RING3)
    14531445typedef void vga_draw_glyph8_func(uint8_t *d, int linesize,
    1454                              const uint8_t *font_ptr, int h,
    1455                              uint32_t fgcol, uint32_t bgcol,
    1456                              int dscan);
     1446                                  const uint8_t *font_ptr, int h,
     1447                                  uint32_t fgcol, uint32_t bgcol,
     1448                                  int dscan);
    14571449typedef void vga_draw_glyph9_func(uint8_t *d, int linesize,
    14581450                                  const uint8_t *font_ptr, int h,
    14591451                                  uint32_t fgcol, uint32_t bgcol, int dup9);
    1460 typedef void vga_draw_line_func(VGAState *s1, uint8_t *d,
    1461                                 const uint8_t *pThis, int width);
     1452typedef void vga_draw_line_func(PVGASTATE pThis, uint8_t *pbDst, const uint8_t *pbSrc, int width);
    14621453
    14631454static inline unsigned int rgb_to_pixel8(unsigned int r, unsigned int g, unsigned b)
     
    15261517
    15271518/* return true if the palette was modified */
    1528 static bool update_palette16(VGAState *pThis)
     1519static bool update_palette16(PVGASTATE pThis)
    15291520{
    15301521    bool full_update = false;
     
    15521543
    15531544/* return true if the palette was modified */
    1554 static bool update_palette256(VGAState *pThis)
     1545static bool update_palette256(PVGASTATE pThis)
    15551546{
    15561547    bool full_update = false;
     
    15811572}
    15821573
    1583 static void vga_get_offsets(VGAState *pThis,
     1574static void vga_get_offsets(PVGASTATE pThis,
    15841575                            uint32_t *pline_offset,
    15851576                            uint32_t *pstart_addr,
     
    16181609
    16191610/* update start_addr and line_offset. Return TRUE if modified */
    1620 static bool update_basic_params(VGAState *pThis)
     1611static bool update_basic_params(PVGASTATE pThis)
    16211612{
    16221613    bool full_update = false;
     
    16971688 * - flashing
    16981689 */
    1699 static int vga_draw_text(VGAState *pThis, bool full_update, bool fFailOnResize, bool reset_dirty)
     1690static int vga_draw_text(PVGASTATE pThis, bool full_update, bool fFailOnResize, bool reset_dirty)
    17001691{
    17011692    int cx, cy, cheight, cw, ch, cattr, height, width, ch_attr;
     
    19681959};
    19691960
    1970 static int vga_get_bpp(VGAState *pThis)
     1961static int vga_get_bpp(PVGASTATE pThis)
    19711962{
    19721963    int ret;
     
    19821973}
    19831974
    1984 static void vga_get_resolution(VGAState *pThis, int *pwidth, int *pheight)
     1975static void vga_get_resolution(PVGASTATE pThis, int *pwidth, int *pheight)
    19851976{
    19861977    int width, height;
     
    20152006 * @param   cy      The height.
    20162007 */
    2017 static int vga_resize_graphic(VGAState *pThis, int cx, int cy)
     2008static int vga_resize_graphic(PVGASTATE pThis, int cx, int cy)
    20182009{
    20192010    const unsigned cBits = pThis->get_bpp(pThis);
     
    20802071 * graphic modes
    20812072 */
    2082 static int vga_draw_graphic(VGAState *pThis, bool full_update, bool fFailOnResize, bool reset_dirty)
     2073static int vga_draw_graphic(PVGASTATE pThis, bool full_update, bool fFailOnResize, bool reset_dirty)
    20832074{
    20842075    int y1, y2, y, page_min, page_max, linesize, y_start, double_scan;
     
    22582249}
    22592250
    2260 static void vga_draw_blank(VGAState *pThis, int full_update)
     2251static void vga_draw_blank(PVGASTATE pThis, int full_update)
    22612252{
    22622253    int i, w, val;
     
    23882379}
    23892380
    2390 static void vga_save(QEMUFile *f, void *opaque)
    2391 {
    2392     VGAState *pThis = (VGAState*)opaque;
     2381static void vga_save(QEMUFile *f, PVGASTATE pThis)
     2382{
    23932383    int i;
    23942384
     
    24282418}
    24292419
    2430 static int vga_load(QEMUFile *f, void *opaque, int version_id)
    2431 {
    2432     VGAState *pThis = (VGAState*)opaque;
     2420static int vga_load(QEMUFile *f, PVGASTATE pThis, int version_id)
     2421{
    24332422    int is_vbe, i;
    24342423    uint32_t u32Dummy;
     
    25232512
    25242513/**
    2525  * Port I/O Handler for VGA OUT operations.
    2526  *
    2527  * @returns VBox status code.
    2528  *
    2529  * @param   pDevIns     The device instance.
    2530  * @param   pvUser      User argument - ignored.
    2531  * @param   Port        Port number used for the IN operation.
    2532  * @param   u32         The value to output.
    2533  * @param   cb          The value size in bytes.
     2514 * @callback_method_impl{FNIOMIOPORTOUT,Generic VGA OUT dispatcher.}
    25342515 */
    25352516PDMBOTHCBDECL(int) vgaIOPortWrite(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t u32, unsigned cb)
     
    25512532
    25522533/**
    2553  * Port I/O Handler for VGA IN operations.
    2554  *
    2555  * @returns VBox status code.
    2556  *
    2557  * @param   pDevIns     The device instance.
    2558  * @param   pvUser      User argument - ignored.
    2559  * @param   Port        Port number used for the IN operation.
    2560  * @param   pu32        Where to store the result.
    2561  * @param   cb          Number of bytes read.
     2534 * @callback_method_impl{FNIOMIOPORTOUT,Generic VGA IN dispatcher.}
    25622535 */
    25632536PDMBOTHCBDECL(int) vgaIOPortRead(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t *pu32, unsigned cb)
     
    25802553
    25812554/**
    2582  * Port I/O Handler for VBE OUT operations.
    2583  *
    2584  * @returns VBox status code.
    2585  *
    2586  * @param   pDevIns     The device instance.
    2587  * @param   pvUser      User argument - ignored.
    2588  * @param   Port        Port number used for the IN operation.
    2589  * @param   u32         The value to output.
    2590  * @param   cb          The value size in bytes.
     2555 * @callback_method_impl{FNIOMIOPORTOUT,VBE Data Port OUT handler.}
    25912556 */
    25922557PDMBOTHCBDECL(int) vgaIOPortWriteVBEData(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t u32, unsigned cb)
     
    26542619
    26552620/**
    2656  * Port I/O Handler for VBE OUT operations.
    2657  *
    2658  * @returns VBox status code.
    2659  *
    2660  * @param   pDevIns     The device instance.
    2661  * @param   pvUser      User argument - ignored.
    2662  * @param   Port        Port number used for the IN operation.
    2663  * @param   u32         The value to output.
    2664  * @param   cb          The value size in bytes.
     2621 * @callback_method_impl{FNIOMIOPORTOUT,VBE Index Port OUT handler.}
    26652622 */
    26662623PDMBOTHCBDECL(int) vgaIOPortWriteVBEIndex(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t u32, unsigned cb)
     
    26932650
    26942651/**
    2695  * Port I/O Handler for VBE IN operations.
    2696  *
    2697  * @returns VBox status code.
    2698  *
    2699  * @param   pDevIns     The device instance.
    2700  * @param   pvUser      User argument - ignored.
    2701  * @param   Port        Port number used for the IN operation.
    2702  * @param   pu32        Where to store the result.
    2703  * @param   cb          Number of bytes to read.
     2652 * @callback_method_impl{FNIOMIOPORTOUT,VBE Data Port IN handler.}
    27042653 */
    27052654PDMBOTHCBDECL(int) vgaIOPortReadVBEData(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t *pu32, unsigned cb)
     
    27402689
    27412690/**
    2742  * Port I/O Handler for VBE IN operations.
    2743  *
    2744  * @returns VBox status code.
    2745  *
    2746  * @param   pDevIns     The device instance.
    2747  * @param   pvUser      User argument - ignored.
    2748  * @param   Port        Port number used for the IN operation.
    2749  * @param   pu32        Where to store the result.
    2750  * @param   cb          Number of bytes to read.
     2691 * @callback_method_impl{FNIOMIOPORTOUT,VBE Index Port IN handler.}
    27512692 */
    27522693PDMBOTHCBDECL(int) vgaIOPortReadVBEIndex(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t *pu32, unsigned cb)
    27532694{
    27542695    NOREF(pvUser);
    2755     VGAState *pThis = PDMINS_2_DATA(pDevIns, PVGASTATE);
     2696    PVGASTATE pThis = PDMINS_2_DATA(pDevIns, PVGASTATE);
    27562697    Assert(PDMCritSectIsOwner(pDevIns->CTX_SUFF(pCritSectRo)));
    27572698
     
    27802721
    27812722#ifdef VBOX_WITH_HGSMI
    2782 #ifdef IN_RING3
    2783 /**
    2784  * Port I/O Handler for HGSMI OUT operations.
    2785  *
    2786  * @returns VBox status code.
    2787  *
    2788  * @param   pDevIns     The device instance.
    2789  * @param   pvUser      User argument - ignored.
    2790  * @param   Port        Port number used for the operation.
    2791  * @param   u32         The value to output.
    2792  * @param   cb          The value size in bytes.
     2723# ifdef IN_RING3
     2724/**
     2725 * @callback_method_impl{FNIOMIOPORTOUT,HGSMI OUT handler.}
    27932726 */
    27942727static DECLCALLBACK(int) vgaR3IOPortHGSMIWrite(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t u32, unsigned cb)
    27952728{
    2796     VGAState *pThis = PDMINS_2_DATA(pDevIns, PVGASTATE);
     2729    PVGASTATE pThis = PDMINS_2_DATA(pDevIns, PVGASTATE);
    27972730    Assert(PDMCritSectIsOwner(pDevIns->CTX_SUFF(pCritSectRo)));
    27982731    LogFlowFunc(("Port 0x%x, u32 0x%x, cb %d\n", Port, u32, cb));
     
    28072740            case VGA_PORT_HGSMI_HOST: /* Host */
    28082741            {
    2809 #if defined(VBOX_WITH_VIDEOHWACCEL) || defined(VBOX_WITH_VDMA) || defined(VBOX_WITH_WDDM)
     2742# if defined(VBOX_WITH_VIDEOHWACCEL) || defined(VBOX_WITH_VDMA) || defined(VBOX_WITH_WDDM)
    28102743                if (u32 == HGSMIOFFSET_VOID)
    28112744                {
    28122745                    PDMDevHlpPCISetIrq(pDevIns, 0, PDM_IRQ_LEVEL_LOW);
    2813                     HGSMIClearHostGuestFlags(pThis->pHGSMI, HGSMIHOSTFLAGS_IRQ
    2814 #ifdef VBOX_VDMA_WITH_WATCHDOG
    2815                             | HGSMIHOSTFLAGS_WATCHDOG
    2816 #endif
    2817                             | HGSMIHOSTFLAGS_VSYNC
    2818                             );
     2746                    HGSMIClearHostGuestFlags(pThis->pHGSMI,
     2747                                             HGSMIHOSTFLAGS_IRQ
     2748#  ifdef VBOX_VDMA_WITH_WATCHDOG
     2749                                             | HGSMIHOSTFLAGS_WATCHDOG
     2750#  endif
     2751                                             | HGSMIHOSTFLAGS_VSYNC
     2752                                             );
    28192753                }
    28202754                else
    2821 #endif
     2755# endif
    28222756                {
    28232757                    HGSMIHostWrite(pThis->pHGSMI, u32);
     
    28312765
    28322766            default:
    2833 #ifdef DEBUG_sunlover
     2767# ifdef DEBUG_sunlover
    28342768                AssertMsgFailed(("vgaR3IOPortHGSMIWrite: Port=%#x cb=%d u32=%#x\n", Port, cb, u32));
    2835 #endif
     2769# endif
    28362770                break;
    28372771        }
     
    28392773    else
    28402774    {
    2841 #ifdef DEBUG_sunlover
     2775# ifdef DEBUG_sunlover
    28422776        AssertMsgFailed(("vgaR3IOPortHGSMIWrite: Port=%#x cb=%d u32=%#x\n", Port, cb, u32));
    2843 #endif
     2777# endif
    28442778    }
    28452779
     
    28472781}
    28482782
    2849 /**
    2850  * Port I/O Handler for HGSMI IN operations.
    2851  *
    2852  * @returns VBox status code.
    2853  *
    2854  * @param   pDevIns     The device instance.
    2855  * @param   pvUser      User argument - ignored.
    2856  * @param   Port        Port number used for the operation.
    2857  * @param   pu32        Where to store the result.
    2858  * @param   cb          Number of bytes to read.
     2783
     2784/**
     2785 * @callback_method_impl{FNIOMIOPORTOUT,HGSMI IN handler.}
    28592786 */
    28602787static DECLCALLBACK(int) vgaR3IOPortHGSMIRead(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t *pu32, unsigned cb)
    28612788{
    2862     VGAState *pThis = PDMINS_2_DATA(pDevIns, PVGASTATE);
     2789    PVGASTATE pThis = PDMINS_2_DATA(pDevIns, PVGASTATE);
    28632790    Assert(PDMCritSectIsOwner(pDevIns->CTX_SUFF(pCritSectRo)));
    28642791    LogFlowFunc(("Port 0x%x, cb %d\n", Port, cb));
     
    28782805                break;
    28792806            default:
    2880 #ifdef DEBUG_sunlover
     2807# ifdef DEBUG_sunlover
    28812808                AssertMsgFailed(("vgaR3IOPortHGSMIRead: Port=%#x cb=%d\n", Port, cb));
    2882 #endif
     2809# endif
    28832810                rc = VERR_IOM_IOPORT_UNUSED;
    28842811                break;
     
    28872814    else
    28882815    {
    2889 #ifdef DEBUG_sunlover
     2816# ifdef DEBUG_sunlover
    28902817        Log(("vgaR3IOPortHGSMIRead: Port=%#x cb=%d\n", Port, cb));
    2891 #endif
     2818# endif
    28922819        rc = VERR_IOM_IOPORT_UNUSED;
    28932820    }
     
    28952822    return rc;
    28962823}
    2897 #endif /* IN_RING3 */
     2824# endif /* IN_RING3 */
    28982825#endif /* VBOX_WITH_HGSMI */
    28992826
     
    29032830/* -=-=-=-=-=- Guest Context -=-=-=-=-=- */
    29042831
    2905 /*
    2906  * Internal. For use inside VGAGCMemoryFillWrite only.
     2832/**
     2833 * @internal. For use inside VGAGCMemoryFillWrite only.
    29072834 * Macro for apply logical operation and bit mask.
    29082835 */
    29092836#define APPLY_LOGICAL_AND_MASK(pThis, val, bit_mask) \
    29102837    /* apply logical operation */                \
    2911     switch(pThis->gr[3] >> 3)                        \
     2838    switch (pThis->gr[3] >> 3)                   \
    29122839    {                                            \
    29132840        case 0:                                  \
     
    29172844        case 1:                                  \
    29182845            /* and */                            \
    2919             val &= pThis->latch;                     \
     2846            val &= pThis->latch;                 \
    29202847            break;                               \
    29212848        case 2:                                  \
    29222849            /* or */                             \
    2923             val |= pThis->latch;                     \
     2850            val |= pThis->latch;                 \
    29242851            break;                               \
    29252852        case 3:                                  \
    29262853            /* xor */                            \
    2927             val ^= pThis->latch;                     \
     2854            val ^= pThis->latch;                 \
    29282855            break;                               \
    29292856    }                                            \
     
    31113038}
    31123039
    3113 /**
    3114  * Legacy VGA memory (0xa0000 - 0xbffff) write hook, to be called from IOM and from the inside of VGADeviceGC.cpp.
    3115  * This is the advanced version of vga_mem_writeb function.
    3116  *
    3117  * @returns VBox status code.
    3118  * @param   pDevIns     Pointer device instance.
    3119  * @param   pvUser      User argument - ignored.
    3120  * @param   GCPhysAddr  Physical address of memory to write.
    3121  * @param   u32Item     Data to write, up to 4 bytes.
    3122  * @param   cbItem      Size of data Item, only 1/2/4 bytes is allowed for now.
    3123  * @param   cItems      Number of data items to write.
     3040
     3041/**
     3042 * @callback_method_impl{FNIOMMMIOFILL,
     3043 * Legacy VGA memory (0xa0000 - 0xbffff) write hook, to be called from IOM and
     3044 * from the inside of VGADeviceGC.cpp. This is the advanced version of
     3045 * vga_mem_writeb function.}
    31243046 */
    31253047PDMBOTHCBDECL(int) vgaMMIOFill(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS GCPhysAddr, uint32_t u32Item, unsigned cbItem, unsigned cItems)
     
    31343056
    31353057/**
    3136  * Legacy VGA memory (0xa0000 - 0xbffff) read hook, to be called from IOM.
    3137  *
    3138  * @returns VBox status code.
    3139  * @param   pDevIns     Pointer device instance.
    3140  * @param   pvUser      User argument - ignored.
    3141  * @param   GCPhysAddr  Physical address of memory to read.
    3142  * @param   pv          Where to store read data.
    3143  * @param   cb          Bytes to read.
     3058 * @callback_method_impl{FNIOMMMIOREAD, Legacy VGA memory (0xa0000 - 0xbffff)
     3059 *                      read hook, to be called from IOM.}
    31443060 */
    31453061PDMBOTHCBDECL(int) vgaMMIORead(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS GCPhysAddr, void *pv, unsigned cb)
     
    31953111
    31963112/**
    3197  * Legacy VGA memory (0xa0000 - 0xbffff) write hook, to be called from IOM.
    3198  *
    3199  * @returns VBox status code.
    3200  * @param   pDevIns     Pointer device instance.
    3201  * @param   pvUser      User argument - ignored.
    3202  * @param   GCPhysAddr  Physical address of memory to write.
    3203  * @param   pv          Pointer to data.
    3204  * @param   cb          Bytes to write.
     3113 * @callback_method_impl{FNIOMMMIOWRITE, Legacy VGA memory (0xa0000 - 0xbffff)
     3114 *                      write hook, to be called from IOM.}
    32053115 */
    32063116PDMBOTHCBDECL(int) vgaMMIOWrite(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS GCPhysAddr, void const *pv, unsigned cb)
     
    33263236#ifdef IN_RC
    33273237/**
    3328  * #PF Handler for VBE LFB access.
    3329  *
    3330  * @returns VBox status code (appropriate for GC return).
    3331  * @param   pVM         VM Handle.
    3332  * @param   uErrorCode  CPU Error code.
    3333  * @param   pRegFrame   Trap register frame.
    3334  * @param   pvFault     The fault address (cr2).
    3335  * @param   GCPhysFault The GC physical address corresponding to pvFault.
    3336  * @param   pvUser      User argument, ignored.
    3337  */
    3338 PDMBOTHCBDECL(int) vgaGCLFBAccessHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, RTGCPHYS GCPhysFault, void *pvUser)
     3238 * @callback_method_impl{FNPGMRCPHYSHANDLER, \#PF Handler for VBE LFB access.}
     3239 */
     3240PDMBOTHCBDECL(int) vgaRCLFBAccessHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, RTGCPHYS GCPhysFault, void *pvUser)
    33393241{
    33403242    PVGASTATE   pThis = (PVGASTATE)pvUser;
     
    33503252
    33513253/**
    3352  * #PF Handler for VBE LFB access.
    3353  *
    3354  * @returns VBox status code (appropriate for GC return).
    3355  * @param   pVM         VM Handle.
    3356  * @param   uErrorCode  CPU Error code.
    3357  * @param   pRegFrame   Trap register frame.
    3358  * @param   pvFault     The fault address (cr2).
    3359  * @param   GCPhysFault The GC physical address corresponding to pvFault.
    3360  * @param   pvUser      User argument, ignored.
     3254 * @callback_method_impl{FNPGMR0PHYSHANDLER, \#PF Handler for VBE LFB access.}
    33613255 */
    33623256PDMBOTHCBDECL(int) vgaR0LFBAccessHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, RTGCPHYS GCPhysFault, void *pvUser)
     
    33743268
    33753269/**
    3376  * HC access handler for the LFB.
    3377  *
    3378  * @returns VINF_SUCCESS if the handler have carried out the operation.
    3379  * @returns VINF_PGM_HANDLER_DO_DEFAULT if the caller should carry out the access operation.
    3380  * @param   pVM             VM Handle.
    3381  * @param   GCPhys          The physical address the guest is writing to.
    3382  * @param   pvPhys          The HC mapping of that address.
    3383  * @param   pvBuf           What the guest is reading/writing.
    3384  * @param   cbBuf           How much it's reading/writing.
    3385  * @param   enmAccessType   The access type.
    3386  * @param   pvUser          User argument.
     3270 * @callback_method_impl{FNPGMR3PHYSHANDLER, HC access handler for the LFB.}
    33873271 */
    33883272static DECLCALLBACK(int) vgaR3LFBAccessHandler(PVM pVM, RTGCPHYS GCPhys, void *pvPhys, void *pvBuf, size_t cbBuf, PGMACCESSTYPE enmAccessType, void *pvUser)
     
    34053289
    34063290/**
    3407  * Port I/O Handler for VGA BIOS IN operations.
    3408  *
    3409  * @returns VBox status code.
    3410  *
    3411  * @param   pDevIns     The device instance.
    3412  * @param   pvUser      User argument - ignored.
    3413  * @param   Port        Port number used for the IN operation.
    3414  * @param   pu32        Where to store the result.
    3415  * @param   cb          Number of bytes read.
     3291 * @callback_method_impl{FNIOMIOPORTIN,
     3292 *      Port I/O Handler for VGA BIOS IN operations.}
    34163293 */
    34173294PDMBOTHCBDECL(int) vgaIOPortReadBIOS(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t *pu32, unsigned cb)
     
    34263303
    34273304/**
    3428  * Port I/O Handler for VGA BIOS OUT operations.
    3429  *
    3430  * @returns VBox status code.
    3431  *
    3432  * @param   pDevIns     The device instance.
    3433  * @param   pvUser      User argument - ignored.
    3434  * @param   Port        Port number used for the IN operation.
    3435  * @param   u32         The value to output.
    3436  * @param   cb          The value size in bytes.
     3305 * @callback_method_impl{FNIOMIOPORTOUT,
     3306 *      Port I/O Handler for VGA BIOS IN operations.}
    34373307 */
    34383308PDMBOTHCBDECL(int) vgaIOPortWriteBIOS(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t u32, unsigned cb)
     
    34823352# ifdef VBE_NEW_DYN_LIST
    34833353/**
    3484  * Port I/O Handler for VBE Extra OUT operations.
    3485  *
    3486  * @returns VBox status code.
    3487  *
    3488  * @param   pDevIns     The device instance.
    3489  * @param   pvUser      User argument - ignored.
    3490  * @param   Port        Port number used for the IN operation.
    3491  * @param   u32         The value to output.
    3492  * @param   cb          The value size in bytes.
     3354 * @callback_method_impl{FNIOMIOPORTOUT,
     3355 *      Port I/O Handler for VBE Extra OUT operations.}
    34933356 */
    34943357PDMBOTHCBDECL(int) vbeIOPortWriteVBEExtra(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t u32, unsigned cb)
     
    35113374
    35123375/**
    3513  * Port I/O Handler for VBE Extra IN operations.
    3514  *
    3515  * @returns VBox status code.
    3516  *
    3517  * @param   pDevIns     The device instance.
    3518  * @param   pvUser      User argument - ignored.
    3519  * @param   Port        Port number used for the IN operation.
    3520  * @param   pu32        Where to store the result.
    3521  * @param   cb          Number of bytes read.
     3376 * @callback_method_impl{FNIOMIOPORTIN,
     3377 *      Port I/O Handler for VBE Extra IN operations.}
    35223378 */
    35233379PDMBOTHCBDECL(int) vbeIOPortReadVBEExtra(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t *pu32, unsigned cb)
     
    38273683
    38283684
    3829 
    3830 
    3831 /**
    3832  * Port I/O Handler for BIOS Logo OUT operations.
    3833  *
    3834  * @returns VBox status code.
    3835  *
    3836  * @param   pDevIns     The device instance.
    3837  * @param   pvUser      User argument - ignored.
    3838  * @param   Port        Port number used for the IN operation.
    3839  * @param   u32         The value to output.
    3840  * @param   cb          The value size in bytes.
     3685/**
     3686 * @callback_method_impl{FNIOMIOPORTOUT,
     3687 *      Port I/O Handler for BIOS Logo OUT operations.}
    38413688 */
    38423689PDMBOTHCBDECL(int) vbeIOPortWriteCMDLogo(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t u32, unsigned cb)
     
    39393786
    39403787/**
    3941  * Port I/O Handler for BIOS Logo IN operations.
    3942  *
    3943  * @returns VBox status code.
    3944  *
    3945  * @param   pDevIns     The device instance.
    3946  * @param   pvUser      User argument - ignored.
    3947  * @param   Port        Port number used for the IN operation.
    3948  * @param   pu32        Where to store the result.
    3949  * @param   cb          Number of bytes read.
     3788 * @callback_method_impl{FNIOMIOPORTIN,
     3789 *      Port I/O Handler for BIOS Logo IN operations.}
    39503790 */
    39513791PDMBOTHCBDECL(int) vbeIOPortReadCMDLogo(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t *pu32, unsigned cb)
     
    39813821}
    39823822
    3983 /**
    3984  * Info handler, device version. Dumps several interesting bits of the
    3985  * VGA state that are difficult to decode from the registers.
    3986  *
    3987  * @param   pDevIns     Device instance which registered the info.
    3988  * @param   pHlp        Callback functions for doing output.
    3989  * @param   pszArgs     Argument string. Optional and specific to the handler.
     3823
     3824/* -=-=-=-=-=- Ring 3: Debug Info Handlers -=-=-=-=-=- */
     3825
     3826/**
     3827 * @callback_method_impl{FNDBGFHANDLERDEV,
     3828 *      Dumps several interesting bits of the VGA state that are difficult to
     3829 *      decode from the registers.}
    39903830 */
    39913831static DECLCALLBACK(void) vgaInfoState(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)
     
    41393979
    41403980/**
    4141  * Info handler, device version. Dumps VGA memory formatted as
    4142  * ASCII text, no attributes. Only looks at the first page.
    4143  *
    4144  * @param   pDevIns     Device instance which registered the info.
    4145  * @param   pHlp        Callback functions for doing output.
    4146  * @param   pszArgs     Argument string. Optional and specific to the handler.
     3981 * @callback_method_impl{FNDBGFHANDLERDEV,
     3982 *      Dumps VGA memory formatted as ASCII text, no attributes. Only looks at the
     3983 *      first page.}
    41473984 */
    41483985static DECLCALLBACK(void) vgaInfoText(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)
     
    42174054
    42184055/**
    4219  * Info handler, device version. Dumps VGA Sequencer registers.
    4220  *
    4221  * @param   pDevIns     Device instance which registered the info.
    4222  * @param   pHlp        Callback functions for doing output.
    4223  * @param   pszArgs     Argument string. Optional and specific to the handler.
     4056 * @callback_method_impl{FNDBGFHANDLERDEV, Dumps VGA Sequencer registers.}
    42244057 */
    42254058static DECLCALLBACK(void) vgaInfoSR(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)
     
    42384071
    42394072/**
    4240  * Info handler, device version. Dumps VGA CRTC registers.
    4241  *
    4242  * @param   pDevIns     Device instance which registered the info.
    4243  * @param   pHlp        Callback functions for doing output.
    4244  * @param   pszArgs     Argument string. Optional and specific to the handler.
     4073 * @callback_method_impl{FNDBGFHANDLERDEV, Dumps VGA CRTC registers.}
    42454074 */
    42464075static DECLCALLBACK(void) vgaInfoCR(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)
     
    42534082    Assert(sizeof(pThis->cr) >= 24);
    42544083    for (i = 0; i < 10; ++i)
    4255     {
    42564084        pHlp->pfnPrintf(pHlp, " CR%02X:%02X", i, pThis->cr[i]);
    4257     }
    42584085    pHlp->pfnPrintf(pHlp, "\n");
    42594086    for (i = 10; i < 20; ++i)
    4260     {
    42614087        pHlp->pfnPrintf(pHlp, " CR%02X:%02X", i, pThis->cr[i]);
    4262     }
    42634088    pHlp->pfnPrintf(pHlp, "\n");
    42644089    for (i = 20; i < 25; ++i)
    4265     {
    42664090        pHlp->pfnPrintf(pHlp, " CR%02X:%02X", i, pThis->cr[i]);
    4267     }
    42684091    pHlp->pfnPrintf(pHlp, "\n");
    42694092}
     
    42714094
    42724095/**
    4273  * Info handler, device version. Dumps VGA Graphics Controller registers.
    4274  *
    4275  * @param   pDevIns     Device instance which registered the info.
    4276  * @param   pHlp        Callback functions for doing output.
    4277  * @param   pszArgs     Argument string. Optional and specific to the handler.
     4096 * @callback_method_impl{FNDBGFHANDLERDEV,
     4097 *      Dumps VGA Graphics Controller registers.}
    42784098 */
    42794099static DECLCALLBACK(void) vgaInfoGR(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)
     
    42944114
    42954115/**
    4296  * Info handler, device version. Dumps VGA Sequencer registers.
    4297  *
    4298  * @param   pDevIns     Device instance which registered the info.
    4299  * @param   pHlp        Callback functions for doing output.
    4300  * @param   pszArgs     Argument string. Optional and specific to the handler.
     4116 * @callback_method_impl{FNDBGFHANDLERDEV,
     4117 *      Dumps VGA Attribute Controller registers.}
    43014118 */
    43024119static DECLCALLBACK(void) vgaInfoAR(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)
     
    43114128    pHlp->pfnPrintf(pHlp, " Palette:");
    43124129    for (i = 0; i < 0x10; ++i)
    4313     {
    43144130        pHlp->pfnPrintf(pHlp, " %02X", pThis->ar[i]);
    4315     }
    43164131    pHlp->pfnPrintf(pHlp, "\n");
    43174132    for (i = 0x10; i <= 0x14; ++i)
    4318     {
    43194133        pHlp->pfnPrintf(pHlp, " AR%02X:%02X", i, pThis->ar[i]);
    4320     }
    43214134    pHlp->pfnPrintf(pHlp, "\n");
    43224135}
    43234136
    4324 /**
    4325  * Info handler, device version. Dumps VGA DAC registers.
    4326  *
    4327  * @param   pDevIns     Device instance which registered the info.
    4328  * @param   pHlp        Callback functions for doing output.
    4329  * @param   pszArgs     Argument string. Optional and specific to the handler.
     4137
     4138/**
     4139 * @callback_method_impl{FNDBGFHANDLERDEV, Dumps VGA DAC registers.}
    43304140 */
    43314141static DECLCALLBACK(void) vgaInfoDAC(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)
     
    43374147    pHlp->pfnPrintf(pHlp, "VGA DAC contents:\n");
    43384148    for (i = 0; i < 0x100; ++i)
    4339     {
    43404149        pHlp->pfnPrintf(pHlp, " %02X: %02X %02X %02X\n",
    43414150                        i, pThis->palette[i*3+0], pThis->palette[i*3+1], pThis->palette[i*3+2]);
    4342     }
    4343 }
    4344 
    4345 
    4346 /**
    4347  * Info handler, device version. Dumps VBE registers.
    4348  *
    4349  * @param   pDevIns     Device instance which registered the info.
    4350  * @param   pHlp        Callback functions for doing output.
    4351  * @param   pszArgs     Argument string. Optional and specific to the handler.
     4151}
     4152
     4153
     4154/**
     4155 * @callback_method_impl{FNDBGFHANDLERDEV, Dumps VBE registers.}
    43524156 */
    43534157static DECLCALLBACK(void) vgaInfoVBE(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)
     
    43794183
    43804184/**
    4381  * Info handler, device version. Dumps register state relevant
    4382  * to 16-color planar graphics modes (GR/SR) in human-readable form.
    4383  *
    4384  * @param   pDevIns     Device instance which registered the info.
    4385  * @param   pHlp        Callback functions for doing output.
    4386  * @param   pszArgs     Argument string. Optional and specific to the handler.
     4185 * @callback_method_impl{FNDBGFHANDLERDEV,
     4186 *      Dumps register state relevant to 16-color planar graphics modes (GR/SR)
     4187 *      in human-readable form.}
    43874188 */
    43884189static DECLCALLBACK(void) vgaInfoPlanar(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)
     
    52005001                                              vgaR3LFBAccessHandler, pThis,
    52015002                                              g_DeviceVga.szR0Mod, "vgaR0LFBAccessHandler", pDevIns->pvInstanceDataR0,
    5202                                               g_DeviceVga.szRCMod, "vgaGCLFBAccessHandler", pDevIns->pvInstanceDataRC,
     5003                                              g_DeviceVga.szRCMod, "vgaRCLFBAccessHandler", pDevIns->pvInstanceDataRC,
    52035004                                              "VGA LFB");
    52045005            AssertRC(rc);
     
    53675168
    53685169/**
    5369  * Reset notification.
    5370  *
    5371  * @returns VBox status.
    5372  * @param   pDevIns     The device instance data.
     5170 * @interface_method_impl{PDMDEVREG,pfnReset}
    53735171 */
    53745172static DECLCALLBACK(void)  vgaR3Reset(PPDMDEVINS pDevIns)
     
    54595257
    54605258/**
    5461  * Device relocation callback.
    5462  *
    5463  * @param   pDevIns     Pointer to the device instance.
    5464  * @param   offDelta    The relocation delta relative to the old location.
    5465  *
    5466  * @see     FNPDMDEVRELOCATE for details.
     5259 * @interface_method_impl{PDMDEVREG,pfnRelocate}
    54675260 */
    54685261static DECLCALLBACK(void) vgaR3Relocate(PPDMDEVINS pDevIns, RTGCINTPTR offDelta)
     
    54815274
    54825275/**
    5483  * Attach command.
    5484  *
    5485  * This is called to let the device attach to a driver for a specified LUN
    5486  * during runtime. This is not called during VM construction, the device
    5487  * constructor have to attach to all the available drivers.
     5276 * @interface_method_impl{PDMDEVREG,pfnAttach}
    54885277 *
    54895278 * This is like plugging in the monitor after turning on the PC.
    5490  *
    5491  * @returns VBox status code.
    5492  * @param   pDevIns     The device instance.
    5493  * @param   iLUN        The logical unit which is being detached.
    5494  * @param   fFlags      Flags, combination of the PDMDEVATT_FLAGS_* \#defines.
    54955279 */
    54965280static DECLCALLBACK(int)  vgaAttach(PPDMDEVINS pDevIns, unsigned iLUN, uint32_t fFlags)
     
    55615345
    55625346/**
    5563  * Detach notification.
    5564  *
    5565  * This is called when a driver is detaching itself from a LUN of the device.
    5566  * The device should adjust it's state to reflect this.
     5347 * @interface_method_impl{PDMDEVREG,pfnDetach}
    55675348 *
    55685349 * This is like unplugging the monitor while the PC is still running.
    5569  *
    5570  * @param   pDevIns     The device instance.
    5571  * @param   iLUN        The logical unit which is being detached.
    5572  * @param   fFlags      Flags, combination of the PDMDEVATT_FLAGS_* \#defines.
    55735350 */
    55745351static DECLCALLBACK(void)  vgaDetach(PPDMDEVINS pDevIns, unsigned iLUN, uint32_t fFlags)
     
    55985375
    55995376/**
    5600  * Destruct a device instance.
    5601  *
    5602  * Most VM resources are freed by the VM. This callback is provided so that any non-VM
    5603  * resources can be freed correctly.
    5604  *
    5605  * @param   pDevIns     The device instance data.
     5377 * @interface_method_impl{PDMDEVREG,pfnDestruct}
    56065378 */
    56075379static DECLCALLBACK(int) vgaR3Destruct(PPDMDEVINS pDevIns)
     
    56135385    LogFlow(("vgaR3Destruct:\n"));
    56145386
    5615 #ifdef VBOX_WITH_VDMA
     5387# ifdef VBOX_WITH_VDMA
    56165388    vboxVDMADestruct(pThis->pVdma);
    5617 #endif
     5389# endif
    56185390
    56195391    /*
     
    56255397        pThis->pu8VBEExtraData = NULL;
    56265398    }
    5627 #endif
     5399#endif /* VBE_NEW_DYN_LIST */
    56285400    if (pThis->pu8VgaBios)
    56295401    {
     
    56475419    return VINF_SUCCESS;
    56485420}
     5421
    56495422
    56505423/**
     
    56735446    pMode->info.LinNumberOfPages   = maxPage;
    56745447}
     5448
    56755449
    56765450/**
     
    57865560
    57875561    /* The LBF access handler - error handling is better here than in the map function.  */
    5788     rc = PDMR3LdrGetSymbolRCLazy(pVM, pDevIns->pReg->szRCMod, NULL, "vgaGCLFBAccessHandler", &pThis->RCPtrLFBHandler);
     5562    rc = PDMR3LdrGetSymbolRCLazy(pVM, pDevIns->pReg->szRCMod, NULL, "vgaRCLFBAccessHandler", &pThis->RCPtrLFBHandler);
    57895563    if (RT_FAILURE(rc))
    57905564    {
    5791         AssertReleaseMsgFailed(("PDMR3LdrGetSymbolRC(, %s, \"vgaGCLFBAccessHandler\",) -> %Rrc\n", pDevIns->pReg->szRCMod, rc));
     5565        AssertReleaseMsgFailed(("PDMR3LdrGetSymbolRC(, %s, \"vgaRCLFBAccessHandler\",) -> %Rrc\n", pDevIns->pReg->szRCMod, rc));
    57925566        return rc;
    57935567    }
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette