Re: Test whether rdmsr instruction is supported.

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



"Ben Voigt [C++ MVP]" <rbv@xxxxxxxxxxxxxxxxx> wrote in message
news:ADF9BC63-C9D3-423E-A60A-8D32440DF139@xxxxxxxxxxxxxxxx
What compiler are you using? With Microsoft C++ (cl.exe), if you aren't
using declspec(naked) then registers should be saved.

Yes and no :) If you are changing ECX in _asm block inside class function,
the compiler saves the register in stack and restore it after, so that
program does not cause access violation. But you can play with ECX in non
class functions and compiler does not save it. The notion "compiler always
saves registers which are used in _asm block" is wrong, instead it seems to
be sticking to "compiler always saves register in stack and restore it later
if it's use in _asm block might cause instability of code".

--
Volodymyr M. Shcherbyna, blog: http://www.shcherbyna.com/
(This posting is provided "AS IS" with no warranties, and confers no
rights)


.



Relevant Pages

  • RE: [BUG mm] "fixed" i386 memcpy inlining buggy
    ... You can NOT make assumptions about registers keeping their values between ... one asm block and another. ... the compiler can do ANYTHING IT WANTS and to just _hope_ that it won't ... send the line "unsubscribe linux-kernel" in ...
    (Linux-Kernel)
  • Re: register assignments in C code
    ... to allow direct access to specific registers eg ... cf. "Variables in Specified Registers" ... the compiler doesn't know about banked registers in FIQ ... use in a #asm block then you might be able to accomplish what you describe ...
    (comp.sys.arm)
  • Re: switching context on MSP430
    ... registers R15,R14,R13 and R12on stack. ... are you aware that not every c compiler for the MSP430 ... Preemption vs Cooperation ... Another important decision to make is whether or not a real-time clock ...
    (comp.arch.embedded)
  • Re: Ive seen the future...and it works! (was: my view on this assembler is blah)
    ... The compiler has the advantage, granted, that it can "remember" what all ... the registers are...but "remembering" isn't the challenge here, ... registers with the CPU... ... The HLLs, though - shackled by a whole bunch of factors that they have to ...
    (alt.lang.asm)
  • Ive seen the future...and it works! (was: my view on this assembler is blah)
    ... > though the registers are few. ... And the 64 bit CPU designers ... what my Borland _C++ compiler_ does when you ask for assembly output...it ... out programming with something like BASIC or Pascal, ...
    (alt.lang.asm)