Page 1 of 1

My kernel is making computers make strange buzzing sound

Posted: Sun Jul 27, 2008 2:41 pm
by xlq
My kernel can now run on real hardware. All it does at the moment is read keyboard input and print it to the text-mode console, and out COM1 if present.

Strange thing is, when it's running, the computer emits a strange buzzing sound, (It is *not* the PC speaker), almost like a series of fast clicks. This is slightly disturbing.

The PIT is set for approximately 1000 kHz, and fires an interrupt on every tick. The isr increments a counter, checks for things to do and then usually returns.

Also, I have an idle loop running, most of the time, that looks like this:

Code: Select all

while (some_variable != some_value)
{
    asm volatile ("pushf ; sti ; hlt ; popf");
}
Might this have something to do with this odd sound?

The code is available at ShareSource. Check out and build with:

Code: Select all

$ hg clone http://hg.sharesource.org/marionette
$ scons --help # look at build options
$ scons
The kernel image ("cohbos") is a flat-binary multiboot image.
If you don't have Mercurial, use this link.

Re: My kernel is making computers make strange buzzing sound

Posted: Mon Jul 28, 2008 1:34 am
by AJ
Hi,

Are you spinning down all drives after boot? The clicking could be coming from the FDD.

Cheers,
Adam

Re: My kernel is making computers make strange buzzing sound

Posted: Mon Jul 28, 2008 5:10 am
by xlq
I'm not using the drives at all, so if GRUB leaves them spinning, they'll remain spinning. Not sure about the FDD though. The FDD light didn't come on.

Re: My kernel is making computers make strange buzzing sound

Posted: Sun Aug 03, 2008 3:01 am
by kataklinger
I'm not familiar with GCC inline assembly but you use ; in your inline code which marks beginning of the comment in normal assembly. So I guess that the compiler emits only pushf instruction and ignores the rest of inline code and you end up with endless loop which heats CPU and then the fan start spinning faster to cool down CPU producing strange buzzing. Or maybe I'm completely wrong :)

Re: My kernel is making computers make strange buzzing sound

Posted: Sun Aug 03, 2008 3:12 am
by xlq
With gcc/binutils/gas, a ';' is the same as a newline.

(Comments are normal C preprocessor comments: // or /* ... */ )

Re: My kernel is making computers make strange buzzing sound

Posted: Sun Aug 03, 2008 7:44 pm
by JJeronimo
xlq wrote:With gcc/binutils/gas, a ';' is the same as a newline.

(Comments are normal C preprocessor comments: // or /* ... */ )
Or a sharp symbol "#".

JJ

Re: My kernel is making computers make strange buzzing sound

Posted: Mon Aug 04, 2008 4:44 am
by xlq
JJeronimo wrote: Or a sharp symbol "#".
That's for preprocessor directives.

Re: My kernel is making computers make strange buzzing sound

Posted: Mon Aug 04, 2008 11:49 pm
by phire
I had similar issue with an old laptop I was taking apart. (Celeron 300-a I think)
I removed the fan so it would completely silent. And all through the BIOS code it was, but the second the Linux kernel was loaded, there would be a reasonably loud buzzing noise (but quiter than a fan would be.) my guess would be that the sound was around the 200Hz frequency.

I never got around to digging around for the source of the problem, but I assumed it would either be the cpu vibrating, or the power conversion circuitry.

Re: My kernel is making computers make strange buzzing sound

Posted: Wed Jan 21, 2009 7:11 am
by JJeronimo
xlq wrote:
JJeronimo wrote: Or a sharp symbol "#".
That's for preprocessor directives.
Yes it is. And that token marks the beginning of a single-line comment.
3.1 Preprocessing
The as internal preprocessor:
(...)
• removes all comments, replacing them with a single space, or an appropriate number
of newlines.
(...)
3.3 Comments
(...)
Anything from the line comment character to the next newline is considered a comment
and is ignored. The line comment character is ‘;’ for the AMD 29K family; ‘;’ on the ARC;
‘@’ on the ARM; ‘;’ for the H8/300 family; ‘!’ for the H8/500 family; ‘;’ for the HPPA; ‘#’
on the i386 and x86-64;
‘#’ on the i960; ‘;’ for the PDP-11; ‘;’ for picoJava; ‘#’ for Motorola
PowerPC; ‘!’ for the Renesas / SuperH SH; ‘!’ on the SPARC; ‘#’ on the ip2k; ‘#’ on the
m32r; ‘|’ on the 680x0; ‘#’ on the 68HC11 and 68HC12; ‘;’ on the M880x0; ‘#’ on the
Vax; ‘!’ for the Z8000; ‘#’ on the V850; ‘#’ for Xtensa systems.
JJ

Re: My kernel is making computers make strange buzzing sound

Posted: Wed Jan 21, 2009 8:05 am
by thepowersgang
For the GNU assembler # is used as a pre-processor directive as it is passed through the c pre-processor.
Personally I think that most things about GAS are completely backwards.

Re: My kernel is making computers make strange buzzing sound

Posted: Thu Jan 22, 2009 10:43 pm
by iammisc
Are you directly probing memory? Are you sure your kernel is not overwriting something somewhere in memory?

Clicking sounds could be caused not only be drives but also by your kernel writing spurious values to the sound card or to acpi things that control the fan, etc. From your post, it also seems that you only tried the kernel on one computer. If you can, try another too.

Re: My kernel is making computers make strange buzzing sound

Posted: Fri Jan 23, 2009 2:09 am
by kmtdk
well
knowing that some computers have "inbuild" speakers ( bad qualyty,), and that the secound chanell of the timer chip is connected to the "speakers" but this might have been to the "inside" speaker. SO if this is the case, you are using a "speaker chanel", witch works.

but a solution is this:
make a "program" view the fans ( speed), the temp of the cpu. and then chek what chanels you are using ( timer chip).
If that does not help
then try to make a program to "stop" the computers multitasking, make the computer run a "powersaving" loop(forever), and then listen if the sound countiues or if it stops, if it stops = you code, if not, then it (with most chance) is the hardware.

KMT dk

Re: My kernel is making computers make strange buzzing sound

Posted: Fri Jan 23, 2009 5:37 am
by jal
xlq wrote:The PIT is set for approximately 1000 kHz
That's approx. 1MHz. Seems quite fast to me.


JAL