Re: [Patch] (big) real mode emulation - jmp rel

Avi Kivity
2007-08-17T12:24:37Z

Nitin A Kamble wrote:
> Avi,
> In my opinion converting this small function to file-scope function,
> would make code look ugly. I think the earlier Macro definition was
> better.
>
>

A file scope function would indeed be uglier. But the macro has more
serious problems; it's impossible to understand how variables are
affected since nobody expects function local variables whose address is
not taken to change after something that looks like a macro is called.

At the very least, it needs to be in uppercase so that people know
something funny is going on. But it's really better as a function.

(and yes, the rest of the file uses macros. and yes, the rest of the
file is an unmaintainable mess)

> On Thu, 2007-08-16 at 03:25 -0700, Avi Kivity wrote:
>
>>> + inline void jmp_rel(int rel)
>>> + {
>>> + _eip += (int)(rel);
>>> + _eip = ((op_bytes == 2) ? (uint16_t)_eip :
>>>
>> (uint32_t)_eip);
>>
>>> + };
>>> +
>>>
>> This is a nested function which we don't use (in the kernel or
>> userspace).
>>
>> It needs to be a file-scope function (static, too).
>>
>
>

--
Do not meddle in the internals of kernels, for they are subtle and quick to panic.