Docsity

Types of Processor-System Programming-Lecture Notes, Study notes of System Programming

Toggle sidebar
bg1
Lecture # 20
Types of Processor
Flags register test to identify 8086
Determining the Processor Type
Unused in 8086
1215
Pushing or Poping the flags register will set
these 4-bits in 8086.
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.
Determining the Processor Type
The above slides show the test that can be used to determine if the underlying processor
is 8086 or not. If its not 8086 some test for it to be 80286 should be performed.
docsity.com
pf3
pf4
pf5
pf8
pf9

Partial preview of the text

Download Types of Processor-System Programming-Lecture Notes and more Study notes System Programming in PDF only on Docsity!

Lecture # 20

Types of Processor

Flags register test to identify 8086

Determining the Processor Type

Unused in 8086

15 12

Pushing or Poping the flags register will set these 4-bits in 8086.

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.

Determining the Processor Type

The above slides show the test that can be used to determine if the underlying processor is 8086 or not. If its not 8086 some test for it to be 80286 should be performed.

Checking for 80286

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.

Determining the Processor Type

if the bits 14-12 are cleared on pushing the flags register then the processor is 80286. This can be checked as shown in the slide above.

Alignment Test ( If Not 286)

Alignment Check

18

Alignment Check:

mov dword ptr [12], EDX

Eflags

In 32-bit processors it is more optimal in terms of speed if double word are placed at addresses which ate multiples of 4. If data items are placed at odd addresses the access to such data items is slower by the virtue of the memory interface of such PCs. So it more

Distinguishing between 486 and Pentium processors

• 486 will pass the alignment test.

• To distinguish 486 with Pentium

CPUID Test is used.

CPUID Test

A Pentium and 486 both will pass the alignment test. But a 486 does not support the CPUID instruction. We will next incorporate the CPUID instruction support test to find if the processor is 486 or a Pentium as Pentium does support CPUID instruction.

  • 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.

CPUID Test

21 Eflags

If the CPUID instruction is available the processor is a Pentium processor otherwise it’s a

More about CPUID Instruction

Before After 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

CPUID Instruction

The CPUID instruction, if available, returns the vendor name and information about the model as shown in the slide above. Beside rest of the test the CPUID instruction can also be used by the software to identify the vendor name.

The coprocessor status register stores the status of the coprocessor. Very much like the flags register in the microprocessor the Coprocessor status word can be used to determine the result of a comparison as shown in the slide. Following test can be performed to test the presence of coprocessor.

• Initialize

• Read Hi – Byte of Control register.

• If value in Hi – Byte is 3, then

coprocessor is available, otherwise

its absent.

To Check Coprocessor is

Present

Once its established that the coprocessor is present then the model of the coprocessor should be determined. In case an invalid numerical operation is requested the 8087 coprocessor generates an interrupt while the higher coprocessors does not use interrupts in fact they make use of exceptions. This feature can be used to distinguish between 8087 and higher processor as shown in the slide above. The higher processor will not respond to an attempt made to set the IEM flag while 8087 will respond.

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

Check for 8087 Coprocessor

Distinguishing between 80287 and 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

Distinguish between 80287 & 80387

if the sign of infinity can be reversed than the coprocessor is 80387 otherwise its 80387