x86-64

Impossible constraint with cmpxchg16b in extended assembly

一笑奈何 提交于 2019-12-04 06:51:55
问题 I am trying to write inline assembly with my C code to perform compare and swap operation. My code is: typedef struct node { int data; struct node * next; struct node * backlink; int flag; int mark; } node_lf; typedef struct searchfrom { node_lf * current; node_lf * next; } return_sf; typedef struct csArg { node_lf * node; int mark; int flag; } cs_arg; typedef struct return_tryFlag { node_lf * node; int result; } return_tf; static inline node_lf cs(node_lf * address, cs_arg *old_val, cs_arg

Best assembly or compilation for minimum of three values

谁说我不能喝 提交于 2019-12-04 06:42:07
I'm looking at code generated by GCC-4.8 for x86_64 and wondering if there is a better (faster) way to compute the minimum of three values. Here's an excerpt from Python's collections module that computes the minimum of m , rightindex+1 , and leftindex : ssize_t m = n; if (m > rightindex + 1) m = rightindex + 1; if (m > leftindex) m = leftindex; GCC generates serially dependent code with CMOVs: leaq 1(%rbp), %rdx cmpq %rsi, %rdx cmovg %rsi, %rdx cmpq %rbx, %rdx cmovg %rbx, %rdx Is there faster code that can take advantage of processor out-of-order parallel execution by removing the data

Trying to install pyaudio using pip

让人想犯罪 __ 提交于 2019-12-04 06:29:56
问题 I try to install pyaudio in pycharm, and I get this error error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\cl.exe' failed with exit status 2 I used pip install pyaudio command. Copy comment: I downloaded PyAudio‑0.2.11‑cp37‑cp37m‑win_amd64.whl try to install it using this command pip install PyAudio‑0.2.11‑cp37‑cp37m‑win_amd64 but it does not work and get this error ERROR: Could not find a version that satisfies the requirement PyAudio-0.2.11-cp37-cp37m-win

missing required architecture x86_64

Deadly 提交于 2019-12-04 06:26:33
I have an old project, that I recompiled for an uodate, and it is now showing this error message: …. missing required architecture x86_64 in file myLibrary.a …. I have tried various tricks that I could find on the net after searching on missing required architecture x86_64 in file , but with no success. Anyone knows how to properly handle the issue? I am using Xcode Version 7.0.1. Running: lipo -info myLibrary.a shows: Architectures in the fat file: myLibrary.a are: armv7 arm64 I have been able to add armv7s but not x86_64. You are trying to build a universal library and it does not have all

General structure for executing system commands from x86-64 assembly (NASM)?

瘦欲@ 提交于 2019-12-04 06:21:57
问题 I am trying to make some basic system calls in assembly (x86-64 in NASM on OSX), but have so far been unsuccessful. The only examples I have seen on the web so far are for reading from stdin or writing to stdout, such as this: global main section .text main: call write write: mov rax, 0x2000004 mov rdi, 1 mov rsi, message mov rdx, length syscall section .data message: db 'Hello, world!', 0xa length: equ $ - message However, when I try to use that same pattern to make another system call, it

Converting C code to x86-64 assembly

青春壹個敷衍的年華 提交于 2019-12-04 05:52:05
问题 I'm trying to convert my C code to x86-64. My goal is to reverse a linked list. The two parameters that are passed in are the head ptr and the offset to to get the address of the pointer field (i.e. the pointer to the next node in the list). From what I understand, the head ptr is passed in through the rdi register, and the offset is passed in through the rsi register. I keep getting a segmentation fault when it reaches the line "mov rcx, [rbx]." The segmentation fault goes away when it's

Does referencing constants without a dollar sign have a distinct meaning?

徘徊边缘 提交于 2019-12-04 05:33:58
问题 I wrote: mov 60, %rax GNU as accepted it, although I should have written mov $60, %rax Is there any difference between two such calls? 回答1: Yes; the first loads the value stored in memory at address 60 and stores the result in rax , the second stores the immediate value 60 into rax . 回答2: Just try it... mov 60,%rax mov $60,%rax mov 0x60,%rax 0000000000000000 <.text>: 0: 48 8b 04 25 3c 00 00 mov 0x3c,%rax 7: 00 8: 48 c7 c0 3c 00 00 00 mov $0x3c,%rax f: 48 8b 04 25 60 00 00 mov 0x60,%rax 16: 00

using printf before and inside a loop x86-64 assembly

谁说胖子不能爱 提交于 2019-12-04 05:10:40
问题 I'm having trouble figuring out how to use printf correctly in this function. So the function is called multInts and is supposed to multiply the first element of the first array with the first element of the second array and continue through the whole array. However, the lab instructions specify that I can't call printf in the main function. So, I need to print out the word "Products:\n" and then in each new line after that, print out the product. I don't know how to use printf within the

Position independent addressing in GNU assembler with Intel syntax

若如初见. 提交于 2019-12-04 04:18:58
问题 On x86-64, how do I load an address from the .data section in a position independent manner (PIC and PIE compatible) when using the GNU assembler with intel syntax . For example, using AT&T syntax, you can do this: leaq mystring(%rip), %rdi Is there an equivalent for Intel syntax? I can't seem to find the answer using search engines... I am actually using the noprefix version of intel syntax, in case that makes a difference. Thanks 回答1: An easy way to answer this is to assemble the

Conditional jump to register

我们两清 提交于 2019-12-04 04:16:39
问题 I want to get these commands: jl some_label(%rip) # or jl *%rax in my asm program that I am writing for Intel x64 architecture. GCC says that "operand type mismatch for jl" when I try to compile this code. 回答1: Conditional jumps are relative on x86. You can use an "inverted" conditional jump followed by an unconditional jump: jge skip_jump jmp *%rax # AT&T syntax skip_jump: The equivalent NASM syntax is jmp rax . Either way, it sets RIP = RAX, so it's a register-indirect jump. 回答2: