rtos: add custom stack read function