From your example, I'll assume that EXTI9_5_IRQHandler() was auto generated by STM32CubeMX. The generated code calls HAL_GPIO_EXTI_IRQHandler() with a hardcoded parameter GPIO_PIN_8 because the generator knows you configured pin 8 as an external interrupt source in the STM32CubeMX project. If you enabled multiple pins as EXTI then there would be a call to HAL_GPIO_EXTI_IRQHandler() for each EXTI pin*.
Now look at the implementation of HAL_GPIO_EXTI_IRQHandler() in stm32xxxx_hal_gpio.c. (I took this from the STM32L4 HAL but I suspect STM32F7 HAL is the same.)
void HAL_GPIO_EXTI_IRQHandler(uint16_t GPIO_Pin)
{
/* EXTI line interrupt detected */
if(__HAL_GPIO_EXTI_GET_IT(GPIO_Pin) != 0x00u)
{
__HAL_GPIO_EXTI_CLEAR_IT(GPIO_Pin);
HAL_GPIO_EXTI_Callback(GPIO_Pin);
}
}
It calls __HAL_GPIO_EXTI_GET_IT(GPIO_Pin) to determine whether an interrupt has occurred for the specified pin. (HAL_GPIO_EXTI_Callback() is where you would put your application specific interrupt handler code.) Now look at the definition of __HAL_GPIO_EXTI_GET_IT() in stm32xxxx_hal_gpio.h.
#define __HAL_GPIO_EXTI_GET_IT(__EXTI_LINE__) (EXTI->PR1 & (__EXTI_LINE__))
It reads the EXTI->PR1 register to check whether the bit corresponding to the pin is set.
The answer to your question is to check the EXTI->PR1 register to determine which pin out of multiple are indicating that an interrupt occurred. (Double-check your HAL because different STM32 families may implement __HAL_GPIO_EXTI_GET_IT() differently.)
*Consider that there could be more than one pin indicating an interrupt by the time the interrupt service routine gets around to checking.