Search
lxdream.org :: lxdream :: r182:e3b513538548
lxdream 0.9.1
released Jun 29
Download Now
changeset182:e3b513538548
parent181:bc28fd93e233
child183:5938ecc01dc8
authornkeynes
dateThu Jul 06 08:47:33 2006 +0000 (16 years ago)
Add -q command line argument to allow dcload_exit() to actually exit lxdream
altogether (useful for test cases)
src/dcload.c
src/main.c
src/syscall.h
1.1 --- a/src/dcload.c Thu Jul 06 08:46:41 2006 +0000
1.2 +++ b/src/dcload.c Thu Jul 06 08:47:33 2006 +0000
1.3 @@ -1,5 +1,5 @@
1.4 /**
1.5 - * $Id: dcload.c,v 1.3 2006-03-20 11:59:57 nkeynes Exp $
1.6 + * $Id: dcload.c,v 1.4 2006-07-06 08:47:33 nkeynes Exp $
1.7 *
1.8 * DC-load syscall implementation.
1.9 *
1.10 @@ -18,6 +18,7 @@
1.11
1.12 #include <stdio.h>
1.13 #include "dream.h"
1.14 +#include "dreamcast.h"
1.15 #include "mem.h"
1.16 #include "syscall.h"
1.17 #include "sh4/sh4core.h"
1.18 @@ -47,6 +48,13 @@
1.19 #define SYS_MAGIC_ADDR 0x8c004004
1.20 #define SYSCALL_ADDR 0x8c004008
1.21
1.22 +static gboolean dcload_allow_exit = FALSE;
1.23 +
1.24 +void dcload_set_allow_exit( gboolean allow )
1.25 +{
1.26 + dcload_allow_exit = allow;
1.27 +}
1.28 +
1.29 void dcload_syscall( uint32_t syscall_id )
1.30 {
1.31 uint32_t syscall = sh4r.r[4];
1.32 @@ -70,8 +78,10 @@
1.33 }
1.34 break;
1.35 case SYS_EXIT:
1.36 - /* exit( sh4r.r[4] ); */
1.37 - dreamcast_stop();
1.38 + if( dcload_allow_exit )
1.39 + exit( sh4r.r[4] );
1.40 + else
1.41 + dreamcast_stop();
1.42 default:
1.43 sh4r.r[0] = -1;
1.44 }
2.1 --- a/src/main.c Thu Jul 06 08:46:41 2006 +0000
2.2 +++ b/src/main.c Thu Jul 06 08:47:33 2006 +0000
2.3 @@ -1,5 +1,5 @@
2.4 /**
2.5 - * $Id: main.c,v 1.18 2006-07-02 04:59:00 nkeynes Exp $
2.6 + * $Id: main.c,v 1.19 2006-07-06 08:47:33 nkeynes Exp $
2.7 *
2.8 * Main program, initializes dreamcast and gui, then passes control off to
2.9 * the gtk main loop (currently).
2.10 @@ -35,7 +35,7 @@
2.11
2.12 #define S3M_PLAYER "s3mplay.bin"
2.13
2.14 -char *option_list = "a:s:A:V:phbd:c:";
2.15 +char *option_list = "a:s:A:V:pqhbd:c:";
2.16 struct option longopts[1] = { { NULL, 0, 0, 0 } };
2.17 char *aica_program = NULL;
2.18 char *s3m_file = NULL;
2.19 @@ -87,6 +87,9 @@
2.20 case 'p': /* Start immediately */
2.21 start_immediately = TRUE;
2.22 break;
2.23 + case 'q': /* Quit on DC program exit */
2.24 + dcload_set_allow_exit(TRUE);
2.25 + break;
2.26 case 'b': /* No BIOS */
2.27 without_bios = TRUE;
2.28 break;
3.1 --- a/src/syscall.h Thu Jul 06 08:46:41 2006 +0000
3.2 +++ b/src/syscall.h Thu Jul 06 08:47:33 2006 +0000
3.3 @@ -1,5 +1,5 @@
3.4 /**
3.5 - * $Id: syscall.h,v 1.1 2006-03-13 12:38:34 nkeynes Exp $
3.6 + * $Id: syscall.h,v 1.2 2006-07-06 08:47:33 nkeynes Exp $
3.7 *
3.8 * Generic syscall support - ability to add hooks into SH4 code to call out
3.9 * to the emu.
3.10 @@ -65,6 +65,12 @@
3.11 */
3.12 void dcload_install( void );
3.13
3.14 +/**
3.15 + * Set the flag that indicates whether the dcload exit() syscall will be
3.16 + * honoured by exiting the VM.
3.17 + */
3.18 +void dcload_set_allow_exit( gboolean allow );
3.19 +
3.20 #ifdef __cplusplus
3.21 }
3.22 #endif
.