[alsa-devel] alsa on Atmel at91

Michel Benoit murpme at gmail.com
Thu May 10 15:44:07 CEST 2007


After digging through the assembler files it seems that for some
reason a function  called
__old_snd_pcm_hw_params_get_period_size that uses another procedure
calling standard is used.


Here is the code in libasound:

.symver __snd_pcm_hw_params_get_period_size,snd_pcm_hw_params_get_period_size@@ALSA_0.9.0rc4
	.symver __old_snd_pcm_hw_params_get_period_size,snd_pcm_hw_params_get_period_size at ALSA_0.9

	.align	2
	.global	__snd_pcm_hw_params_get_period_size
	.type	__snd_pcm_hw_params_get_period_size, %function
__snd_pcm_hw_params_get_period_size:
	@ args = 0, pretend = 0, frame = 4
	@ frame_needed = 0, uses_anonymous_args = 0
	stmfd	sp!, {r4, lr}
	sub	sp, sp, #4
	mov	r3, r2
	mov	r4, r1
	mov	r2, sp
	mov	r1, #13
	bl	snd_pcm_hw_param_get(PLT)
	cmp	r0, #0
	ldrge	r3, [sp, #0]
	strge	r3, [r4, #0]
	add	sp, sp, #4
	ldmfd	sp!, {r4, pc}
	.size	__snd_pcm_hw_params_get_period_size,
.-__snd_pcm_hw_params_get_period_size
	.align	2
	.global	__old_snd_pcm_hw_params_get_period_size
	.type	__old_snd_pcm_hw_params_get_period_size, %function
__old_snd_pcm_hw_params_get_period_size:
	@ args = 0, pretend = 0, frame = 4
	@ frame_needed = 0, uses_anonymous_args = 0
	str	lr, [sp, #-4]!
	sub	sp, sp, #4
	mov	r2, r1
	mov	r1, sp
	bl	__snd_pcm_hw_params_get_period_size(PLT)
	mov	r3, #0
	cmp	r0, r3
	ldrge	r3, [sp, #0]
	mov	r0, r3
	add	sp, sp, #4
	ldmfd	sp!, {pc}
	.size	__old_snd_pcm_hw_params_get_period_size,
.-__old_snd_pcm_hw_params_get_period_size

	
And here is the code that calls the lib function:

       sub     r3, fp, #28
       sub     r2, fp, #32
       ldr     r0, [fp, #-40]
       mov     r1, r3
       bl      snd_pcm_hw_params_get_period_size
       mov     r3, r0
       str     r3, [fp, #-20]


Clearly if __old_snd_pwm_hw_params_get_period_size() is called then
'dir' gets 'val's address and the 'val' is some irrelevant data from
the stack.  Calling __snd_pwm_hw_params_get_period_size() directly
should work.

What is __old_snd_pwm_hw_params_get_period_size()  and how do I get rid of it?
What does @ALSA_0.9 mean?

Michel


More information about the Alsa-devel mailing list