Explore chapters and articles related to this topic
A First Windows Program
Published in Julio Sanchez, Maria P. Canton, Software Solutions for Engineers and Scientists, 2018
Julio Sanchez, Maria P. Canton
WINAPI is a macro defined in the windows.h header file which translates the function call to the appropriate calling convention. Recall that calling conventions refer to how the function arguments are placed in the stack at call time, and if the caller or the called routine is responsible for restoring stack integrity after the call. Microsoft Basic, FORTRAN, and Pascal push the parameters onto the stack in the same order in which they are declared. In these languages the stack must be restored by the caller. In C and C++, the parameters are pushed in reverse order, and the stack is restored automatically after the call returns. For historical reasons (and to take advantage of hardware features of the Intel processors) Windows requires the Pascal calling convention. In previous versions of Windows the calling convention for WinMain() was PASCAL or FAR PASCAL. You can still replace WINAPI for FAR PASCAL and the program will compile and link correctly, but the use of the WINAPI macro makes your program more portable.
Exploration for Software Mitigation to Spectre Attacks of Poisoning Indirect Branches
Published in IETE Technical Review, 2018
Baozi Chen, Qingbo Wu, Yusong Tan, Liu Yang, Peng Zou
A trampoline, also known as thunk [27], refers to a small piece of code called as a function, does some small work, and then jumps to another location (Figure 2). Unlike ordinary function call, it does not return to its caller after execution, as shown in Figure 3. If the jump target of the trampoline is a function which means it will jump back to some location, it will return to the trampoline's caller. It can be used as calling convention translation, virtual function translation or dynamic closures.