This commit is contained in:
2026-09-17 12:06:20 +03:00
parent 4ade8dde11
commit ac4c553ec0
13 changed files with 52 additions and 0 deletions
View File

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Before

Width:  |  Height:  |  Size: 123 KiB

After

Width:  |  Height:  |  Size: 123 KiB

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 129 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 247 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 179 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 KiB

+52
View File
@@ -0,0 +1,52 @@
# Студент: [Пузанова Анна Андреевна]
* **Группа:** [228]
* **Курс:** [2]
## Список работ
Практическое задание
Код:
#include <stdio.h>
#include <stdint.h>
void main() {
uint32_t magic = 0xAABBCCDD;
uint8_t *byte_ptr = (uint8_t*)&magic;
printf("Byte 0: 0x%02X\n", byte_ptr[0]);
printf("Byte 1: 0x%02X\n", byte_ptr[1]);
printf("Byte 2: 0x%02X\n", byte_ptr[2]);
printf("Byte 3: 0x%02X\n", byte_ptr[3]);
}
Задания
1.Какие значения выведут  printf ?
Значения выводятся в обратном порядке
x86-64 gcc 16.2
x86-64 gcc 16.2
Compiler options for execution
-O2 -fno-verbose-asm
Program returned: 13
Program stdout
Byte 0: 0xDD
Byte 1: 0xCC
Byte 2: 0xBB
Byte 3: 0xAA
2.Посмотрите в ассемблер на то, как компилятор кладет  0xAABBCCDD  в память.
Найдите инструкцию  mov DWORD PTR [rsp+...], 2864434397  (или в hex  0xaabbccdd ).
DWORD означает 32 бита = 4 байта;
[rsp+12] — адрес в стеке, куда записывается значение;
0xAABBCCDD — само 32-битное число.
В нашем коде:
mov DWORD PTR [rbp-12], -1430532899
Как она выглядит? (Компилятор может использовать  mov r32, imm32  или  movabs ).
Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 KiB