Re: Problem with DosSetPathInfo in version 14.103b kernel



bv_schornak wrote:

Last year? More like the last 15 or so years...

In Lorne's register dump EBP definitely is used as frame pointer.


You can't tell that from a register dump alone. Just because ebp contains a value slightly higher than esp is not a proof that it's a frame pointer. It could just as well be a generic pointer to a local variable.

As others pointed out, even if ebp is a frame pointer, so what? It's very common to pass addresses of local variables to called functions.If you have:

void foo( void )
{
    char buf[123];

    bar( buf );
}

 where do you think the argument will point to inside buf()?

The document you referenced only describes two calling conventions. There are tons more. Some of them prefer passing arguments in registers and have no fixed use for (e)bp.

There should be as many as different machines exist.
>
There are lots more ;) The x86 architecture alone probably has more than a dozen calling conventions. Admittedly most other archs aren't quite as "inventive".


Registers are machine
dependent - only a small subset of them uses Intel register naming for the
x86 line of CPUs. 68k machines have no base pointer at all, all address or
data registers are on a par.

 Right. I honestly had no idea.

OK, that was sarcasm. Although I'm not very familiar with 68K, I did some work on PowerPC and Alpha, and I added basic support for MIPS target to an existing retargetable code generator. So I think I have *some* vague idea about how these things work on x86 and elsewhere.

Yes. I've seen the term "leaf function" first in Steven's posting. I still
have to figure out what a "leaf function" is, though. (Probably I know the
programming technique, but the term doesn't ring a bell.)

It's not a programming technique. "Leaf function" simply means a function that does not call any other function. Consider the call graph to be a tree and you'll understand why it's called that. It's a term commonly used in compiler development, because compilers typically have considerable freedom as to how they can transform leaf functions (precisely because they don't need to build a standard stack frame).

Keeping track of PUSHs and POPs is crucial (you have to learn how to walk,
then you may challenge Asafa Powell). How specific compilers use EBP isn't
known to me.
>
For the most part, it's not really your business to care about how a compiler may use ebp. That's the compiler's job. You only need to worry about it when you need a stack trace :)


As mentioned in my reply to Steven, I'm familiar with GCC be-
cause it was the only free compiler for OS/2 back then. Watcom 9.5 came at
a price in the range of my monthly earning. Not very convincing, even if I
had to learn AT&T syntax... :)

 Sometimes you get what you pay for...


Michal .



Relevant Pages