@@ -58,8 +58,15 @@ static pthread_mutex_t network_read_mutex;
5858static pthread_mutex_t network_write_mutex ;
5959static int gdbserver_reset_event = -1 ;
6060
61+ enum spectranext_autoboot
62+ {
63+ autoboot_nothing = 0 ,
64+ autoboot_force_set_once = 1 ,
65+ autoboot_force_reset_once
66+ };
67+
6168/** vSpectranext autoboot: if true at machine_reset, apply ram mount + autoboot once, then clear. */
62- static bool spectranext_autoboot = false ;
69+ static enum spectranext_autoboot spectranext_autoboot = autoboot_nothing ;
6370
6471static libspectrum_word * registers [] = {
6572 & AF ,
@@ -857,7 +864,7 @@ void gdbserver_schedule_reset(void)
857864
858865void gdbserver_schedule_autoboot (void )
859866{
860- spectranext_autoboot = true ;
867+ spectranext_autoboot = autoboot_force_set_once ;
861868 event_add (tstates + 1 , gdbserver_reset_event );
862869}
863870
@@ -1117,15 +1124,25 @@ static uint8_t action_remove_breakpoint(const void* arg, void* response)
11171124void gdbserver_on_machine_reset (void )
11181125{
11191126#ifdef BUILD_SPECTRANET
1120- if (spectranext_autoboot )
1127+ switch (spectranext_autoboot )
11211128 {
1129+ case autoboot_force_set_once :
1130+ {
11221131 spectranet_config_set_string (CONFIG_SECTION_AUTO_MOUNT , CONFIG_ITEM_MOUNT_RESOURCE , "xfs://ram/" );
11231132 spectranet_config_set_byte (CONFIG_SECTION_AUTO_MOUNT , CONFIG_ITEM_AUTO_BOOT , 1 );
1124- spectranext_autoboot = false;
1125- }
1126- else
1127- {
1133+ spectranext_autoboot = autoboot_force_reset_once ;
1134+ break ;
1135+ }
1136+ case autoboot_force_reset_once :
1137+ {
11281138 spectranet_config_set_byte (CONFIG_SECTION_AUTO_MOUNT , CONFIG_ITEM_AUTO_BOOT , 0 );
1139+ spectranext_autoboot = autoboot_nothing ;
1140+ break ;
1141+ }
1142+ default :
1143+ {
1144+ break ;
1145+ }
11291146 }
11301147#endif
11311148}
0 commit comments