My kernel is making computers make strange buzzing sound

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
xlq
Member
Member
Posts: 36
Joined: Mon Dec 11, 2006 7:51 am

My kernel is making computers make strange buzzing sound

Post 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.
Marionette the flexible kernel
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Re: My kernel is making computers make strange buzzing sound

Post by AJ »

Hi,

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

Cheers,
Adam
xlq
Member
Member
Posts: 36
Joined: Mon Dec 11, 2006 7:51 am

Re: My kernel is making computers make strange buzzing sound

Post 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.
Marionette the flexible kernel
User avatar
kataklinger
Member
Member
Posts: 381
Joined: Fri Nov 04, 2005 12:00 am
Location: Serbia

Re: My kernel is making computers make strange buzzing sound

Post 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 :)
xlq
Member
Member
Posts: 36
Joined: Mon Dec 11, 2006 7:51 am

Re: My kernel is making computers make strange buzzing sound

Post by xlq »

With gcc/binutils/gas, a ';' is the same as a newline.

(Comments are normal C preprocessor comments: // or /* ... */ )
Marionette the flexible kernel
JJeronimo
Member
Member
Posts: 202
Joined: Wed Oct 18, 2006 3:29 pm

Re: My kernel is making computers make strange buzzing sound

Post 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
xlq
Member
Member
Posts: 36
Joined: Mon Dec 11, 2006 7:51 am

Re: My kernel is making computers make strange buzzing sound

Post by xlq »

JJeronimo wrote: Or a sharp symbol "#".
That's for preprocessor directives.
Marionette the flexible kernel
phire
Posts: 4
Joined: Wed Jan 16, 2008 7:25 pm
Location: Christchruch, New Zealand

Re: My kernel is making computers make strange buzzing sound

Post 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.
JJeronimo
Member
Member
Posts: 202
Joined: Wed Oct 18, 2006 3:29 pm

Re: My kernel is making computers make strange buzzing sound

Post 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
User avatar
thepowersgang
Member
Member
Posts: 734
Joined: Tue Dec 25, 2007 6:03 am
Libera.chat IRC: thePowersGang
Location: Perth, Western Australia
Contact:

Re: My kernel is making computers make strange buzzing sound

Post 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.
Kernel Development, It's the brain surgery of programming.
Acess2 OS (c) | Tifflin OS (rust) | mrustc - Rust compiler
Currently Working on: mrustc
iammisc
Member
Member
Posts: 269
Joined: Thu Nov 09, 2006 6:23 pm

Re: My kernel is making computers make strange buzzing sound

Post 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.
User avatar
kmtdk
Member
Member
Posts: 263
Joined: Sat May 17, 2008 4:05 am
Location: Cyperspace, Denmark
Contact:

Re: My kernel is making computers make strange buzzing sound

Post 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
well, what to say, to much to do in too little space.
when it goes up hill, increase work, when it goes straight, test yourself but when going down, slow down.
jal
Member
Member
Posts: 1385
Joined: Wed Oct 31, 2007 9:09 am

Re: My kernel is making computers make strange buzzing sound

Post by jal »

xlq wrote:The PIT is set for approximately 1000 kHz
That's approx. 1MHz. Seems quite fast to me.


JAL
Post Reply