32-bit

Linking an assembler program: error “undefined reference to `printf'”

ⅰ亾dé卋堺 提交于 2019-12-03 17:18:27
I'm trying to compile this x86 assembly code on x64 Debian : BITS 32 %include 'training.s' global main extern exit ; =============================================== section .text main: ; The program begins here: call read_hex mov edx,eax call read_hex add eax,edx add eax,eax inc eax call print_eax ; Exit the process: push 0 call exit I'm getting these errors: ~$nasm -f elf -g 0_strange_calc.asm && ld -o 0_strange_calc 0_strange_calc.o ld: i386 architecture of input file `0_strange_calc.o' is incompatible with i386:x86-64 output ld: warning: cannot find entry symbol _start; defaulting to

Using a 64 bit driver in a 32 bit program. Windows

冷暖自知 提交于 2019-12-03 16:55:26
This is only a half-way programming question. First of all I have a PCI-Express card and 32/64 bit drivers. The target operating system has to be a Windows 64 bit system. I read that under Vista64 all drivers have to be certified 64 bit drivers. Is this a general restriction under 64 bit operating systems and does this also apply to "XP 64" or any Linux system? So for simplicity let's say I use a 64 bit driver for my PCIe card under Vista64 and have a bunch of 64 bit DLLs to use the cards functionality. On the other side there's a large, legacy 32 bit exe program which needs to use the PCIe

Build 32-bit with 64-bit llvm-gcc

强颜欢笑 提交于 2019-12-03 16:10:45
问题 I have a 64-bit version of llvm-gcc, but I want to be able to build both 32-bit and 64-bit binaries. Is there a flag for this? I tried passing -m32 (which works on the regular gcc), but I get an error message like this: [jay@andesite]$ llvm-gcc -m32 test.c -o test Warning: Generation of 64-bit code for a 32-bit processor requested. Warning: 64-bit processors all have at least SSE2. /tmp/cchzYo9t.s: Assembler messages: /tmp/cchzYo9t.s:8: Error: bad register name `%rbp' /tmp/cchzYo9t.s:9: Error

fwrite() more than 2 GiB? [duplicate]

元气小坏坏 提交于 2019-12-03 15:22:43
This question already has an answer here: Is fopen() limited by the filesystem? 4 answers I have a set of files that I want to concatenate (each represents a part from a multi-part download). Each splitted file is about 250MiB in size, and I have a variable number of them. My concatenation logic is straight-forward: if (is_resource($handle = fopen($output, 'xb')) === true) { foreach ($parts as $part) { if (is_resource($part = fopen($part, 'rb')) === true) { while (feof($part) !== true) { fwrite($handle, fread($part, 4096)); } fclose($part); } } fclose($handle); } It took me a while to trace it

Why is abs(0x80000000) == 0x80000000?

寵の児 提交于 2019-12-03 14:59:20
问题 I just started reading Hacker's Delight and it defines abs(-2 31 ) as -2 31 . Why is that? I tried printf("%x", abs(0x80000000)) on a few different systems and I get back 0x80000000 on all of them. 回答1: For a 32bit datatype there is no expression of +2^31, because the biggest number is 2^31-1 ... read more about the two's complement ... 回答2: Actually, in C, the behavior is undefined. From the C99 standard, §7.20.6.1/2: The abs , labs , and llabs functions compute the absolute value of an

PHP json_decode on a 32bit server

做~自己de王妃 提交于 2019-12-03 14:50:50
im writting a twitter mashup service. When i receive the json data, some of the twit ids are greater than 2147483647 (which is the maximum allowed integer on 32bit servers). I came up with a solution that works, which is converting the integers to strings; that way the json_decode() function won't have any problems when trying to generate the array. This is what i need to achieve: Before (original JSON data) [{"name":"john","id":5932725006},{"name":"max","id":4953467146}] After (solution applied) [{"name":"john","id":"5932725006"},{"name":"max","id":"4953467146"}] I'm thinking of a preg_match

How are numbers greater than 2^32 handled by a 32 bit machine?

一笑奈何 提交于 2019-12-03 13:55:51
I am trying to understand how calculations involving numbers greater than 2 32 happen on a 32 bit machine. C code $ cat size.c #include<stdio.h> #include<math.h> int main() { printf ("max unsigned long long = %llu\n", (unsigned long long)(pow(2, 64) - 1)); } $ gcc output $ gcc size.c -o size $ ./size max unsigned long long = 18446744073709551615 $ Corresponding assembly code $ gcc -S size.c -O3 $ cat size.s .file "size.c" .section .rodata.str1.4,"aMS",@progbits,1 .align 4 .LC0: .string "max unsigned long long = %llu\n" .text .p2align 4,,15 .globl main .type main, @function main: pushl %ebp

Syscall or sysenter on 32 bits Linux?

╄→гoц情女王★ 提交于 2019-12-03 13:47:38
Since MS‑DOS, I know system invocation using interrupts. In old papers, I saw reference to int 80h to invoke system functions on Linux. Since a rather long time now, I know int 80h is deprecated in favour of the syscall instruction. But I can't get it working on my 32 bits machine. The question Is the syscall instruction to be used on 64 bits platform only? Doesn't 32 bits Linux makes use of syscall ? A sample test On my 32 bits Linux (Ubuntu Precise), this program terminates with a core dump: global _start _start: mov eax, 4 ; 4 is write mov ebx, 1 ; 1 is stdout mov ecx, message ; address of

64-bit windows assembler

只谈情不闲聊 提交于 2019-12-03 12:53:33
I want to program 64 bit windows assembly (preferably using NASM). I have looked quite a but on google but it seems that I cannot find a 64 bit windows compiler. Some site mentioned ml64 but it seems like it is no longer included in VC++. I have tried with 32 bit assembly, but obviously it just crashes on my 64 bit machine. Is it possible to write, compile and run 32 bit assembly applications on a 64 bit windows machine? Or should it be written and compiled for 64 bits? Thanks. Yasm(*) is a modern, multi-platform NASM-rewritten assembler which is capable of assembling for both x86 and AMD64

ERROR: 32-bit Linux Android emulator binaries are DEPRECATED

非 Y 不嫁゛ 提交于 2019-12-03 12:02:16
I installed the latest version of the ADT Bundle 32 bit on my ubuntu 14.04 32 bit. I created an AVD, but it doesn't launch. When I press the start button it shows this message: Starting emulator for AVD 'NexusOne' ERROR: 32-bit Linux Android emulator binaries are DEPRECATED, to use them you will have to do at least one of the following: - Use the '-force-32bit' option when invoking 'emulator'. - Set ANDROID_EMULATOR_FORCE_32BIT to 'true' in your environment. Either one will allow you to use the 32-bit binaries, but please be aware that these will disappear in a future Android SDK release.