realmode _WAKEUP

Paul Bolle pebolle at tiscali.nl
Wed Jan 7 12:13:35 EST 2015


On Wed, 2015-01-07 at 17:54 +0100, Paul Bolle wrote:
> On Wed, 2015-01-07 at 20:12 +0600, Alexander Kuleshov wrote:
> > There is following definition at arch/x86/realmode/rm/Makefile:
> > 
> > KBUILD_CFLAGS    := $(LINUXINCLUDE) $(REALMODE_CFLAGS) -D_SETUP -D_WAKEUP \
> >            -I$(srctree)/arch/x86/boot
> > 
> > Is it used now? I'm asking because _WAKEUP definition everywhere
> > undefined in the code.
> 
> git grep tells me:
>     $ git grep -n "_WAKEUP\b" arch/x86
>     arch/x86/boot/video-bios.c:51:#ifndef _WAKEUP
>     arch/x86/boot/video-bios.c:66:#ifdef _WAKEUP
>     arch/x86/boot/video-mode.c:169:#ifndef _WAKEUP
>     arch/x86/boot/video-vesa.c:27:#ifndef _WAKEUP
>     arch/x86/boot/video-vesa.c:29:#else /* _WAKEUP */
>     arch/x86/boot/video-vesa.c:31:#endif /* _WAKEUP */
>     arch/x86/boot/video-vesa.c:160:#ifndef _WAKEUP
>     arch/x86/boot/video-vesa.c:272:#endif /* not _WAKEUP */
>     arch/x86/boot/video-vga.c:257:#ifndef _WAKEUP
>     arch/x86/boot/video-vga.c:269:#ifndef _WAKEUP
> 
> And in that Makefile we also see, a few lines up:
>     wakeup-objs     := [...] video-mode.o
>     [...]
>     wakeup-objs     += video-vga.o
>     wakeup-objs     += video-vesa.o
>     wakeup-objs     += video-bios.o
> 
> So this Makefile line defines a _WAKEUP macro that is, it seems, used
> for the build of those four object files. (It's bit more complicated
> than that. But I think KBUILD_CFLAGS is explained in Documentation/,
> isn't it?)

Actually, that doesn't fully explain those wakeup-objs. Because you also
need to look at this:
    arch/x86/realmode/rm/video-bios.c:1:#include "../../boot/video-bios.c"
    arch/x86/realmode/rm/video-mode.c:1:#include "../../boot/video-mode.c"
    arch/x86/realmode/rm/video-vesa.c:1:#include "../../boot/video-vesa.c"
    arch/x86/realmode/rm/video-vga.c:1:#include "../../boot/video-vga.c"

And that is the _entire_ content of those files. Rather hackish, but it
apparently works.


Paul Bolle




More information about the Kernelnewbies mailing list