[llvm-commits] Bug in "call __chkstak" on 64 bit OS

Yatsina, Marina marina.yatsina at intel.com
Sun Feb 19 06:50:36 PST 2012


Hi Anton, Takumi, 

The "__chkstk" function is in ntdll.dll. In my OS, the JIT is loaded to an address which is more than 2Gb away from the ntdll.dll, thus the call to this function fails. I will investigate other system calls as well. But regardless of other calls, this fix is needed.  The definition of W64ALLOCA (below) assumes that we use an i32 immediate, thus we can’t use it.

    def W64ALLOCA : Ii32PCRel<0xE8, RawFrm,
                      (outs), (ins i64i32imm_pcrel:$dst, variable_ops),
                      "call{q}\t$dst", []>,
                    Requires<[IsWin64]>;


Thank you,
Marina.

-----Original Message-----
From: Anton Korobeynikov [mailto:anton at korobeynikov.info] 
Sent: Sunday, February 19, 2012 16:14
To: Yatsina, Marina
Cc: llvm-commits at cs.uiuc.edu; NAKAMURA Takumi
Subject: Re: [llvm-commits] Bug in "call __chkstak" on 64 bit OS

Marina,

> Why is it unconditional, not enhancing memory model modes?
Takumi is correct. For normal applications the 'small' code model is
applicable, and thus everything will fit in 32 bits (note that this
not __checkstk specific, all other calls should be converted as
well!). Surely, inside JIT you have to use other code model and do
different lowering for calls.

You might want to check how the code models (small, kernel, medium)
are currently handled inside LLVM and use something similar.

Also:
+    // R11 is a volotiale register and assumed to be destoyed by the callee,
volatile and destroyed

-- 
With best regards, Anton Korobeynikov
Faculty of Mathematics and Mechanics, Saint Petersburg State University
---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.




More information about the llvm-commits mailing list