CPR E 281x/282x - Lab 11a

 

Big-Endian Structure Mapping and Mixed C & Assembly Programming

 

1. Objectives

 

In this lab you will learn how to write structures that allocate memory efficiently.   Also, you will learn how to pass parameters between C and assembly code.

 

1.1 Reference Files for Lab

 

Lab Evaluation Form

 

2. Prelab

 

Before you come to lab it would be good to understand how to setup, declare, and use structures.  Also, it would be good to understand EABI and how to pass parameters in mixed coding.  You can find information on all of these topics in the following documents:

 

PowerPC Manual  (Big-Endian Mapping is section 3.1.2.1, pages 3-2 to 3-4)

PowerPC Quick Reference

EABI Guidelines

 

3. Big-Endian Structure Mapping

 

Observe the following structure.

 

 

When the struct is declared as a variable type in main, memory is allocated for that declaration.  Read the Information about big endian mapping in the PowerPC manual.  Recall that byte, half-word, word, and double word alignment must be followed.

 

 

 

 

 

 

 

4. Mixed C & Assembly Programming

 

Observe the following C & Assembly code.