Question

In: Computer Science

Open selfmodifying.asm in MARS. Before running the code, predict: what will be the result in register...

Open selfmodifying.asm in MARS. Before running the code, predict: what will be the result in register $s0when this program is finished running? Now when you run the program, you will see an error: “Cannot read directly from text segment!”. To allow code to read and write the text segment, check Settings | “Self-modifying code”. Now click run again.

a) Explain the result in register $s0when this program is finished running. In order to understand what is going on, we suggest...

•Step through the program line by line, paying careful attention to the Text Segment and registers.

•Work it out on paper

b) Why would an operating system, which is in charge of running the user’s programs, need to be able to modify the Text Segment?

c) While operating systems can modify the Text Segment, for security purposes they disallow user programs from modifying the Text Segment. Explain.

selfmodifying.asm:

la $t2, wow
lw $t1, 0($t2)
addiu $t1, $t1, 0xFED
sw $t1, 0($t2)
wow: addiu $s0, $zero, 1

Solutions

Expert Solution

Please find the answer below.
Please do comments in case of any issue. Also, don't forget to rate the question. Thank You So Much.

after executing the code in self mode . Text sagment will be as below.

and the content of s0 will be

Explanation.

User program may be need to change the text sagment based on some condition and to save lot of space in case of large application.

But user code is not allowed to change the text sagment , Becuase on alternation they can read system file and can change in it as well.


Related Solutions

what are challenges to open or register cosmetics business in saudi Arabia?
what are challenges to open or register cosmetics business in saudi Arabia?
Directly copy the source code and paste into the Word file. Screenshot of running result must...
Directly copy the source code and paste into the Word file. Screenshot of running result must be presented. 1. (20 points) Write the “Hello, world!” program. 2. (30 points) Write a program to calculate the sum from -5 to10. Use the for loop to do the calculation. 3. (20 points) Write a complete C++ program that asks the user to enter the necessary information about the cylinder, calculate the volume in a function (named as calculate_vol, using reference to pass...
What is the code for running the Monte Carlo integration technique for the integral of the...
What is the code for running the Monte Carlo integration technique for the integral of the standard normal distribution at 2? Please include a graph of sample size vs relative error in the solution.
Open jump.asm in MARS. Assemble the program. Notice that in the Basic column, the labels for...
Open jump.asm in MARS. Assemble the program. Notice that in the Basic column, the labels for the two jump instructions are translated into addresses. Explain the following .a) how the address in the Basic column was calculated for each of the two jump instructions b) The upper 6 bits of the machine code are 000010 for the jump instructions (opcode=2). But explain why the lower 26 bits of the machine code looks the way it does for each of the...
What risks does running a platform open up to a platform owner like Facebook? What challenges...
What risks does running a platform open up to a platform owner like Facebook? What challenges has it encountered, and how did it deal with these challenges?
Explain the following code. What language? What does it do? What is the result?                 <!DOCTYPE...
Explain the following code. What language? What does it do? What is the result?                 <!DOCTYPE teo[                                 <ELEMENT teo((stations| databases)+)>                                 <ELEMENT stations(stationName stationLocation sensors*)> <ELEMENT databases(databaseName databaseType )> <ELEMENT stationName(#PCDATA)> <ELEMENT stationLocation(#PCDATA)> <ELEMENT sensors (sensorName phenomenon)+> <ELEMENT sensorName(#PCDATA)> <ELEMENT phenomenon(#PCDATA)> <ELEMENT databaseName(#PCDATA)> <ELEMENT databaseType(#PCDATA)> <!ATTLIST stations boundingBox CDATA #required> ]>
// 5. Predict what the following code will print (write it down), then try it. var...
// 5. Predict what the following code will print (write it down), then try it. var myVariable = "global"; var myOtherVariable = "global"; function myFunction() { var myVariable = "local"; return myVariable; } function myOtherFunction() { myOtherVariable = "local"; return myOtherVariable; javascript
In a maze running study, a rat is run in a T maze and the result...
In a maze running study, a rat is run in a T maze and the result of each run recorded. A reward in the form of food is always placed at the right exit. If learning is taking place, the rat will choose the right exit more often than the left. If no learning is taking place, the rat should randomly choose either exit. Suppose that the rat is given n = 100 runs in the maze and that he...
SpaceXis going to launch a manned shuttle to mars. Before takeoff, they have to determine if...
SpaceXis going to launch a manned shuttle to mars. Before takeoff, they have to determine if all systems are clear for launch. Ho: Ha: A type one error in this case would be : A type 2 error in this case would be :
A) What amino acid characteristics result in large Rf values? B) On a silica plate, predict...
A) What amino acid characteristics result in large Rf values? B) On a silica plate, predict the relative movement of aspartic acid, valine, and serine.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT