Class Notes (811,170)
Canada (494,539)
CS 240 (49)

tutorial 5

2 Pages
Unlock Document

University of Waterloo
Computer Science
CS 240
Brad Lushman

CS 241 { Week 5 Tutorial MERL, Relocation and Linking Winter 2014 Topics ▯ Relocation ▯ Linking 1 Relocation Given the program below, answer the following questions: ▯ Which lines contain values that need to be relocated by the loader? ▯ What needs to be added to the machine code ▯le to produce a valid MERL ▯le containing all necessary relocation info? addr source code machine l. -------------------------------------------------- 0x00 bne $1, $0, endLabels 0x14200004 0x04 lis $1 0x00000814 0x08 .word a 0x00000034 0x0C lis $2 0x00001014 0x10 .word b 0x00000020 0x14 endLabels: lis $4 0x00002014 0x18 .word 0x04 0x00000004 0x1C add $4, $2, $4 0x00442020 0x20 b: jr $4 0x00800008 0x24 lis $5 0x00002814 0x28 .word 0xbad 0x00000bad 0x2C beq $2, $0, a 0x10400001 0x30 add $31, $5, $31 0x00bff820 0x34 a: jr $31 0x03e00008 0x38 endProgram: .word endProgram 0x00000038 Useful Information A relocation entry in a MERL ▯le has the form: ▯ .word 0x01 (the relocation format code) ▯ A 32-bit word containing the location in the MERL ▯le of the value we want to relocate
More Less

Related notes for CS 240

Log In


Don't have an account?

Join OneClass

Access over 10 million pages of study
documents for 1.3 million courses.

Sign up

Join to view


By registering, I agree to the Terms and Privacy Policies
Already have an account?
Just a few more details

So we can recommend you notes for your school.

Reset Password

Please enter below the email address you registered with and we will send you a link to reset your password.

Add your courses

Get notes from the top students in your class.