Saving/Restoring 64 bits width data into two 32 bits

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hey Guys,

I have a question on how to store a variable whose length is 64 bits
in 32 bits environment.

I am intercepting system calls to modify its behavior and then return
back to the user. So I first store the value and restore it later. But
the system call I want to intercept is ftruncate64 and it has 64 bit
width variable as its second variable. So I assume that I need two
registers to save this value. Here is what I am trying to do. Assume
that I have called CALL64(ftruncate64) from other place.

#define CALL64(func) \
 push %ebp; \
 mov  %esp, %ebp; \
 REG_SAVE \
 push %edx; \
 push %ecx; \
 push %ebx; \
 call func; \
 REG_RESTORE64() \
 leave

#define REG_RESTORE64() \
 addl $12, %esp; \
 pop %ebx; \
 pop %ecx; \
 pop %edx; \
 mov %ebx, %esi; \
 mov %ecx, %ebx; \
 mov %esi, %ecx;

But when I print out the value after the call, the value gets
corrupted and I suppose this is due to the incorrect restoration of
high order bits. Please give me some suggestion where I am doing
wrong. Thank you very much.

Ilho <><
--
YES, JESUS LOVES YOU, TOO.
- Come for Eng. Christian Fellowship on Friday 6pm!
For God so loved the world that he gave his one and only Son, that
whoever believes in him shall not perish but have eternal life(John
3:16).

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux