Go Back   Exetools > General > General Discussion


Thread Tools Display Modes
Old 01-31-2018, 03:18
leader leader is offline
Join Date: Oct 2017
Posts: 10
Rept. Given: 0
Rept. Rcvd 0 Times in 0 Posts
Thanks Given: 15
Thanks Rcvd at 3 Times in 2 Posts
leader Reputation: 0
WinCE Floating-Point operators - HELP

Hi All,

A have a function in Windows CE with some floating point calculations over an elapsed seconds value. Unfortunatally I don't understand the second part of this function. So I would like to ask your help to decode it. This is the fcuntion in IDA:

dert:00001638 sub_1638                               
dert:00001638                                         ; DATA XREF: dert:00006008↓o
dert:00001638                 STMFD   SP!, {R4,LR}
dert:0000163C                 MOV     R0, #0
dert:00001640                 BL      getElapsedSeconds ; Get elapsed time in seconds
dert:00001644                 LDR     R3, =_i64tos
dert:00001648                 LDR     R3, [R3]
dert:0000164C                 MOV     LR, PC
dert:00001650                 BX      R3              ; _i64tos(secs) //convert eleapsed secs to Single Precision float
dert:00001654                 LDR     R3, =_divs
dert:00001658                 LDR     R1, =2592000.0  ; 30 days in seconds
dert:0000165C                 LDR     R3, [R3]
dert:00001660                 MOV     LR, PC
dert:00001664                 BX      R3              ; _divs(secs/30 days)
dert:00001668                 LDR     R3, =_stod
dert:0000166C                 LDR     R3, [R3]
dert:00001670                 MOV     LR, PC
dert:00001674                 BX      R3              ; Convert the result tp Double precision float
dert:00001678                 LDR     LR, =_subd
dert:0000167C                 LDR     R2, =0xEB851EB8 ; Not used (float: -3.2186e26)
dert:00001680                 LDR     R3, =0x3FDEB851 ; Not used (1.74)
dert:00001684                 LDR     R4, [LR]
dert:00001688                 MOV     LR, PC          ; subd => Double precision substraction, what are the operands?
dert:0000168C                 BX      R4
dert:00001690                 LDR     R3, =_dtoi
dert:00001694                 LDR     R3, [R3]
dert:00001698                 MOV     LR, PC
dert:0000169C                 BX      R3              ; _dtoi() Convert double back to int
dert:000016A0                 LDMFD   SP!, {R4,LR}
dert:000016A4                 BX      LR              ; return
So there is 2 note used constants, and on double precision substarction where I don't know the second operand (the first must be the return valus of _divs(secs/30 days)).

The C code generated by Hex-ray is the following:

int sub_1638()
  signed int v0; // r0
  int v1; // r0
  int v2; // r0
  int v3; // r0
  int v4; // r0

  v0 = getElapsedSeconds(0);
  v1 = i64tos(v0);
  v2 = divs(v1, 0x4A1E3400);
  v3 = stod(v2);
  v4 = subd(v3);
  return dtoi(v4);
Hex-Ray decode the substraction with only 1 operand. It's incorrect becasue it's need 2 arguments:

So everybody can help me to decode the floating point operations over the elapsed seconds?

Thanks and regards,
Reply With Quote

windows ce floating point

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
WinCE dll unpacking leader General Discussion 2 01-20-2018 05:16
Runtime Error R6002 - Floating point not loaded after unpacking TempoMat General Discussion 14 11-02-2013 14:05
Runtime Error R6002 - Floating point not loaded MrGneissGuy's General Discussion 1 09-14-2009 03:08
reverse engineering floating point code jonwil General Discussion 3 11-04-2008 09:08

All times are GMT +8. The time now is 03:12.

Always Your Best Friend: Aaron, JMI, ahmadmansoor, ZeNiX, chessgod101
( 1998 - 2024 )