x86

What are my available march/mtune options?

时光总嘲笑我的痴心妄想 提交于 2021-02-08 12:22:47
问题 Is there a way to get gcc to output the available -march=arch options? I'm getting build errors (tried -march=x86_64 ) and I don't know what my options are. The compiler I'm using is a proprietary wrapper around gcc that doesn't seem to like -march=skylake . The flags should be the same so I assume whatever options I'd send to gcc to dump architectures would be the same for this wrapper. I managed to cause gcc to error with a bogus parameter and it dumped a list, but I'm not seeing that now

How to calculate parity of a 32bits number in assembly?

半腔热情 提交于 2021-02-08 12:16:37
问题 I need to calculate the parity of a 32 bits number and return it. To do this I must use XOR, SHR,SETP(or similar) and movzx. Somebody have an idea ? 回答1: Many ways to do this, of course. If you decide to use the hardware parity flag, keep in mind that it only checks the low 8 bits. A solution using this approach might be to process your 32 bit input as four 8 bit values, and use XOR on the partial results: p(31:0) = p(31:24) ^ p(23:16) ^ p(15:8) ^ p(7:0) To get the 8 bit units, you can use

How to calculate parity of a 32bits number in assembly?

五迷三道 提交于 2021-02-08 12:16:21
问题 I need to calculate the parity of a 32 bits number and return it. To do this I must use XOR, SHR,SETP(or similar) and movzx. Somebody have an idea ? 回答1: Many ways to do this, of course. If you decide to use the hardware parity flag, keep in mind that it only checks the low 8 bits. A solution using this approach might be to process your 32 bit input as four 8 bit values, and use XOR on the partial results: p(31:0) = p(31:24) ^ p(23:16) ^ p(15:8) ^ p(7:0) To get the 8 bit units, you can use

X86 Fibonacci program

情到浓时终转凉″ 提交于 2021-02-08 12:04:29
问题 My assignment is to write a program that calculates first seven values of fibonacci number sequence. the formula given is: Fib(1) = 1, Fib(2) = 1, Fib(n) = Fib(n-1) + Fib(n-2) I believe that is a function but I do not understand how to incorporate it into code. I need to place the values in EAX register. I am using MASM not that makes any difference. Any hints? 回答1: I suspect that this is an academic assignment so I'm only going to partially answer the question. The fibonacci sequence is

Virustotal flag 32 bit version of my program as malware

允我心安 提交于 2021-02-08 10:09:41
问题 I've run into a very odd thing. I wrote a pretty simple program in C#, and tried to build a 32bit and a 64bit version of it. The 64bit version works fine, but whenever i try to build the 32bit version, my antivirus software removes it. I've uploaded both files to virustotal here: 32 bit: https://virustotal.com/da/file/fdb3d2870ce876b49eb5d9371fc0b133b7657ddd994603777a42a47f3eb09d8b/analysis/1461779525/ 64 bit: https://virustotal.com/da/file

Why is data stored in memory reversed?

故事扮演 提交于 2021-02-08 09:59:03
问题 This is the source code I have: section .data msg: db "pppaaa" len: equ $ section .text global main main: mov edx,len mov ecx,msg mov ebx,1 mov eax,4 int 0x80 And when I debug this code I will see: (gdb) info register ecx ecx 0x804a010 134520848 (gdb) x 0x804a010 0x804a010 <msg>: 0x61707070 (gdb) x 0x804a014 0x804a014: 0x00006161 "70" here represents the character 'p' and "61" the character 'a' obviously. What I am confused about is, why is the data in location 0x804a010 is 0x61707070 (appp)

Why is data stored in memory reversed?

倾然丶 夕夏残阳落幕 提交于 2021-02-08 09:59:01
问题 This is the source code I have: section .data msg: db "pppaaa" len: equ $ section .text global main main: mov edx,len mov ecx,msg mov ebx,1 mov eax,4 int 0x80 And when I debug this code I will see: (gdb) info register ecx ecx 0x804a010 134520848 (gdb) x 0x804a010 0x804a010 <msg>: 0x61707070 (gdb) x 0x804a014 0x804a014: 0x00006161 "70" here represents the character 'p' and "61" the character 'a' obviously. What I am confused about is, why is the data in location 0x804a010 is 0x61707070 (appp)

Why is data stored in memory reversed?

风流意气都作罢 提交于 2021-02-08 09:58:51
问题 This is the source code I have: section .data msg: db "pppaaa" len: equ $ section .text global main main: mov edx,len mov ecx,msg mov ebx,1 mov eax,4 int 0x80 And when I debug this code I will see: (gdb) info register ecx ecx 0x804a010 134520848 (gdb) x 0x804a010 0x804a010 <msg>: 0x61707070 (gdb) x 0x804a014 0x804a014: 0x00006161 "70" here represents the character 'p' and "61" the character 'a' obviously. What I am confused about is, why is the data in location 0x804a010 is 0x61707070 (appp)

OFFSET Operator in Assembly language for x86 Processors

ⅰ亾dé卋堺 提交于 2021-02-08 09:18:24
问题 I am rather confused by the concept OFFSET Operator. According to Kip R. Irvine's book Assembly Language for x86 Processors, he defines the Offset Operator as the operator that returns the distance of a variable from the beginning of its enclosing segment. He also says the Offset Operator returns the offset of a data label and that represents the distance (in bytes) of the label from the beginning of the data segment. What is the offset? What does he mean by the distance of the label from the

Estimating Cycles Per Instruction

早过忘川 提交于 2021-02-08 08:15:11
问题 I have disassembled a small C++ program compiled with MSVC v140 and am trying to estimate the cycles per instruction in order to better understand how code design impacts performance. I've been following Mike Acton's CppCon 2014 talk on "Data-Oriented Design and C++", specifically the portion I've linked to. In it, he points out these lines: movss 8(%rbx), %xmm1 movss 12(%rbx), %xmm0 He then claims that these 2 x 32-bit reads are probably on the same cache line therefore cost roughly ~200