* Jordan Crouse <[EMAIL PROTECTED]> [071006 00:28]:
> This week I've been working with LinuxBIOSv3 to try to get over the XIP
> initram problem. For those that tuning in late, here's the recap:
>
> There are some symbols that we use that we want to define once, and
> use in different segments (such as printk). This is very easy to do
> for segments that are loaded and run at a particular location in memory,
> by passing in the symbol list from stage0 to LD through the -R command
> line option, from which LD figures the right relative offsets.
>
> The problem is, this is only easy if you know where your code is
> executing, and pass the appropriate fu into LD. For most systems,
> we need to run at least the initram segment in place on the ROM which
> are not always located at a known location - there can be multiple
> initram blocks, and LAR can put them anywhere it wishes. Needless to
> say, this breaks things badly when we try to call functions in the bootblock
> with a relative offset that walks into the weeds.
I tried playing with the same thing and I came up with the following
hack (attachment) .. The big issue is it doesnt work like that yet. The
idea is to take the decision of the jump address from the
compiler+linker because we already know it.
Can something like this work a all?
--
coresystems GmbH • Brahmsstr. 16 • D-79104 Freiburg i. Br.
Tel.: +49 761 7668825 • Fax: +49 761 7664613
Email: [EMAIL PROTECTED] • http://www.coresystems.de/
Registergericht: Amtsgericht Freiburg • HRB 7656
Geschäftsführer: Stefan Reinauer • Ust-IdNr.: DE245674866
Index: include/console.h
===================================================================
--- include/console.h (revision 503)
+++ include/console.h (working copy)
@@ -46,7 +46,18 @@
};
//
+#ifndef INITRAM
int printk(int msg_level, const char *fmt, ...)
__attribute__((format (printf, 2, 3)));
-
+#else
+static int printk(int msg_level, const char *fmt, ...)
+{
+ asm volatile (
+ //" jmp $0xffffd1dc\n "
+ " movl $" PRINTK_ADDR ", %edx\n"
+ " jmp *%edx\n "
+ );
+ return 0;
+}
+#endif
#endif /* CONSOLE_H */
Index: mainboard/emulation/qemu-x86/initram.c
===================================================================
--- mainboard/emulation/qemu-x86/initram.c (revision 503)
+++ mainboard/emulation/qemu-x86/initram.c (working copy)
@@ -17,6 +17,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#define INITRAM
+#include <stage0.h>
#include <console.h>
int main(void)
Index: mainboard/emulation/qemu-x86/Makefile
===================================================================
--- mainboard/emulation/qemu-x86/Makefile (revision 503)
+++ mainboard/emulation/qemu-x86/Makefile (working copy)
@@ -42,8 +42,13 @@
INITRAM_OBJ = $(obj)/mainboard/$(MAINBOARDDIR)/initram.o
# These are possibly not permanent
-INITRAM_OBJ += $(obj)/lib/console.o $(obj)/lib/vtxprintf.o $(obj)/lib/uart8250.o $(obj)/arch/x86/post_code.o
+#INITRAM_OBJ += $(obj)/lib/console.o $(obj)/lib/vtxprintf.o $(obj)/lib/uart8250.o $(obj)/arch/x86/post_code.o
+$(obj)/mainboard/$(MAINBOARDDIR)/initram.o: $(obj)/stage0.h
+
+$(obj)/stage0.h:
+ echo "#define PRINTK_ADDR \"0x$(shell grep printk $(obj)/stage0.init.map |cut -f1 -d\ )\"" > $(obj)/stage0.h
+
$(obj)/linuxbios.initram: $(obj)/stage0.init $(obj)/stage0.o $(INITRAM_OBJ)
$(Q)# initram links against stage0
$(Q)printf " LD $(subst $(shell pwd)/,,$(@))\n"
Index: lib/lar.c
===================================================================
--- lib/lar.c (revision 503)
+++ lib/lar.c (working copy)
@@ -230,7 +230,7 @@
} else { /* XIP */
if (find_file(archive, filename, &result)) {
printk(BIOS_INFO,
- "LAR: Run file %s failed: No such file.\n",
+ "LAR: Run file %s failed: No such file. XY\n",
filename);
return 1;
}
@@ -244,6 +244,7 @@
where = result.start;
}
printk(BIOS_SPEW, "where is %p\n", where);
+ printk(BIOS_INFO, "Running it..\n");
ret = run_address(where);
printk(BIOS_SPEW, "run_file returns with %d\n", ret);
return ret;
--
linuxbios mailing list
[email protected]
http://www.linuxbios.org/mailman/listinfo/linuxbios