Skip to contentSkip to conversation

multiboot take partial mmap

DISCUSSION Andrey Valyaev 4 participants 10 messages Jun 3, 2009 – Jun 8, 2009

lore
Share & tools
lore
#0 lore raw

Try create gub2 multiboot cd.
My kernel worked fine with grub-legacy.

But encounter problem.
kernel receive mmap up to 1meg...
lsmmap command show full mmap.

multiboot fill mmap over grub_mmap_iterate,
lsmmap get mmap over grub_machine_mmap_iterate.

May be machine_mmap is better?

Sometime, kernel, loaded from console, see full mmap. from menu always fail.. :(

Help me, please!!!

PS: sorry for bad english.

Signature · 2 lines
Andrey Valyaev
http://mdf-i.blogspot.com
#1 lore raw
Quoted 11 lines · Andrey Valyaev

Try create gub2 multiboot cd.
My kernel worked fine with grub-legacy.

But encounter problem.
kernel receive mmap up to 1meg...
lsmmap command show full mmap.

multiboot fill mmap over grub_mmap_iterate,
lsmmap get mmap over grub_machine_mmap_iterate.

May be machine_mmap is better?

It's not. machine_mmap doesn't take into account possible badram and hooks installed. Be sure to use latest svn and post your exact config since I didn't have such a problem in my tests

Quoted 18 lines

Sometime, kernel, loaded from console, see full mmap. from menu always fail.. :(

Help me, please!!!

PS: sorry for bad english.

--
Andrey Valyaev
http://mdf-i.blogspot.com

_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

Signature · 2 lines
Regards
Vladimir 'phcoder' Serbinenko
#2 lore raw
Quoted 5 lines · On Четверг 04 июня 2009 03:18:15 Vladimir 'phcoder' Serbinenko wrote:
Quoted 3 lines

My kernel worked fine with grub-legacy.
But encounter problem.
kernel receive mmap up to 1meg...

Be sure to use latest svn and post your exact config since I didn't have such a problem in my tests

Sorry, it's my bug...
grub2 place modules to upper pages, but grub-legasy place modules after kernel.

I wrong check the modules location for searching temporary kernel memory.

mmap work.

Some question. Module mmap need only for command badram? my loader worked without mmap module.

PS: latest svn revision (from 2243) failed with message:

gcc -Icommands -I./commands -I. -I./include -I./include -Wall -W -Wall -W -
Wshadow -Wpointer-arith -Wmissing-prototypes -Wundef -
Wstrict-prototypes -g -Os -falign-jumps=1 -falign-loops=1 -falign-functions=1 -m32 -fno-stack-protector -mno-stack-arg-probe -fno-builtin -mrtd -mregparm=3 -m32 -Werror -Wall -MD -c -o search_mod-commands_search.o commands/search.c
cc1: warnings being treated as errors
commands/search.c: In function 'search_fs':
commands/search.c:42: error: generating trampoline in object (requires executable stack)
commands/search.c: In function 'grub_cmd_search':
commands/search.c:105: error: generating trampoline in object (requires executable stack)
make[1]: *** [search_mod-commands_search.o] Error 1

$ gcc --version
gcc (Gentoo 4.3.3-r2 p1.1, pie-10.1.5) 4.3.3
Signature · 2 lines
Andrey Valyaev
http://mdf-i.blogspot.com
#3 lore raw
Quoted 7 lines · Andrey Valyaev
Quoted 5 lines · On Четверг 04 июня 2009 03:18:15 Vladimir 'phcoder' Serbinenko wrote:
Quoted 3 lines

My kernel worked fine with grub-legacy.
But encounter problem.
kernel receive mmap up to 1meg...

Be sure to use latest svn and post your exact config since I didn't have such a problem in my tests

Quoted 7 lines

Sorry, it's my bug...
grub2 place modules to upper pages, but grub-legasy place modules after kernel.

I wrong check the modules location for searching temporary kernel memory.

mmap work.

Do you mean that memory map as passed by mainstream grub is ok?

Quoted 2 lines

Some question. Module mmap need only for command badram?

No. It's needed for drivemap and ACPI spoofing too

Quoted 2 lines

my loader worked
without mmap module.

Do you mean that you replaced grub_memory_mmap_iterate with grub_machine_memory_mmap_iterate? As I already said it's NOT correct. Can you give me more details in a personal mail in Russian so language wouldn't be a problem for you?

Quoted 17 lines

PS: latest svn revision (from 2243) failed with message:

gcc -Icommands -I./commands -I. -I./include -I./include -Wall -W  -Wall -W - Wshadow -Wpointer-arith -Wmissing-prototypes                  -Wundef - Wstrict-prototypes -g -Os -falign-jumps=1 -falign-loops=1 -falign-functions=1

(quoted diff) +0 -2
-m32 -fno-stack-protector -mno-stack-arg-probe -fno-builtin -mrtd -mregparm=3
-m32 -Werror -Wall -MD -c -o search_mod-commands_search.o commands/search.c

cc1: warnings being treated as errors
commands/search.c: In function 'search_fs':
commands/search.c:42: error: generating trampoline in object (requires executable stack)
commands/search.c: In function 'grub_cmd_search':
commands/search.c:105: error: generating trampoline in object (requires executable stack)
make[1]: *** [search_mod-commands_search.o] Error 1

Quoted 3 lines
$ gcc --version
gcc (Gentoo 4.3.3-r2 p1.1, pie-10.1.5) 4.3.3

This is because of commit 2243 by Robert Millan. The commit was about floppy probing but also added -Wall -Werror to search.mod
I myself stepped on this mine once with adding -Wall -Werror to my xnu module. I'll revert this change (only -Werror, not the rest of commit) as it causes build error for all gentoo users. Sorry, Robert, but we can't enable -Werror and still have nested functions. I don't think we should use -Werror at all because different compilers, versions or modifications of same compiler cause different warnings and imho maintaintaining cost is too high and breaks are too frequent. Or perhaps we can enable -Werror only on some compilers? Or perhaps anyone has a better idea

Quoted 10 lines

--
Andrey Valyaev
http://mdf-i.blogspot.com

_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

Signature · 2 lines
Regards
Vladimir 'phcoder' Serbinenko
#4 lore raw
Quoted 11 lines · On Пятница 05 июня 2009 05:24:09 Vladimir 'phcoder' Serbinenko wrote:
Quoted 5 lines

Sorry, it's my bug...
grub2 place modules to upper pages, but grub-legasy place modules after kernel.
I wrong check the modules location for searching temporary kernel memory. mmap work.

Do you mean that memory map as passed by mainstream grub is ok?

Quoted 2 lines

my loader worked
without mmap module.

Do you mean that you replaced grub_memory_mmap_iterate with grub_machine_memory_mmap_iterate? As I already said it's NOT correct.

No, i use r2242 without modification.

Quoted 2 lines

Can you give me more details in a personal mail in Russian so language wouldn't be a problem for you?

Thank's.... :)

Signature · 2 lines
Andrey Valyaev
http://mdf-i.blogspot.com
#5 lore raw
In reply to Vladimir 'phcoder' Serbinenko
Quoted 17 lines · Vladimir 'phcoder' Serbinenko
Quoted 16 lines · Andrey Valyaev

PS: latest svn revision (from 2243) failed with message:

gcc -Icommands -I./commands -I. -I./include -I./include -Wall -W  -Wall -W - Wshadow -Wpointer-arith -Wmissing-prototypes                  -Wundef - Wstrict-prototypes -g -Os -falign-jumps=1 -falign-loops=1 -falign-functions=1

(quoted diff) +0 -2
-m32 -fno-stack-protector -mno-stack-arg-probe -fno-builtin -mrtd -mregparm=3
-m32 -Werror -Wall -MD -c -o search_mod-commands_search.o commands/search.c

cc1: warnings being treated as errors
commands/search.c: In function 'search_fs':
commands/search.c:42: error: generating trampoline in object (requires executable stack)
commands/search.c: In function 'grub_cmd_search':
commands/search.c:105: error: generating trampoline in object (requires executable stack)
make[1]: *** [search_mod-commands_search.o] Error 1

Quoted 14 lines
Quoted 3 lines
$ gcc --version
gcc (Gentoo 4.3.3-r2 p1.1, pie-10.1.5) 4.3.3

This is because of commit 2243 by Robert Millan. The commit was about floppy probing but also added -Wall -Werror to search.mod
I myself stepped on this mine once with adding -Wall -Werror to my xnu module. I'll revert this change (only -Werror, not the rest of commit) as it causes build error for all gentoo users. Sorry, Robert, but we can't enable -Werror and still have nested functions. I don't think we should use -Werror at all because different compilers, versions or modifications of same compiler cause different warnings and imho maintaintaining cost is too high and breaks are too frequent. Or perhaps we can enable -Werror only on some compilers? Or perhaps anyone has a better idea

You could use -Wno-trampolines (IIRC that's the spelling) on Gentoo's patched GCC; it's generally good to minimise unwanted warnings even if they aren't errors. Here's the macro I use in man-db to add GCC warning options:

  # man-gcc-warning.m4 serial 1
  dnl MAN_GCC_WARNING(WARNING)
  dnl Add -WWARNING to CFLAGS if it is supported by the compiler.
  AC_DEFUN([MAN_GCC_WARNING],
  [man_saved_CFLAGS="$CFLAGS"
   CFLAGS="$CFLAGS -W$1"
   AC_CACHE_CHECK([that GCC supports -W$1],
     [AS_TR_SH([man_cv_gcc_warning_$1])],
     [AS_TR_SH([man_cv_gcc_warning_$1])=no
      AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
                        [AS_TR_SH([man_cv_gcc_warning_$1])=yes])])
   if test "$AS_TR_SH([man_cv_gcc_warning_$1])" = no; then
     CFLAGS="$man_saved_CFLAGS"
   fi]) # MAN_GCC_WARNING

I then use this in configure.ac:

if test "$GCC" = yes
then

          MAN_GCC_WARNING([]) # -W
          MAN_GCC_WARNING([pointer-arith])
          MAN_GCC_WARNING([write-strings])
          MAN_GCC_WARNING([strict-prototypes])
          MAN_GCC_WARNING([shadow])
          MAN_GCC_WARNING([format-security])
          MAN_GCC_WARNING([no-missing-field-initializers])

fi

Feel free to use and adjust to taste if you want.

Signature · 1 line
Colin Watson                                       [[email protected]]
#8 lore raw
In reply to Vladimir 'phcoder' Serbinenko
Quoted 14 lines · Vladimir 'phcoder' Serbinenko
Quoted 14 lines

gcc -Icommands -I./commands -I. -I./include -I./include -Wall -W  -Wall -W - Wshadow -Wpointer-arith -Wmissing-prototypes                  -Wundef - Wstrict-prototypes -g -Os -falign-jumps=1 -falign-loops=1 -falign-functions=1

(quoted diff) +0 -2
-m32 -fno-stack-protector -mno-stack-arg-probe -fno-builtin -mrtd -mregparm=3
-m32 -Werror -Wall -MD -c -o search_mod-commands_search.o commands/search.c

cc1: warnings being treated as errors
commands/search.c: In function 'search_fs':
commands/search.c:42: error: generating trampoline in object (requires executable stack)
commands/search.c: In function 'grub_cmd_search':
commands/search.c:105: error: generating trampoline in object (requires executable stack)
make[1]: *** [search_mod-commands_search.o] Error 1

Quoted 14 lines
Quoted 3 lines
$ gcc --version
gcc (Gentoo 4.3.3-r2 p1.1, pie-10.1.5) 4.3.3

This is because of commit 2243 by Robert Millan. The commit was about floppy probing but also added -Wall -Werror to search.mod
I myself stepped on this mine once with adding -Wall -Werror to my xnu module. I'll revert this change (only -Werror, not the rest of commit) as it causes build error for all gentoo users. Sorry, Robert, but we can't enable -Werror and still have nested functions. I don't think we should use -Werror at all because different compilers, versions or modifications of same compiler cause different warnings and imho maintaintaining cost is too high and breaks are too frequent. Or perhaps we can enable -Werror only on some compilers? Or perhaps anyone has a better idea

Unfixed warnings have given us MUCH worse problems than build failures.

I'm talking countless hours of debugging here.

Why exactly does gcc generate a warning because of nested functions? Is there no way to fix this?

Signature · 5 lines
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."
#6 lore raw
In reply to Colin Watson
Quoted 66 lines · Colin Watson
Quoted 17 lines · Vladimir 'phcoder' Serbinenko
Quoted 16 lines · Andrey Valyaev

PS: latest svn revision (from 2243) failed with message:

gcc -Icommands -I./commands -I. -I./include -I./include -Wall -W  -Wall -W - Wshadow -Wpointer-arith -Wmissing-prototypes                  -Wundef - Wstrict-prototypes -g -Os -falign-jumps=1 -falign-loops=1 -falign-functions=1

(quoted diff) +0 -2
-m32 -fno-stack-protector -mno-stack-arg-probe -fno-builtin -mrtd -mregparm=3
-m32 -Werror -Wall -MD -c -o search_mod-commands_search.o commands/search.c

cc1: warnings being treated as errors
commands/search.c: In function 'search_fs':
commands/search.c:42: error: generating trampoline in object (requires executable stack)
commands/search.c: In function 'grub_cmd_search':
commands/search.c:105: error: generating trampoline in object (requires executable stack)
make[1]: *** [search_mod-commands_search.o] Error 1

Quoted 14 lines
Quoted 3 lines
$ gcc --version
gcc (Gentoo 4.3.3-r2 p1.1, pie-10.1.5) 4.3.3

This is because of commit 2243 by Robert Millan. The commit was about floppy probing but also added -Wall -Werror to search.mod
I myself stepped on this mine once with adding -Wall -Werror to my xnu module. I'll revert this change (only -Werror, not the rest of commit) as it causes build error for all gentoo users. Sorry, Robert, but we can't enable -Werror and still have nested functions. I don't think we should use -Werror at all because different compilers, versions or modifications of same compiler cause different warnings and imho maintaintaining cost is too high and breaks are too frequent. Or perhaps we can enable -Werror only on some compilers? Or perhaps anyone has a better idea

You could use -Wno-trampolines (IIRC that's the spelling) on Gentoo's patched GCC; it's generally good to minimise unwanted warnings even if they aren't errors. Here's the macro I use in man-db to add GCC warning options:

 # man-gcc-warning.m4 serial 1
 dnl MAN_GCC_WARNING(WARNING)
 dnl Add -WWARNING to CFLAGS if it is supported by the compiler.
 AC_DEFUN([MAN_GCC_WARNING],
 [man_saved_CFLAGS="$CFLAGS"
  CFLAGS="$CFLAGS -W$1"
  AC_CACHE_CHECK([that GCC supports -W$1],
    [AS_TR_SH([man_cv_gcc_warning_$1])],
    [AS_TR_SH([man_cv_gcc_warning_$1])=no
     AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
                       [AS_TR_SH([man_cv_gcc_warning_$1])=yes])])
  if test "$AS_TR_SH([man_cv_gcc_warning_$1])" = no; then
    CFLAGS="$man_saved_CFLAGS"
  fi]) # MAN_GCC_WARNING

I then use this in configure.ac:

 if test "$GCC" = yes
 then
         MAN_GCC_WARNING([]) # -W MAN_GCC_WARNING([pointer-arith]) MAN_GCC_WARNING([write-strings]) MAN_GCC_WARNING([strict-prototypes]) MAN_GCC_WARNING([shadow]) MAN_GCC_WARNING([format-security]) MAN_GCC_WARNING([no-missing-field-initializers]) fi

Quoted 1 line

Feel free to use and adjust to taste if you want.

I think we could use it with -W, -Wall, -Wno-trampolines. Is everybody ok with that? Is this code copyrighted by you?

Quoted 10 lines

--
Colin Watson                                       [[email protected]]

_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

Signature · 2 lines
Regards
Vladimir 'phcoder' Serbinenko
#7 lore raw
Quoted 1 line · Vladimir 'phcoder' Serbinenko

Is this code copyrighted by you?

I think it's really too obvious to be copyrightable, but if it's copyrightable by anyone it's by me, GPLv2 or later. I have an assignment pending although the paperwork doesn't seem to have arrived yet (though I was away for a couple of weeks; maybe I should have another dig through the post pile ...)

Signature · 1 line
Colin Watson                                       [[email protected]]