LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-23-2005, 01:57 AM   #1
rhoyerboat
Member
 
Registered: Feb 2005
Posts: 40

Rep: Reputation: 15
readw(port, int)


Im working on my -old- sound card drivers. Its neomagic 256AV where a sound buffer is located in the video memory and it crashes X when the audio is played while the video memory is being
utilized.

the compiler tells me (Improver lvalue in assignment (var) variable in <expression>) on lines
of code which call readb, readw, or readl from pci/io.h .. what boggles me about it is the variable
which must be passed to these functions, the "offset" is declared as "int offset" in each
nm256_readx prototype. This unrestricted variable will assume the address of some crucial
video memory segment and crash a large portion, but not all, of the system. Ive isolated the bugger with a "if (&offset >= buffer_top); { printk("Doing it again!\n") }" line inserted before
the prototype returns, when i load the module it goes "doing it again!/ndoing it again!" a certain number of times before continuing, only four different addresses are returned if i make it print the offset where the overflow is occuring. on one boot it returns two addresses, two at A then two at B then two at A then two at B .. however many times im not sure yet. I cant remember how to make it print hex values but i dont think thats so important. I need to keep it from growing into that region of memory, but im not sure how to do that, (psuedocode) if buffer_top-&offset==
range->getting_smaller;{reset_buffer(buffer)} ?? *shrug*

when i run the sound card in X the printk runs too, but the XMMS program and the sound drivers crash. not that i care about X so much but i need to do something so this is what im doing.

and if anyone has a hint as to what the nm256_coefficients table is for it might prove to be enlightening for me.. anyway anything someone has to say will be appreciated greatly
appreciated.

pax
andrew
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to use the scanf( ) int C ? naihe2010 Programming 7 11-30-2005 02:35 AM
invalid types int[int] for array subscript scuzzman Programming 2 11-16-2004 09:34 PM
Strings and int? kalleanka Programming 12 02-10-2004 04:34 AM
string to int in C h/w Programming 2 12-05-2003 03:47 PM
int main() gurra Programming 1 02-02-2002 06:28 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:53 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration