I'm working on my own kernel using GCC, and when calling C functions from asm code, I have to do add esp,xx
myself. After some searching I found that stdcall
is a Microsoft invention and can't use it in GCC. Is there any handy way to do this work?
Asked
Active
Viewed 9,691 times
12

Dietrich Epp
- 205,541
- 37
- 345
- 415

babel92
- 767
- 1
- 11
- 21
-
Since you mentioned that it's your own kernel, I've removed references to Linux. – Dietrich Epp Oct 27 '12 at 00:55
1 Answers
10
Is there any equivalence of stdcall in linux?
my kernel in a linux environment
Wait, is this your own kernel, or the Linux kernel? Because if it's your own kernel, it's not Linux any more.
If you're working on Linux, you'll want to stick with regular calling conventions and write your assembly to match.
If you're working on your own kernel, you can do anything you want. GCC and Clang both support
stdcall
calling conventions on ix86 processors, e.g.,#define stdcall __attribute__((stdcall))

Community
- 1
- 1

Dietrich Epp
- 205,541
- 37
- 345
- 415
-
Thanks a lot! I'm compiling my own kernel with gcc and someone said there is no stdcall in linux gcc. But it works well with your code! – babel92 Oct 27 '12 at 00:27