Skip to content

Commit

Permalink
cosmetic tweak stop_all_cpus, new start_all_cpus:
Browse files Browse the repository at this point in the history
Mostly just to make them consistent with one another.

The new start_all_cpus function will be needed for eventual #322 implementation.

[skip travis]
  • Loading branch information
Fish-Git committed Sep 24, 2020
1 parent ab6e740 commit d6dda19
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 8 deletions.
4 changes: 2 additions & 2 deletions cmdtab.h
Original file line number Diff line number Diff line change
Expand Up @@ -1524,15 +1524,16 @@
"asking for confirmation.\n"

#define start_cmd_desc "Start CPU (or printer/punch device if argument given)"
#define startall_cmd_desc "Start all CPU's"
#define start_cmd_help \
\
"Entering the 'start' command by itself starts the target cpu if it\n" \
"is currently stopped. Entering the 'start <devn>' command will press\n" \
"the specified printer or punch device's virtual start button. Use the\n" \
"'cpu' command beforehand to choose which processor you wish to start.\n"

#define startall_cmd_desc "Start all CPU's"
#define stop_cmd_desc "Stop CPU (or printer/punch device if argument given)"
#define stopall_cmd_desc "Stop all CPU's"
#define stop_cmd_help \
\
"Entering the 'stop' command by itself stops the target cpu if it is\n" \
Expand All @@ -1541,7 +1542,6 @@
"an INTREQ (Intervention Required) status. Use the 'cpu' command before\n" \
"issuing the stop command to choose which processor you wish to stop.\n"

#define stopall_cmd_desc "Stop all CPU's"
#define store_cmd_desc "Store CPU status at absolute zero"
#define suspend_cmd_desc "Suspend hercules"
#define symptom_cmd_desc "Alias for traceopt"
Expand Down
49 changes: 43 additions & 6 deletions hinlines.h
Original file line number Diff line number Diff line change
Expand Up @@ -496,21 +496,46 @@ static inline void stop_all_cpus_intlock_held()
{
CPU_BITMAP mask;
REGS* regs;
int i;
int cpu;

for (i=0, mask = sysblk.started_mask; mask; i++, mask >>= 1)
mask = sysblk.started_mask & sysblk.config_mask;

for (cpu=0; mask; cpu++)
{
if (mask & 1)
if (mask & 1) // (configured and started?)
{
regs = sysblk.regs[i];

regs = sysblk.regs[ cpu ];
regs->opinterv = 1;
regs->cpustate = CPUSTATE_STOPPING;

ON_IC_INTERRUPT( regs );
signal_condition( &regs->intcond );
}
mask >>= 1;
}
}

/*-------------------------------------------------------------------*/
/* Start ALL CPUs (INTLOCK held) */
/*-------------------------------------------------------------------*/
static inline void start_all_cpus_intlock_held()
{
CPU_BITMAP mask;
REGS* regs;
int cpu;

mask = (~sysblk.started_mask) & sysblk.config_mask;

for (cpu=0; mask; cpu++)
{
if (mask & 1) // (configured but not started?)
{
regs = sysblk.regs[ cpu ];
regs->opinterv = 0;
regs->cpustate = CPUSTATE_STARTED;
ON_IC_INTERRUPT( regs );
signal_condition( &regs->intcond );
}
mask >>= 1;
}
}

Expand Down Expand Up @@ -586,6 +611,18 @@ static inline void stop_all_cpus()
RELEASE_INTLOCK( NULL );
}

/*-------------------------------------------------------------------*/
/* Start ALL CPUs (INTLOCK not held) */
/*-------------------------------------------------------------------*/
static inline void start_all_cpus()
{
OBTAIN_INTLOCK( NULL );
{
start_all_cpus_intlock_held();
}
RELEASE_INTLOCK( NULL );
}

/*-------------------------------------------------------------------*/
#undef asm

Expand Down

0 comments on commit d6dda19

Please sign in to comment.