c - X86 32b assembly - using atoll -


under ubuntu 12.04., , using x86 32 bit assembly possibly c libraries, need use number n

 2^31 - 1 < n <= 2^63 -1           

on system, c ints 32 bit; , long longs 64 bit. know how proceed after having number, stuck on getting number ready.

my planned approach follows:

 - store n string in .data segment      - use atoll (pushl $n_str, call atoll)      - retrieve converted value, , store in 2 consecutive int-sized storage locations (taking note of little-endian storage)         

as usual 32 bit return value convention through %eax cannot apply (or possibly through pointer, have checked seems not case (%eax points inaccessible memory after)), assumed value might in (%eax, %ebx). checked permutations of high/low assuming case, doesn't seem (if is, , messed up, kindly point out proper way). man (and man 3) page atoll doesn't help.

how retrieve converted integer? if approach impossible (strtoll has same issue), suggestions alternatives?

it seems depend on calling convention , compiler. __stdcall functions return 64-bit integers in pairs in eax:edx registers. __cdecl functions return pointer stack integer on gcc. __cdecl functions on visual c++ return pair in eax:edx.

here source: http://en.wikibooks.org/wiki/x86_assembly/high-level_languages


Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -