Skip to contentSkip to conversation

loader cleanup for i386-ieee1275

PATCH In review Robert Millan 3 participants 8 messages Jan 23, 2008 – Jan 24, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 loader cleanup for i386-ieee1275

Some cleanup for i386-ieee1275.

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)

* include/grub/i386/ieee1275/loader.h: Include <grub/types.h>', <grub/symbol.h>' and `<grub/multiboot.h>'. (grub_multiboot2_real_boot): New function prototype.

* include/grub/i386/pc/memory.h: Include `<grub/machine/machine.h>'. (grub_lower_mem, grub_upper_mem): Disable for IEEE1275.

* kern/i386/ieee1275/init.c (grub_os_area_addr) (grub_os_area_size, grub_lower_mem, grub_upper_mem): Remove variables.

include/grub/i386/ieee1275/loader.h renamed from grub2/include/grub/i386/ieee1275/loader.h +30 -1
diff -x CVS -x '*~' -x '*.mk' -urp ../grub2/include/grub/i386/ieee1275/loader.h ./include/grub/i386/ieee1275/loader.h
@@ -1 +1,30 @@
-#include <grub/cpu/loader.h>
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2002,2003,2004,2007,2008  Free Software Foundation, Inc.
+ *
+ *  GRUB is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  GRUB is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef GRUB_LOADER_MACHINE_HEADER
+#define GRUB_LOADER_MACHINE_HEADER	1
+
+#include <grub/types.h>
+#include <grub/symbol.h>
+#include <grub/multiboot.h>
+
+void EXPORT_FUNC(grub_multiboot2_real_boot) (grub_addr_t entry,
+                                             struct grub_multiboot_info *mbi)
+     __attribute__ ((noreturn));
+
+#endif /* ! GRUB_LOADER_MACHINE_HEADER */
include/grub/i386/pc/memory.h renamed from grub2/include/grub/i386/pc/memory.h +3 -0
diff -x CVS -x '*~' -x '*.mk' -urp ../grub2/include/grub/i386/pc/memory.h ./include/grub/i386/pc/memory.h
@@ -21,6 +21,7 @@
 #define GRUB_MEMORY_MACHINE_HEADER	1
 
 #include <grub/symbol.h>
+#include <grub/machine/machine.h>
 #ifndef ASM_FILE
 #include <grub/types.h>
 #endif
@@ -75,9 +76,11 @@
 /* The data segment of the pseudo real mode.  */
 #define GRUB_MEMORY_MACHINE_PSEUDO_REAL_DSEG	0x20
 
+#ifndef GRUB_MACHINE_IEEE1275
 #ifndef ASM_FILE
 extern grub_size_t EXPORT_VAR(grub_lower_mem);
 extern grub_size_t EXPORT_VAR(grub_upper_mem);
 #endif
+#endif
 
 #endif /* ! GRUB_MEMORY_MACHINE_HEADER */
kern/i386/ieee1275/init.c renamed from grub2/kern/i386/ieee1275/init.c +0 -4
diff -x CVS -x '*~' -x '*.mk' -urp ../grub2/kern/i386/ieee1275/init.c ./kern/i386/ieee1275/init.c
@@ -19,10 +19,6 @@
 
 #include <grub/types.h>
 
-grub_addr_t grub_os_area_addr;
-grub_size_t grub_os_area_size;
-grub_size_t grub_lower_mem, grub_upper_mem;
-
 void
 grub_stop_floppy (void)
 {
#1 lore raw
Quoted 1 line · Robert Millan

Some cleanup for i386-ieee1275.

Can you please give a bit more information?

Quoted 6 lines

* include/grub/i386/ieee1275/loader.h: Include <grub/types.h>', <grub/symbol.h>' and `<grub/multiboot.h>'. (grub_multiboot2_real_boot): New function prototype.

* include/grub/i386/pc/memory.h: Include `<grub/machine/machine.h>'. (grub_lower_mem, grub_upper_mem): Disable for IEEE1275.

You can make this conditional in the ChangeLog entry.

Quoted 2 lines

* kern/i386/ieee1275/init.c (grub_os_area_addr) (grub_os_area_size, grub_lower_mem, grub_upper_mem): Remove variables.

--
Marco

#2 lore raw
Quoted 5 lines · Marco Gerards
Quoted 1 line · Robert Millan

Some cleanup for i386-ieee1275.

Can you please give a bit more information?

The multiboot module on i386-ieee1275 was using variables that only have a meaning on i386-pc (and i386-linuxbios): grub_os_area_addr, grub_os_area_size, grub_lower_mem and grub_upper_mem. A bunch of unnecessary cruft from i386-pc port was being included, because at the beginning I thought I would base the multiboot loader on i386-pc (like I did for i386-linuxbios), but this turned out to be a wrong approach.

Quoted 8 lines
Quoted 6 lines

* include/grub/i386/ieee1275/loader.h: Include <grub/types.h>', <grub/symbol.h>' and `<grub/multiboot.h>'. (grub_multiboot2_real_boot): New function prototype.

* include/grub/i386/pc/memory.h: Include `<grub/machine/machine.h>'. (grub_lower_mem, grub_upper_mem): Disable for IEEE1275.

You can make this conditional in the ChangeLog entry.

What do you mean?

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)
#3 lore raw
Quoted 5 lines · Robert Millan
Quoted 4 lines · Marco Gerards
Quoted 1 line · Robert Millan

Some cleanup for i386-ieee1275.

Quoted 8 lines
Quoted 1 line

Can you please give a bit more information?

The multiboot module on i386-ieee1275 was using variables that only have a meaning on i386-pc (and i386-linuxbios): grub_os_area_addr, grub_os_area_size, grub_lower_mem and grub_upper_mem. A bunch of unnecessary cruft from i386-pc port was being included, because at the beginning I thought I would base the multiboot loader on i386-pc (like I did for i386-linuxbios), but this turned out to be a wrong approach.

I see.

Quoted 10 lines
Quoted 8 lines
Quoted 6 lines

* include/grub/i386/ieee1275/loader.h: Include <grub/types.h>', <grub/symbol.h>' and `<grub/multiboot.h>'. (grub_multiboot2_real_boot): New function prototype.

* include/grub/i386/pc/memory.h: Include `<grub/machine/machine.h>'. (grub_lower_mem, grub_upper_mem): Disable for IEEE1275.

You can make this conditional in the ChangeLog entry.

What do you mean?

	* include/grub/i386/pc/memory.h: Include `<grub/machine/machine.h>'.
        [!GRUB_IEEE1275] (grub_lower_mem, grub_upper_mem): Disabled.

I didn't check if this is the name of the macro, so please do not blindly copy this. But this is the right approach.

--
Marco

#4 lore raw
Quoted 9 lines · Marco Gerards
Quoted 3 lines
Quoted 1 line

You can make this conditional in the ChangeLog entry.

What do you mean?

	* include/grub/i386/pc/memory.h: Include `<grub/machine/machine.h>'.
        [!GRUB_IEEE1275] (grub_lower_mem, grub_upper_mem): Disabled.

I didn't check if this is the name of the macro, so please do not blindly copy this. But this is the right approach.

Ok, done.

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)
#5 lore raw
In reply to Robert Millan
Quoted 4 lines · Robert Millan
Quoted 3 lines · Marco Gerards
Quoted 1 line · Robert Millan

Some cleanup for i386-ieee1275.

Quoted 8 lines
Quoted 1 line

Can you please give a bit more information?

The multiboot module on i386-ieee1275 was using variables that only have a meaning on i386-pc (and i386-linuxbios): grub_os_area_addr, grub_os_area_size, grub_lower_mem and grub_upper_mem. A bunch of unnecessary cruft from i386-pc port was being included, because at the beginning I thought I would base the multiboot loader on i386-pc (like I did for i386-linuxbios), but this turned out to be a wrong approach.

If you have time, please consider refactoring the memory management on i386-pc. It is in my task list for so long...

Okuji

#6 lore raw
Quoted 10 lines · Yoshinori K. Okuji
Quoted 7 lines

The multiboot module on i386-ieee1275 was using variables that only have a meaning on i386-pc (and i386-linuxbios): grub_os_area_addr, grub_os_area_size, grub_lower_mem and grub_upper_mem. A bunch of unnecessary cruft from i386-pc port was being included, because at the beginning I thought I would base the multiboot loader on i386-pc (like I did for i386-linuxbios), but this turned out to be a wrong approach.

If you have time, please consider refactoring the memory management on i386-pc. It is in my task list for so long...

Is there a savannah task for this?

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)
#7 lore raw
Quoted 8 lines · Robert Millan
Quoted 7 lines · Yoshinori K. Okuji
Quoted 6 lines

The multiboot module on i386-ieee1275 was using variables that only have a meaning on i386-pc (and i386-linuxbios): grub_os_area_addr, grub_os_area_size, grub_lower_mem and grub_upper_mem. A bunch of unnecessary cruft from i386-pc port was being included, because at the beginning I thought I would base the multiboot loader on i386-pc (like I did for i386-linuxbios), but this turned out to be a wrong approach.

Quoted 4 lines
Quoted 2 lines

If you have time, please consider refactoring the memory management on i386-pc. It is in my task list for so long...

Is there a savannah task for this?

Yes. My description was very terse, though.

Okuji