Looking for CA & OS (Computer Architecture) - EFREI - Fall 2026 test answers and solutions? Browse our comprehensive collection of verified answers for CA & OS (Computer Architecture) - EFREI - Fall 2026 at moodle.lab.ii.agh.edu.pl.
Get instant access to accurate answers and detailed explanations for your course questions. Our community-driven platform helps students succeed!
Avant de commencer cet exercice, il est nécessaire de configurer l'environnement SASM. Après avoir démarré SASM, accédez au menu Paramètres et repérez l'onglet Compilation. Dans cet onglet, vérifiez que l'option x86 est cochée dans la section Mode et que l'option GAS est cochée dans la section Assembleur. Ne modifiez pas les autres paramètres ! Les paramètres corrects sont indiqués dans la figure ci-dessous.
Veuillez ouvrir SASM, vérifier que vos paramètres sont corrects (x86 et GAS), copier-coller le programme simple fourni séparément dans cette section (TP 1) du cours, le compiler et l'exécuter. Le programme a-t-il été compilé correctement, sans erreur ?
Voici un exemple de ce à quoi cela pourrait ressembler après avoir compilé et exécuté le programme avec le bouton (sous Linux, donc pas de « _ » ici, mais vous aurez probablement besoin des tirets bas) :
Cet exercice porte sur la manière dont différents types de données sont organisés en mémoire.
L'organisation de la mémoire x86 est appelée little-endian . Cela signifie que l'octet de poids faible (LSB) d'une variable multi-octets est placé à une adresse mémoire plus basse. Pour rappel, voici une diapositive du cours :
Commençons donc par quelques notions de base. Quelle séquence d'octets préféreriez-vous trouver dans un dump mémoire si la machine sur laquelle vous travaillez est little-endian et que la mémoire contient une variable 32 bits dont la valeur est 0x01020304 en hexadécimal ?
Now, still in the debug session, you should see a small strip at the bottom of the SASM window with GDB command. In the text box there, enter the command x /32bx and the address you have in the eax register (replace _____ with the address) and press enter.
x /32bx ____Please, do not type mindlessly what you see below - the command is specific to one of the operating systems. Instead, replace the address number with what you had read from eax before:
Copy & paste the command you typed to the report text box in the correct section, using the provided template.
You will receive the output - the memory dump of the interesting section, for example:
Again, copy&paste the memory dump to the appropriate section in the report as many times as needed and highlight the values according to the instructions in the template.
Prepare declaration of memory content represented in .long that will contain a unique text encoded as ASCII character so you can interpret the data as a string containing your name. The text can be your name, your nickname, or any other unique string of characters, but please ensure that the string length is 10 characters or more.
For a shorter string as an example, instead of defining the Abcdef text like this:
.asciz "Abcdef"we can write:
.long 0x64636241, 0x00006665and then we can use it with the printf instruction and it will be printed as if it would be an ASCII text.
.datastring:# put here your long number declaration.long 0x64636241, 0x00006665 #.asciz "Abcdef".text.global _main_main:movl %esp, %ebp #for correct debugging# write your code herepushl $stringcall _printfaddl $4,%espxorl %eax, %eaxret
Modify the program so that you define the following declaration of .data section:
.data
variables:
.word 0x55aa
.asciz "Text"
.word 0xFFFF
.ascii "Nums 0123"
.word 0xFFFF
The .asciz directive is used to declare a null terminated string type variable or constant.The .ascii directive is used to declare string type variable or constant without terminating character at the end.
Also, if necessary, adequately modify the program to build it successfully and perform the memory dump in the debug session. This way you will see the contents of the data section properly.
Similarly to the previous exercise, copy & paste the memory dumps and bold&underline the values according to the instructions in the template. Also, attach the source code .asm file for a reference (however the source code will not be graded).
Modify the program so that you define the following declaration of .data section:
.data
variables:
.tfloat 23.7
The .tfloat directive is used to declare an extended precision floating point type variable (80 bits - 10 bytes in size). This data type is specific for x86-32 architecture.
Also, if necessary, adequately modify the program to build it successfully and perform the memory dump in the debug session. This way you will see the contents of the data section properly.
Similarly to the previous exercise, copy & paste the memory dumps and bold&underline the values according to the instructions in the template. Also, attach the source code .asm file for a reference (however the source code will not be graded).
Copy, paste & modify the program below:
.data
variables:
.word 0x55AA
.align 8
.quad 0xDEADCAFE87654321
.quad 0
so that the alignment of the
0xDEADCAFE87654321is: 4 bytes, 2 bytes, and 0 bytes.
If necessary, adequately modify the program to build it successfully and perform the memory dump in the debug session. This way you will see the contents of the data section properly.
Similarly to the previous exercise, copy & paste the memory dumps and highlight the values according to the instructions in the template. Also, attach the modified source code .asm file (any alignment you choose) for a reference (however the source code will not be graded).
Modify the program so that you define the following declaration of .data section:
.data
variables:
.word 0x55AA
.align 8
.quad 0xDEADCAFE87654321
.quad 0
The .word directive is used to declare an short int type variable with a lenght of 16 bits (2 bytes).The .quad directive is used to declare an long long int type variable with a lenght of 64 bits (8 bytes).
Also, adequately modify the program to build it successfully and perform the memory dump in the debug session. This way you will see the contents of the data section properly.
Similarly to the previous exercise, copy & paste the memory dumps and highlight the values according to the instructions in the template. Also, attach the source code .asm file for a reference (however the source code will not be graded).
Modify the program so that you define the following declaration of .data section:
.datavariables:
.long 0xDEADCAFE
.long 1678
num_i32s:
.long -24786
The .long directive is used to declare an integer type variable with a length of 32 bits.
Also, adequately modify the program to build it successfully and perform the memory dump in the debug session. This way you will see the contents of the data section properly.
Similarly to the previous exercise, copy & paste the memory dumps and highlight the values according to the instructions in the template. Also, attach the source code .asm file for a reference (however the source code will not be graded).
Now start the debugger with the "Debug" button.
In the Debug menu please make sure that the box Show registers is checked:
Now, using Step over, move to the next instruction, and the to the ret instruction.
movl $variables, %eaxretNow you should see something similar to this:
In the Registers section, you can see what's in the internal registers of the CPU. The highlighted instruction moved the address under the variables label to the eax register. So please read that value in hexadecimal and write that value to the answer box using the provided template. Also note that value because we'll use it later.
If you use Windows it probably will be something like 0x402000, and if you use Linux then rather something like 0x804c020.Do not exit the debug session yet ;)