x86-64

x86-64 Relative jmp performance

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-11 12:37:35
问题 I'm currently doing an assignment that measures the performance of various x86-64 commands (at&t syntax). The command I'm somewhat confused on is the "unconditional jmp" command. This is how I've implemented it: .global uncond uncond: .rept 10000 jmp . + 2 .endr mov $10000, %rax ret It's fairly simple. The code creates a function called "uncond" which uses the .rept directive to call the jmp command 10000 times, then sets the return value to the number of times you called the jmp command. "."

Can 128bit/64bit hardware unsigned division be faster in some cases than 64bit/32bit division on x86-64 Intel/AMD CPUs?

安稳与你 提交于 2019-12-11 10:03:14
问题 Can a scaled 64bit/32bit division performed by the hardware 128bit/64bit division instruction, such as: ; Entry arguments: Dividend in EAX, Divisor in EBX shl rax, 32 ;Scale up the Dividend by 2^32 xor rdx,rdx and rbx, 0xFFFFFFFF ;Clear any garbage that might have been in the upper half of RBX div rbx ; RAX = RDX:RAX / RBX ...be faster in some special cases than the scaled 64bit/32bit division performed by the hardware 64bit/32bit division instruction, such as: ; Entry arguments: Dividend in

Addressing variables (or, what is ML64 generating?)

梦想的初衷 提交于 2019-12-11 09:59:57
问题 I have an ASM file written for X64. It provides a leaf function. The file was assembled with MASM64/ML64. The C-pseduo code with a signature is: int GenerateBlock(byte* ptr, size_t size, unsigned int safety) { if (ptr == NUL) return 0; /*FAIL*/ ... } Here's the same portion of ASM code: ;; RCX (in): byte* buffer ;; RDX (in): size_t bsize ;; R8d (in): unsigned int safety ;; RAX (out): bool, success (1), failure (0) ASM_GenerateBlock PROC buffer:QWORD,bsize:QWORD,safety:DWORD LOCAL val:QWORD ;;

How to use malloc and free in 64-bit NASM?

故事扮演 提交于 2019-12-11 09:54:55
问题 In 64-bit NASM, I'm allocating a memory block of 8000 bytes using malloc() from the C library, and when I'm finished with it, I deallocate it by calling free(). My research has come up with a lot of conflicting information about how to do this in 64-bit NASM, and much of the information is 32-bit, where the calling convention is different, or it's C or C++, not NASM. I think I have the malloc part right, but I'm not sure about the free part. I'm posting this question because I don't want to

Differences of x86 and x86-64 machine code

狂风中的少年 提交于 2019-12-11 09:39:10
问题 So, I've got a program which generates JIT x86 machine code and executes it directly and I want it to support x86-64/AMD64/x64 as well. The obvious differences are: New registers ( rax , r8 ...) and pointer width (pointers need to use 64bit regs) Default C calling convention (arguments on stack vs. registers) Some new mnemonics ( pushq to push 64bit) Are there any differences in the binary instructions as well or should it be (roughly) sufficient to use pushq and 64bit registers when

QT console application with Crypto++ library

和自甴很熟 提交于 2019-12-11 08:47:05
问题 This is driving me nuts. Using crypto++ ver 5.6.2. Qt 5.2.1 on Mac OSX. All the projects are built inside QT Creator. Im not using make from the command line I build crypto++ by unpacking and building as follow: qmake -project Deleted the GNUmakefile Open in QT and modified the .pro file by adding macx { DEFINES += CRYPTOPP_DISABLE_ASM } The target is cryptopp: TARGET = cryptopp Set to release, ran qmake and did a rebuild all. The dylibs get generated: libcryptopp.1.0.0.dylib libcryptopp.1.0

sys_read syscall vs. int 0x80 in GNU Assembler [duplicate]

房东的猫 提交于 2019-12-11 08:42:32
问题 This question already has an answer here : What happens if you use the 32-bit int 0x80 Linux ABI in 64-bit code? (1 answer) Closed 2 years ago . I'm attempting to write a simple program which grabs a number of characters from stdin. For the sake of brevity, the relevant code is: mov $3, %rax # sys_read = 3 mov $0, %rbx # stdin fd = 0 mov $b, %rcx # '.lcomm b, 32' declared in .bss section mov $32,%rdx # size_t # syscall int $0x80 When I use int $0x80 the program functions as intended, however

How to Debug MIPS elf?

筅森魡賤 提交于 2019-12-11 07:39:07
问题 Suppose I have a MIPS elf binary (meaning someone cross compiled/compiled on MIPS a MIPS linux executable) Are there any linux distros that are compiled to run on mips architecture that could perhaps run the executable? I've looked around, but all I can find is linux-mips. Even better would be if the distro was already installed to a VM disk file, and you could just download it. Is there any guaranteed way to run the MIPS elf on a non MIPS distro? Like using some qemu setup or something? (By

Invalid operand for instruction movq using clang

谁说胖子不能爱 提交于 2019-12-11 07:35:15
问题 I'm using the movq X86_64 assembly instruction on an Intel Core i5 with the LLVM-based clang-902.0.39.1 compiler. The simplified code (at the my_asm.S file) in Intel syntax looks like this: .intel_syntax noprefix #define a_const 0xFFFFFFFFFFFFFFFF movq rax, a_const I'm compiling with clang -c -g -O3 -fwrapv -fomit-frame-pointer -march=native my_asm.S The compiler gives me the following message: error: invalid operand for instruction movq rax, 0xFFFFFFFFFFFFFFFF ^ I've also tried the AT&T

Use CPAN BerkeleyDB module on Windows 7 (64 bit)

孤街醉人 提交于 2019-12-11 07:27:39
问题 I have been trying to install the BerkeleyDB CPAN module on my Windows 7 (x86_64) PC without any luck (BerkeleyDB::Hash is what I need). I have 64 bit ActivePerl and Oracle Berkeley DB 11gR2 5.3.15 installed. First I tried installing using the command : *cpan install BerkeleyDB* This came back with the error: *It looks like the installation of dmake and MinGW has failed. You will not be able to run Makefile commands or compile C extension code. Please check your internet connection and your