Homework8_sol

Homework8_sol - swap.o , indicate if it will have a symbol...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Homework 8 1. We now have a piece of Y86 code, tell the value of %eax when the program ends; and give a description about what the program has done. 0x000: 0x000: 308400020000 0x006: 308500020000 0x00c: 7058000000 0x011: 0x011: a058 0x013: 2045 0x015: a008 0x017: a018 0x019: 308102000000 0x01f: 6110 0x021: 7631000000 0x026: 308001000000 0x02c: 7051000000 0x031: 0x031: 8011000000 0x036: a028 0x038: 2002 0x03a: 5005fcffffff 0x040: 308101000000 0x046: 6110 0x048: 8011000000 0x04d: 6020 0x04f: b028 0x051: 0x051: b018 0x053: b058 0x055: b058 0x057: 90 0x058: 0x058: 308007000000 0x05e: 8011000000 0x063: 10 0x200: 0x200:
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
%eax: __13___ description: __ Fibonacci_____ 2. Consider the following version of the swap.c function that counts the number of times it has been called. For each symbol that is defined and referenced in
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: swap.o , indicate if it will have a symbol table entry in the .symtab section in module swap.o . If so, indicate the module that defines the symbol( swap.o or main.o ), the symbol type( local , global , or extern ) and the section ( .text , . data , or .bss ) it occupies in that module. Symbol swap.o .symtab entry ? Symbol Type Module where defined Section buf Yes Extern main.o -- bufp0 Yes Global swap.o .data bufp1 Yes Local swap.o .bss swap Yes Global swap.o .text temp No -- -- -- incr Yes Local swap.o .text count Yes Local swap.o .bss 1 extern int buf[]; 2 3 int * bufp0 = &buf[0]; 4 static int *bufp1; 5 6 static void incr(){ 7 static int count = 0; 8 count ++; 9 } 10 11 void swap(){ 12 int temp; 13 incr(); 14 bufp1 = &buf[1]; 15 temp = *bufp0; 16 *bufp0 = *bufp1; 17 *bufp1 = temp; 18 }...
View Full Document

This note was uploaded on 10/19/2011 for the course CS 000 taught by Professor Jing during the Fall '10 term at Fudan University.

Page1 / 2

Homework8_sol - swap.o , indicate if it will have a symbol...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online