[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference kernel::csguk_systems

Title:CSGUK_SYSTEMS
Notice:No restrictions on keyword creation
Moderator:KERNEL::ADAMS
Created:Wed Mar 01 1989
Last Modified:Thu Nov 28 1996
Last Successful Update:Fri Jun 06 1997
Number of topics:242
Total number of notes:1855

16.0. "va to pa translation" by KERNEL::PETTET (Norm Pettet CSC Basingstoke) Wed Mar 15 1989 20:49

Gents,

	Over the past few months we have had alot of calls where we have to 
translate the Virtual Address (VA) to Physical Address (PA) using SDA and/or 
SYSGEN. To put it frankly (apologies to FB) WE HAVE F!@KED IT UP!!!!. The 
purpose of this memo is to remind engineers (and they know who they are) how to 
translate VA's to PA's. 

	It is divided into 3 sections:-

	a) The procedure to accomplish VA to PA translation.

	b) Worked examples. 

	c) Hints and tips.

a) The procedure to accomplish VA to PA translation.
----------------------------------------------------

	1) Locate Virtual Address

		If its a 8XXXXXXX number its in SYSTEM S0 space
		Any other number and its in PROCESS PX space

	2) If VA is 8XXXXXXX it can be translated using either the crash dump 
	ie: anal/crash sysdump.dmp or alternatively the online running system 
	ie: anal/sys
	   If VA is anything else you will have to use the crash dump

	3) Type the following commands to determine Page Frame Number (PFN):-

	For  a system VA type:-
	SDA> sho page/sys 8XXXXXXX;1 <CR>

	For a process address type:-
	SDA> sho proc/page XXXXXXXX;1 <CR>

	4) Left shift PFN by 9 bits and add byte offset and this will give
	you the Physical Address (PA) of the Virtual Address (VA).

	************************************************************
	Confusing isn't it????? so following is some worked examples
	************************************************************


b) Worked examples. 
-------------------
	1) Example 1 is a VAX 11750 machine check in kernel mode caused by a 
memory RDS not logged in errorlog.

$ anal/cr ;

VAX/VMS System dump analyzer
 
Dump taken on 23-APR-1988 19:03:29.78
MACHINECHK, Machine check while in kernel mode

SDA> sho cra

Time of system crash: 23-APR-1988 19:03:29.78
Version of system: VAX/VMS VERSION V4.4
VAXcluster node name: LS
Reason for BUGCHECK exception: MACHINECHK, Machine check while in kernel mode
Process currently executing: URH1
Current image file: _LS$DUA0:[KERNEL.EXE]URH.EXE
Current IPL: 31  (decimal)
    
General registers:
        R0  = 801AB57C   R1  = 02C80074   R2  = 00000000   R3  = 0000001D
        R4  = 801C3940   R5  = 00000005   R6  = 8044B160   R7  = 00000005
        R8  = 002D8A20   R9  = 0000001B   R10 = 800394C8   R11 = 002C6C00
        AP  = 7FFE9D54   FP  = 7FFE7DE4   SP  = 804F09CC   PC  = 801F8192
        PSL = 041F0008
Processor registers:              VAX-11/750
        P0BR   = 806A6200     SBR    = 00DDD400     ASTLVL = 00000004
        P0LR   = 000023FA     SLR    = 00008B00     SISR   = 00000000
        P1BR   = 7FEC5200     PCBB   = 0064FC78     ICCS   = 800000C1
        P1LR   = 001FFA0A     SCBB   = 00DD9C00     SID    = 0200637C
        ICR    = FFFFF0CA     TBDR   = 00000000     CAER   = 00000000
        TODR   = 4A9A2782     CADR   = 00000000     CMIERR = 00080010
        ACCS   = 00000000     MCESR  = 00000000
        ISP    = 804F09CC
        KSP    = 7FFE7DCC
        ESP    = 7FFE9D18
        SSP    = 7FFED04E
        USP    = 7FF44548
SDA> sho sta

Current operating stack (INTERRUPT):
                804F09AC  0000001B      
                804F09B0  800394C8      
                804F09B4  002C6C00      
                804F09B8  7FFE9D54      
                804F09BC  7FFE7DE4      CTL$GL_KSTKBAS+5E4
                804F09C0  804F09C4      
                804F09C4  801F8192      MCHK+55A
                804F09C8  041F0008      
         SP =>  804F09CC  00000028      
                804F09D0  00000002      
                804F09D4  8044B190      ;VA in this example
                804F09D8  8000C5A7      LCK$GRANTWTRS+070
                804F09DC  02C80074      
                804F09E0  00000008      
                804F09E4  00000000      
                804F09E8  00000000      
                804F09EC  00000000      
                804F09F0  00000008      
                804F09F4  00000008      
                804F09F8  8000C5A3      LCK$GRANTWTRS+06C
                804F09FC  00480009      
