diff options
author | aurel32 <aurel32@c046a42c-6fe2-441c-8c8c-71466251a162> | 2009-03-31 05:55:16 +0000 |
---|---|---|
committer | aurel32 <aurel32@c046a42c-6fe2-441c-8c8c-71466251a162> | 2009-03-31 05:55:16 +0000 |
commit | 65297bc408f303463754efbd5e6613e4554adae8 (patch) | |
tree | 0756a5f9afe2d81dbd2481e1cc3e99f320139909 | |
parent | 02d400ead71795123ac8580618de24e90df71154 (diff) |
SH4: Add support for kernel cmdline
Backport of revisions 6792, 6916, 6919 from trunk.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/branches/stable_0_10@6960 c046a42c-6fe2-441c-8c8c-71466251a162
-rw-r--r-- | hw/r2d.c | 18 | ||||
-rw-r--r-- | loader.c | 3 |
2 files changed, 16 insertions, 5 deletions
@@ -37,6 +37,9 @@ #define SM501_VRAM_SIZE 0x800000 +/* CONFIG_BOOT_LINK_OFFSET of Linux kernel */ +#define LINUX_LOAD_OFFSET 0x800000 + #define PA_IRLMSK 0x00 #define PA_POWOFF 0x30 #define PA_VERREG 0x32 @@ -233,20 +236,27 @@ static void r2d_init(ram_addr_t ram_size, int vga_ram_size, pci_nic_init(pci, &nd_table[i], (i==0)? 2<<3: -1, "rtl8139"); /* Todo: register on board registers */ - { + if (kernel_filename) { int kernel_size; /* initialization which should be done by firmware */ stl_phys(SH7750_BCR1, 1<<3); /* cs3 SDRAM */ stw_phys(SH7750_BCR2, 3<<(3*2)); /* cs3 32bit */ - kernel_size = load_image(kernel_filename, phys_ram_base); + if (kernel_cmdline) { + kernel_size = load_image_targphys(kernel_filename, + SDRAM_BASE + LINUX_LOAD_OFFSET, + SDRAM_SIZE - LINUX_LOAD_OFFSET); + env->pc = (SDRAM_BASE + LINUX_LOAD_OFFSET) | 0xa0000000; + pstrcpy_targphys(SDRAM_BASE + 0x10100, 256, kernel_cmdline); + } else { + kernel_size = load_image_targphys(kernel_filename, SDRAM_BASE, SDRAM_SIZE); + env->pc = SDRAM_BASE | 0xa0000000; /* Start from P2 area */ + } if (kernel_size < 0) { fprintf(stderr, "qemu: could not load kernel '%s'\n", kernel_filename); exit(1); } - - env->pc = SDRAM_BASE | 0xa0000000; /* Start from P2 area */ } } @@ -90,11 +90,12 @@ int fread_targphys(target_phys_addr_t dst_addr, size_t nbytes, FILE *f) while (nbytes) { want = nbytes > sizeof(buf) ? sizeof(buf) : nbytes; did = fread(buf, 1, want, f); - if (did != want) break; cpu_physical_memory_write_rom(dst_addr, buf, did); dst_addr += did; nbytes -= did; + if (did != want) + break; } return dst_addr - dst_begin; } |