diff options
author | Oleksandr Tymoshenko <gonzo@FreeBSD.org> | 2012-03-15 05:29:51 +0000 |
---|---|---|
committer | Oleksandr Tymoshenko <gonzo@FreeBSD.org> | 2012-03-15 05:29:51 +0000 |
commit | fba09d4c08df02bf54d969502252eddb930a6d5f (patch) | |
tree | e2b2a934e81167d570f4763b947edb32ee8ee12a /sys/mips | |
parent | 199aa9756be321adc412219147cbe9c43be23204 (diff) | |
download | src-fba09d4c08df02bf54d969502252eddb930a6d5f.tar.gz src-fba09d4c08df02bf54d969502252eddb930a6d5f.zip |
Notes
Diffstat (limited to 'sys/mips')
-rw-r--r-- | sys/mips/mips/machdep.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/sys/mips/mips/machdep.c b/sys/mips/mips/machdep.c index 8a9fabe3801c..21b85c571d9a 100644 --- a/sys/mips/mips/machdep.c +++ b/sys/mips/mips/machdep.c @@ -380,6 +380,56 @@ mips_vector_init(void) void mips_postboot_fixup(void) { + static char fake_preload[256]; + caddr_t preload_ptr = (caddr_t)&fake_preload[0]; + size_t size = 0; + + /* + * Provide kernel module file information + */ + *(uint32_t*)(preload_ptr + size) = MODINFO_NAME; + size += sizeof(uint32_t); + *(uint32_t*)(preload_ptr + size) = strlen("kernel") + 1; + size += sizeof(uint32_t); + strcpy((char*)(preload_ptr + size), "kernel"); + size += strlen("kernel") + 1; + size = roundup(size, sizeof(u_long)); + + *(uint32_t*)(preload_ptr + size) = MODINFO_TYPE; + size += sizeof(uint32_t); + *(uint32_t*)(preload_ptr + size) = strlen("elf kernel") + 1; + size += sizeof(uint32_t); + strcpy((char*)(preload_ptr + size), "elf kernel"); + size += strlen("elf kernel") + 1; + size = roundup(size, sizeof(u_long)); + + *(uint32_t*)(preload_ptr + size) = MODINFO_ADDR; + size += sizeof(uint32_t); + *(uint32_t*)(preload_ptr + size) = sizeof(vm_offset_t); + size += sizeof(uint32_t); + *(vm_offset_t*)(preload_ptr + size) = KERNLOADADDR; + size += sizeof(vm_offset_t); + size = roundup(size, sizeof(u_long)); + + *(uint32_t*)(preload_ptr + size) = MODINFO_SIZE; + size += sizeof(uint32_t); + *(uint32_t*)(preload_ptr + size) = sizeof(size_t); + size += sizeof(uint32_t); + *(vm_offset_t*)(preload_ptr + size) = (size_t)&end - KERNLOADADDR; + size = roundup(size, sizeof(u_long)); + size += sizeof(size_t); + + /* End marker */ + *(uint32_t*)(preload_ptr + size) = 0; + size += sizeof(uint32_t); + *(uint32_t*)(preload_ptr + size) = 0; + size += sizeof(uint32_t); + + KASSERT((size < sizeof(fake_preload)), + ("fake preload size is more thenallocated")); + + preload_metadata = (void *)fake_preload; + #ifdef DDB Elf_Size *trampoline_data = (Elf_Size*)kernel_kseg0_end; Elf_Size symtabsize = 0; |