summaryrefslogtreecommitdiff
path: root/src/arch/ppc/boot/boot.c
blob: 5a7d06d26e2fc94d851ecd4ce9034ee79cffcbb9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <ip_checksum.h>
#include <boot/elf.h>
#include <boot/elf_boot.h>
#include <string.h>
#include <console/console.h>

extern void flush_dcache(void);

int elf_check_arch(Elf_ehdr *ehdr)
{
	return (
		(ehdr->e_machine == EM_PPC) &&
		(ehdr->e_ident[EI_CLASS] == ELFCLASS32) &&
		(ehdr->e_ident[EI_DATA] == ELFDATA2MSB) 
		);
	
}

void jmp_to_elf_entry(void *entry, unsigned long buffer)
{
	void (*kernel_entry)(void);       

	kernel_entry = entry;

	/*
	 * Kernel will invalidate and disable dcache immediately on
	 * entry. This is bad if we've been using it, which we
	 * have. Make sure it is flushed to memory.
	 */
	flush_dcache();

	/* On ppc we don't currently support loading over LinuxBIOS.
	 * So ignore the buffer.
	 */

	/* Jump to kernel */
	kernel_entry();
}