home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / pc / source / cpu.zoo / cpu.3 < prev    next >
Internet Message Format  |  1989-08-18  |  3KB

  1. From santra!kth!sunic!mcvax!uunet!ginosko!gem.mps.ohio-state.edu!csd4.csd.uwm.edu!mailrus!jarvis.csri.toronto.edu!utgpu!utzoo!mnetor!tmsoft!mshiels Fri Aug 18 10:31:52 EET DST 1989
  2. Article 7097 of comp.sys.ibm.pc:
  3. Path: chyde!santra!kth!sunic!mcvax!uunet!ginosko!gem.mps.ohio-state.edu!csd4.csd.uwm.edu!mailrus!jarvis.csri.toronto.edu!utgpu!utzoo!mnetor!tmsoft!mshiels
  4. >From: mshiels@tmsoft.uucp (Michael A. Shiels)
  5. Newsgroups: comp.sys.ibm.pc
  6. Subject: CPU Identification 3 of 4
  7. Message-ID: <1989Aug16.110546.405@tmsoft.uucp>
  8. Date: 16 Aug 89 11:05:46 GMT
  9. Reply-To: mshiels@tmsoft.UUCP (Michael A. Shiels)
  10. Followup-To: comp.sys.ibm.pc
  11. Organization: MaS Network Software and Consulting
  12. Lines: 61
  13.  
  14. Article 17981 of comp.sys.ibm.pc:
  15. Path: watmath!looking!brad
  16. >From: brad@looking.UUCP (Brad Templeton)
  17. Newsgroups: comp.sys.ibm.pc
  18. Subject: Re: How to tell the difference between 80386 virtual 8086 mode and 286 real mode?
  19. Message-ID: <1884@looking.UUCP>
  20. Date: 30 Jul 88 16:56:17 GMT
  21. References: <1873@looking.UUCP> <1657@microsoft.UUCP>
  22. Reply-To: brad@looking.UUCP (Brad Templeton)
  23. Organization: Looking Glass Software Ltd.
  24. Lines: 49
  25.  
  26. > use SMSW
  27.  
  28. This does sound like a good method.  Another method, which I developed
  29. on my own while waiting for replies, was to examine the length of the
  30. instruction prefetch queue.   This can even tell the difference between
  31. an 8088 and and 8086 if you want it to.  (8088 = 4, 8086,286 = 6, 386 = 8)
  32.  
  33. But that does sound like a rather scary way to do things, since Intel is
  34. certainly free to change the length of this in future chips, or to put
  35. in impure code checking into the prefetch hardware.
  36.  
  37. For those who want it,...
  38.  
  39. prefcount    PROC    NEAR
  40.         ; must preserve ax.  It does
  41.         mov    bx,offset point
  42.         mov    cx,0
  43.         mov    dx,12        ; max iter
  44.     kloop:
  45.         nop
  46.         nop
  47.         ; store "inc cx" at one of the nops
  48.         mov    byte ptr cs:[bx],41h        ; inc cx
  49.     point:
  50.         ; execute a chain of nops, one that might be the "inc cx"
  51.         REPT    12
  52.         nop
  53.         ENDM
  54.         ; restore the "inc cx" back to a nop
  55.         mov    byte ptr cs:[bx],90h        ; nop
  56.         ; go on to the next byte
  57.         inc    bx
  58.         ; check we haven't gone too far
  59.         dec    dx
  60.         jz    pcdone
  61.         ; keep looping until the inc was interpreted
  62.         jcxz    kloop
  63.      pcdone:
  64.         ; we already have the index of the first non-prefetched
  65.         ; byte plus one (we incremented anyway).  Now we use
  66.         ; point-1 to add another to it because of the three byte
  67.         ; instruction at the front
  68.         ; the result is 6 for 286 and 8 for 386. (4 for 8088)
  69.         sub    bx,offset point-1
  70.         ret
  71. prefcount    ENDP
  72.  
  73. -- 
  74. Brad Templeton, Looking Glass Software Ltd.  --  Waterloo, Ontario 519/884-7473
  75.  
  76.  
  77.