'naked' keyword
bearophile
bearophileHUGS at lycos.com
Fri Jan 2 00:10:19 PST 2009
Duane Bailey:
> + Remove the naked keyword as an assembly 'instruction'.
>
> + Instate it as a function property, similarly to 'extern (C)'. So you might see the following declaration:
>
> extern naked void flushIDT() {
> mov EAX, [ESP+4]
> lidt [EAX]
> ret
> }
I agree. putting "naked" as function attribute seems more correct.
As they say: "Wisdom begins by calling things by their right names."
Putting back the asm{} is a compromise syntax, useful to remove a special case from one of the stages of the compiler:
naked void flushIDT() {
asm {
mov EAX, [ESP+4]
lidt [EAX]
ret
}
}
>except to reference arguments passed to it. In other words, it should not touch the stack.<
>And because D code should not be used (except perhaps for macros?),<
I don't fully understand what you say.
>From my very limited experiments with naked functions I think I may enjoy to add some I/O into naked functions: to be able to define new variables before the asm and to copy registers into some variable before the final return. What I am asking here may make useless the "naked" attribute, in such case please ignore what I have said here.
Bye,
bearophile
More information about the Digitalmars-d
mailing list