2009-09-09 Till Straumann <strauman@slac.stanford.edu>

* startup/bspstart.c: Added dummy implementation of firmware
	syscalls for use with QEMU. Dummy handler is installed if no
	pre-existing firmware handler is found.
This commit is contained in:
Till Straumann
2009-09-09 05:34:44 +00:00
parent ad4137358b
commit ddfae71ab0
2 changed files with 46 additions and 0 deletions

View File

@@ -1,3 +1,9 @@
2009-09-09 Till Straumann <strauman@slac.stanford.edu>
* startup/bspstart.c: Added dummy implementation of firmware
syscalls for use with QEMU. Dummy handler is installed if no
pre-existing firmware handler is found.
2009-08-26 Joel Sherrill <joel.sherrill@oarcorp.com>
* clock/clock.c, include/bsp.h: Rename BSP specific idle thread to

View File

@@ -184,6 +184,8 @@ void _CPU_cache_invalidate_1_data_line(const void *addr)
#endif
}
extern void bsp_fake_syscall();
/*
* The Arcturus boot ROM prints exception information improperly
* so use this default exception handler instead. This one also
@@ -263,6 +265,13 @@ void bsp_start( void )
MCF5XXX_ACR_BWE;
m68k_set_acr0(mcf5282_acr0_mode);
/*
* Qemu has no trap handler; install our fake syscall
* implementation if there is no existing handler.
*/
if ( 0 == *((void (**)(int))((32+2) * 4)) )
*((void (**)(int))((32+2) * 4)) = bsp_fake_syscall;
/*
* Enable the cache
*/
@@ -394,6 +403,37 @@ syscall_2(int, program, bsp_mnode_t *, chain, int, flags)
syscall_3(int, flash_erase_range, volatile unsigned short *, flashptr, int, start, int, end);
syscall_3(int, flash_write_range, volatile unsigned short *, flashptr, bsp_mnode_t *, chain, int, offset);
/* Provide a dummy-implementation of these syscalls
* for qemu (which lacks the firmware).
*/
#define __STR(x) #x
#define __STRSTR(x) __STR(x)
#define ERRVAL __STRSTR(EACCES)
/* reset-control register */
#define RCR "__IPSBAR + 0x110000"
asm(
"bsp_fake_syscall: \n"
" cmpl #0, %d0 \n" /* sysreset */
" bne 1f \n"
" moveb #0x80, %d0 \n"
" moveb %d0, "RCR" \n" /* reset-controller */
/* should never get here - but we'd return -EACCESS if we do */
"1: \n"
" cmpl #12, %d0 \n" /* gethwaddr */
" beq 2f \n"
" cmpl #14, %d0 \n" /* getbenv */
" beq 2f \n"
" movel #-"ERRVAL", %d0 \n" /* return -EACCESS */
" rte \n"
"2: \n"
" movel #0, %d0 \n" /* return NULL */
" rte \n"
);
/*
* 'Extended BSP' routines
* Should move to cpukit/score/cpu/m68k/cpu.c someday.