Changeset 44877 in vbox for trunk/src/VBox/Devices
- Timestamp:
- Feb 28, 2013 9:22:52 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Graphics/DevVGA.cpp
r44876 r44877 46 46 47 47 /* WARNING!!! All defines that affect VGAState should be placed to DevVGA.h !!! 48 * NEVER place them here as this would lead to VGAS tateinconsistency48 * NEVER place them here as this would lead to VGASTATE inconsistency 49 49 * across different .cpp files !!! 50 50 */ … … 59 59 60 60 #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))) 62 62 #endif /* VBOX_WITH_HGSMI */ 63 63 /** Converts a vga adaptor state pointer to a device instance pointer. */ … … 305 305 * @param offVRAM The VRAM offset of the page to set. 306 306 */ 307 DECLINLINE(void) vga_set_dirty( VGAState *pThis, RTGCPHYS offVRAM)307 DECLINLINE(void) vga_set_dirty(PVGASTATE pThis, RTGCPHYS offVRAM) 308 308 { 309 309 AssertMsg(offVRAM < pThis->vram_size, ("offVRAM = %p, pThis->vram_size = %p\n", offVRAM, pThis->vram_size)); … … 320 320 * @param offVRAM The VRAM offset of the page to check. 321 321 */ 322 DECLINLINE(bool) vga_is_dirty( VGAState *pThis, RTGCPHYS offVRAM)322 DECLINLINE(bool) vga_is_dirty(PVGASTATE pThis, RTGCPHYS offVRAM) 323 323 { 324 324 AssertMsg(offVRAM < pThis->vram_size, ("offVRAM = %p, pThis->vram_size = %p\n", offVRAM, pThis->vram_size)); … … 333 333 * @param offVRAMEnd Offset into the VRAM buffer of the last page - exclusive. 334 334 */ 335 DECLINLINE(void) vga_reset_dirty( VGAState *pThis, RTGCPHYS offVRAMStart, RTGCPHYS offVRAMEnd)335 DECLINLINE(void) vga_reset_dirty(PVGASTATE pThis, RTGCPHYS offVRAMStart, RTGCPHYS offVRAMEnd) 336 336 { 337 337 Assert(offVRAMStart < pThis->vram_size); … … 463 463 * Unless the CRTC is horribly misprogrammed, vsync implies vblank. 464 464 */ 465 static void vga_update_retrace_state( VGAState *pThis)465 static void vga_update_retrace_state(PVGASTATE pThis) 466 466 { 467 467 unsigned htotal_cclks, vtotal_lines, chars_per_sec; … … 539 539 } 540 540 541 static uint8_t vga_retrace( VGAState *pThis)541 static uint8_t vga_retrace(PVGASTATE pThis) 542 542 { 543 543 vga_retrace_s *r = &pThis->retrace_state; … … 572 572 } 573 573 574 int vga_ioport_invalid( VGAState *pThis, uint32_t addr)574 int vga_ioport_invalid(PVGASTATE pThis, uint32_t addr) 575 575 { 576 576 if (pThis->msr & MSR_COLOR_EMULATION) { … … 583 583 } 584 584 585 static uint32_t vga_ioport_read(void *opaque, uint32_t addr) 586 { 587 VGAState *pThis = (VGAState*)opaque; 585 static uint32_t vga_ioport_read(PVGASTATE pThis, uint32_t addr) 586 { 588 587 int val, index; 589 588 … … 667 666 } 668 667 669 static void vga_ioport_write(void *opaque, uint32_t addr, uint32_t val) 670 { 671 VGAState *pThis = (VGAState*)opaque; 668 static void vga_ioport_write(PVGASTATE pThis, uint32_t addr, uint32_t val) 669 { 672 670 int index; 673 671 … … 827 825 828 826 #ifdef CONFIG_BOCHS_VBE 829 static uint32_t vbe_ioport_read_index(void *opaque, uint32_t addr) 830 { 831 VGAState *pThis = (VGAState*)opaque; 827 static uint32_t vbe_ioport_read_index(PVGASTATE pThis, uint32_t addr) 828 { 832 829 uint32_t val = pThis->vbe_index; 833 830 NOREF(addr); … … 835 832 } 836 833 837 static uint32_t vbe_ioport_read_data(void *opaque, uint32_t addr) 838 { 839 VGAState *pThis = (VGAState*)opaque; 834 static uint32_t vbe_ioport_read_data(PVGASTATE pThis, uint32_t addr) 835 { 840 836 uint32_t val; 841 837 NOREF(addr); … … 913 909 #endif 914 910 915 static void recalculate_data( VGAState *pThis, bool fVirtHeightOnly)911 static void recalculate_data(PVGASTATE pThis, bool fVirtHeightOnly) 916 912 { 917 913 uint16_t cBPP = pThis->vbe_regs[VBE_DISPI_INDEX_BPP]; … … 952 948 } 953 949 954 static void vbe_ioport_write_index(void *opaque, uint32_t addr, uint32_t val) 955 { 956 VGAState *pThis = (VGAState*)opaque; 950 static void vbe_ioport_write_index(PVGASTATE pThis, uint32_t addr, uint32_t val) 951 { 957 952 pThis->vbe_index = val; 958 953 NOREF(addr); 959 954 } 960 955 961 static int vbe_ioport_write_data(void *opaque, uint32_t addr, uint32_t val) 962 { 963 VGAState *pThis = (VGAState*)opaque; 956 static int vbe_ioport_write_data(PVGASTATE pThis, uint32_t addr, uint32_t val) 957 { 964 958 uint32_t max_bank; 965 959 NOREF(addr); … … 1178 1172 1179 1173 /* 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; 1174 static uint32_t vga_mem_readb(PVGASTATE pThis, target_phys_addr_t addr, int *prc) 1175 { 1183 1176 int memory_map_mode, plane; 1184 1177 uint32_t ret; … … 1259 1252 1260 1253 /* 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; 1254 static int vga_mem_writeb(PVGASTATE pThis, target_phys_addr_t addr, uint32_t val) 1255 { 1264 1256 int memory_map_mode, plane, write_mode, b, func_select, mask; 1265 1257 uint32_t write_mask, bit_mask, set_mask; … … 1452 1444 #if defined(IN_RING3) 1453 1445 typedef 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); 1457 1449 typedef void vga_draw_glyph9_func(uint8_t *d, int linesize, 1458 1450 const uint8_t *font_ptr, int h, 1459 1451 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); 1452 typedef void vga_draw_line_func(PVGASTATE pThis, uint8_t *pbDst, const uint8_t *pbSrc, int width); 1462 1453 1463 1454 static inline unsigned int rgb_to_pixel8(unsigned int r, unsigned int g, unsigned b) … … 1526 1517 1527 1518 /* return true if the palette was modified */ 1528 static bool update_palette16( VGAState *pThis)1519 static bool update_palette16(PVGASTATE pThis) 1529 1520 { 1530 1521 bool full_update = false; … … 1552 1543 1553 1544 /* return true if the palette was modified */ 1554 static bool update_palette256( VGAState *pThis)1545 static bool update_palette256(PVGASTATE pThis) 1555 1546 { 1556 1547 bool full_update = false; … … 1581 1572 } 1582 1573 1583 static void vga_get_offsets( VGAState *pThis,1574 static void vga_get_offsets(PVGASTATE pThis, 1584 1575 uint32_t *pline_offset, 1585 1576 uint32_t *pstart_addr, … … 1618 1609 1619 1610 /* update start_addr and line_offset. Return TRUE if modified */ 1620 static bool update_basic_params( VGAState *pThis)1611 static bool update_basic_params(PVGASTATE pThis) 1621 1612 { 1622 1613 bool full_update = false; … … 1697 1688 * - flashing 1698 1689 */ 1699 static int vga_draw_text( VGAState *pThis, bool full_update, bool fFailOnResize, bool reset_dirty)1690 static int vga_draw_text(PVGASTATE pThis, bool full_update, bool fFailOnResize, bool reset_dirty) 1700 1691 { 1701 1692 int cx, cy, cheight, cw, ch, cattr, height, width, ch_attr; … … 1968 1959 }; 1969 1960 1970 static int vga_get_bpp( VGAState *pThis)1961 static int vga_get_bpp(PVGASTATE pThis) 1971 1962 { 1972 1963 int ret; … … 1982 1973 } 1983 1974 1984 static void vga_get_resolution( VGAState *pThis, int *pwidth, int *pheight)1975 static void vga_get_resolution(PVGASTATE pThis, int *pwidth, int *pheight) 1985 1976 { 1986 1977 int width, height; … … 2015 2006 * @param cy The height. 2016 2007 */ 2017 static int vga_resize_graphic( VGAState *pThis, int cx, int cy)2008 static int vga_resize_graphic(PVGASTATE pThis, int cx, int cy) 2018 2009 { 2019 2010 const unsigned cBits = pThis->get_bpp(pThis); … … 2080 2071 * graphic modes 2081 2072 */ 2082 static int vga_draw_graphic( VGAState *pThis, bool full_update, bool fFailOnResize, bool reset_dirty)2073 static int vga_draw_graphic(PVGASTATE pThis, bool full_update, bool fFailOnResize, bool reset_dirty) 2083 2074 { 2084 2075 int y1, y2, y, page_min, page_max, linesize, y_start, double_scan; … … 2258 2249 } 2259 2250 2260 static void vga_draw_blank( VGAState *pThis, int full_update)2251 static void vga_draw_blank(PVGASTATE pThis, int full_update) 2261 2252 { 2262 2253 int i, w, val; … … 2388 2379 } 2389 2380 2390 static void vga_save(QEMUFile *f, void *opaque) 2391 { 2392 VGAState *pThis = (VGAState*)opaque; 2381 static void vga_save(QEMUFile *f, PVGASTATE pThis) 2382 { 2393 2383 int i; 2394 2384 … … 2428 2418 } 2429 2419 2430 static int vga_load(QEMUFile *f, void *opaque, int version_id) 2431 { 2432 VGAState *pThis = (VGAState*)opaque; 2420 static int vga_load(QEMUFile *f, PVGASTATE pThis, int version_id) 2421 { 2433 2422 int is_vbe, i; 2434 2423 uint32_t u32Dummy; … … 2523 2512 2524 2513 /** 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.} 2534 2515 */ 2535 2516 PDMBOTHCBDECL(int) vgaIOPortWrite(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t u32, unsigned cb) … … 2551 2532 2552 2533 /** 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.} 2562 2535 */ 2563 2536 PDMBOTHCBDECL(int) vgaIOPortRead(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t *pu32, unsigned cb) … … 2580 2553 2581 2554 /** 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.} 2591 2556 */ 2592 2557 PDMBOTHCBDECL(int) vgaIOPortWriteVBEData(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t u32, unsigned cb) … … 2654 2619 2655 2620 /** 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.} 2665 2622 */ 2666 2623 PDMBOTHCBDECL(int) vgaIOPortWriteVBEIndex(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t u32, unsigned cb) … … 2693 2650 2694 2651 /** 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.} 2704 2653 */ 2705 2654 PDMBOTHCBDECL(int) vgaIOPortReadVBEData(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t *pu32, unsigned cb) … … 2740 2689 2741 2690 /** 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.} 2751 2692 */ 2752 2693 PDMBOTHCBDECL(int) vgaIOPortReadVBEIndex(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t *pu32, unsigned cb) 2753 2694 { 2754 2695 NOREF(pvUser); 2755 VGAState *pThis = PDMINS_2_DATA(pDevIns, PVGASTATE);2696 PVGASTATE pThis = PDMINS_2_DATA(pDevIns, PVGASTATE); 2756 2697 Assert(PDMCritSectIsOwner(pDevIns->CTX_SUFF(pCritSectRo))); 2757 2698 … … 2780 2721 2781 2722 #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.} 2793 2726 */ 2794 2727 static DECLCALLBACK(int) vgaR3IOPortHGSMIWrite(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t u32, unsigned cb) 2795 2728 { 2796 VGAState *pThis = PDMINS_2_DATA(pDevIns, PVGASTATE);2729 PVGASTATE pThis = PDMINS_2_DATA(pDevIns, PVGASTATE); 2797 2730 Assert(PDMCritSectIsOwner(pDevIns->CTX_SUFF(pCritSectRo))); 2798 2731 LogFlowFunc(("Port 0x%x, u32 0x%x, cb %d\n", Port, u32, cb)); … … 2807 2740 case VGA_PORT_HGSMI_HOST: /* Host */ 2808 2741 { 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) 2810 2743 if (u32 == HGSMIOFFSET_VOID) 2811 2744 { 2812 2745 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 ); 2819 2753 } 2820 2754 else 2821 # endif2755 # endif 2822 2756 { 2823 2757 HGSMIHostWrite(pThis->pHGSMI, u32); … … 2831 2765 2832 2766 default: 2833 # ifdef DEBUG_sunlover2767 # ifdef DEBUG_sunlover 2834 2768 AssertMsgFailed(("vgaR3IOPortHGSMIWrite: Port=%#x cb=%d u32=%#x\n", Port, cb, u32)); 2835 # endif2769 # endif 2836 2770 break; 2837 2771 } … … 2839 2773 else 2840 2774 { 2841 # ifdef DEBUG_sunlover2775 # ifdef DEBUG_sunlover 2842 2776 AssertMsgFailed(("vgaR3IOPortHGSMIWrite: Port=%#x cb=%d u32=%#x\n", Port, cb, u32)); 2843 # endif2777 # endif 2844 2778 } 2845 2779 … … 2847 2781 } 2848 2782 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.} 2859 2786 */ 2860 2787 static DECLCALLBACK(int) vgaR3IOPortHGSMIRead(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t *pu32, unsigned cb) 2861 2788 { 2862 VGAState *pThis = PDMINS_2_DATA(pDevIns, PVGASTATE);2789 PVGASTATE pThis = PDMINS_2_DATA(pDevIns, PVGASTATE); 2863 2790 Assert(PDMCritSectIsOwner(pDevIns->CTX_SUFF(pCritSectRo))); 2864 2791 LogFlowFunc(("Port 0x%x, cb %d\n", Port, cb)); … … 2878 2805 break; 2879 2806 default: 2880 # ifdef DEBUG_sunlover2807 # ifdef DEBUG_sunlover 2881 2808 AssertMsgFailed(("vgaR3IOPortHGSMIRead: Port=%#x cb=%d\n", Port, cb)); 2882 # endif2809 # endif 2883 2810 rc = VERR_IOM_IOPORT_UNUSED; 2884 2811 break; … … 2887 2814 else 2888 2815 { 2889 # ifdef DEBUG_sunlover2816 # ifdef DEBUG_sunlover 2890 2817 Log(("vgaR3IOPortHGSMIRead: Port=%#x cb=%d\n", Port, cb)); 2891 # endif2818 # endif 2892 2819 rc = VERR_IOM_IOPORT_UNUSED; 2893 2820 } … … 2895 2822 return rc; 2896 2823 } 2897 # endif /* IN_RING3 */2824 # endif /* IN_RING3 */ 2898 2825 #endif /* VBOX_WITH_HGSMI */ 2899 2826 … … 2903 2830 /* -=-=-=-=-=- Guest Context -=-=-=-=-=- */ 2904 2831 2905 /* 2906 * Internal. For use inside VGAGCMemoryFillWrite only.2832 /** 2833 * @internal. For use inside VGAGCMemoryFillWrite only. 2907 2834 * Macro for apply logical operation and bit mask. 2908 2835 */ 2909 2836 #define APPLY_LOGICAL_AND_MASK(pThis, val, bit_mask) \ 2910 2837 /* apply logical operation */ \ 2911 switch (pThis->gr[3] >> 3)\2838 switch (pThis->gr[3] >> 3) \ 2912 2839 { \ 2913 2840 case 0: \ … … 2917 2844 case 1: \ 2918 2845 /* and */ \ 2919 val &= pThis->latch; 2846 val &= pThis->latch; \ 2920 2847 break; \ 2921 2848 case 2: \ 2922 2849 /* or */ \ 2923 val |= pThis->latch; 2850 val |= pThis->latch; \ 2924 2851 break; \ 2925 2852 case 3: \ 2926 2853 /* xor */ \ 2927 val ^= pThis->latch; 2854 val ^= pThis->latch; \ 2928 2855 break; \ 2929 2856 } \ … … 3111 3038 } 3112 3039 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.} 3124 3046 */ 3125 3047 PDMBOTHCBDECL(int) vgaMMIOFill(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS GCPhysAddr, uint32_t u32Item, unsigned cbItem, unsigned cItems) … … 3134 3056 3135 3057 /** 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.} 3144 3060 */ 3145 3061 PDMBOTHCBDECL(int) vgaMMIORead(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS GCPhysAddr, void *pv, unsigned cb) … … 3195 3111 3196 3112 /** 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.} 3205 3115 */ 3206 3116 PDMBOTHCBDECL(int) vgaMMIOWrite(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS GCPhysAddr, void const *pv, unsigned cb) … … 3326 3236 #ifdef IN_RC 3327 3237 /** 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 */ 3240 PDMBOTHCBDECL(int) vgaRCLFBAccessHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, RTGCPHYS GCPhysFault, void *pvUser) 3339 3241 { 3340 3242 PVGASTATE pThis = (PVGASTATE)pvUser; … … 3350 3252 3351 3253 /** 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.} 3361 3255 */ 3362 3256 PDMBOTHCBDECL(int) vgaR0LFBAccessHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, RTGCPHYS GCPhysFault, void *pvUser) … … 3374 3268 3375 3269 /** 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.} 3387 3271 */ 3388 3272 static DECLCALLBACK(int) vgaR3LFBAccessHandler(PVM pVM, RTGCPHYS GCPhys, void *pvPhys, void *pvBuf, size_t cbBuf, PGMACCESSTYPE enmAccessType, void *pvUser) … … 3405 3289 3406 3290 /** 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.} 3416 3293 */ 3417 3294 PDMBOTHCBDECL(int) vgaIOPortReadBIOS(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t *pu32, unsigned cb) … … 3426 3303 3427 3304 /** 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.} 3437 3307 */ 3438 3308 PDMBOTHCBDECL(int) vgaIOPortWriteBIOS(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t u32, unsigned cb) … … 3482 3352 # ifdef VBE_NEW_DYN_LIST 3483 3353 /** 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.} 3493 3356 */ 3494 3357 PDMBOTHCBDECL(int) vbeIOPortWriteVBEExtra(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t u32, unsigned cb) … … 3511 3374 3512 3375 /** 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.} 3522 3378 */ 3523 3379 PDMBOTHCBDECL(int) vbeIOPortReadVBEExtra(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t *pu32, unsigned cb) … … 3827 3683 3828 3684 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.} 3841 3688 */ 3842 3689 PDMBOTHCBDECL(int) vbeIOPortWriteCMDLogo(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t u32, unsigned cb) … … 3939 3786 3940 3787 /** 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.} 3950 3790 */ 3951 3791 PDMBOTHCBDECL(int) vbeIOPortReadCMDLogo(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t *pu32, unsigned cb) … … 3981 3821 } 3982 3822 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.} 3990 3830 */ 3991 3831 static DECLCALLBACK(void) vgaInfoState(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs) … … 4139 3979 4140 3980 /** 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.} 4147 3984 */ 4148 3985 static DECLCALLBACK(void) vgaInfoText(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs) … … 4217 4054 4218 4055 /** 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.} 4224 4057 */ 4225 4058 static DECLCALLBACK(void) vgaInfoSR(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs) … … 4238 4071 4239 4072 /** 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.} 4245 4074 */ 4246 4075 static DECLCALLBACK(void) vgaInfoCR(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs) … … 4253 4082 Assert(sizeof(pThis->cr) >= 24); 4254 4083 for (i = 0; i < 10; ++i) 4255 {4256 4084 pHlp->pfnPrintf(pHlp, " CR%02X:%02X", i, pThis->cr[i]); 4257 }4258 4085 pHlp->pfnPrintf(pHlp, "\n"); 4259 4086 for (i = 10; i < 20; ++i) 4260 {4261 4087 pHlp->pfnPrintf(pHlp, " CR%02X:%02X", i, pThis->cr[i]); 4262 }4263 4088 pHlp->pfnPrintf(pHlp, "\n"); 4264 4089 for (i = 20; i < 25; ++i) 4265 {4266 4090 pHlp->pfnPrintf(pHlp, " CR%02X:%02X", i, pThis->cr[i]); 4267 }4268 4091 pHlp->pfnPrintf(pHlp, "\n"); 4269 4092 } … … 4271 4094 4272 4095 /** 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.} 4278 4098 */ 4279 4099 static DECLCALLBACK(void) vgaInfoGR(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs) … … 4294 4114 4295 4115 /** 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.} 4301 4118 */ 4302 4119 static DECLCALLBACK(void) vgaInfoAR(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs) … … 4311 4128 pHlp->pfnPrintf(pHlp, " Palette:"); 4312 4129 for (i = 0; i < 0x10; ++i) 4313 {4314 4130 pHlp->pfnPrintf(pHlp, " %02X", pThis->ar[i]); 4315 }4316 4131 pHlp->pfnPrintf(pHlp, "\n"); 4317 4132 for (i = 0x10; i <= 0x14; ++i) 4318 {4319 4133 pHlp->pfnPrintf(pHlp, " AR%02X:%02X", i, pThis->ar[i]); 4320 }4321 4134 pHlp->pfnPrintf(pHlp, "\n"); 4322 4135 } 4323 4136 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.} 4330 4140 */ 4331 4141 static DECLCALLBACK(void) vgaInfoDAC(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs) … … 4337 4147 pHlp->pfnPrintf(pHlp, "VGA DAC contents:\n"); 4338 4148 for (i = 0; i < 0x100; ++i) 4339 {4340 4149 pHlp->pfnPrintf(pHlp, " %02X: %02X %02X %02X\n", 4341 4150 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.} 4352 4156 */ 4353 4157 static DECLCALLBACK(void) vgaInfoVBE(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs) … … 4379 4183 4380 4184 /** 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.} 4387 4188 */ 4388 4189 static DECLCALLBACK(void) vgaInfoPlanar(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs) … … 5200 5001 vgaR3LFBAccessHandler, pThis, 5201 5002 g_DeviceVga.szR0Mod, "vgaR0LFBAccessHandler", pDevIns->pvInstanceDataR0, 5202 g_DeviceVga.szRCMod, "vga GCLFBAccessHandler", pDevIns->pvInstanceDataRC,5003 g_DeviceVga.szRCMod, "vgaRCLFBAccessHandler", pDevIns->pvInstanceDataRC, 5203 5004 "VGA LFB"); 5204 5005 AssertRC(rc); … … 5367 5168 5368 5169 /** 5369 * Reset notification. 5370 * 5371 * @returns VBox status. 5372 * @param pDevIns The device instance data. 5170 * @interface_method_impl{PDMDEVREG,pfnReset} 5373 5171 */ 5374 5172 static DECLCALLBACK(void) vgaR3Reset(PPDMDEVINS pDevIns) … … 5459 5257 5460 5258 /** 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} 5467 5260 */ 5468 5261 static DECLCALLBACK(void) vgaR3Relocate(PPDMDEVINS pDevIns, RTGCINTPTR offDelta) … … 5481 5274 5482 5275 /** 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} 5488 5277 * 5489 5278 * 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.5495 5279 */ 5496 5280 static DECLCALLBACK(int) vgaAttach(PPDMDEVINS pDevIns, unsigned iLUN, uint32_t fFlags) … … 5561 5345 5562 5346 /** 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} 5567 5348 * 5568 5349 * 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.5573 5350 */ 5574 5351 static DECLCALLBACK(void) vgaDetach(PPDMDEVINS pDevIns, unsigned iLUN, uint32_t fFlags) … … 5598 5375 5599 5376 /** 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} 5606 5378 */ 5607 5379 static DECLCALLBACK(int) vgaR3Destruct(PPDMDEVINS pDevIns) … … 5613 5385 LogFlow(("vgaR3Destruct:\n")); 5614 5386 5615 # ifdef VBOX_WITH_VDMA5387 # ifdef VBOX_WITH_VDMA 5616 5388 vboxVDMADestruct(pThis->pVdma); 5617 # endif5389 # endif 5618 5390 5619 5391 /* … … 5625 5397 pThis->pu8VBEExtraData = NULL; 5626 5398 } 5627 #endif 5399 #endif /* VBE_NEW_DYN_LIST */ 5628 5400 if (pThis->pu8VgaBios) 5629 5401 { … … 5647 5419 return VINF_SUCCESS; 5648 5420 } 5421 5649 5422 5650 5423 /** … … 5673 5446 pMode->info.LinNumberOfPages = maxPage; 5674 5447 } 5448 5675 5449 5676 5450 /** … … 5786 5560 5787 5561 /* The LBF access handler - error handling is better here than in the map function. */ 5788 rc = PDMR3LdrGetSymbolRCLazy(pVM, pDevIns->pReg->szRCMod, NULL, "vga GCLFBAccessHandler", &pThis->RCPtrLFBHandler);5562 rc = PDMR3LdrGetSymbolRCLazy(pVM, pDevIns->pReg->szRCMod, NULL, "vgaRCLFBAccessHandler", &pThis->RCPtrLFBHandler); 5789 5563 if (RT_FAILURE(rc)) 5790 5564 { 5791 AssertReleaseMsgFailed(("PDMR3LdrGetSymbolRC(, %s, \"vga GCLFBAccessHandler\",) -> %Rrc\n", pDevIns->pReg->szRCMod, rc));5565 AssertReleaseMsgFailed(("PDMR3LdrGetSymbolRC(, %s, \"vgaRCLFBAccessHandler\",) -> %Rrc\n", pDevIns->pReg->szRCMod, rc)); 5792 5566 return rc; 5793 5567 }
Note:
See TracChangeset
for help on using the changeset viewer.