sysperfana/perfinvestigator/com.nokia.carbide.cpp.pi.doc.user/html/reference/methods/link_register.htm
author Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
Wed, 21 Apr 2010 15:14:16 +0300
changeset 5 844b047e260d
parent 2 b9ab3b238396
permissions -rw-r--r--
Performance Investigator Carbide extension 2.3.0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     2
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     3
<html>
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     4
<head>
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     5
	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     6
	<title>Link Register Value</title>
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     7
    <link href="../../../book.css" rel="stylesheet" type="text/css">
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     8
</head>
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     9
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    10
<body>
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    11
<h3>Link Register Value</h3>
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    12
<p>Link register as presented here is specific to the instruction set of the ARM architecture, even though similar solutions can be found from other processor families. Purpose of the link register is to store the value of the address following an executed Branch and Link instruction. Purpose of storing the value is to be able to continue the execution from the next instruction following the branch and link instruction, after returning from a subroutine. In practice this takes place by storing the value from the link register back to the program counter. Link register is a banked register, thus each of the processor modes refer to a dedicated physical register. In performance measurements, link register values can be inspected in order to resolve addresses from which the execution has branched to the currently executing function. A problem in this resolution is that the link register value is usually stored to the stack after entering a custom subroutine, and therefore the values in it do not have to be preserved. The correct link register value is always retrieved from the stack just before returning from the subroutine. This permits the subroutine to trash the value present in the link register during its execution. The trashing usually takes place when a sequential branch and link command is executed within a subroutine. It leaves the link register with a value of the address next to the most recent branch and link command instead of the original value (stored to the stack) that would point to the return address outside the subroutine.</p>
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    13
<P LANG="en-GB" ALIGN=JUSTIFY>In performance measurements, link register values can be used to resolve the caller / callee relations between the functions or methods at run-time. In a practical arrangement, this can be done for example during a periodic interrupt. The explained limitations within the correctness of the link register value have to be taken into account in the analysis, but by following a certain logic the correct values can be distinguished from the values in which the link register has already trashed. In simple terms, the values that point outside the function that are currently under execution can be considered as correct return values for the function, thus revealing the caller of that function. The values that point inside the same function result from subsequent branches that have taken place within the function before the investigation, and cannot be considered correct return values.</P>
5
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    14
<div id="footer">Copyright &copy; 2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. <br>License: <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a></div>
2
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    15
</body>
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    16
</html>