assembly

Why does eax contain the number of vector parameters?

a 夏天 提交于 2020-12-23 11:13:01
问题 Why does al contain the number of vector parameters in assembly? Why are vector parameters any different from normal parameters for the callee? 回答1: The value is used for optimization as stated in the ABI document The prologue should use %al to avoid unnecessarily saving XMM registers. This is especially important for integer only programs to prevent the initialization of the XMM unit. 3.5.7 Variable Argument Lists - The Register Save Area. System V Application Binary Interface version 1.0

Interrupting instruction in the middle of execution

筅森魡賤 提交于 2020-12-23 09:56:14
问题 Suppose that CPU is running an assembly instruction, say, FOO that will be executed in several clocks (e.g. 10) An interrupt request has come just in the middle of executing FOO and processor needs to interrupt. Does it wait until command is properly executed, or is FOO aborted and will be restarted? Does it behave differently considering different types of interrupts' prioritization? 回答1: The CPU has the option of deciding to do either one, i.e. deciding when the interrupt was handled

Interrupting instruction in the middle of execution

北城以北 提交于 2020-12-23 09:52:28
问题 Suppose that CPU is running an assembly instruction, say, FOO that will be executed in several clocks (e.g. 10) An interrupt request has come just in the middle of executing FOO and processor needs to interrupt. Does it wait until command is properly executed, or is FOO aborted and will be restarted? Does it behave differently considering different types of interrupts' prioritization? 回答1: The CPU has the option of deciding to do either one, i.e. deciding when the interrupt was handled

Interrupting instruction in the middle of execution

六眼飞鱼酱① 提交于 2020-12-23 09:52:27
问题 Suppose that CPU is running an assembly instruction, say, FOO that will be executed in several clocks (e.g. 10) An interrupt request has come just in the middle of executing FOO and processor needs to interrupt. Does it wait until command is properly executed, or is FOO aborted and will be restarted? Does it behave differently considering different types of interrupts' prioritization? 回答1: The CPU has the option of deciding to do either one, i.e. deciding when the interrupt was handled

Interrupting instruction in the middle of execution

て烟熏妆下的殇ゞ 提交于 2020-12-23 09:52:17
问题 Suppose that CPU is running an assembly instruction, say, FOO that will be executed in several clocks (e.g. 10) An interrupt request has come just in the middle of executing FOO and processor needs to interrupt. Does it wait until command is properly executed, or is FOO aborted and will be restarted? Does it behave differently considering different types of interrupts' prioritization? 回答1: The CPU has the option of deciding to do either one, i.e. deciding when the interrupt was handled

Linux default behavior against `.data` section

戏子无情 提交于 2020-12-23 09:31:49
问题 Story Case 1 I accidentally wrote my Assembly code in the .data section. I compiled it and executed it. The program ran normally under Linux 5.4.0-53-generic even though I didn't specify a flag like execstack . Case 2: After that, I executed the program under Linux 5.9.0-050900rc5-generic . The program got SIGSEGV . I inspected the virtual memory permission by reading /proc/$pid/maps . It turned out that the section is not executable. I think there is a configuration on Linux that manages

What is the “-4” for in assembler: movl $1, -4(%rbp) [duplicate]

我怕爱的太早我们不能终老 提交于 2020-12-15 07:06:37
问题 This question already has answers here : What does the bracket in `movl (%eax), %eax` mean? (3 answers) What does a hexadecimal number, with a register in parenthesis mean in Assembly? (1 answer) Closed 22 days ago . int x=1; int y=2; int z=3; turns into movl $1, -4(%rbp) movl $2, -8(%rbp) movl $3, -12(%rbp) What is the -4,-8,-12 for ? Why is it going by 4's? 4 bytes = 32 bits? 回答1: -4 / -8 / -12 bytes relative to the address held in rbp , which is the pointer to the top of the stack (which

How to get an argument from stack in x64 assembly?

旧城冷巷雨未停 提交于 2020-12-15 06:22:05
问题 I'm trying to write a procedure in x64 assembly. I'm calling it in a main program that is written in C++. I'm passing several parameters. I know that first 4 will be in specific registers and the rest of them (should be) on stack. What's more, I read that before taking 5th argument from the stack, I should substract 40 from RSP. And at the begining it worked. Later I needed to check the address of sth so I did it by: cout and &. But then, taking 5th argument from stack didn't work and I have

Reading from one file and writing to another - MIPS

↘锁芯ラ 提交于 2020-12-15 05:36:12
问题 I have written some code which opens and reads from a file, input.txt, in a loop. I now want to take each word from the first file, and write it to a new file like so. If file 1 says "This is my file", File 2 would say "This /n is /n my /n file" each on a separate line. I have written a label which opens the file to be written to, now I am unsure of what I should write in order to access each word from my input.txt. file_open: li $v0, 13 la $a0, output_file_name # output.txt li $a1, 1 li $a2,

how to show the index of element found in tasm program

£可爱£侵袭症+ 提交于 2020-12-13 20:59:27
问题 how can i display index number of the element which i have found? i have found out the maximum element from the array and now I want to print the index of the element which I have found how to proceed? i want to find the element of the largest number which i found in the array according to the below logic ? Data Segment msg db 0dh,0ah,"Please enter the length of the array: $" msg1 db 0dh,0ah,"Enter a number: $" newl db 0dh,0ah," $" res db 0dh,0ah,"The maximum is: $" len db ? max db ? Data