[Haiku-commits] r28861 - haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/auich
Axel Dörfler
axeld at pinc-software.de
Fri Jan 9 10:26:33 CET 2009
korli at BerliOS <korli at mail.berlios.de> wrote:
> +#ifdef __HAIKU__
> +#define copy_to_user(x, y) if (user_memcpy(&x, &y, sizeof(x)) <
> B_OK) \
> + return B_BAD_ADDRESS
> +#else
> +#define copy_to_user(x, y) x = y
> +#endif
For BeOS, you should use lock_memory() before accessing the buffer to
be on the safe side.
> + copy_to_user(data->playback_buffer_cycle, playback_buffer_cycle);
> + copy_to_user(data->played_real_time, played_real_time);
> + copy_to_user(data->played_frames_count, played_frames_count);
> + copy_to_user(data->_reserved_0, _reserved_0);
> + copy_to_user(data->record_buffer_cycle, record_buffer_cycle);
> + copy_to_user(data->recorded_real_time, recorded_real_time);
> + copy_to_user(data->recorded_frames_count, recorded_frames_count);
> + copy_to_user(data->_reserved_1, _reserved_1);
And for Haiku, it would be nicer (and considerably faster) to use an on
-stack structure and copy that at once.
Bye,
Axel.
More information about the Haiku-commits
mailing list