public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: "Sebastian Herbszt" <herbszt@gmx.de>
To: "Jan Kiszka" <jan.kiszka@web.de>
Cc: "Volker Ruppert" <info@vruppert.de>,
	"Simon Bienlein" <simon@linux-fuer-blinde.de>,
	<Qemu-devel@nongnu.org>, <kvm@vger.kernel.org>
Subject: Re: [Qemu-devel] Re: Question about KVM and PC speaker
Date: Tue, 12 May 2009 23:06:51 +0200	[thread overview]
Message-ID: <6D825FA2F92349029E0C39C9BC4D72C7@FSCPC> (raw)
In-Reply-To: <4A0925F7.5070806@web.de>

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()
 {


  reply	other threads:[~2009-05-12 21:10 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <49EF69BC.90300@gmx.de>
     [not found] ` <49F01C8D.1010203@web.de>
     [not found]   ` <20090423083252.GB5277@const.bordeaux.inria.fr>
     [not found]     ` <49F031C2.5000204@siemens.com>
     [not found]       ` <20090423092546.GF5277@const.bordeaux.inria.fr>
     [not found]         ` <49F035E7.5080906@siemens.com>
     [not found]           ` <49F03A00.8060502@redhat.com>
2009-04-23 10:29             ` [Qemu-devel] Re: Question about KVM and PC speaker Jan Kiszka
2009-04-23 11:09               ` Avi Kivity
2009-04-23 17:42                 ` Jan Kiszka
2009-05-04 16:34               ` Simon Bienlein
2009-05-04 20:29                 ` Jan Kiszka
2009-05-04 20:56                   ` Samuel Thibault
2009-05-04 21:00                     ` [Qemu-devel] " Jan Kiszka
2009-05-05 15:59                       ` Simon Bienlein
2009-05-05 22:34                         ` Sebastian Herbszt
2009-05-06 10:34                           ` Jan Kiszka
2009-05-06 20:55                             ` Sebastian Herbszt
2009-05-07  8:12                               ` Jan Kiszka
2009-05-09 22:21                                 ` Sebastian Herbszt
2009-05-12  7:32                                   ` Jan Kiszka
2009-05-12 21:06                                     ` Sebastian Herbszt [this message]
2009-05-12 21:50                                       ` Jan Kiszka
2009-05-12 22:21                                         ` Sebastian Herbszt
2009-05-12 22:27                                           ` Samuel Thibault
2009-05-12 22:37                                           ` malc
2009-05-14 19:48                                             ` [Qemu-devel] " Sebastian Herbszt
2009-05-14 22:01                                               ` malc

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6D825FA2F92349029E0C39C9BC4D72C7@FSCPC \
    --to=herbszt@gmx.de \
    --cc=Qemu-devel@nongnu.org \
    --cc=info@vruppert.de \
    --cc=jan.kiszka@web.de \
    --cc=kvm@vger.kernel.org \
    --cc=simon@linux-fuer-blinde.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox