diff options
author | Thomas Huth <thuth@linux.vnet.ibm.com> | 2011-07-11 17:32:32 +0200 |
---|---|---|
committer | Thomas Huth <thuth@linux.vnet.ibm.com> | 2011-10-12 08:58:04 +0200 |
commit | 399e16b3f77cda49e6a92af401415f6e8f4faa0d (patch) | |
tree | c4d5cf7d3b6c8926249a2027bbecb193c3e6e18e /board-qemu | |
parent | f06450c2e5909ff97e58007e7c602ed69a956dd9 (diff) | |
download | SLOF-399e16b3f77cda49e6a92af401415f6e8f4faa0d.zip SLOF-399e16b3f77cda49e6a92af401415f6e8f4faa0d.tar.gz SLOF-399e16b3f77cda49e6a92af401415f6e8f4faa0d.tar.bz2 |
Make net-snk and modules relocatable, too.
Cleaned up the toc-relative assembly of net-snk, fixed the Makefiles, save the
modules as ELF files instead of raw binaries, adjust the net-snk base address
and the load-base variable... a lot of changes were required to make the net-snk
and the snk modules relocatable, too. But now it should be possible to relocate
all files so that the firmware also runs with less than 256 MiB RAM.
Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Diffstat (limited to 'board-qemu')
-rw-r--r-- | board-qemu/llfw/stage2.c | 4 | ||||
-rw-r--r-- | board-qemu/romfs/boot_rom.ffs | 2 | ||||
-rw-r--r-- | board-qemu/slof/OF.fs | 3 | ||||
-rw-r--r-- | board-qemu/veth/Makefile | 13 | ||||
-rw-r--r-- | board-qemu/veth/module_entry.c | 20 | ||||
-rw-r--r-- | board-qemu/veth/veth.lds | 13 |
6 files changed, 30 insertions, 25 deletions
diff --git a/board-qemu/llfw/stage2.c b/board-qemu/llfw/stage2.c index 4b1c15b..3d2e410 100644 --- a/board-qemu/llfw/stage2.c +++ b/board-qemu/llfw/stage2.c @@ -168,9 +168,9 @@ void early_c_entry(uint64_t start_addr, uint64_t fdt_addr) ((uint64_t *)fileInfo.addr_header)[2], ((uint64_t *)fileInfo.addr_header)[3]); - /* Assume that paflof need ca. 16 MiB RAM right now.. + /* Assume that paflof and SNK need ca. 31 MiB RAM right now. * TODO: Use value from ELF file instead */ - paflof_base = romfs_base - 0x1000000 + 0x100; + paflof_base = romfs_base - 0x1F00000 + 0x100; if ((int64_t)paflof_base <= 0LL) { puts("ERROR: Not enough memory for Open Firmware"); } diff --git a/board-qemu/romfs/boot_rom.ffs b/board-qemu/romfs/boot_rom.ffs index 385a08d..75a9fc5 100644 --- a/board-qemu/romfs/boot_rom.ffs +++ b/board-qemu/romfs/boot_rom.ffs @@ -18,4 +18,4 @@ xvect slof/xvect.bin 0 0 ofw_main board-qemu/slof/paflof 0 0 bootinfo board-qemu/llfw/Cboot.bin 0 0 snk clients/net-snk.client 0 0 -net_veth board-qemu/veth/net_veth.bin 0 0 +net_veth board-qemu/veth/net_veth.elf 0 0 diff --git a/board-qemu/slof/OF.fs b/board-qemu/slof/OF.fs index bd2c7b3..e2712c9 100644 --- a/board-qemu/slof/OF.fs +++ b/board-qemu/slof/OF.fs @@ -22,6 +22,9 @@ hex #include "base.fs" +\ Adjust load-base to point to paflof-start / 2: +paflof-start 1 rshift fff not and to load-base + \ Little-endian accesses. Also known as `wrong-endian'. #include <little-endian.fs> diff --git a/board-qemu/veth/Makefile b/board-qemu/veth/Makefile index 0032b8e..ac3b947 100644 --- a/board-qemu/veth/Makefile +++ b/board-qemu/veth/Makefile @@ -24,15 +24,14 @@ SRCS = module_entry.c veth.c OBJS = $(SRCS:.c=.o) $(TOP)/lib/libhvcall/hvcall.o -all: Makefile.dep net_veth.bin +all: Makefile.dep net_veth.elf -net_veth.o: $(OBJS) - $(LD) $(LDFLAGS) $^ -o $@ -T veth.lds -N +net_veth.elf: $(OBJS) + $(LD) $(LDFLAGS) $^ -o $@ -T veth.lds -N -q + $(STRIP) --strip-unneeded $@ -net_veth.bin: net_veth.o - $(OBJCOPY) -O binary $^ $@ -clean: - $(RM) -f *.o *.a *.i *.bin +clean: + $(RM) -f *.o *.a *.i *.elf distclean : clean rm -f Makefile.dep diff --git a/board-qemu/veth/module_entry.c b/board-qemu/veth/module_entry.c index 30a3508..385baba 100644 --- a/board-qemu/veth/module_entry.c +++ b/board-qemu/veth/module_entry.c @@ -20,25 +20,27 @@ static void* memset( void *dest, int c, size_t n ) return dest; } -extern char __bss_start; -extern char __bss_size; +extern char __module_start[]; +extern char __module_end[]; +extern char __bss_start[]; +extern char __bss_end[]; extern snk_module_t* veth_module_init(snk_kernel_t *snk_kernel_int, vio_config_t *conf); snk_module_t* module_init(snk_kernel_t *snk_kernel_int, pci_config_t *pciconf) { - char *bss = &__bss_start; - unsigned long long bss_size = (unsigned long long) &__bss_size; + long module_size; vio_config_t *vioconf = (vio_config_t *)pciconf; - if (((unsigned long long) bss) + bss_size >= 0xFF00000 - || bss_size >= 0x2000000) { - snk_kernel_int->print("BSS size (%llu bytes) is too big!\n", - bss_size); + module_size = __module_end - __module_start; + if (module_size >= 0x800000) { + snk_kernel_int->print("Module size (%llu bytes) is too big!\n", + module_size); return 0; } - memset(bss, 0, bss_size); + + memset(__bss_start, 0, __bss_end - __bss_start); return veth_module_init(snk_kernel_int, vioconf); } diff --git a/board-qemu/veth/veth.lds b/board-qemu/veth/veth.lds index a0c75d5..5132bcf 100644 --- a/board-qemu/veth/veth.lds +++ b/board-qemu/veth/veth.lds @@ -17,23 +17,24 @@ ENTRY(module_init) SECTIONS { .code 0xF800000: { + __module_start = .; module_entry.o(.opd) *(.text .stub .text.* .gnu.linkonce.t.*) *(.sfpr .glink) - *(.rodata .rodata.* .gnu.linkonce.r.*) + *(.rodata .rodata.* .gnu.linkonce.r.*) *(.data .data.* .gnu.linkonce.d.*) *(.opd) } .got : { _got = .; - *(.got .toc) + *(.got .toc) } - .bss : { + .bss : + { __bss_start = .; - *(*COM* .bss .gnu.linkonce.b.*) + *(*COM* .bss .gnu.linkonce.b.*) __bss_end = .; } - __bss_size = (__bss_end - __bss_start); - __end = .; + __module_end = .; } |