Мальков Павел lab2
9 unresolved threads
- Last updated by Paul Malkov
1 ASM = nasm 2 ASMFLAGS = -f elf64 -o 3 4 %.o: %.asm 5 $(ASM) $(ASMFLAGS) $@ $< 6 .PHONY: clean files test 7 clean: 8 rm *.o 9 rm main 10 files: 11 make lib.o main.o dict.o 12 ld -o main *.o 13 test: 14 python test.py - Last updated by Paul Malkov
1 ASM = nasm 2 ASMFLAGS = -f elf64 -o 3 4 %.o: %.asm Кажется, стоит добавить зависимости от inc файлов в целом в makefile (не привязываюсь к этой строчке кода)
Edited by Emil Askarov
- Last updated by Paul Malkov
- Last updated by Paul Malkov
14 def print_res(input_string, expected_value, received_value): 15 print( 16 "| Test with input" + " [" + input_string + "] Result: " + ("SUCCESS" if expected_value == received_value else "FAILED")) 17 print("| Expected value: [" + expected_value + "]") 18 print("| Got value: [" + received_value + "]") 19 print("----------------------------------------") 20 21 22 for input_str, output_str in zip(inputs_file, outputs_file): 23 exp_value = output_str.strip() 24 input_str = input_str.strip() 25 proc = sb.Popen(EXECUTABLE_FILE, universal_newlines=True, stdin=PIPE, stdout=PIPE, stderr=PIPE) 26 res = proc.communicate(input_str.strip()) 27 out = res[0].strip() 28 err = res[1].strip() 29 result = result if (out == exp_value) or (err == exp_value) else False - Last updated by Paul Malkov
4 global _start 5 6 %define NODE_POINTER_SIZE 8 7 8 9 section .text 10 find_word: 11 mov rdx, rsi 12 xor rax, rax 13 .loop: 14 test rdx, rdx 15 jz .not_found 16 17 18 lea rsi, [rdx + NODE_POINTER_SIZE] ; skip next node pointer 19 push rdi changed this line in version 2 of the diff
- Last updated by Paul Malkov
1 %include "words.inc" 2 %include "lib.inc" 3 %include "dict.inc" 4 5 global _start 6 7 %define BUFFER_SIZE 256 8 %define NULL_TERMINATOR_SIZE 1 9 %define NODE_POINTER_SIZE 8 10 11 section .data changed this line in version 2 of the diff
- Last updated by Paul Malkov
31 mov rax, SYS_EXIT 32 syscall 33 34 ; Принимает указатель на нуль-терминированную строку, возвращает её длину 35 string_length: 36 xor rax, rax 37 .loop: 38 cmp byte [rdi + rax], 0 39 je .end 40 inc rax 41 jmp .loop 42 .end: 43 ret 44 ; Принимает указатель на нуль-терминированную строку, выводит ее в stderr 45 print_error: 46 push rdi changed this line in version 2 of the diff
- Last updated by Paul Malkov
184 pop rdi 185 pop rsi 186 cmp rax, " " 187 je .wait_loop 188 cmp rax, TABULATION_CODE 189 je .wait_loop 190 cmp rax, "\n" 191 je .wait_loop 192 193 .read_loop: 194 cmp rdx, rsi 195 ja .bad_end 196 197 test rax, rax 198 je .good_end 199 cmp rax, 0x20 changed this line in version 4 of the diff
- Last updated by Paul Malkov
19 20 ; Выводит значение из словаря, найденное по ключу 21 ; rdi -- содержит адрес вхождения в нужный узел 22 print_word_from_linked_list: 23 push rdi 24 call string_length 25 pop rdi 26 lea rdi, [rdi + rax + NULL_TERMINATOR_SIZE] 27 call print_string 28 call print_newline 29 ret 30 _start: 31 .read_line: 32 mov rdi, buffer 33 mov rsi, BUFFER_SIZE-NULL_TERMINATOR_SIZE 34 call read_word changed this line in version 2 of the diff
added 1 commit
- d42565ac - Injection of dependencies from *.inc files in makefile