代做CS210 Fall 2024: PS2A代写Web开发

CS210 Fall 2024: PS2A

Multiple Choice

1. (1 point) How do registers differ from Main Memory in a computer system ?

Registers are smaller and faster but used for short-term storage, while Main Memory is larger and slower but used for long-term storage.

Registers are used only for storing data.

Main Memory is directly connected to the CPU, while registers are not.

All of the above.

None of the above.

2. (1 point) In an x86 machine, variables and other data values in assembly programs are typically stored in the ’text’ section.

True.

False.

3. (1 point) In most CPUs, instructions are executed sequentially by default.

True

False

4. (1 point) The linker

Can produce an executable.

Takes as input fragments of an executable in the form. of object files.

Combines all of the data bytes of a program into a single data section.

Combines all of the text bytes of a program into a single text section.

All of the above.

None of the above.

5. (1 point) How do “jump” (jmp) instructions contribute to program control flow ?

They force the CPU to execute the same sequence of instructions repeatedly.

They allow for conditional execution of code.

They enable the CPU to transfer control to a different address in memory.

All of the above.

None of the above.

6. (1 point) Select the correct answer:

The PC register and IR register are general-purpose registers.

The PC register is used to hold the instruction of the opcode to be executed.

The PC register stores the memory address of the operation to be executed.

All of the above.

None of the above.

7. (1 point) Which of the following best describes the sequence of internal phases of generic CPU pro-gram execution?

I: Get the value at the location pointed to by the PC

II: CPU conducts memory bus transactions to write results of a calculation to main memory

III: Identify operation and location of input and output values

I, II, III.

II, I, III.

I, III, II.

None of the above.

Basic Byte Representation

The following is the gdb dump of 64 bytes of memory in base 2 notation. Using this data please fill in the following tables.

0 x402000 : 01000011 01010011 00100000 00110010 00110001 00110000 00111100 00110011

8. (4 points) Write the values as single byte values in hex notation.

0x402000

9. (4 points) As 2-byte little endian values in hex notation.

0x402000

10. (4 points) As 4-byte little endian values in hex notation.

0x402000

11. (4 points) As an 8-byte little endian value in hex notation.

0x402000

12. (4 points) Finally using the provided ASCII Table please fill in the table below translating each byte into an ascii character.

0x402000

Assembly Fragments

Given the code and list of gdb commands below, answer the following questions. Assume the code has been assembled and linked correctly to produce a binary, after which gdb is used with the binary to run the given gdb commands.

Remember to use Little Endian byte ordering for multi-byte values when displayed as single bytes

13. Assembly code for subsum.S:

1 . i n t e l s y n t a x n o p r e f i x

2 . s e c t i o n . d a t a

3

4 v a l u e 1 : . quad 0x4

5 v a l u e 2 : . quad 0x8

6

7 . s e c t i o n . t e x t

8 . g l o b a l _s t a r t

9

10 _s t a r t :

11 sub rax , QWORD PTR [ v a l u e 1 ]

12 cmp rax , 0

13 j g B

14 A:

15 add rax , QWORD PTR [ v a l u e 1 ]

16 B :

17 add rax , QWORD PTR [ v a l u e 2 ]

18 C :

19 i n t 3

Gdb commands used with the binary subsum produced from subsum.S.

1 f i l e subsum

2 s e t d i s a s s e m b l y − f l a v o r i n t e l

3 b _s t a r t

4 run

5 d e l e t e 1

6 s e t $r a x = 3

7 s i

8 s i

9 s i

10 s i

11 s i

12 p / x $r a x

13 p / x $pc

14 x / 1 xg &v a l u e 2

15 x / 8 xb &v a l u e 2

16 q u i t

Addtionally this is the gdb output for the gdb command at line 3 of the above commands:

1 ( gdb ) x / 6 i

s t a r t

2 0 x401000 < s t a r t >: sub rax ,QWORD PTR ds : 0 x402000

3 0 x401008 < s t a r t +8>: cmp rax , 0 x0

4 0 x40100c < s t a r t +12>: j g 0 x401016

5 0 x40100e : add rax ,QWORD PTR ds : 0 x402000

6 0 x401016 : add rax ,QWORD PTR ds : 0 x402008

7 0 x40101e : i n t 3

(a) (2 points) Value displayed for rax on line 12 of gdb commands:

(b) (2 points) Value displayed for pc on line 13 of gdb commands:

(c) (2 points) Value displayed for line 14 of gdb commands:

(x/1xg &value2 means display one 64bit value at the address in memory of the value2 sym-bol in hex notation)

(d) (1 point) Values displayed on line 15 of gdb commands:





热门主题

课程名

mktg2509 csci 2600 38170 lng302 csse3010 phas3226 77938 arch1162 engn4536/engn6536 acx5903 comp151101 phl245 cse12 comp9312 stat3016/6016 phas0038 comp2140 6qqmb312 xjco3011 rest0005 ematm0051 5qqmn219 lubs5062m eee8155 cege0100 eap033 artd1109 mat246 etc3430 ecmm462 mis102 inft6800 ddes9903 comp6521 comp9517 comp3331/9331 comp4337 comp6008 comp9414 bu.231.790.81 man00150m csb352h math1041 eengm4100 isys1002 08 6057cem mktg3504 mthm036 mtrx1701 mth3241 eeee3086 cmp-7038b cmp-7000a ints4010 econ2151 infs5710 fins5516 fin3309 fins5510 gsoe9340 math2007 math2036 soee5010 mark3088 infs3605 elec9714 comp2271 ma214 comp2211 infs3604 600426 sit254 acct3091 bbt405 msin0116 com107/com113 mark5826 sit120 comp9021 eco2101 eeen40700 cs253 ece3114 ecmm447 chns3000 math377 itd102 comp9444 comp(2041|9044) econ0060 econ7230 mgt001371 ecs-323 cs6250 mgdi60012 mdia2012 comm221001 comm5000 ma1008 engl642 econ241 com333 math367 mis201 nbs-7041x meek16104 econ2003 comm1190 mbas902 comp-1027 dpst1091 comp7315 eppd1033 m06 ee3025 msci231 bb113/bbs1063 fc709 comp3425 comp9417 econ42915 cb9101 math1102e chme0017 fc307 mkt60104 5522usst litr1-uc6201.200 ee1102 cosc2803 math39512 omp9727 int2067/int5051 bsb151 mgt253 fc021 babs2202 mis2002s phya21 18-213 cege0012 mdia1002 math38032 mech5125 07 cisc102 mgx3110 cs240 11175 fin3020s eco3420 ictten622 comp9727 cpt111 de114102d mgm320h5s bafi1019 math21112 efim20036 mn-3503 fins5568 110.807 bcpm000028 info6030 bma0092 bcpm0054 math20212 ce335 cs365 cenv6141 ftec5580 math2010 ec3450 comm1170 ecmt1010 csci-ua.0480-003 econ12-200 ib3960 ectb60h3f cs247—assignment tk3163 ics3u ib3j80 comp20008 comp9334 eppd1063 acct2343 cct109 isys1055/3412 math350-real math2014 eec180 stat141b econ2101 msinm014/msing014/msing014b fit2004 comp643 bu1002 cm2030
联系我们
EMail: 99515681@qq.com
QQ: 99515681
留学生作业帮-留学生的知心伴侣!
工作时间:08:00-21:00
python代写
微信客服:codinghelp
站长地图