Binary code is seldom portable across different

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: r strings. Program libraries are also available for C that provide Unicode versions of the standard string functions such as strlen and strcpy. End Aside. 2.1.6 Representing Code Consider the following C function: 1 2 3 4 int sum(int x, int y) { return x + y; } When compiled on our sample machines, we generate machine code having the following byte representations: Linux: 55 89 e5 8b 45 0c 03 45 08 89 ec 5d c3 NT: 55 89 e5 8b 45 0c 03 45 08 89 ec 5d c3 34 ˜ 0 1 CHAPTER 2. REPRESENTING AND MANIPULATING INFORMATION & 1 0 0 1 0 0 0 1 0 1 | 0 1 0 0 1 1 1 1 ˆ 0 1 0 0 1 1 1 0 Figure 2.6: Operations of Boolean Algebra. Binary values 1 and 0 encode logic values T RUE and FALSE, while operations ˜, &, |, and ˆ encode logical operations N OT, A ND, O R, and E XCLUSIVE -O R, respectively. Sun: 81 C3 E0 08 90 02 00 09 Alpha: 00 00 30 42 01 80 FA 6B Here we find that the instruction codings are different, except for the NT and Linux machines. Different machine types use different and incompatible instructions and encodings. The NT and Lin...
View Full Document

This note was uploaded on 09/02/2010 for the course ELECTRICAL 360 taught by Professor Schultz during the Spring '10 term at BYU.

Ask a homework question - tutors are online