SDA> sho page 8044b190;4

         ADDRESS     SVAPTE    PTE       TYPE  PROT  BITS PAGTYP    LOC STATE TYPE  REFCNT   BAK    
   SVAPTE  FLINK  BLINK
        8044B000    8112CD60 B4006E6C    VALID ERKW M   K
                               --|---
                                 |
                                 |
				 |
	    |--------------------|
            |
          __|_                
SDA> eval 6e6c@9+190              (8044B190-8044B000=190)

Hex = 00DCD990   Decimal = 14473616             
SDA> *EXIT*
**************************in this example array is D ie 13th megabyte


	2) Example 2 is a timeout error on a VAX 8600


SDA> sho page/sys 80184200;1

	 ADDRESS     SVAPTE    PTE       TYPE  PROT  BITS PAGTYP    LOC STATE TY
PE  REFCNT   BAK      SVAPTE  FLINK  BLINK
	80184200    82139884 94100090    IOPAG KW   M   K
			       --|---
				 |
				 |
				PFN....Note 21 bits
				 |
	     ____________________|
	     |
	     |
	     |
          ___|__
SDA> eval 100090@9


Hex = 20012000   Decimal = 536944640		
SDA>  ----|---
	  |
	  |_________Adapter at Tr#9 (RH780)

	Note:- There was no byte offset to add as in previous example as VA was 
on a page boundary.


c) Hints and tips.
------------------

	1) Not all memory errors are necessarily logged in errorlog, so check 
	in crash dump. If necessary run Alan's DUE program.

	2) Not all RDS errors are memory related so check in errorlog as well 
	as crash dump. Do not assume that ALL RDS errors are memory related.

	3) Don't forget PFN's are 21 bits wide. Failure to include bit 20 may 
	result in calling out memory when  in fact it is I/O space.

	4) Don't forget to shift PFN by 9 bits and add byte offset.
T.RTitleUserPersonal
Name
DateLines
16.1...tribute to BDAYKERNEL::JAMESAlan James CSC BasingstokeMon Feb 19 1990 14:3994
	             Procedure for VA translation using SDA
                     **************************************

						-  PRODUCED BY BOB DAY


	Procedure to translate a Virtual Address to a Physical
	Address using SDA and the Page Tables.

	1.  Get your VA from the stack, or the errorlog entry for
	    the mcheck.

	2.  If the VA is 8xxxxxxx it's a System space address. If 
	    it is anything else it's a Process space address.

	NB  If you have a System space address you do NOT need a 
	    crashdump to translate it. A system will normally map 
	    it's System and I/O addresses the same each time it 
	    boots... Therefore you can use the dump from an Operator
	    Requested Shutdown, or failing that an ANAL/SYS.
	

	3.  If you have a system address do :-

		SDA> Sh page/sys 8xxxxxxx;1 <ret>
	
	    for a process address do :-

		SDA> Sh proc/page xxxxxxxx;1 <ret>
 
	eg 

	   SDA> sh page/sys 8002AAEC;1   ( this is the VA of TXA CSR on THESUN )
	
	 ADDRESS     SVAPTE    PTE       TYPE  PROT  BITS PAGTYP    LOC STATE TYPE  REFCNT   BAK       SVAPTE    FLINK      BLINK

	8002AA00    87FFE954 941009F0    IOPAG KW   M   K

	4.  The number under 'ADDRESS' is the VA of the first longword
	    of the page. We need to subtract this number from our original
	    VA to get the offset into the page.

	    8002AAEC-8002AA00 = EC	

	    The number under 'PTE' is contents of the PTE. This contains
	    the Page Frame Number, as well as protection bits. We are 
	    interested in bits 20-0, this is the PFN..

	5. The easy way to break down the PTE is 

		SDA> eval/pte 941009f0

|31       28|27       24|23       20|19       16|15       12|11        8|7
|           |           |           |           |           |           |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+-->
|1 |  0 0 1 0  |1 |--| 0 0 |--| 0|                          1009FE             
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+-->
Vld  Prot= KW   M     Own=K     W                      Page Frame Number       

	Page is Active and Valid

	  The PFN ( bits 20-0 ) becomes bits 29-9 of the PA, so
	we need to shift it 9 places left..

	 
         6.  Do it the easy way

		SDA> eval 1009FE@9
                                                                                
	  Hex = 2013E000   Decimal = 538180608		

	 So 2013E000 is the Physical Address of the page. We now need to
	 add in the offset to get the address.

	  SDA> eval 2013E000+EC

	  Hex = 2013E0EC   Decimal = 538180844	

           2013E0EC is the final physical address...


	  7. You now need to get a copy of the pyhsical address map
	     for the system your dealing with and see where your
	     address is.

		eg.

           THESUN is an 8600, so if you check this address against the 
	   physical address map for the 8600, you will find that 2013E0EC 
	   falls within the range for SBIA-0 adapter 0. This is a DW780.. 
	   Bits 0-17 are the 18 bit unibus address, in this case 3E0EC, 
	   convert this to octal and you get 760354. Which (fortunately) 
	   turns out to be the CSR for TXA...