x86-64

Porting Assembler x86 CPU ID code to AMD64

不问归期 提交于 2019-12-13 11:43:32
问题 I have a problem. I have following x86 delphi code which is written in ASM. I need to port this to AMD64? type TCPUID = array[1..4] of Longint; function GetCID : TCPUID; assembler; register; asm push ebx push edi mov edi, eax mov eax, 1 dw $A20F stosd mov eax, ebx stosd mov eax, ecx stosd mov eax, edx stosd pop edi pop ebx end; I have never programmed in assembly, does anyone know what the port would be or how I would go about changing it. 回答1: I am not Win64 assembler guru, but the next

Allocating memory using malloc() in 32-bit and 64-bit assembly language

我只是一个虾纸丫 提交于 2019-12-13 10:23:11
问题 I have to do a 64 bits stack. To make myself comfortable with malloc I managed to write two integers(32 bits) into memory and read from there: But, when i try to do this with 64 bits: 回答1: The first snippet of code works perfectly fine. As Jester suggested, you are writing a 64-bit value in two separate (32-bit) halves. This is the way you have to do it on a 32-bit architecture. You don't have 64-bit registers available, and you can't write 64-bit chunks of memory at once. But you already

Python GetModuleHandleW OSError: [WinError 126] The specified module could not be found

你离开我真会死。 提交于 2019-12-13 07:06:51
问题 The following code generates the error : OSError: [WinError 126] The specified module could not be found windll.kernel32.GetModuleHandleW.restype = wintypes.HMODULE windll.kernel32.GetModuleHandleW.argtypes = [wintypes.LPCWSTR] KERNEL32 = windll.GetModuleHandleW("C:\\Windows\\System32\\kernel32.dll") However, if I use KERNEL32 = windll.LoadLibrary("C:\\Windows\\System32\\kernel32.dll") The dll is found but I encounter a different error by the following code: LoadLibAddy = windll.kernel32

How do I determine whether an application I am installing is 32-bit or 64-bit?

懵懂的女人 提交于 2019-12-13 05:00:45
问题 I want to be able to predict the default install location of an application. On a 64-bit machine, if it is a 32-bit application, it would install in "Program Files (x86)" and if it were a 64-bit application, it would install in "Program Files". My goal is to install the application with its default location and validate if the install was fine. But for this I need to know where it would be installed. If I know what architecture the application is built for, I think it would serve my purpose.

Skype Mac API - Use AppleScript or 5 year old API?

两盒软妹~` 提交于 2019-12-13 04:06:29
问题 I have a x86_64 app that I would like to have optionally read Skype status messages. However, the 5 year old skype mac framework is 32-bit, and if there is a way to have that compile within a 64-bit app, I haven't found it. My question is, basically, how should I go about doing this? I really only need to get and set the USERSTATUS AWAY/ONLINE string. Using AppleScript, a "Should Skype allow this" dialog pops up... every time. This is highly inefficient and downright irritating. Advice? I'm

Building crti.o for i386

£可爱£侵袭症+ 提交于 2019-12-13 03:54:55
问题 I am trying to build a cross-compiler with x86_64 being the host and i386 being the target. I'm getting the (all to common) crti.o: No such file error. Instead of grabbing an already built crti.o and crtn.o from a distro... how might I go about building these files explicitly from glibc (or possibly gcc) sources? FYI, I am well aware of the -m32 option for x86_64 compilers. I'd prefer to just have a 32bit-only compiler environment. Also, the reason I don't want to use any of the gazillion

Integer overflow when calculating the amount of memory to allocate

不想你离开。 提交于 2019-12-13 03:49:03
问题 I'm trying to process a spatial dataset which is stored as a regular X, Y and Z coordinate grid with each location having multiple fields storing the attributes. However, when allocating the array to store the data, it throws an error. Currently working with gcc gfortran version 8.1.0 (i686-posix-dwarf-rev0, Built by MinGW-W64 project) on Win10. I've tried different machines (in case I'm hitting hardware limits) and looked at various compiler options, but have no managed to affect the result.

Compiling WxWidgets on Mac OSX 10.10

£可爱£侵袭症+ 提交于 2019-12-13 03:46:52
问题 I'm trying to compile WxWidgets 3.0.2 on my mac OSX 10.10 and I get the following message: Blockquote ... ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [/Users/.../wxWidgets-3.0.2/build_rel/lib/libwx_osx_cocoau-3.0.0.2.0.dylib] Error 1 I'm compiling using these flags ../configure --with-osx_cocoa --with-macosx-version-min=10.7 --with-macosx-sdk=/Applications/Xcode.app/Contents/Developer/Platforms

Get the last line separator

本秂侑毒 提交于 2019-12-13 03:42:29
问题 I think this is a pretty common task and there should be some fast and concise solution. I have a quadword and I want to get the lowest byte position which is equal to 0x0A (line break in Linux). I wrote the following simple program: SYS_exit equ 0x3C section .text global _start _start: mov rax, 0x0A mov rbx, [dt] mov rcx, 0x07 loop: mov r13, rbx and r13, 0xFF cmp r13, 0x0A jz ok shr rbx, 8 dec rcx jnz loop jmp fail ok: mov rax, SYS_exit mov rdi, 8 sub rdi, rcx syscall fail: mov rax, SYS_exit

What does cmpq compare?

若如初见. 提交于 2019-12-13 03:18:36
问题 mystery has this function signature: int mystery(char *, int); This is the mystery function assembly code: mystery: movl $0, %eax ;set eax to 0 leaq (%rdi, %rsi), %rcx ; rcx = rdi + rsi loop: cmpq %rdi, %rcx jle endl decq %rcx cmpb $0x65, (%rcx) jne loop incl %eax jmp loop endl: ret What does this line cmpq %rdi, %rcx compare? The address or the character value? If it is comparing the address stored inside the registers, what's the point though? If one address is greater than the other, so?