mirror of
https://gitlab.com/qemu-project/openbios.git
synced 2024-02-13 08:34:06 +08:00
than assembler. In order to allow OpenSolaris to boot under OpenBIOS, it is necessary to be able to invoke Forth words from within the MMU I/D-TLB miss handlers, since Solaris 10 kernels hook into the virtual to physical address translation process via va>tte-data at boot time. Hence this patch implements two macros: SAVE_CPU_STATE and RESTORE_CPU_STATE which enable a context switch to occur from within these trap handlers. Things are more complicated from within the MMU miss handlers because we can't use flushw to flush the processor registers to stack. This is because the memory pointed to by the stack pointer may not be in the TLB either, and so we'd end up in a recursive MMU trap. Hence we solve this by creating a static stack within OpenBIOS which is guaranteed to be locked in the TLB and storing all of our state there. Once the ability to switch context has been implemented, it is possible to invoke C functions as per normal from within the MMU miss handlers. Hence as a proof of concept I've migrated the MMU miss handling code from ASM to C with a view of making the relevant changes to invoke the relevant Forth functions at a later date. I'd also like to say thank you to Blue Swirl who took the time to answer all my questions and generally point out the shortcomings in my first attempts at SPARC assembler. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@siriusit.co.uk> git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@874 f158a5a8-5612-0410-a976-696ce0be7e32
33 lines
796 B
C
33 lines
796 B
C
/*
|
|
* <ofmem_sparc64.h>
|
|
*
|
|
* OF Memory manager
|
|
*
|
|
* Copyright (C) 1999, 2002 Samuel Rydh (samuel@ibrium.se)
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public License
|
|
* as published by the Free Software Foundation
|
|
*
|
|
*/
|
|
|
|
#ifndef _H_OFMEM_SPARC64
|
|
#define _H_OFMEM_SPARC64
|
|
|
|
#include "libopenbios/ofmem.h"
|
|
|
|
extern void ofmem_map_pages(ucell phys, ucell virt, ucell size, ucell mode);
|
|
|
|
typedef int (*translation_entry_cb)(ucell phys, ucell virt,
|
|
ucell size, ucell mode);
|
|
|
|
extern void ofmem_walk_boot_map(translation_entry_cb cb);
|
|
|
|
extern translation_t **g_ofmem_translations;
|
|
|
|
extern void dtlb_miss_handler(void);
|
|
extern void itlb_miss_handler(void);
|
|
extern void bug(void);
|
|
|
|
#endif /* _H_OFMEM_SPARC64 */
|