From patchwork Tue May 12 21:06:51 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Herbszt X-Patchwork-Id: 23348 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n4CLAD13025189 for ; Tue, 12 May 2009 21:10:13 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752433AbZELVKJ (ORCPT ); Tue, 12 May 2009 17:10:09 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752724AbZELVKJ (ORCPT ); Tue, 12 May 2009 17:10:09 -0400 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 Received: (qmail invoked by alias); 12 May 2009 21:10:07 -0000 Received: from p54BD0583.dip0.t-ipconnect.de (HELO FSCPC) [84.189.5.131] by mail.gmx.net (mp048) with SMTP; 12 May 2009 23:10:07 +0200 X-Authenticated: #310364 X-Provags-ID: V01U2FsdGVkX18jU8NomhAj60cjGVyEdCAeN6McFQMcxfDeGyhuc9 mkAmJGP4N347u6 Message-ID: <6D825FA2F92349029E0C39C9BC4D72C7@FSCPC> From: "Sebastian Herbszt" To: "Jan Kiszka" Cc: "Volker Ruppert" , "Simon Bienlein" , , 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> In-Reply-To: <4A0925F7.5070806@web.de> Subject: Re: [Qemu-devel] Re: Question about KVM and PC speaker Date: Tue, 12 May 2009 23:06:51 +0200 MIME-Version: 1.0 X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Windows Mail 6.0.6000.16480 X-MimeOLE: Produced By Microsoft MimeOLE V6.0.6000.16669 X-Y-GMX-Trusted: 0 X-FuHaFi: 0.45 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org 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 --- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- 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() {