1 / 16

Lecture 20

Lecture 20. Determining the Processor Type. Flags register test to identify 8086. 12. 15. Unused in 8086. Pushing or Pop the flags register will set these 4-bits in 8086. Determining the Processor Type. mov AX, 0 push AX popf pushf pop AX

Download Presentation

Lecture 20

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Lecture 20

  2. Determining the Processor Type Flags register test to identify 8086 12 15 Unused in 8086 Pushing or Pop the flags register will set these 4-bits in 8086.

  3. Determining the Processor Type mov AX, 0 push AX popf pushf pop AX Test the bits 15 – 12 of AX if all set, the processor is 8086 else higher processor.

  4. Determining the Processor Type Flags test for 80286 mov AX, 7000H push AX popf pushf pop AX If the bits 14 – 12 are cleared the processor is 286 only.

  5. Alignment Test ( If Not 286) 18 Eflags Alignment Check Alignment Check: mov dword ptr [12], EDX

  6. Alignment Test pushfd pop eax mov ecx, eax mov dword ptr [13], EDX pushfd pop eax

  7. CPUID Test • 486 will pass the alignment test. • To distinguish 486 with Pentium CPUID Test is used.

  8. CPUID Test 21 • If a program can set and also clear bit 21 of Eflags, then processor supports CPUID instructions. • Set bit 21 of Eflags and read value of Eflags and store it. • Clear bit 21 of Eflags, read the value of Eflags. • Compare both the value if bit 21 has changed the CPUID instruction is available. Eflags

  9. CPUID Instruction BeforeAfter the execution of Instruction EAX = 0 EAX = 1 EBX – EDX – ECX EBX = “Genu” EDX = “ineI” ECX = “ntel” EAX = 1 EAX (bit 3 – 0) = Stepping ID EAX (bit 7 – 4) = Model EAX (bit 11 – 8) = Family EAX (bit 13 – 12) = Type EAX (bit 14 – 31) = Reserved

  10. Coprocessor Control Word 7 1 1 Interrupt enable flag 11 after initialization signifies extended precision operation

  11. Coprocessor Status Word 14 10 9 8 C0 C3 C1 C3 C3C2C0 0 0 0 st > operand 0 0 1 st < operand 1 0 0 st = operand

  12. To Check Coprocessor is Present • Initialize • Read Hi – Byte of Control register. • If value in Hi – Byte is 3, then coprocessor is available, otherwise its absent.

  13. Check for 8087 Coprocessor • IEM can be set in 8087. • IEM cannot be set in 80287, 80837 as they use exception to inform the software about any invalid instruction. • If an attempt to set this bit fail then it implies, its not a 8087 coprocessor FDISI.

  14. Distinguish between 80287 & 80387 • 80387 only allows to reverse the sign of infinity. • Perform a division by zero. • If the sign of result can be reversed then the coprocessor is 80387.

  15. void PrintConfig( void ) { union REGS Register; BYTE AT; clrscr(); AT = (peekb(0xF000, 0xFFFE) == 0xFC); printf("CONFIGC - (c) 1987, 92 by Michael Tischer\n"); printf("Your PC Configuration \n"); printf("----------------------------------------------\n"); printf("PC type : "); switch( peekb(0xF000, 0xFFFE) ) { case 0xFF : printf("PC\n"); break; case 0xFE : printf("XT\n"); break; default : printf("AT or higher\n"); break; }

  16. printf("Conventional RAM : "); int86(0x12, &Register, &Register); printf("%d K\n",Register.x.ax); if ( AT ) { Register.h.ah = 0x88; int86(0x15, &Register, &Register); printf("Additional RAM : %d K over 1 megabyte\n", Register.x.ax); } int86(0x11, &Register, &Register); printf("Default video mode : "); printf("Disk drives : %d\n", (Register.x.ax >> 6 & 3) + 1); printf("Serial interfaces : %d\n", Register.x.ax >> 9 & 0x03); printf("Parallel interfaces : %d\n\n", Register.x.ax >> 14); } void main() { PrintConfig(); }

More Related