<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://andromeda.df.lu.lv/wiki/index.php?action=history&amp;feed=atom&amp;title=LU-LSP-b12%3AL09</id>
	<title>LU-LSP-b12:L09 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://andromeda.df.lu.lv/wiki/index.php?action=history&amp;feed=atom&amp;title=LU-LSP-b12%3AL09"/>
	<link rel="alternate" type="text/html" href="http://andromeda.df.lu.lv/wiki/index.php?title=LU-LSP-b12:L09&amp;action=history"/>
	<updated>2026-04-19T20:19:01Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.31.0</generator>
	<entry>
		<id>http://andromeda.df.lu.lv/wiki/index.php?title=LU-LSP-b12:L09&amp;diff=4069&amp;oldid=prev</id>
		<title>Atis: New page: === Praktiskais darbs #9 - steka satura analīze un piekļuve stekam. ===  * [http://www.codeproject.com/KB/windows/CallStackTest/StackLayout2.jpg Steka kadra uzbūve x86 arhitektūrā].  ...</title>
		<link rel="alternate" type="text/html" href="http://andromeda.df.lu.lv/wiki/index.php?title=LU-LSP-b12:L09&amp;diff=4069&amp;oldid=prev"/>
		<updated>2012-11-20T14:32:25Z</updated>

		<summary type="html">&lt;p&gt;New page: === Praktiskais darbs #9 - steka satura analīze un piekļuve stekam. ===  * [http://www.codeproject.com/KB/windows/CallStackTest/StackLayout2.jpg Steka kadra uzbūve x86 arhitektūrā].  ...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;=== Praktiskais darbs #9 - steka satura analīze un piekļuve stekam. ===&lt;br /&gt;
&lt;br /&gt;
* [http://www.codeproject.com/KB/windows/CallStackTest/StackLayout2.jpg Steka kadra uzbūve x86 arhitektūrā].&lt;br /&gt;
&lt;br /&gt;
* Funkciju izsaukumu analīze. printf() lietošana steka satura izdrukai.&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;objdump&amp;#039;&amp;#039; programma un tās lietošana koda analīzei.&lt;br /&gt;
&lt;br /&gt;
* Funkciju &amp;quot;calling conventions&amp;quot;. Atšķirības starp cdecl, stdcall, un citām.&lt;br /&gt;
&lt;br /&gt;
* Piekļuve steka saturam caur inline asamblera kodu.&lt;br /&gt;
 #define GET_EBP_VALUE(result) \&lt;br /&gt;
     asm volatile(&amp;quot;movl %%ebp, %0\n&amp;quot; : &amp;quot;=m&amp;quot; (result))&lt;br /&gt;
&lt;br /&gt;
* Optimizācija un tās ietekme uz steka izskatu.&lt;br /&gt;
&lt;br /&gt;
==== Iesūtīšana ====&lt;br /&gt;
&lt;br /&gt;
Šoreiz nekas nav jānodod. PD notiek interaktīvi. Drīkst arī strādāt pie MD.&lt;br /&gt;
&lt;br /&gt;
Atceraties, ka mājasdarbos asamblera kodu lietot nav paredzēts!&lt;br /&gt;
&lt;br /&gt;
==== Parauga kods ====&lt;br /&gt;
&lt;br /&gt;
 #include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 void **stackBottom;&lt;br /&gt;
 &lt;br /&gt;
 void print(int *ip, char *c)&lt;br /&gt;
 {&lt;br /&gt;
     void **head = &amp;amp;head;&lt;br /&gt;
     int i;&lt;br /&gt;
     while (head &amp;lt;= stackBottom) {&lt;br /&gt;
 //    for (i = 0; i &amp;lt; 10; i++) {&lt;br /&gt;
 	printf(&amp;quot;%p: %p\n&amp;quot;, head, *head);&lt;br /&gt;
 	head++;&lt;br /&gt;
     }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void g(int *ip, char *c)&lt;br /&gt;
 {&lt;br /&gt;
     int local = 0xcafe;&lt;br /&gt;
     print(ip, c);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void f(int *ip, char *c)&lt;br /&gt;
 {&lt;br /&gt;
     int local = 0xdeadbeef;&lt;br /&gt;
     g(ip, c);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 int main(void)&lt;br /&gt;
 {&lt;br /&gt;
     int dummy;&lt;br /&gt;
     stackBottom = &amp;amp;dummy;&lt;br /&gt;
     int *i = 0x11111111;&lt;br /&gt;
     char *c = 0x22222222;&lt;br /&gt;
     f(i, c);&lt;br /&gt;
     return 0;&lt;br /&gt;
 }&lt;/div&gt;</summary>
		<author><name>Atis</name></author>
		
	</entry>
</feed>