From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Sebastian Herbszt" Subject: Re: [Qemu-devel] Re: Question about KVM and PC speaker Date: Tue, 12 May 2009 23:06:51 +0200 Message-ID: <6D825FA2F92349029E0C39C9BC4D72C7@FSCPC> References: <49EF69BC.90300@gmx.de> <49F01C8D.1010203@web.de> <20090423083252.GB5277@const.bordeaux.inria.fr> <49F031C2.5000204@siemens.com> <20090423092546.GF5277@const.bordeaux.inria.fr> <49F035E7.5080906@siemens.com> <49F03A00.8060502@redhat.com> <49F0430A.8010300@siemens.com> <49FF1919.1030909@gmx.de> <49FF5033.1050402@web.de> <20090504205618.GP5889@const.famille.thibault.fr> <49FF5777.8070704@web.de> <4A006268.6040006@linux-fuer-blinde.de> <3D0ED7CD58CF4D37904670A5A85AE2C7@FSCPC> <4A0167B7.2050200@siemens.com> <4A0297D2.4040009@siemens.com> <4A0925F7.5070806@web.de> Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit Cc: "Volker Ruppert" , "Simon Bienlein" , , To: "Jan Kiszka" Return-path: Received: from mail.gmx.net ([213.165.64.20]:59695 "HELO mail.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1752349AbZELVKH (ORCPT ); Tue, 12 May 2009 17:10:07 -0400 In-Reply-To: <4A0925F7.5070806@web.de> Sender: kvm-owner@vger.kernel.org List-ID: Jan Kiszka wrote: >> I have implemented the beep for vgabios-6b and it works on bochs but >> fails on qemu. >> With "-soundhw pcspk" i should hear it thru the hosts pc speaker, right? > > Yep, that's how it should work. Mind to share your code and tell us > which test case you used? FreeDOS floppy with "debug" command and assembly code: mov ax,0e07 xor bx,bx int 10 With the modified vgabios (see below) it does beep on bochs on vista, but not on qemu. - Sebastian --- vgabios.c.orig 2009-05-12 22:24:22.000000000 +0200 +++ vgabios.c 2009-05-12 22:24:32.000000000 +0200 @@ -80,6 +80,9 @@ static void memcpyb(); static void memcpyw(); +static void delay_ticks(); +static void beep(); + static void biosfn_set_video_mode(); static void biosfn_set_cursor_shape(); static void biosfn_set_cursor_pos(); @@ -1965,7 +1968,7 @@ switch(car) { case 7: - //FIXME should beep + beep(); break; case 8: @@ -3765,6 +3768,57 @@ ASM_END } + void +delay_ticks(ticks) + Bit16u ticks; +{ +ASM_START + pusha + push ds + xor dx,dx + mov ds,dx + mov cx,4[bp] + add cx,0x46c + adc dx,0x46e + sti +delay_ticks_wait: + hlt + mov ax,0x46c + mov bx,0x46e + cmp dx,bx + jb delay_ticks_out + cmp cx,ax + ja delay_ticks_wait +delay_ticks_out: + pop ds + popa +ASM_END +} + +void beep() +{ +ASM_START + pusha + mov al,#0xb6 + out #0x43,al + mov al,#0x33 + out #0x42,al + mov al,#0x5 + out #0x42,al + in al,#0x61 + push ax + or al,#0x03 + out #0x61,al + mov cx,#0x4 + push cx + call _delay_ticks + pop cx + pop ax + out #0x61,al + popa +ASM_END +} + #ifdef DEBUG void unimplemented() {