I am now thinking of becoming a machine level programmer :) Thanks Christian and others for your valuable feedback and helping me solve the problem. Very valuable learning, to inspect the actual instructions for me. This code was in place for Linux only, I have now gotten round it for s390.
Regards, Raja On Fri, Nov 20, 2009 at 3:17 PM, Christian Borntraeger < [email protected]> wrote: > Am Freitag 20 November 2009 15:54:07 schrieb rui: > > Hi Christian, > > > > Yes, there is floating point precision related stuff, in the code on the > > very first line. > > > > unsigned int cm = 0x27f; > > _FPU_SETCW(cm); > > Ok. That does the sfpc. > > > This is done for all linux systems for achieving 64 bit floating point > > precision. So, do I need to ifdef it out for s390 or is there an > alternative > > for it on s390x system? > > So here is my understanding: > I strongly believe the mask for _FPU_SETCW is platform specific, the code > should use appropriate macros for floating point control. Your 0x27f is > based on the Intel numbers and will probably also have a different effect > on sparc, power, arm and mips (it might not fault, but could give you > strange results) > > There are no precision bits for s390 in the floating point control. On s390 > the precision depends on the instruction, and gcc should use double precion > instruction for variables declared as double. > > > > > BTW, how did you match the spfc to user process fault, can you let me > know > > about it, please? > > > > > User process fault: interruption code 0x40006 > ^^ > The 6 indicates an specification exception. > > I got the sfpc from the pc value in gdb + the disassembly: > > >pc 0x7cc76e 0x7cc76e <TDmain::Initialise()+70> > [...] > >0x007cc762 <_ZN7TDTmain10InitialiseEv+58>: st %r1,100(%r11) > >0x007cc766 <_ZN7TDTmain10InitialiseEv+62>: l %r1,100(%r11) > >0x007cc76a <_ZN7TDTmain10InitialiseEv+66>: sfpc %r1,%r0 > >0x007cc76e <_ZN7TDTmain10InitialiseEv+70>: l %r1,96(%r11) > >0x007cc772 <_ZN7TDTmain10InitialiseEv+74>: lhi %r2,0 > > > On a fault, the pc usually points to the following instruction (or in rare > cases > to the faulting instruction) > > ---------------------------------------------------------------------- > For LINUX-390 subscribe / signoff / archive access instructions, > send email to [email protected] with the message: INFO LINUX-390 or > visit > http://www.marist.edu/htbin/wlvindex?LINUX-390 > ---------------------------------------------------------------------- For LINUX-390 subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO LINUX-390 or visit http://www.marist.edu/htbin/wlvindex?LINUX-390
