VirtualBox

Changeset 11536 in vbox for trunk/src


Ignore:
Timestamp:
Aug 21, 2008 2:47:35 PM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
35111
Message:

Allow ring 0 logging from the VGA BIOS

File:
1 edited

Legend:

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

    r11335 r11536  
    318318PDMBOTHCBDECL(int) vgaMMIORead(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS GCPhysAddr, void *pv, unsigned cb);
    319319PDMBOTHCBDECL(int) vgaMMIOWrite(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS GCPhysAddr, void *pv, unsigned cb);
     320PDMBOTHCBDECL(int) vgaIOPortReadBIOS(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t *pu32, unsigned cb);
     321PDMBOTHCBDECL(int) vgaIOPortWriteBIOS(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t u32, unsigned cb);
    320322#ifdef IN_GC
    321323PDMBOTHCBDECL(int) vgaGCLFBAccessHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, RTGCPHYS GCPhysFault, void *pvUser);
     
    36523654#endif /* IN_RING3 */
    36533655
     3656/* -=-=-=-=-=- All rings: VGA BIOS I/Os -=-=-=-=-=- */
     3657
     3658/**
     3659 * Port I/O Handler for VGA BIOS IN operations.
     3660 *
     3661 * @returns VBox status code.
     3662 *
     3663 * @param   pDevIns     The device instance.
     3664 * @param   pvUser      User argument - ignored.
     3665 * @param   Port        Port number used for the IN operation.
     3666 * @param   pu32        Where to store the result.
     3667 * @param   cb          Number of bytes read.
     3668 */
     3669PDMBOTHCBDECL(int) vgaIOPortReadBIOS(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t *pu32, unsigned cb)
     3670{
     3671    NOREF(pDevIns);
     3672    NOREF(pvUser);
     3673    NOREF(Port);
     3674    NOREF(pu32);
     3675    NOREF(cb);
     3676    return VERR_IOM_IOPORT_UNUSED;
     3677}
     3678
     3679/**
     3680 * Port I/O Handler for VGA BIOS OUT operations.
     3681 *
     3682 * @returns VBox status code.
     3683 *
     3684 * @param   pDevIns     The device instance.
     3685 * @param   pvUser      User argument - ignored.
     3686 * @param   Port        Port number used for the IN operation.
     3687 * @param   u32         The value to output.
     3688 * @param   cb          The value size in bytes.
     3689 */
     3690PDMBOTHCBDECL(int) vgaIOPortWriteBIOS(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t u32, unsigned cb)
     3691{
     3692    static int lastWasNotNewline = 0;  /* We are only called in a single-threaded way */
     3693    /*
     3694     * VGA BIOS char printing.
     3695     */
     3696    if (    cb == 1
     3697        &&  Port == VBE_PRINTF_PORT)
     3698    {
     3699#if 0
     3700        switch (u32)
     3701        {
     3702            case '\r': Log(("vgabios: <return>\n")); break;
     3703            case '\n': Log(("vgabios: <newline>\n")); break;
     3704            case '\t': Log(("vgabios: <tab>\n")); break;
     3705            default:
     3706                Log(("vgabios: %c\n", u32));
     3707        }
     3708#else
     3709        if (lastWasNotNewline == 0)
     3710            Log(("vgabios: "));
     3711        if (u32 != '\r')  /* return - is only sent in conjunction with '\n' */
     3712            Log(("%c", u32));
     3713        if (u32 == '\n')
     3714            lastWasNotNewline = 0;
     3715        else
     3716            lastWasNotNewline = 1;
     3717#endif
     3718        return VINF_SUCCESS;
     3719    }
     3720
     3721    /* not in use. */
     3722    return VINF_SUCCESS;
     3723}
     3724
    36543725
    36553726/* -=-=-=-=-=- Ring 3 -=-=-=-=-=- */
     
    41604231
    41614232
    4162 
    4163 
    4164 /* -=-=-=-=-=- Ring 3: VGA BIOS I/Os -=-=-=-=-=- */
    4165 
    4166 /**
    4167  * Port I/O Handler for VGA BIOS IN operations.
    4168  *
    4169  * @returns VBox status code.
    4170  *
    4171  * @param   pDevIns     The device instance.
    4172  * @param   pvUser      User argument - ignored.
    4173  * @param   Port        Port number used for the IN operation.
    4174  * @param   pu32        Where to store the result.
    4175  * @param   cb          Number of bytes read.
    4176  */
    4177 static DECLCALLBACK(int) vgaIOPortReadBIOS(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t *pu32, unsigned cb)
    4178 {
    4179     NOREF(pDevIns);
    4180     NOREF(pvUser);
    4181     NOREF(Port);
    4182     NOREF(pu32);
    4183     NOREF(cb);
    4184     return VERR_IOM_IOPORT_UNUSED;
    4185 }
    4186 
    4187 /**
    4188  * Port I/O Handler for VGA BIOS OUT operations.
    4189  *
    4190  * @returns VBox status code.
    4191  *
    4192  * @param   pDevIns     The device instance.
    4193  * @param   pvUser      User argument - ignored.
    4194  * @param   Port        Port number used for the IN operation.
    4195  * @param   u32         The value to output.
    4196  * @param   cb          The value size in bytes.
    4197  */
    4198 static DECLCALLBACK(int) vgaIOPortWriteBIOS(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t u32, unsigned cb)
    4199 {
    4200     static int lastWasNotNewline = 0;  /* We are only called in a single-threaded way */
    4201     /*
    4202      * VGA BIOS char printing.
    4203      */
    4204     if (    cb == 1
    4205         &&  Port == VBE_PRINTF_PORT)
    4206     {
    4207 #if 0
    4208         switch (u32)
    4209         {
    4210             case '\r': Log(("vgabios: <return>\n")); break;
    4211             case '\n': Log(("vgabios: <newline>\n")); break;
    4212             case '\t': Log(("vgabios: <tab>\n")); break;
    4213             default:
    4214                 Log(("vgabios: %c\n", u32));
    4215         }
    4216 #else
    4217         if (lastWasNotNewline == 0)
    4218             Log(("vgabios: "));
    4219         if (u32 != '\r')  /* return - is only sent in conjunction with '\n' */
    4220             Log(("%c", u32));
    4221         if (u32 == '\n')
    4222             lastWasNotNewline = 0;
    4223         else
    4224             lastWasNotNewline = 1;
    4225 #endif
    4226         return VINF_SUCCESS;
    4227     }
    4228 
    4229     /* not in use. */
    4230     return VINF_SUCCESS;
    4231 }
    42324233
    42334234
     
    53975398    if (RT_FAILURE(rc))
    53985399        return rc;
     5400    if (pThis->fR0Enabled)
     5401    {
     5402        rc = PDMDevHlpIOPortRegisterR0(pDevIns, VBE_PRINTF_PORT,  1, 0, "vgaIOPortWriteBIOS", "vgaIOPortReadBIOS", NULL, NULL, "VGA BIOS debug/panic");
     5403        if (RT_FAILURE(rc))
     5404            return rc;
     5405    }
     5406
    53995407    AssertReleaseMsg(g_cbVgaBiosBinary <= _64K && g_cbVgaBiosBinary >= 32*_1K, ("g_cbVgaBiosBinary=%#x\n", g_cbVgaBiosBinary));
    54005408    AssertReleaseMsg(RT_ALIGN_Z(g_cbVgaBiosBinary, PAGE_SIZE) == g_cbVgaBiosBinary, ("g_cbVgaBiosBinary=%#x\n", g_cbVgaBiosBinary));
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