sim: ppc: always compile in the sysv sem & shm device files

Move the stub logic to the device files themselves.  This makes the
configure & build logic more static which will make it easier to move
to the top-level build, and matches what we did with the common/ hw
tree already.

This also decouples the logic from the two -- in the past, you needed
both sem & shm in order to enable the device models, but now each one
is tied to its own independent knob.  Practically speaking, this will
probably not make a difference, but it simplifies the build a bit.
This commit is contained in:
Mike Frysinger 2024-01-01 20:22:45 -05:00
parent d961049a26
commit bc756034ee
5 changed files with 46 additions and 14 deletions

View File

@ -24,6 +24,12 @@
/* Define if struct statfs is defined in <sys/mount.h> */ /* Define if struct statfs is defined in <sys/mount.h> */
#undef HAVE_STRUCT_STATFS #undef HAVE_STRUCT_STATFS
/* Define if System V semaphores are supported */
#undef HAVE_SYSV_SEM
/* Define if System V shared memory is supported */
#undef HAVE_SYSV_SHM
/* Define to 1 if you have the <sys/stat.h> header file. */ /* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H #undef HAVE_SYS_STAT_H

18
sim/ppc/configure vendored
View File

@ -3220,6 +3220,12 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sysv_sem" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sysv_sem" >&5
$as_echo "$ac_cv_sysv_sem" >&6; } $as_echo "$ac_cv_sysv_sem" >&6; }
if test x"$ac_cv_sysv_sem" = x"yes"; then :
$as_echo "#define HAVE_SYSV_SEM 1" >>confdefs.h
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether System V shared memory is supported" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether System V shared memory is supported" >&5
$as_echo_n "checking whether System V shared memory is supported... " >&6; } $as_echo_n "checking whether System V shared memory is supported... " >&6; }
@ -3255,16 +3261,16 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sysv_shm" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sysv_shm" >&5
$as_echo "$ac_cv_sysv_shm" >&6; } $as_echo "$ac_cv_sysv_shm" >&6; }
if test x"$ac_cv_sysv_shm" = x"yes"; then :
$as_echo "#define HAVE_SYSV_SHM 1" >>confdefs.h
if test x"$ac_cv_sysv_shm" = x"yes" -a x"$ac_cv_sysv_sem" = x"yes" ; then
sim_sysv_ipc_hw=",sem,shm";
else
sim_sysv_ipc_hw="";
fi fi
# Check whether --enable-sim-hardware was given. # Check whether --enable-sim-hardware was given.
if test "${enable_sim_hardware+set}" = set; then : if test "${enable_sim_hardware+set}" = set; then :
enableval=$enable_sim_hardware; hardware="cpu,memory,nvram,iobus,htab,disk,trace,register,vm,init,core,pal,com,eeprom,opic,glue,phb,ide${sim_sysv_ipc_hw}" enableval=$enable_sim_hardware; hardware="cpu,memory,nvram,iobus,htab,disk,trace,register,vm,init,core,pal,com,eeprom,opic,glue,phb,ide,sem,shm"
case "${enableval}" in case "${enableval}" in
yes) ;; yes) ;;
no) as_fn_error $? "\"List of hardware must be specified for --enable-sim-hardware\"" "$LINENO" 5; hardware="";; no) as_fn_error $? "\"List of hardware must be specified for --enable-sim-hardware\"" "$LINENO" 5; hardware="";;
@ -3278,7 +3284,7 @@ if test x"$silent" != x"yes" && test x"$hardware" != x""; then
echo "Setting hardware to $sim_hw_src, $sim_hw_obj" echo "Setting hardware to $sim_hw_src, $sim_hw_obj"
fi fi
else else
hardware="cpu,memory,nvram,iobus,htab,disk,trace,register,vm,init,core,pal,com,eeprom,opic,glue,phb,ide${sim_sysv_ipc_hw}" hardware="cpu,memory,nvram,iobus,htab,disk,trace,register,vm,init,core,pal,com,eeprom,opic,glue,phb,ide,sem,shm"
sim_hw_src=`echo $hardware | sed -e 's/,/.c hw_/g' -e 's/^/hw_/' -e s'/$/.c/'` sim_hw_src=`echo $hardware | sed -e 's/,/.c hw_/g' -e 's/^/hw_/' -e s'/$/.c/'`
sim_hw_obj=`echo $sim_hw_src | sed -e 's/\.c/.o/g'` sim_hw_obj=`echo $sim_hw_src | sed -e 's/\.c/.o/g'`
if test x"$silent" != x"yes"; then if test x"$silent" != x"yes"; then

View File

@ -131,6 +131,9 @@ AC_CACHE_CHECK([whether System V semaphores are supported],
if (semctl(id, 0, IPC_RMID, arg) == -1) if (semctl(id, 0, IPC_RMID, arg) == -1)
return 1; return 1;
], [ac_cv_sysv_sem="yes"], [ac_cv_sysv_sem="no"])]) ], [ac_cv_sysv_sem="yes"], [ac_cv_sysv_sem="no"])])
AS_IF([test x"$ac_cv_sysv_sem" = x"yes"], [dnl
AC_DEFINE(HAVE_SYSV_SEM, 1, [Define if System V semaphores are supported])
])
AC_CACHE_CHECK(whether System V shared memory is supported, AC_CACHE_CHECK(whether System V shared memory is supported,
ac_cv_sysv_shm, ac_cv_sysv_shm,
@ -144,16 +147,13 @@ ac_cv_sysv_shm,
if (shmctl(id, IPC_RMID, 0) == -1) if (shmctl(id, IPC_RMID, 0) == -1)
return 1; return 1;
], [ac_cv_sysv_shm="yes"], [ac_cv_sysv_shm="no"])]) ], [ac_cv_sysv_shm="yes"], [ac_cv_sysv_shm="no"])])
AS_IF([test x"$ac_cv_sysv_shm" = x"yes"], [dnl
if test x"$ac_cv_sysv_shm" = x"yes" -a x"$ac_cv_sysv_sem" = x"yes" ; then AC_DEFINE(HAVE_SYSV_SHM, 1, [Define if System V shared memory is supported])
sim_sysv_ipc_hw=",sem,shm"; ])
else
sim_sysv_ipc_hw="";
fi
AC_ARG_ENABLE(sim-hardware, AC_ARG_ENABLE(sim-hardware,
[ --enable-sim-hardware=list Specify the hardware to be included in the build.], [ --enable-sim-hardware=list Specify the hardware to be included in the build.],
[hardware="cpu,memory,nvram,iobus,htab,disk,trace,register,vm,init,core,pal,com,eeprom,opic,glue,phb,ide${sim_sysv_ipc_hw}" [hardware="cpu,memory,nvram,iobus,htab,disk,trace,register,vm,init,core,pal,com,eeprom,opic,glue,phb,ide,sem,shm"
case "${enableval}" in case "${enableval}" in
yes) ;; yes) ;;
no) AC_MSG_ERROR("List of hardware must be specified for --enable-sim-hardware"); hardware="";; no) AC_MSG_ERROR("List of hardware must be specified for --enable-sim-hardware"); hardware="";;
@ -165,7 +165,7 @@ sim_hw_src=`echo $hardware | sed -e 's/,/.c hw_/g' -e 's/^/hw_/' -e s'/$/.c/'`
sim_hw_obj=`echo $sim_hw_src | sed -e 's/\.c/.o/g'` sim_hw_obj=`echo $sim_hw_src | sed -e 's/\.c/.o/g'`
if test x"$silent" != x"yes" && test x"$hardware" != x""; then if test x"$silent" != x"yes" && test x"$hardware" != x""; then
echo "Setting hardware to $sim_hw_src, $sim_hw_obj" echo "Setting hardware to $sim_hw_src, $sim_hw_obj"
fi],[hardware="cpu,memory,nvram,iobus,htab,disk,trace,register,vm,init,core,pal,com,eeprom,opic,glue,phb,ide${sim_sysv_ipc_hw}" fi],[hardware="cpu,memory,nvram,iobus,htab,disk,trace,register,vm,init,core,pal,com,eeprom,opic,glue,phb,ide,sem,shm"
sim_hw_src=`echo $hardware | sed -e 's/,/.c hw_/g' -e 's/^/hw_/' -e s'/$/.c/'` sim_hw_src=`echo $hardware | sed -e 's/,/.c hw_/g' -e 's/^/hw_/' -e s'/$/.c/'`
sim_hw_obj=`echo $sim_hw_src | sed -e 's/\.c/.o/g'` sim_hw_obj=`echo $sim_hw_src | sed -e 's/\.c/.o/g'`
if test x"$silent" != x"yes"; then if test x"$silent" != x"yes"; then

View File

@ -84,6 +84,8 @@
*/ */
#ifdef HAVE_SYSV_SEM
typedef struct _hw_sem_device { typedef struct _hw_sem_device {
unsigned_word physical_address; unsigned_word physical_address;
key_t key; key_t key;
@ -278,4 +280,12 @@ const device_descriptor hw_sem_device_descriptor[] = {
{ NULL }, { NULL },
}; };
#else
const device_descriptor hw_sem_device_descriptor[] = {
{ NULL },
};
#endif /* HAVE_SYSV_SEM */
#endif /* _HW_SEM_C_ */ #endif /* _HW_SEM_C_ */

View File

@ -77,6 +77,8 @@
*/ */
#ifdef HAVE_SYSV_SHM
typedef struct _hw_shm_device { typedef struct _hw_shm_device {
unsigned_word physical_address; unsigned_word physical_address;
char *shm_address; char *shm_address;
@ -222,4 +224,12 @@ const device_descriptor hw_shm_device_descriptor[] = {
{ NULL }, { NULL },
}; };
#else
const device_descriptor hw_shm_device_descriptor[] = {
{ NULL },
};
#endif /* HAVE_SYSV_SHM */
#endif /* _HW_SHM_C_ */ #endif /* _HW_SHM_C_ */