⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bios.c

📁 国产CPU-龙芯(loongson)BIOS源代码
💻 C
📖 第 1 页 / 共 3 页
字号:
	    linux_outb(start & 0xFF, ioport + 1); 	}	break;    case 0x06:	/* Initialise or Scroll Window Up                     */	/* Enter:  AL = lines to scroll up                    */	/*         BH = attribute for blank                   */	/*         CH = upper y of window                     */	/*         CL = left x of window                      */	/*         DH = lower y of window                     */	/*         DL = right x of window                     */	/* Leave:  Nothing                                    */	/* Not Implemented                                    */	{                                         /* Localise */	    printf("Not implemented:Initialise or Scroll window up\n");	}	break;    case 0x07:	/* Initialise or Scroll Window Down                   */	/* Enter:  AL = lines to scroll down                  */	/*         BH = attribute for blank                   */	/*         CH = upper y of window                     */	/*         CL = left x of window                      */	/*         DH = lower y of window                     */	/*         DL = right x of window                     */	/* Leave:  Nothing                                    */	/* Not Implemented                                    */	{                                         /* Localise */	    printf("Not implemented:Initialise or Scroll window up\n");	}	break;    case 0x08:	/* Read Character and Attribute at Cursor             */	/* Enter:  BH = display page number                   */	/* Leave:  AH = attribute                             */	/*         AL = character                             */	/* Not Implemented                                    */	{                                         /* Localise */	    printf("Not implemented:Initialise or Scroll window up\n");	    M.x86.R_AX = 0;	}	break;    case 0x09:	/* Write Character and Attribute at Cursor            */	/* Enter:  AL = character                             */	/*         BH = display page number                   */	/*         BL = attribute (text) or colour (graphics) */	/*         CX = replication count                     */	/* Leave:  Nothing                                    */	/* Not Implemented                                    */	{                                         /* Localise */	    printf("Not implemented:Write Character and Attibute at Cursor\n");	}	break;    case 0x0a:	/* Write Character at Cursor                          */	/* Enter:  AL = character                             */	/*         BH = display page number                   */	/*         BL = colour                                */	/*         CX = replication count                     */	/* Leave:  Nothing                                    */	/* Not Implemented                                    */	{                                         /* Localise */	    printf("Not implemented:Write Character at Cursor\n");	}	break;    case 0x0b:	/* Set Palette, Background or Border                  */	/* Enter:  BH = 0x00 or 0x01                          */	/*         BL = colour or palette (respectively)      */	/* Leave:  Nothing                                    */	/* Implemented                                        */	{                                         /* Localise */	    u16 ioport = BE_rdw( 0x0463) + 5;	    u8 cgacolour = BE_rdb( 0x0466);	    if (M.x86.R_BH) {		cgacolour &= 0xDF;		cgacolour |= (M.x86.R_BL & 0x01) << 5;	    } else {		cgacolour &= 0xE0;		cgacolour |= M.x86.R_BL & 0x1F;	    }	    BE_wrb( 0x0466, cgacolour);	    linux_outb(cgacolour, ioport);	}	break;    case 0x0c:	/* Write Graphics Pixel                               */	/* Enter:  AL = pixel value                           */	/*         BH = display page number                   */	/*         CX = column                                */	/*         DX = row                                   */	/* Leave:  Nothing                                    */	/* Not Implemented                                    */	{                                         /* Localise */	    printf("Not implemented: Write Graphics Pixel\n");	}	break;    case 0x0d:	/* Read Graphics Pixel                                */	/* Enter:  BH = display page number                   */	/*         CX = column                                */	/*         DX = row                                   */	/* Leave:  AL = pixel value                           */	/* Not Implemented                                    */	{                                         /* Localise */	    printf("Not implemented: Read Graphics Pixel\n");	    M.x86.R_AL = 0;	}	break;    case 0x0e:	/* Write Character in Teletype Mode                   */	/* Enter:  AL = character                             */	/*         BH = display page number                   */	/*         BL = foreground colour                     */	/* Leave:  Nothing                                    */	/* Not Implemented                                    */	/* WARNING:  Emulation of BEL characters will require */	/*           emulation of RTC and PC speaker I/O.     */	/*           Also, this recurses through int 0x10     */	/*           which might or might not have been       */	/*           installed yet.                           */	{                                         /* Localise */	    printf("Not implemented: Write Character in Telebyte Mode\n");	}	break;    case 0x0f:	/* Get Video Mode                                     */	/* Enter:  Nothing                                    */	/* Leave:  AH = number of columns                     */	/*         AL = video mode number                     */	/*         BH = display page number                   */	/* Implemented                                        */	{                                         /* Localise */	    M.x86.R_AH = BE_rdw( 0x044A);	    M.x86.R_AL = BE_rdb( 0x0449);	    M.x86.R_BH = BE_rdb( 0x0462);	}	break;    case 0x10:	/* Colour Control (subfunction in AL)                 */	/* Enter:  Various                                    */	/* Leave:  Various                                    */	/* Ignored                                            */	break;    case 0x11:	/* Font Control (subfunction in AL)                   */	/* Enter:  Various                                    */	/* Leave:  Various                                    */	/* Ignored                                            */	break;    case 0x12:	/* Miscellaneous (subfunction in BL)                  */	/* Enter:  Various                                    */	/* Leave:  Various                                    */	/* Ignored.  Previous code here optionally allowed    */	/* the enabling and disabling of VGA, but no system   */	/* BIOS I've come across actually implements it.      */	break;    case 0x13:	/* Write String in Teletype Mode                      */	/* Enter:  AL = write mode                            */	/*         BL = attribute (if (AL & 0x02) == 0)       */	/*         CX = string length                         */	/*         DH = row                                   */	/*         DL = column                                */	/*         ES:BP = string segment:offset              */	/* Leave:  Nothing                                    */	/* Not Implemented                                    */	/* WARNING:  Emulation of BEL characters will require */	/*           emulation of RTC and PC speaker I/O.     */	/*           Also, this recurses through int 0x10     */	/*           which might or might not have been       */	/*           installed yet.                           */	{                                         /* Localise */	    printf("Not implemented: Write String in Telebyte Mode\n");	}	break;    default:        printf("biosEmu/bios.int42: unknown function AH=%#02x, AL=%#02x, BL=%#02x\n",M.x86.R_AH, M.x86.R_AL, M.x86.R_BL);	/* Various extensions                                 */	/* Enter:  Various                                    */	/* Leave:  Various                                    */	/* Ignored                                            */	break;    }}/****************************************************************************PARAMETERS:intno   - Interrupt number being servicedREMARKS:This function handles the default system BIOS Int 10h. If the POST codehas not yet re-vectored the Int 10h BIOS interrupt vector, we handle thisby simply calling the int42 interrupt handler above. Very early in theBIOS POST process, the vector gets replaced and we simply let the realmode interrupt handler process the interrupt.****************************************************************************/static void  int10(    int intno){    if (BE_rdw(intno * 4 + 2) == BIOS_SEG)        int42(intno);    else        X86EMU_prepareForInt(intno);}static void  int6d(    int intno){	int10(intno);}/* Result codes returned by the PCI BIOS */#define SUCCESSFUL          0x00#define FUNC_NOT_SUPPORT    0x81#define BAD_VENDOR_ID       0x83#define DEVICE_NOT_FOUND    0x86#define BAD_REGISTER_NUMBER 0x87#define SET_FAILED          0x88#define BUFFER_TOO_SMALL    0x89/****************************************************************************PARAMETERS:intno   - Interrupt number being servicedREMARKS:This function handles the default Int 1Ah interrupt handler for the realmode code, which provides support for the PCI BIOS functions. Since we onlywant to allow the real mode BIOS code *only* see the PCI config space forits own device, we only return information for the specific PCI configspace that we have passed in to the init function. This solves problemswhen using the BIOS to warm boot a secondary adapter when there is anidentical adapter before it on the bus (some BIOS'es get confused in thiscase).****************************************************************************/static void  int1A(int unused){    u16 pciSlot;    /* Fail if no PCI device information has been registered */    if (!_BE_env.vgaInfo.pciInfo)        return;    pciSlot = (u16)((_BE_env.vgaInfo.pciInfo->pa.pa_bus<<8)|(_BE_env.vgaInfo.pciInfo->pa.pa_device<<3)|(_BE_env.vgaInfo.pciInfo->pa.pa_function&0x7));#ifdef DEBUG_EMU_VGAprintf("int 0x1a: ax=0x%x bx=0x%x cx=0x%x dx=0x%x di=0x%x es=0x%x\n",					   M.x86.R_EAX, M.x86.R_EBX,M.x86.R_ECX,M.x86.R_EDX,M.x86.R_EDI,M.x86.R_ES);#endif    switch (M.x86.R_AX) {        case 0xB101:                    /* PCI bios present? */            M.x86.R_EAX  &= 0xFF00;         /* no config space/special cycle generation support */            M.x86.R_EDX = 0x20494350;   /* " ICP" */            M.x86.R_BX  = 0x0210;       /* Version 2.10 */            M.x86.R_ECX  &= 0xff00;            /* Max bus number in system */            CLEAR_FLAG(F_CF);            break;        case 0xB102:                    /* Find PCI device */            M.x86.R_AH = DEVICE_NOT_FOUND;            if (M.x86.R_DX == PCI_VENDOR(_BE_env.vgaInfo.pciInfo->pa.pa_id) &&                    M.x86.R_CX == _BE_env.vgaInfo.pciInfo->pa.pa_device &&                    M.x86.R_SI == 0) {                M.x86.R_AH = SUCCESSFUL;                M.x86.R_BX = pciSlot;                }            CONDITIONAL_SET_FLAG((M.x86.R_AH != SUCCESSFUL), F_CF);            break;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -