Index: stable/4/contrib/libstdc++/sstream =================================================================== --- stable/4/contrib/libstdc++/sstream (nonexistent) +++ stable/4/contrib/libstdc++/sstream (revision 60994) @@ -0,0 +1,225 @@ +/* This is part of libio/iostream, providing -*- C++ -*- input/output. +Copyright (C) 2000 Free Software Foundation + +This file is part of the GNU IO Library. This library is free +software; you can redistribute it and/or modify it under the +terms of the GNU General Public License as published by the +Free Software Foundation; either version 2, or (at your option) +any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this library; see the file COPYING. If not, write to the Free +Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +As a special exception, if you link this library with files +compiled with a GNU compiler to produce an executable, this does not cause +the resulting executable to be covered by the GNU General Public License. +This exception does not however invalidate any other reasons why +the executable file might be covered by the GNU General Public License. */ + +/* Written by Magnus Fromreide (magfr@lysator.liu.se). */ + +#ifndef __SSTREAM__ +#define __SSTREAM__ + +#include +#include +#include + +namespace std +{ + class stringbuf : public streambuf + { + public: + typedef char char_type; + typedef int int_type; + typedef streampos pos_type; + typedef streamoff off_type; + + explicit stringbuf(int which=ios::in|ios::out) : + streambuf(which), buf(), mode(static_cast(which)), + rpos(0), bufsize(1) + { } + + explicit stringbuf(const std::string &s, int which=ios::in|ios::out) : + streambuf(which), buf(s), mode(static_cast(which)), + bufsize(1) + { + if(mode & ios::in) + { + setg(&defbuf, &defbuf + bufsize, &defbuf + bufsize); + } + if(mode & ios::out) + { + setp(&defbuf, &defbuf + bufsize); + } + rpos = (mode & ios::ate ? s.size() : 0); + } + + std::string str() const + { + const_cast(this)->sync(); // Sigh, really ugly hack + return buf; + }; + + void str(const std::string& s) + { + buf = s; + if(mode & ios::in) + { + gbump(egptr() - gptr()); + } + if(mode & ios::out) + { + pbump(pbase() - pptr()); + } + rpos = (mode & ios::ate ? s.size() : 0); + } + + protected: + inline virtual int sync(); + inline virtual int overflow(int = EOF); + inline virtual int underflow(); + private: + std::string buf; + ios::open_mode mode; + std::string::size_type rpos; + streamsize bufsize; + char defbuf; + }; + + class stringstreambase : virtual public ios { + protected: + stringbuf __my_sb; + public: + std::string str() const + { + return dynamic_cast(_strbuf)->str(); + } + void str(const std::string& s) + { + clear(); + dynamic_cast(_strbuf)->str(s); + } + + stringbuf* rdbuf() + { + return &__my_sb; + } + protected: + stringstreambase(int which) : + __my_sb(which) + { + init (&__my_sb); + } + + stringstreambase(const std::string& s, int which) : + __my_sb(s, which) + { + init (&__my_sb); + } + }; + + class istringstream : public stringstreambase, public istream { + public: + istringstream(int which=ios::in) : + stringstreambase(which) + { } + + istringstream(const std::string& s, int which=ios::in) : + stringstreambase(s, which) + { } + }; + + class ostringstream : public stringstreambase, public ostream { + public: + ostringstream(int which=ios::out) : + stringstreambase(which) + { } + + ostringstream(const std::string& s, int which=ios::out) : + stringstreambase(s, which) + { } + }; + + class stringstream : public stringstreambase, public iostream { + public: + stringstream(int which=ios::in|ios::out) : + stringstreambase(which) + { } + + stringstream(const std::string &s, int which=ios::in|ios::out) : + stringstreambase(s, which) + { } + }; +} + +inline int std::stringbuf::sync() +{ + if((mode & ios::out) == 0) + return EOF; + + streamsize n = pptr() - pbase(); + if(n) + { + buf.replace(rpos, std::string::npos, pbase(), n); + if(buf.size() - rpos != n) + return EOF; + rpos += n; + pbump(-n); + gbump(egptr() - gptr()); + } + return 0; +} + +inline int std::stringbuf::overflow(int ch) +{ + if((mode & ios::out) == 0) + return EOF; + + streamsize n = pptr() - pbase(); + + if(n && sync()) + return EOF; + + if(ch != EOF) + { + std::string::size_type oldSize = buf.size(); + + buf.replace(rpos, std::string::npos, ch); + if(buf.size() - oldSize != 1) + return EOF; + ++rpos; + } + return 0; +} + +inline int std::stringbuf::underflow() +{ + sync(); + if((mode & ios::in) == 0) + { + return EOF; + } + if(rpos >= buf.size()) + { + return EOF; + } + + std::string::size_type n = egptr() - eback(); + std::string::size_type s; + + s = buf.copy(eback(), n, rpos); + pbump(pbase() - pptr()); + gbump(eback() - gptr()); + int res = (0377 & buf[rpos]); + rpos += s; + return res; +} + +#endif /* not __STRSTREAM__ */ Property changes on: stable/4/contrib/libstdc++/sstream ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Index: stable/4/games/fortune/datfiles/murphy =================================================================== --- stable/4/games/fortune/datfiles/murphy (nonexistent) +++ stable/4/games/fortune/datfiles/murphy (revision 60994) @@ -0,0 +1,2350 @@ +%%$FreeBSD$ +When things are going well, someone will inevitably +experiment detrimentally. +% +If not controlled, work will flow to the competent +man until he submerges. +% +The deficiency will never show itself during the test runs. +% +The lagging activity in a project will invariably be found +in the area where the highest overtime rates lie waiting. +% +It is impossible to build a fool proof system; +because fools are so ingenious. +% +Talent in staff work or sales will continually be +interpreted as managerial ability. +% +Information travels more surely to those with a +lesser need to know. +% +The "think positive" leader tends to listen to his +subordinate's premonitions only during the postmortems. +% +An original idea can never emerge from committee +in its original form. +% +No good deed goes unpunished. +% +When the product is destined to fail, the delivery system +will perform perfectly. +% +Clearly stated instructions will consistently produce +multiple interpretations. +% +The crucial memorandum will be snared in the out-basket by +the paper clip of the overlying memo and go to file. +% +On successive charts of the same organization, the number of +boxes will never decrease. +% +It is ok to be ignorant in some areas, +but some people abuse the privilege. +% +Everyone breaks more than the seven-year-bad-luck allotment +to cover rotten luck throughout an entire lifetime. +% +Success can be insured only by devising a defense against +failure of the contingency plan. +% +Adding manpower to a late software product makes it later. +% +Performance is directly affected by the perversity of +inanimate objects. +% +Leakproof seals --- will. +% +Never offend people with style +when you can offend them with substance. +% +Our customers' paperwork is profit. +Our own paperwork is loss. +% +At any level of traffic, any delay is intolerable. +% +As the economy gets better, everything else gets worse. +% +This space for rent. +% +The more directives you issue to solve a problem, +the worse it gets. +% +Cop-out number 1. +You should have seen it when I got it. +% +When you're up to your ass in alligators, it is +difficult to keep your mind on the fact that your primary +objective was to drain the swamp. +% +The road to hell is paved with good intentions +and littered with sloppy analyses! +% +Self starters --- won't. +% +If the assumptions are wrong, +the conclusions aren't likely to be very good. +% +The organization of any program reflects the organization +of the people who developed it. +% +There is no such thng as a "dirty capitalist", +only a capitalist. +% +Anything is possible, but nothing is easy. +% +The meek will inherit the earth +after the rest of us go to the stars. +% +Capitalism can exist in one of only two states: +welfare or warfare. +% +History proves nothing. +% +A lot of what appears to be progress is just so much +technological roccoco. +% +A little humility is arrogance. +% +Interchangeable parts --- won't. +% +Any time you wish to demonstrate something, the number of +faults is proportional to the number of viewers. +% +All American cars are basically Chevrolets. +% +A coup that is known in advance is a coup that does not +take place. +% +No experiment is ever a complete failure. +It can always be used as a bad example. +% +Despite the sign that says "wet paint", +please don't. +% +Everything tastes more or less like chicken. +% +People don't change; they only become more so. +% +I finally got it all together... +but I forgot where I put it. +% +If your next pot of chili tastes better, it probably is +because of something left out, rather than added. +% +There is always one more bug. +% +The big guys always win. +% +Nothing is ever accomplished by a reasonable man. +% +Any sufficiently advanced technology is +indistinguishable from magic. +% +It's always darkest just before the lights go out. +% +It is better to be part of the idle rich class +than be part of the idle poor class. +% +Each problem solved introduces a new unsolved problem. +% +For every credibility gap there is a gullibility fill. +% +If you have something to do, and you put it off long enough +chances are someone else will do it for you. +% +Everybody's gotta be someplace. +% +Nature is a mother. +% +If you've got them by the balls, +their hearts and minds will follow. +% +People will accept your idea much more readily if you tell +them Benjamin Franklin said it first. +% +If at first you don't succeed, transform your dataset. +% +Any given program, when running, is obsolete. +% +Any given program cost more and take longer. +% +If a program is useful, it will be changed. +% +If a program is useless, it will be documented. +% +Any given program will expand to fill all available memory. +% +The value of a program is proportional +to the weight of its output. +% +Don't mess with Mrs. Murphy! +% +Program complexity grows until it exceeds the capability +of the programmer who must maintain it. +% +Make it possible for programmers to write programs +in english and you will find that programmers cannot +write in english. +% +When more and more people are thrown out of work, +unemployment results. +% +If you can't measure it, I'm not interested. +% +The best way to lie is to tell the truth..... +carefully edited truth. +% +There are three ways to get things done: + (1) Do it yourself, + (2) Hire someone to do it, or + (3) Forbid your kids to do it. +% +I think ... therefore I am confused. +% +A fail-safe circuit will destroy others. +% +History repeats itself. +that's one of the things wrong with history. +% +90% of everything is crud. +% +Nature will tell you a direct lie if she can. +% +Those with the best advice offer no advice. +% +Speak softly and own a big, mean doberman. +% +Democracy is that form of government where +everybody gets what the majority deserves. +% +If you're worried about being crazy, +don't be overly concerned: +If you were, you would think you were sane. +% +Pills to be taken in twos always come +out of the bottle in threes. +% +Flynn is dead +Tron is dead +long live the MCP. +% +Why worry about tomorrow? We may not make it through today! +% +Real programmers don't number paragraph names +consecutively. +% +If you're feeling good, don't worry, +you'll get over it. +% +Real programmers don't grumble about the disadvantages +of Cobol when they don't know any other language. +% +Definition of an elephant: +A mouse built to goverment specifications. +% +Real programmers are kind to rookies. +% +Real programmers don't notch their desks for each +completed service request. +% +You don't have to be crazy to work here +but it sure helps!!!!!!! +% +Real programmers don't announce how many times the +operations department called them last night. +% +A day without sunshine .... +is like ... night! +% +Real programmers are secure enough to write readable code, +which they then self-righteously refuse to explain. +% +Real programmers don't play video games, they write them. +% +Anything that can go wrong, will go wrong. +% +Real programmers understand Pascal. +% +Real programmers know it's not operations' +fault if their jobs go into "hogs". +% +Real programmers do not eat breakfast from the +vending machines. +% +Real programmers punch up their own programs. +% +When life hands you a lemon, make lemonade. +% +Real programmers have read the standards manual +but won't admit it. +% +Real programmers don't advertise their hangovers. +% +Real programmers don't dress for success unless +they are trying to convince others that they are +going on interviews. +% +Real programmers do not practice four-syllable words before +walkthroughs. +% +All warranties expire upon payment of invoice. +% +Real programmers argue with the systems analyst as a +matter of principle. +% +The final test is when it goes production ... +w h e n i t g o e s p r o d u c t i o n ... +w h e n i t g o e s p r o d u c t +w h e n i t g o e s p r o +% +Real programmers drink too much coffee so that they will +always seem tense and overworked. +% +Real programmers always have a better idea. +% +Anyone who follows a crowd will +never be followed by a crowd. +% +Real programmers can do octal, hexadecimal and +binary math in their heads. +% +Real programmers don't write memos. +% +Real programmers know what saad means. +% +Real programmers do not utter profanities at an elevated +decible level. +% +Where you stand on an issue depends on where you sit. +% +Real programmers do not apply DP terminology to non-DP +situations. +% +I no longer get lost in the shuffle.... +I shuffle along with the lost. +% +Real programmers do not read books like +"effective listening" and "communication skills". +% +Real programmers print only clean compiles, +fixing all errors through the terminal. +% +The early worm deserves the bird. +% +Lead, follow, or get the hell out of the way!! +% +All good things must come to an end. +I want to know when they start! +% +A diplomat is someone who can tell you to go to hell +in such a way that you look forward to the trip. +% +Blessed are those who go around in circles, +for they shall be known as wheels. +% +Never eat prunes when you are famished. +% +Keep emotionally active, +cater to your favorite neurosis. +% +A RACF protected dataset is inaccessible. +% +RACF is a four letter word. +% +You may be recognized soon. +Hide! +If they find you, lie. +% +You can pray hard enough to make water run uphill +how hard? +Hard enough to make water run uphill. +% +Avoid reality at all costs. +% +Program design philosophy: + + Start at the beginning and continue until the end, + then stop. + -- Lewis Carroll +% +A closed mouth gathers no foot. +% +Only a mediocre person is always at their best. +% +Friends come and go, but enemies accumulate. +% +In a hierarchical organization, the higher the level, +the greater the confusion. +% +The first time is for love. +The next time is $200. +% +Of two possible events, +only the undesired one will occur. +% +The faster the plane, +the narrower the seats. +% +If you have to ask, you are not entitled to know. +% +If on an actuarial basis there is a 50 50 chance that +something will go wrong, +It will actually go wrong nine times out of ten. +% +A man of quality does not fear a woman seeking equality. +% +The first rule of intelligent tinkering is to +save all of the parts. +% +1) Things will get worse before they get better. +2) Who said things would get better? +% +If you try to please everybody, nobody will like it. +% +There is a solution to every problem; +the only difficulty is finding it. +% +Don't make your doctor your heir. +% +Don't ask the barber if you need a haircut. +% +If there isn't a law, there will be. +% +If you don't like the answer, +you shouldn't have asked the question. +% +Do not believe in miracles -- rely on them. +% +You can't expect to hit the jackpot +if you don't put a few nickles in the machine. +% +Unless you intend to kill him immediately; never kick a man +in the balls, not even symbolically or perhaps especially +not symbolically. +% +Freud's 23rd law: ideas endure and prosper in inverse +proportion to their soundness and validity. +% +A short cut is the longest distance between two points. +% +If you want to make an enemy, do someone a favor. +% +If you know, you can't say. +% +The meek shall inherit the earth, +but not its mineral rights. +% +1) You can't win +2) You can't break even +3) You can't even quit the game +% +When eating an elephant take one bite at a time. +% +Common sense is not so common. +% +If we learn by our mistakes, +I'm getting one hell of an education!! +% +Fuzzy project objectives are used to avoid the +embarrassment of estimating the corresponding costs. +% +Usefulness is inversely proportional to its reputation +for being useful. +% +You will always find something in the last place you look. +% +The probability of anything happening is in +inverse ratio to its desirability. +% +The first myth of management is that it exists +the second myth of management is that success equals skill. +% +If it's good they will stop making it. +% +Inside every large program +is a small program struggling to get out. +% +A memorandum is written not to inform the reader +but to protect the writer. +% +Never insult an alligator +until after you have crossed the river. +% +Anything hit with a big enough hammer will fall apart. +% +When your opponent is down, kick him. +% +The man who can smile when things go wrong has thought of +someone he can blame it on. +% +The chance of a piece of bread falling with the buttered +side down is directly proportional to the cost of the +carpet. +% +In the fight between you and the world, back the world. +% +Last guys don't finish nice. +% +Never admit anything. +Never regret anything +whatever it is, your not responsible. +% +If you have always done it that way, it is probably wrong. +% +When working toward the solution of a problem, +it always helps if you know the answer. +Provided of course you know there is a problem. +% +The usefulness of any meeting +is in inverse proportion to the attendance. +% +The sun goes down just when you need it the most. +% +Pure drivel tends to drive ordinary +drivel off the tv screen. +% +Whatever creates the greatest inconvenience for the largest +number must happen. +% +No matter how long or hard you shop for an item, after +you have bought it, it will be on sale somewhere cheaper. +% +Sanity and insanity overlap a fine gray line. +% +A disagreeable task is its own reward. +% +If things were left to chance, they'd be better. +% +The phone will not ring until you leave your desk and walk +to the other end of the building. +% +Anybody can win - unless there happens to be a second entry. +% +A president of a democracy is a man who is always ready, +willing, and able to lay down your life for his country. +% +If a thing is done wrong ofter enough +it becomes right. +% +People will buy anything that is one to a customer. +% +If you just try long enough and hard enough, you can always +manage to boot yourself in the posterior. +% +No one's life, liberty, or property are safe +while the legislature is in session. +% +Never say "oops" after you have submitted a job. +% +Bad news drives good news out of the media. +% +Just when you get really good at something, +you don't need to do it anymore. +% +If facts do not conform to the theory, +they must be disposed of. +% +Almost anything is easier to get into than out of. +% +When properly administered, vacations do not diminish +productivity. For every week you are away and get nothing +done, there is another week when your boss is away and you +get twice as much done. +% +No matter what happens, there is always somebody +who knew that it would. +% +The other line always moves faster. +% +Never eat at a place called moms, never play cards with a +man named doc, and never lie down with a woman who has +got more troubles than you. +% +To get a loan, you must first prove you don't need it. +% +When all else fails, read the instructions. +% +Anything you try to fix will take longer and cost more than +you thought. +% +"Close" only counts in horseshoes, handgrenades and +thermonuclear devices. +% +The lion and the calf shall lie down together, +but the calf won't get much sleep. +% +If you fool around with a thing for very long you will +screw it up. +% +It is better for civilization to be going down the drain, +than to be coming up it. +% +A $300.00 picture tube will protect a 10› fuse by blowing +first. +% +Justice always prevails... +three times out of seven. +% +If it jams --- force it. If it breaks, +it needed replacing anyway. +% +I have yet to see any problem, however complicated, which, +when you looked at it in the right way, did not become +still more complicated. + -- Poul Anderson +% +Any tool dropped while repairing a car will roll underneath +to the exact center. +% +No matter which direction you start, +it's always against the wind coming back. +% +The repairman will never have seen a model quite like +yours before. +% +Don't force it, +get a bigger hammer. +% +When a broken appliance is demonstrated for the repairman, +it will work perfectly. +% +Pity the poor egg; +It only gets laid once in its life. +% +An optimist is a person who looks forward to marriage. +A pessimist is a married optimist! +% +A pessimist is an optimist with experience. +% +Old programmers never die - they just abend. +% +The success of any venture will be helped by prayer, +even in the wrong denomination. +% +Just about the time when you think you can make ends meet +somebody moves the ends! +% +Just because you are paranoid +doesn't mean "they" aren't out to get you. +% +An Irishman is not drunk as long as +he can hang onto a single blade of grass +and not fall off the face of the earth. +% +If an experiment works, you must be using the wrong +equipment. +% +Some come to the fountain of knowledge to drink, +some prefer to just gargle. +% +Everything is revealed to he who turns over enough stones. +(Including the snakes that he did not want to find.) +% +Everybody should believe in something; +I believe I'll have another drink. +% +Those whose approval you seek the most give you the least. +% +Build a system that even a fool can use, +and only a fool will use it. +% +Everyone has a scheme for getting rich that will not work. +% +It's always the wrong time of the month. +% +In any hierarchy, each individual rises to his own level +of incompetence, and then remains there. +% +It does not matter if you fall down as long as you pick +up something from the floor while you get up. +% +You will remember that you forgot to take out the trash +when the garbage truck is two doors away. +% +Misery no longer loves company +nowdays it insists on it. +% +The race is not always to the swift nor the battle to the +strong, but that's the way to bet. +% +Some of it plus the rest of it is all of it. +% +There's never time to do it right, but there's always +time to do it over. +% +On a beautiful day like this it's hard to believe anyone +can be unhappy -- but we will work on it. +% +When in doubt, mumble. When in trouble, delegate. +% +The more ridiculous a belief system, +the higher probability of its success. +% +Anything good in life is either illegal, immoral or +fattening. +% +Old age is always fifteen years older than I am. +% +It is morally wrong to allow suckers to keep their money. +% +A bird in hand is safer than one overhead. +% +The ratio of time involved in work to time available for +work is usually about 0.6 +% +Remember the golden rule: +Those that have the gold make the rules. +% +Blessed is he who has reached the point of no return and +knows it for he shall enjoy living. +% +Everything east of the San Andreas fault will evenutally +plunge into the Atlantic ocean. +% +I finally got it all together ... +but I forgot where I put it. +% +Nature always sides with the hidden flaw. +% +Blessed is he who expects no gratitude, +for he shall not be disappointed. +% +The light at the end of the tunnel is the headlamp of +an oncoming train. +% +Celibacy is not hereditary. +% +You can observe a lot just by watching. +% +If it can be borrowed and it can be broken, +you will borrow it and +you will break it. +% +Live within your income, +even if you have to borrow to do so. +% +Beauty is only skin deep, ugly goes clear to the bone. +% +Never go to a doctor whose office plants have died. +% +To know yourself is the ultimate form of aggression. +% +An ounce of application is worth a ton of abstraction. +% +Never play leapfrog with a unicorn. +% +A bird in the hand is dead. +% +A Smith and Wesson beats four aces. +% +Never put all your eggs in your pocket. +% +If everything seems to be going well, +you obviously don't know what the hell is going on. +% +If at first you don't succeed, +blame it on your supervisor. +% +If more than one person is responsible for a +miscalculation, no one will be at fault. +% +Don't bite the hand that has your pay check in it. +% +In case of doubt, make it sound convincing. +% +When in doubt, mumble. +When in trouble, delegate. +When in charge, ponder. +% +Please don't steal, the IRS hates competition! +% +Never argue with a fool, +people might not know the difference. +% +You can't guard against the arbitrary. +% +People can be divided into three groups: +Those who make things happen, +Those who watch things happen and +Those who wonder what happened. +% +I no longer get lost in the shuffle, +I shuffle along with the lost. +% +The one thing that money can not buy is poverty. +% +You are not drunk if you can lay on the floor without +holding on. +% +In any household, junk accumulates to the the space +available for its storage. +% +Don't stop to stomp on ants +when the elephants are stampeding. +% +The longer the title the less important the job. +% +Any improbable event which would create maximum confusion +if it did occur, will occur. +% +When you are right be logical, +when you are wrong be-fuddle. +% +For every human problem, there is a neat, plain solution -- +and it is always wrong. +% +There are no winners in life: Only survivors. +% +When they want it bad (in a rush), they get it bad. +% +The yoo-hoo you yoo-hoo into the forest is the yoo-hoo you +get back. +% +You can't tell how deep a puddle is until you step into it. +% +The idea is to die young as late as possible. +% +No man is lonely while eating spaghetti. +% +It's better to retire too soon than too late. +% +A man should be greater than some of his parts. +% +If you don't say it, they can't repeat it. +% +Nothing is ever as simple as it seems. +% +Everything takes longer than you expect. +% +Left to themselves, all things go from bad to worse. +% +If you see that there are four possible ways in which a +procedure can go wrong, and circumvent these, then a +fifth way, unprepared for, will promptly develop. +% +Things get worse under pressure. +% +Persons disagreeing with your facts are always emotional +and employ faulty reasoning. +% +A consultant is an ordinary person a long way from home. +% +Progress is made on alternate Fridays. +% +The first 90 percent of the task takes 90 percent of the +time, the last 10 percent takes the other 90 percent. +% +If two wrongs don't make a right, try three. +% +Don't look back, something may be gaining on you. +% +All things being equal, all things are never equal. +% +Even paranoids have enemies. +% +Incompetence knows no barriers of time or place. +% +Work is accomplished by those employees who have not yet +reached their level of incompetence. +% +If at first you don't succeed, try something else. +% +If you're coasting, you're going downhill. +% +Never tell them what you wouldn't do. +% +The amount of flak received on any subject is inversely +proportional to the subject's true value. +% +Indifference is the only sure defense. +% +Whatever hits the fan will not be evenly distributed. +% +Never needlessly disturb a thing at rest. +% +If you want to get along, go along. +% +Everything happens at the same time with nothing in between. +% +The easiest way to find something lost around the house +is to buy a replacement. +% +Bare feet magnetize sharp metal objects so they always +point upward from the floor -- especially in the dark. +% +Make three correct guesses consectively and you will +establish yourself as an expert. +% +It works better if you plug it in. +% +Quit while your still behind. +% +If you plan to leave your mark in the sands of time, +you better wear work shoes. +% +It's always easier to go down hill, but the view is +from the top. +% +Any line, however short, is still too long. +% +Laziness is the mother of nine inventions out of ten. +% +If you can't measure output then you measure input. +% +Any theory can be made to fit any facts by means of +approximate, additional assumptions. +% +Never be first to do anything. +% +The chief cause of problems is solutions. +% +The only winner in the war of 1812 was Tchaikovsky. +% +A little ignorance can go a long way. +% +Learn to be sincere. Even if you have to fake it. +% +Entropy has us outnumbered. +% +Everything put together sooner or later falls apart. +% +Do whatever your enemies don't want you to do. +% +A little ambiguity never hurt anyone. +% +Don't permit yourself to get between a dog and a lamppost. +% +Go where the money is. +% +Work may be the crabgrass of life, but money is still the +water that keeps it green. +% +A stagnant science is at a standstill. +% +Half of being smart is knowing what you're dumb at. +% +For every credibility gap there is a gullibility gap. +% +Can't produces countercan't. +% +If you see a man approaching you with the obvious intent +of doing you good, you should run for your life. +% +When you are sure you're right, you have a moral duty +to impose your will upon anyone who disagrees with you. +% +If you can't convince them, confuse them. +% +Assumption is the mother of all foul-ups. +% +All general statements are false. (Think about it.) +% +If it happens, it must be possible. +% +Them what gets--has. +% +If you are already in a hole, there's no use to continue +digging. +% +If builders built buildings the way programmers wrote +programs, then the first woddpecker that came along would +destroy civilization. +% +People will believe anything if you whisper it. +% +A pat on the back is only a few inches from a kick +in the pants. +% +Never leave hold of what you've got until you've got hold +of something else. +% +A theory is better than its explanation. +% +Eat a live toad the first thing in the morning and nothing +worse will happen to you the rest of the day. +% +Nobody notices when things go right. +% +There is no safety in numbers, or in anything else. +% +Roses are red violets are blue +I am schizophrenic and so am I +% +If anything can go wrong, it will. +% +If anything can't go wrong it will. +% +If muprhy's law can go wrong, it will. +% +If a series of events can go wrong, it will do so in +in the worst possible sequence. +% +After things have gone from bad to worse, the cycle +will repeat itself. +% +An auditor enters the battlefield after the war is over, +and attacks the wounded. +% +Nothing is ever so bad that it can't get worse. +% +No matter what goes wrong, there is always somebody +who knew it would. +% +Nature always sides with the hidden flaw. +% +The hidden flaw never remains hidden. +% +(1) Everything depends. +(2) Nothing is always. +(3) Everything is sometimes. +% +If you wait, it will go away +... having done it's damage. +If it was bad, it'll be back. +% +Complex problems have simple, easy-to-understand +wrong answers. +% +Opportunity always knocks at the least opportune +moment. +% +When you need to knock on wood is when you realize the +world's composed of aluminum and vinyl. +% +In order for something to become clean, something +else must become dirty. +... but you can get everything dirty without getting +anything clean. +% +Things equal to nothing else are equal to each other. +% +The first place to look for anything is the last place +you would expect to find it. +% +You can always find what you're not looking for. +% +If you don't care where you are, you ain't lost. +% +It is impossible for an optimist to be pleasantly +suprised. +% +A crisis is when you can't say "let's forget the +whole thing". +% +Washing your car to make it rain doesn't work. +% +When the going gets tough, everyone leaves. +% +The time it talkes to rectify a situation is +inversely proportional to the time it took +to do the damage. +% +An optimist believes we live in the best of all +possible worlds. +A pessimist fears this is true. +% +You can make it foolproof, but you can't make it +damnfoolproof. +% +It takes longer to glue a vase together than to +break one. +% +It takes longer to lose 'x' number of pounds than +to gain 'x' number of pounds. +% +The item you had your eye on the minute you walked in +will be taken by the person in front of you. +% +The other line moves faster. +% +If you change lines, the one you just left will start +to move faster than the one you are now in. +% +The longer you wait in line, the greater the +likelihood that you are standing in the wrong line. +% +The slowest checker is always at the quick-check-out +lane. +% +Whenever you cut your fingernails you will find a +need for them an hour later. +% +(1) If the weather is extremely bad, church + attendance will be down. +(2) If the weather is extremely good, church + attendance will be down. +(3) If the bulletin covers are in short supply + church attendance will exceed all expectations. +% +If a situation requires undivided attention, it will +occur simultaneously with a compelling distraction. +% +The further away the disaster or accident occurs, the +greater the number of dead and injured required for it +to become a story. +% +The closer you are to the facts of a situation, the +more obvious are the errors in all news coverage of +the situation. +% +The further you are from the facts of a situation, +the more you tend to believe news coverage of the +situation. +% +The best way to inspire fresh thoughts is to seal +the letter. +% +The most interesting specimen will not be labeled. +% +Some errors will always go unnoticed until the book +is in print. +% +The first page the author turns to upon receiving an +advance copy will be the page containing the worst +error. +% +(1) Never draw what you can copy. +(2) Never copy what you can trace. +(3) Never trace what you can cut out and paste down. +% +The best shots happen immediately after the last +frame is exposed. +% +The best shots are generally attempted through the +lens cap. +% +Any surviving best shots are ruined when someone +inadvertently open the darkroom door and all of the +dark leaks out. +% +If a three-story buiding served by one elevator, nine +times out of ten the elevator care will be on a floor +where you are not. +% +The tendency of smoke from a cigarette, barbeque, +campfire, etc. to drift into a person's face varies +directly with that person's sensitivity to smoke. +% +The distance to the gate is inversely proportional +to the time available to catch you flight. +% +As soon as the flight attendant serves the coffee, the +airliner encounters turbulence. +% +Serving coffee on aircraft causes turbulence. +% +Whatever carrousel you stand by, your baggage will +come in on another one. +% +When travelling overseas, the exchange rate improves +markedly the day after one has purchased foreign +currency. +% +Upon returning home, the exchange rate drops again as +soon as one has converted all unused foreign currency. +% +The bigger they are, the harder they hit. +% +For every action, there is an equal and opposite +criticism. +% +Authorization for a project will be granted only when +none of the authorizers can be blamed if the project +fails but when all of the authorizers can claim credit +if it succeeds. +% +If an idea can survive a bureacratic review and be +implemented, it wasn't worth doing. +% +The greater the cost of putting a plan into operation, +the less chance there is of abandoning the plan - even +if it subsequently becomes irrevelant. +% +The higher the level of prestige accorded the people +behind the plan, the least less chance there is of +abandoning it. +% +In any organization there will always be one person +who knows what is going on. +This person must be fired. +% +It is easier to get forgiveness than permission. +% +Far-way talent always seems better than home-developed +talent. +% +Personnel recruiting is a triumph of hope over +experience. +% +Some people manage by the book, even though they +don't know who wrote the book or even what book. +% +Don't let your superiors know you're better than +they are. +% +You never know who's right, but you always know +who's in charge. +% +(1) Anyone can make a decision given enough facts. +(2) A good manager can make a decision without enough + facts. +(3) A perfect manager can operate in perfect ignorance. +% +The boss who attempts to impress employees with his +knowledge of intricate details has lost sight of his +final objective. +% +You will save yourself a lot of needless worry if you +don't burn your bridges until you come to them. +% +In a hierarchical system, the rate of pay varies +inversely with the unpleasantness and difficulty +of the task. +% +The client who pays the least complains the most +% +A lack of planning on your part +does not constitute an emergency on my part. +% +I know you believe you understand + what you think I said, + however, I am not sure you realize, + that what I think you heard + is not what I meant +% +Real programmers don't eat muffins. +% +In any bureaucracy, paperwork increases as you spend +more and more time reporting on the less and less you +are doing. Stability is achieved when you spend all of +your time reporting on the nothing you are doing. +% +Consultants are mystical people who ask a company for +a number and then give it back to them. +% +When somebody drops something, everybody will kick it +around instead of picking it up. +% +The chances of anybody doing anything are inversely +proportional to the number of other people who are in +a position to do it instead. +% +Never make a decision you can get someone else to make. +% +No one keeps a record of decisions you could have made +but didn't. Everyone keeps a records of your bad ones. +% +For every vision, there is an equal and opposite revision. +% +The inside contact that you have developed at great +expense is the first person to be let go in any +reorganization. +% +It's tough to get reallocated when you're the one +who's redundant. +% +Whatever hits the fan will not be evenly distributed. +% +If you're early, it'll be cancelled. +If you knock yourself out to be on time, you will + have to wait. +If you're late, you will be too late. +% +A meeting is an event at which the minutes are kept +and the hours are lost. +% +If you leave the room, you're elected. +% +The cream rises to the top. +So does the scum. +% +You can never do just one thing. +% +There's no time like the present for postponing +what you don't want to do. +% +Any task worth doing was worth doing yesterday. +% +The more complicated and grandiose the plan, the +greater the chance of failure. +% +Simple jobs always get put off because there will be +time to do them later. +% +Assumption is the mother of all screw-ups. +% +A work project expands to fill the space available. +% +No matter how large the work space, if two projects +must be done at the same time they will require the +same part of the work space. +% +The one wrench or drill bit you need will be the one +missing from the tool chest. +% +Most projects require three hands. +% +Leftover nuts never match leftover bolts. +% +The more carefully you plan a project, the more +confusion there is when something goes wrong. +% +Murphy's rule for precision: + Measure with a micrometer + Mark with chalk + Cut with an axe +% +You can't fix it if it ain't broke. +% +First rule of intelligent tinkering: + Save all the parts +% +Access holes will be 1/2" too small. +Holes that are the right size will be in the wrong place. +% +If it would be cheaper to buy a new unit, the company +will insist upon repairing the old one. +% +If it would be cheaper to repair the old one, the +company will insist on the latest model. +% +The primary function of the design engineer is to make +things difficult for the fabricator and impossible +for the serviceman. +% +That component of any circuit which has the shortest +service life will be placed in the least +accessible location. +% +Any circuit design must contain at least one part which +is obsolete, two parts which are unobtainable and three +parts which at still under development. +% +Important letters which contain no errors will develop +errors in the mail. +% +Office machines which function perfectly during normal +business hours will break down when you return to the +office at night to use them for personal business. +% +Machines that have broken down will work perfectly +when the repairman arrives. +% +Envelopes and stamps which don't stick when you lick +them will stick to other things when you don't want +them to. +% +Vital papers will demonstrate their vitality by +spontaneously moving from where you left them to where +you can't find them. +% +The last person who quit or was fired will be held +responsible for everything that goes wrong -- until +the next person quits or is fired. +% +If you hit two keys on the typewriter, the one you +don't want his the paper. +% +The one time in the day that you lean back and relax +is the one time the boss walks through the office. +% +Hot glass looks exactly the same as cold glass. +% +When you do not know what you are going, do it neatly. +% +Teamwork is essential. It allows you to blame someone else. +% +Science is true. Don't be misled by facts. +% +(1) If it's green or it wiggles, it's biology. +(2) If it stinks, it's chemistry. +(3) If it doesn't work, it's physics. +% +Nothing improves an innovation like lack of controls. +% +The quality of correlation is inversely proportional +to the density of control. +% +If reproducibility may be a problem conduct the +test only once. +% +If a straight line fit is required, obtain only two +data points. +% +Any technical problem can be overcome given enough +time and money. +% +You are never given enough time or money. +% +Unless the results are known in advance, funding +agencies will reject the proposal. +% +It is better to solve a problem with a crude +approximation and know the truth, than to demand an +exact solution and not know the truth at all. +% +An easily-understood, workable falsehood is more useful +than a complex, incompreshensible truth. +% +Anyone who make a significant contribution to any field +of endeavor and stays in that field long enough, +becomes an obstruction to its progress -- in direct +proportion to the importance of his original contribution. +% +If a scientist uncovers a publishable fact, it will +become central to his theory. + +His theory, in turn, will become central to all +scientific truth. +% +There is no such thing as a straight line. +% +In any series of calculations, errors tend to occur +at the opposite end to the end at which you begin +checking for errors. +% +Only errors exist. +% +One man's error is another man's data. +% +To err is human, but to really foul things up requires +a computer. +% +When putting it into memory, remember where you put it. +% +Never test for an error condition you don't know +how to handle. +% +Everybody lies; but it doesn't matter, since +nobody listens. +% +People who love sausage and respect the law should +never watch either one being made. +% +No matter what they're telling you, they're not +telling you the whole truth. +% +No matter what they're talking about, they're +talking about money. +% +In any dealings with a collective body of people, the +people will always be more tacky than originally expected. +% +If you can keep your head when all about you are losing +theirs, then you just don't understand the problem. +% +Information deteriorates upward through the bureaucracies. +% +When an exaggerated emphasis is placed upon delegation, +responsibility, like sediment, sinks to the bottom. +% +When outrageous expenditures are divided finely enough +the public will not have enough stake in any one +expenditure to squelch it. +% +When the government bureau's remedies do not match your +problem, you modify the problem, not the remedy. +% +A fool and your money are soon partners. +% +You may know where the market is going, but you can't +possibly know where it's going after that. +% +Among economists, the real world is often a special case. +% +Trial balances don't. +% +Working capital doesn't. +% +Liquidity tends to run out. +% +Return on investments won't. +% +If everybody doesn't want it, nobody gets it. +% +Mass man must be serviced by mass means. +% +Everything is contagious. +% +Nothing is ever done for the right reasons. +% +The secret of success is sincerity. Once you can fake +that you've got it made. +% +An expert is anyone from out of town. +% +An expert is one who knows more and more about less +and less until he knows absolutely everything +about nothing. +% +To spot the expert, pick the one who perdicts the job +will take the longest and cost the most. +% +If it sits on your desk for 15 minutes, you've just +become the expert. +% +Indecision is the basis for flexibility. +% +Anything is possible if you don't know what you're +talking about. +% +Never create a problem for which you do not have +the answer. +% +Create problems for which only you have the answer. +% +A conclusion is the place where you got tired of thinking. +% +Hindsight is an exact science. +% +History doesn't repeat itself -- historians merely +repeat each other. +% +Fact is solidified opinion. +% +Facts may weaken under extreme heat and pressure. +% +Truth is elastic. +% +When in doubt, predict that the trend will continue. +% +When in trouble, obfuscate. +% +Progress does not consist in replacing a theory that is +wrong with one that is right. It consists in replacing +a theory that is wrong with one that is more sublty wrong. +% +It is a simple task to make things complex, but a complex +task to make them simple. +% +If you have a difficult task give it to a lazy man, he +will find an easier way to do it. +% +Every great idea has a disadvantage equal to or +exceeding the greatness of the idea. +% +Never attribute to malice that which is adequately +explained by stupidity. +% +New systems generate new problems. +% +Systems should not be unnecessarily multiplied. +% +Systems tend to grow and as they grow they encroach. +% +Complicated systems produce unexpected outcomes. +% +The total behavior of large systems cannot be predicted. +% +A large system, produced by expanding the dimensions of +a smaller system, does not behave like the smaller system. +% +People in systems do not do what the systems says +they are doing. +% +The system itself does not do what it says it is doing. +% +A complex system that works is invariably found to have +evolved from a simple system that works. +% +A complex system designed from scratch never works and +cannot be patched up to make it work. You have to start +over, beginning with a working simple system. +% +(1) Everything is a system. +(2) Everything is part of a larger system. +(3) The universe is infinitely systematized both upward + (larger systems) and downward (smaller systems). +(4) All systems are infinitely complex. (The illuison + of simplicity comes from focussing attention on + one or a few variables). +% +Complex systems tend to oppose their own proper function. +% +If the course you wanted most has room for 'n' students +you will be the 'n + 1' to apply. +% +Class schedules are designed so that every student will +waste the maximum time between classes. +% +Show me a person who's never made a mistake and I'll +show you somebdoy who's never achieved much. +% +When you consider there are 24 hours in a day, it's +sad to know that only one is called the happy hour. +% +When you are able to schedule two classes in a row, +they will be held in classrooms at opposite end of +the campus. +% +A prerequisite for a desired course will be offered +only during the semester following the desired course. +% +When reviewing your notes before an exam, the most +important ones will be illegible. +% +The more studying you did for the exam, the less sure +you are as to which answer they want. +% +80% of the final exam will be based on the one lecture +you missed about the one book you didn't read. +% +The night before the english history mid-term, your +biology instructor will assign 200 pages on planaria. +% +Every instructor assumes that you have nothing else +to do except study for that instructor's course. +% +If you are given an open-book exam, you will forget +your book. +If you are given a take-home exam, you will forget +where you live. +% +At the end of the semester you will recall having +enrolled in a course at the beginning of the semester +-- and never attending. +% +The one course you must take to graduate will not be +offered during your last semester. +% +The more general the title of a course, the less +you will learn from it. +% +The more specific the title of a course, the less you +will be able to apply it later. +% +The most valuable quotation will be the one for which +you cannot determine the source. +% +The source for an unattributed quotation will appear +in the most hostile review of your work. +% +When a writer prepares a manuscript on a subject he does +not understand, his work will be understood only by +readers who know more about that subject than he does. +% +Writings prepared without understanding must fail in the +first ojbective of communication -- informing +the uninformed. +% +When a student asks for a second time if you have read +his book report, he did not read the book. +% +If daily class attendance is mandatory, a schedules +exam will product increased absenteeism. If attendance +is optional, a schedules exam will produce persons you +have never seen before. +% +Just because your doctor has a name for your condition +doesn't mean he knows what it is. +% +The more boring and out-of-date the magazines in the +waiting room, the longer you will have to wait for +your scheduled appointment. +% +Only adults have difficulty with child-proof bottles. +% +You never have the right number of pills left on the +last day of a prescription. +% +The pills to be taken with meals will be the least +appetizing ones. +% +Even water tastes bad when taken on doctors orders. +% +If your condition seems to be getting better, it's +probably your doctor getting sick. +% +Beware of the physician who is great at getting +out of trouble. +% +A drug is that substance which, when injected into a +rat, will produce a scientific report. +% +Before ordering a test decide what you will do if it is, +(1) positive, or +(2) negative. +If both answers are the same, don't do the test. +% +The radiologists' national flower is the hedge. +% +The feasibility of an operation is not the best +indiciation for its performance. +% +A physician's ability is inversely proportional +to his availability. +% +There are two kinds of adhesive tape: That which won't +stay on and that which won't come off. +% +Everbody wants a pain shot at the same time. +% +Everybody who didn't want a pain shot when you were +passing out pain shots wants one when you are passing +out sleeping pills. +% +An alcoholic is a person who drinks more than his +own physician. +% +Fools rush in -- and get the best seats. +% +At any event, the people whose seats are furthest from +the aisle arrive last. +% +Exciting plays occur only while you are watching the +scoreboard or out buying a hot dog. +% +Nothing is ever so bad it can't be made worse by +firing the coach. +% +The wrong quarterback is the one that's in there. +% +A free agent is anything but. +% +Hockey is a game played by six good players and the +home team. +% +Whatever can go to New York, will. +% +Whenever a superstar is traded to your favorite team, +he fades. Whenever your team trades away a usless +no-name, he immediately rises to stardom. +% +Never leave hold of what you've got until you've +got hold of something else. +% +A mediocre player will sink to the level of his or +her opposition. +% +The only way to make up for being lost is to make +record time while you are lost. +% +The amount of wind will vary inversely with the number +and experience of the people you have on board. +% +No matter how strong the breeze when you leave the dock +once you have reached the furthest point from port +the wind will die. +% +The time available to go fishing shrinks as the fishing +season draws nearer. +% +The least experienced fisherman always catches the +biggest fish. +% +The more elaborate and costly the equipment, the greater +the chance of having to stop at the fish market +on the way home. +% +The worse your line is tangled, the better is the +fishing around you. +% +The mountain gets steeper as you get closer. +% +The mountain looks closer than it is. +% +All trails have more uphill sections that they have +level or downhill sections. +% +The one who least wants to play is the one who will win. +% +All things being equal, you lose. + +All things being in your favor, you still lose. +% +Win or lose, you lose. +% +No matter where you go, there you are! +% +It always takes longer to get there than to get back. +% +If everything is coming your way, you're in the +wrong lane. +% +If you allow someone to get in front of you either: +(1) The car in front will be the last one over a + railroad crossing, and you will be stuck waiting + for a long, slow-moving train; or +(2) you both will have the same destination and the + other car will get the last parking space. +% +If you have to park six blocks away, you will find two +new parking spaces right in front of the building +entrance. +% +When you're not in a hurry, the traffic light will turn +green as soon as your vehicle comes to a complete stop. +% +A car and a truck approaching each other on an otherwise +deserted road will meet at the narrow bridge. +% +The speed of an oncoming vehicle is directly proportional +to the length of the passing zone. +% +The first bug to hit a clean windshield lands directly +in front of your eyes. +% +If you can get to the faulty part, you don't have the +tool to get it off. +% +If you can get the faulty part off, the parts house +will have it back-ordered. +% +If the faulty part is in stock, it didn't need replacing +in the first place. +% +When the need arises, any tool or object closest to you +becomes a hammer. +% +No matter how minor the task, you will inevitably end +up covered with grease and motor oil. +% +When necessary, metric and inch tools can be used +interchangeably. +% +Automotive engine reparing law: +If you drop something, it will never reach the ground. +% +If you lived here you'd be home now. +% +If it's good, they discontinue it. +% +It the shoe fits, it's ugly. +% +(1) If you like it, they don't have it in your size. +(2) If you like it and it's in your size, it doesn't + fit anyway. +(4) If you like it and it fits, you can't afford it. +(5) If you like it, it fits and you can afford it, it + falls apart the first time you wear it. +% +The one you want is never the one on sale. +% +Anything labeled "new" and/or "improved" isn't. +% +The label "new" and/or "improved" means the price went up. +% +The label "all new," "completely new" or "great news" +means the price went way way up. +% +If an item is advertised as "under $50," you can bet +it's not $19.95. +% +ACF2 is a four letter word. +% +If only one price can be obtained for any quotation, +the price will be unreasonable. +% +A 60-day warranty guarantees that the product will +self-destruct on the 61st day. +% +The "consumer report" on the item will come out a week +after you've made your purchase: + +(1) The one you bought will be rated "unacceptable". +(2) The one you almost bought will be rated "best buy". +% +If you don't write to complain, you'll never receive +your order. +If you do write, you'll receive the merchandise before +your angry letter reaches its destination. +% +The most important item in an order will no longer +be available. +% +During the time an item is on back-order, it will be +available cheaper and quicker from many other sources. +% +People will buy anthing that's one to a customer. +% +Security isn't. +% +Management can't. +% +Sale promotions don't. +% +Consumer assistance doesn't. +% +Workers won't. +% +Cleanliness is next to impossible. +% +Multiple-function gadgets will not perform any +function adequately. +% +The more expensive the gadget, the less often you +will use it. +% +The simpler the instruction, e.g. "press here", the +more difficult it will be to open the package. +% +In a family recipe you just discovered in an old book, +the most vital measurement will be illegible. +% +Once a dish is fouled up, anything added to save it +only makes it worse. +% +You are always complimented on the item which took the +least effort to prepare. + +Example: + If you make "duck a l'orange" you will be + complimented on the baked potato. +% +The one ingredient you made a special trip to the store +to get will be the one thing your guest is allergic to. +% +The more time and energy you put into preparing a meal +the greater the chance you guests will spend the entire +meal discussing other meals they have had. +% +Souffles rise and cream whips only for the family and +for guests you didn't really want to invite anyway. +% +The rotten egg will be the one you break into the +cake batter. +% +Any cooking utensil placed in the dishwasher will be +needed immediately thereafter for something else. +% +Any measuring utensil used for liquid ingredients will +be needed immediately thereafter for dry ingredients. +% +Time spent consuming a meal is in inverse proportion +to time spent preparing it. +% +Whatever it is, somebody will have had it for lunch. +% +If you're wondering if you took the meat out to +thaw, you didn't. +% +If you're wondering if you left the coffee pot +plugged in, you did. +% +If you're wondering if you need to stop and pick up +bread and eggs on the way home, you do. +% +If you're wondering if you have enough money to take +the family out to eat tonight, you don't. +% +The spot you are scrubbing on glassware is always on +the other side. +% +Washing machines only break down during the wash cycle. +% +All break downs occur on the plumber's day off. +% +Cost of repair can be determined by multiplying the +cost of your new coat by 1.75, or by multiplying the +cost of a new washer by .75. +% +There is always more dirty laundry then clean laundry. +% +If it's clean, it isn't laundry. +% +A child will not spill on a dirty floor. +% +An unbreakable toy is useful for breaking other toys. +% +Any child who chatters non-stop at home will adamantly +refuse to utter a word when requested to demonstrate +for an audience. +% +A shy, introverted child will choose a crowded public +area to loudly demonstrate new acquired vocabulary. +% +The probablility of a cat eating its dinner has +absolutely nothing to do with the price of the food +placed before it. +% +The probability that a household pet will raise a fuss +to go in or out is directly proportional to the number +and importance of your dinner guests. +% +The stomach expands to accommodate the amount of +junk food available. +% +If you buy bananas or avocados before they are ripe, +there won't be any left by the time they are ripe. If +you buy them ripe, they rot before they are eaten. +% +How long a minute is depends on which side of the +bathroom door you're on. +% +The life expectancy of a house plant varies inversely +with its price and directly with its ugliness. +% +If you have watched a TV series only once, and you watch +it again, it will be a rerun of the same episode. +% +If there are only two shows worth watching, they will +be on together. +% +The only new TV show worth watching will be cancelled. +% +The TV show you've been looking forward to all week +will be preempted. +% +Most people deserve each other. +% +Possessions increase to fill the space available for +their storage. +% +When you dial a wrong number, you never get a busy signal +% +(1) The telephone will ring when you are outside the + door, fumbling for your keys. + +(2) You will reach it just in time to hear the click + of the caller hanging up. +% +People to whom you are attracted invariably thing you +remind them of someone else. +% +The one who snores will fall asleep first. +% +Never get excited about a blind date because of how +it sounds over the phone. +% +The love letter you finally got the courage to send +will be delayed in the mail long enough for you to +make a fool of yourself in person. +% +Other people's romantic gestures seem novel and exciting. + +Your own romantic gestures seem fooolish and clumsy. +% +The length of a marriage is inversely proportional +to the amount spent on the wedding. +% +The probablility of meeting someone you know increases +when you are with someone you don't want to be seen with. +% +If you help a friend in need, he is sure to remember +you - the next time he's in need. +% +Virtue is its own punishment. +% +If you do something right once, someone will ask +you to do it again. +% +The one day you'd sell your soul for something, +souls are a glut. +% +The scratch on the record is always through the song +you like most. +% +Superiority is recessive. +% +Forgive and remember. +% +Anything good in life is either illegal, immoral +or fattening. +% +Anything good in life either causes cancer in +laboratory mice or is taxed beyond reality. +% +To err is human -- to blame it on someone else is +even more human. +% +Whatever happens to you, it will previously have +happened to everyone you know only more so. +% +He who laughs last -- probably didn't get the joke. +% +Don't worry over what other people are thinking about +you. They're too busy worrying over what you are +thinking about them. +% +In a bureaucratic hierarchy, the higher up the +organization the less people appreciate Murphy's law, +the Peter Principle, etc. +% +Law expands in proportion to the resources available +for its enforcement. +% +Bad law is more likely to be supplemented than repealed. +% +There are some things which are impossible to know - +but it is impossible to know these things. +% +When we try to pick out anything by itself we find +it hitched to everything else in the universe. +% +If one views his problem closely enough he will +recoginize himself as part of the problem. +% +Anything may be divided into as many parts as you please. +% +Everything may be divided into as many parts as you please. +% +If several things that could have gone wrong have not +gone wrong, it would have been ultimately beneficial +for them to have gone wrong. +% +The quickest way to experiment with acupuncture is to +try on a new shirt. +% +Absolutely nothing in the world is friendlier than +a wet dog. +% +The severity of an itch is inversely proportional +to the reach. +% +A hug is the perfect gift - one size fits all, and +nobody minds if you exchange it. +% +The only game that can't be fixed is peek-a-boo. +% +Ignorance should be painful. +% +The first insurance agent was David - +he gave Goliath a piece of the rock. +% +King Arthur ran the first knight club. +% +Magellan was the first strait man. +% +If you smile when everything goes wrong, you are +either a nitwit or a repariman. +% +If it weren't for the opinion polls we'd never know +what people are undecided about. +% +No news is ... impossible. +% +Laugh and the world laughs with you. cry and ... +you have to blow your nose. +% +A penny saved is ... not much. +% +He who marries for money ... better be nice to his wife. +% +It's always darkest before ... daylight saving time. +% +If at first you don't succeed ... get new batteries. +% +There is nothing more frightening than ignorance in action. +% +Life is like an ice-cream cone: You have to learn to +lick it. +% +One place where you're sure to find the perfect +driver is in the back seat. +% +Nothing is indestructible, with the possible exception +of discount-priced fruitcakes. +% +How do they know no two snowflakes are alike. +% +How did they measure hail before the golf ball was invented. +% +To err is human, to forgive is divine -- +but to forget it altogether is humane. +% +"Watching a birdie" in hand is safer that watching +one overhead. +% +The light at the end of the tunnel can be a helluva +nuisance, espically if your're using the tunnel +as a darkroom. +% +Never play leapfrog with a photo enlarger. +% +Never argue with an artist. +% +When in doubt, don't muble, overexpose ... then mumble. +% +The light at the end of the tunnel really is a train. +% +A budget is saving quarters in a mason jar for +Christmas and spending them by Easter. +% +A budget is spending $15.00 on gas to drive to a +shopping mall to save $4.30 on a 20 pound turkey. +% +A budget is wondering why you should balance yours +if the government can not balance theirs. +% +A budget is trying to figure out how the family next +door is doing it. +% +A budget is a plan that falls apart when the plumber +has to make an emergency visit. +% +A budget is trying to make $25.00 go as far today as +it did when you were first married. +% +A budget is buying a dress two sizes too small because +it was marked down. +% +You sure have to borrow a lot of money these days to +be an average consumer. +% +He who dies with the most toys wins. +% +A fool and his money soon go partying. +% +If his IQ was any lower he'd be a plant. +% +Everybody is ignorant, only on different subjects. +% +It is far better to do nothing that to do +something efficiently. + -- Siezbo +% +The man who has no more problems is out of the game. +% +The race goes not always to the swift, nor the battle +to the strong, but that's the way to bet. +% +A fool and his money are invited places. +% +All things come to him whose name is on a mailing list. +% +The hand that rocks the craddle usually is attached +to someone who isn't getting enough sleep. +% +After winning an argument with his wife, +the wisest thing a man can do is apologize. +% +If opportunity came disguised as temptation, +one knock would be enough. +% +If there was any justice in this world, people would +occasionally be permitted to fly over pigeons. +% +Easy doesn't do it. +% +Most people want to be delivered from temptation but +would like it to keep in touch. +% +When a distinguised scientist states something is possible, +he is almost certainly right. When he states that +something is impossible, he is very probably wrong. +% +Everyone gets away with something. +No one gets away with everything. +% +Remain silent about your intentions until you are sure +% +Calm down .... it is only ones and zeros. +% +Real programmers don't write COBOL. +COBOL is for wimpy applications programmers. +% +I have not lost my mind, it is backed up on tape somewhere. +% +Real programmers do not document. +Documentation is for simps who can't read listings or +object code. +% +Real programmers don't write specs -- users should +consider themselves lucky to get any programs at all and +take what they get. +% +Real programmers don't comment their code. if it is hard +to write, it should be hard to understand. +% +Real programmers don't write apllications programs; they +program right down on the bare metal. Application +programming is for feebs who can't do systems programming. +% +Real programmers don't eat quiche. In fact, real +programmers don't know how to spell quiche. They eat +twinkies and szechwan food. +% +Real programmer's programs never work the first time. But +if you throw them on the machine, they can be patched into +working in "only a few" 30-hour debugging sessions. +% +Real programmers don't write in Fortran. Fortran is for +pipe stress freaks and crystallography weenies. +% +Real programmers never work 9 to 5. If any real +programmers are around at 9 a.m., it's because they +were up all night. +% +Real programmers don't write in Basic. Actually, no +programmers write in basic after age 12. +% +Real programmers don't write in PL/1. PL/1 is for +programmers who can't decide whether to write in +COBOL or Fortran. +% +Real programmers don't play tennis or any other sport +that requires you to change clothes. Mountain climbing is +O.K., and real programmers wear their climbing boots to work +in case a mountain should suddenly spring up in the middle +of the machine room. +% +Real programmers don't write in Pascal, Bliss, or Ada, or +any of those pinko computer science languages. Strong +typing is for people with weak memories. +% +On a clear disk, you can seek forever. +% +Hollerith got us into this hole mess! +% +No major project is ever installed on time, within budgets, +with the same staff that started it. Yours will not be the +first. +% +When things are going well, something will go wrong. +When things just can't get any worse, they will. +When things appear to be going better you have overlooked +something. +% +If project content is allowed to change freely, the rate of +change will exceed the rate of progress. +% +No system is ever completely debugged: Attempts to debug +a system will inevitably introduce new bugs that are even +harder to find. +% +A carelessly planned project will take three times +longer than expected; a carefully planned project will +take only twice as long. +% +After all is said and done, a hell of a lot more is said +than done +% +If it's not in the computer, it doesn't exist. +% +Never wrestle with a pig; you both get dirty, and the pig +likes it! +% +Never argue with an idiot: People watching may not be able +to tell the difference. +% +Don't fight with a bear in his own cage. +% +The six steps of program management are: +(1) Wild enthusiasm +(2) Disenchantment +(3) Total confusion +(4) Search for guilty +(5) Punishment for the innocent +(6) Promotion of the non-participants +% +He who hesitates is not only lost, but several miles from +the next freeway exit. +% +An expert doesn't know any more than you do. He or she is +merely better organized and uses slides. +% +Nothing is impossible for the person who doesn't have +to do it himself/herself. +% +You can lead a horse to water, but if you can get him to +float on his back, you've really got something. +% +You win some, lose some, and some get rained out; but you +gotta suit up for them all. +% +People are promoted not by what they can do, but what +people think they can do. +% +Don't smoke in bed - the ashes on the floor might be your +own. Property changes on: stable/4/games/fortune/datfiles/murphy ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Index: stable/4/games/fortune/datfiles/murphy-o =================================================================== --- stable/4/games/fortune/datfiles/murphy-o (nonexistent) +++ stable/4/games/fortune/datfiles/murphy-o (revision 60994) @@ -0,0 +1,26 @@ +%%$FreeBSD$ +You can lead a horticulture, but you can't make her think. +% +When you're up to your nose in shit, +be sure to keep your mouth shut. +% +One's life tends to be like a beaver's, +one dam thing after another. +% +Never sleep with anyone crazier than yourself. +% +Old Scottish prayer: O Lord, grant that we may always be +right, for thou knowest we will never change our minds. +% +All probabilities are 50%: either a thing will +happen or it won't. + +This is especially true when dealing with women. + +Likelihoods, however, are 90% against you. +% +Sow your wild oats on Saturday night - then on +Sunday pray for crop failure. +% +Early to rise and early to bed makes a male +healthy and wealthy and dead. Property changes on: stable/4/games/fortune/datfiles/murphy-o ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Index: stable/4/gnu/usr.bin/binutils/gdb/freebsd-uthread.c =================================================================== --- stable/4/gnu/usr.bin/binutils/gdb/freebsd-uthread.c (nonexistent) +++ stable/4/gnu/usr.bin/binutils/gdb/freebsd-uthread.c (revision 60994) @@ -0,0 +1,1126 @@ +/* $FreeBSD$ */ +/* Low level interface for debugging FreeBSD user threads for GDB, the GNU debugger. + Copyright 1996, 1999 Free Software Foundation, Inc. + +This file is part of GDB. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +/* This module implements a sort of half target that sits between the + machine-independent parts of GDB and the ptrace interface (infptrace.c) to + provide access to the FreeBSD user-mode thread implementation. + + FreeBSD threads are true user-mode threads, which are invoked via + the pthread_* interfaces. These are mostly implemented in + user-space, with all thread context kept in various structures that + live in the user's heap. For the most part, the kernel has no + knowlege of these threads. + + Based largely on hpux-thread.c + + */ + + +#include "defs.h" +#include +#include +#include +#include "gdbthread.h" +#include "target.h" +#include "inferior.h" +#include +#include +#include +#include "gdbcore.h" + +extern int child_suppress_run; +extern struct target_ops child_ops; /* target vector for inftarg.c */ + +extern void _initialize_freebsd_uthread PARAMS ((void)); + +static int main_pid = -1; /* Real process ID */ + +/* Set to true while we are part-way through attaching */ +static int freebsd_uthread_attaching; + +static int freebsd_uthread_active = 0; +static CORE_ADDR P_thread_list; +static CORE_ADDR P_thread_run; + +static struct cleanup * save_inferior_pid PARAMS ((void)); + +static void restore_inferior_pid PARAMS ((int pid)); + +static void freebsd_uthread_resume PARAMS ((int pid, int step, + enum target_signal signo)); + +static void init_freebsd_uthread_ops PARAMS ((void)); + +static struct target_ops freebsd_uthread_ops; +static struct target_thread_vector freebsd_uthread_vec; + +/* + +LOCAL FUNCTION + + save_inferior_pid - Save inferior_pid on the cleanup list + restore_inferior_pid - Restore inferior_pid from the cleanup list + +SYNOPSIS + + struct cleanup *save_inferior_pid () + void restore_inferior_pid (int pid) + +DESCRIPTION + + These two functions act in unison to restore inferior_pid in + case of an error. + +NOTES + + inferior_pid is a global variable that needs to be changed by many of + these routines before calling functions in procfs.c. In order to + guarantee that inferior_pid gets restored (in case of errors), you + need to call save_inferior_pid before changing it. At the end of the + function, you should invoke do_cleanups to restore it. + + */ + +static struct cleanup * +save_inferior_pid () +{ + return make_cleanup ((make_cleanup_func) restore_inferior_pid, + (void *)(intptr_t) inferior_pid); +} + +static void +restore_inferior_pid (pid) + int pid; +{ + inferior_pid = pid; +} + +static int find_active_thread PARAMS ((void)); + +struct cached_pthread { + u_int64_t uniqueid; + int state; + CORE_ADDR name; + int sig_saved; + ucontext_t saved_sigcontext; + jmp_buf saved_jmp_buf; +}; + +static int cached_thread; +static struct cached_pthread cached_pthread; +static CORE_ADDR cached_pthread_addr; + +#define THREADID_TID(id) ((id) >> 17) +#define THREADID_PID(id) ((id) & ((1 << 17) - 1)) + +LIST_HEAD(idmaplist, idmap); + +struct idmap { + LIST_ENTRY(idmap) link; + u_int64_t uniqueid; + int tid; +}; + +#define MAPHASH_SIZE 257 +#define TID_MIN 1 +#define TID_MAX 16383 + +static int tid_to_hash[TID_MAX + 1]; /* set to map_hash index */ +static struct idmaplist map_hash[MAPHASH_SIZE]; +static int next_free_tid = TID_MIN; /* first available tid */ +static int last_free_tid = TID_MIN; /* first unavailable */ + +static CORE_ADDR P_thread_next_offset; +static CORE_ADDR P_thread_uniqueid_offset; +static CORE_ADDR P_thread_state_offset; +static CORE_ADDR P_thread_name_offset; +static CORE_ADDR P_thread_sig_saved_offset; +static CORE_ADDR P_thread_saved_sigcontext_offset; +static CORE_ADDR P_thread_saved_jmp_buf_offset; +static CORE_ADDR P_thread_PS_RUNNING_value; +static CORE_ADDR P_thread_PS_DEAD_value; + +static int next_offset; +static int uniqueid_offset; +static int state_offset; +static int name_offset; +static int sig_saved_offset; +static int saved_sigcontext_offset; +static int saved_jmp_buf_offset; +static int PS_RUNNING_value; +static int PS_DEAD_value; + +#define UNIQUEID_HASH(id) (id % MAPHASH_SIZE) +#define TID_ADD1(tid) (((tid) + 1) == TID_MAX + 1 \ + ? TID_MIN : (tid) + 1) +#define IS_TID_FREE(tid) (tid_to_hash[tid] == -1) + +static int +get_new_tid(h) + int h; +{ + int tid = next_free_tid; + + tid_to_hash[tid] = h; + next_free_tid = TID_ADD1(next_free_tid); + if (next_free_tid == last_free_tid) + { + int i; + + for (i = last_free_tid; TID_ADD1(i) != last_free_tid; i = TID_ADD1(i)) + if (IS_TID_FREE(i)) + break; + if (TID_ADD1(i) == last_free_tid) + { + error("too many threads"); + return 0; + } + next_free_tid = i; + for (i = TID_ADD1(i); IS_TID_FREE(i); i = TID_ADD1(i)) + ; + last_free_tid = i; + } + + return tid; +} + +static int +find_pid(uniqueid) + u_int64_t uniqueid; +{ + int h = UNIQUEID_HASH(uniqueid); + struct idmap *im; + + LIST_FOREACH(im, &map_hash[h], link) + if (im->uniqueid == uniqueid) + return (im->tid << 17) + main_pid; + + im = xmalloc(sizeof(struct idmap)); + im->uniqueid = uniqueid; + im->tid = get_new_tid(h); + LIST_INSERT_HEAD(&map_hash[h], im, link); + + return (im->tid << 17) + main_pid; +} + +static void +free_pid(pid) + int pid; +{ + int tid = THREADID_TID(pid); + int h = tid_to_hash[tid]; + struct idmap *im; + + if (!tid) return; + + LIST_FOREACH(im, &map_hash[h], link) + if (im->tid == tid) + break; + + if (!im) return; + + LIST_REMOVE(im, link); + tid_to_hash[tid] = -1; + free(im); +} + +#define READ_OFFSET(field) read_memory(P_thread_##field##_offset, \ + (char *) &field##_offset, \ + sizeof(field##_offset)) + +#define READ_VALUE(name) read_memory(P_thread_##name##_value, \ + (char *) &name##_value, \ + sizeof(name##_value)) + +static void +read_thread_offsets () +{ + READ_OFFSET(next); + READ_OFFSET(uniqueid); + READ_OFFSET(state); + READ_OFFSET(name); + READ_OFFSET(sig_saved); + READ_OFFSET(saved_sigcontext); + READ_OFFSET(saved_jmp_buf); + + READ_VALUE(PS_RUNNING); + READ_VALUE(PS_DEAD); +} + +#define READ_FIELD(ptr, T, field, result) \ + read_memory ((ptr) + field##_offset, (char *) &(result), sizeof result) + +static u_int64_t +read_pthread_uniqueid (ptr) + CORE_ADDR ptr; +{ + u_int64_t uniqueid; + READ_FIELD(ptr, u_int64_t, uniqueid, uniqueid); + return uniqueid; +} + +static CORE_ADDR +read_pthread_next (ptr) + CORE_ADDR ptr; +{ + CORE_ADDR next; + READ_FIELD(ptr, CORE_ADDR, next, next); + return next; +} + +static void +read_cached_pthread (ptr, cache) + CORE_ADDR ptr; + struct cached_pthread *cache; +{ + READ_FIELD(ptr, u_int64_t, uniqueid, cache->uniqueid); + READ_FIELD(ptr, int, state, cache->state); + READ_FIELD(ptr, CORE_ADDR, name, cache->name); + READ_FIELD(ptr, int, sig_saved, cache->sig_saved); + READ_FIELD(ptr, ucontext_t, saved_sigcontext,cache->saved_sigcontext); + READ_FIELD(ptr, jmp_buf, saved_jmp_buf, cache->saved_jmp_buf); +} + +static int +find_active_thread () +{ + CORE_ADDR ptr; + + if (main_pid == -1) + return -1; + + read_memory ((CORE_ADDR)P_thread_run, + (char *)&ptr, + sizeof ptr); + + return find_pid(read_pthread_uniqueid(ptr)); +} + +static CORE_ADDR find_pthread_addr PARAMS ((int thread)); +static struct cached_pthread * find_pthread PARAMS ((int thread)); + +static CORE_ADDR +find_pthread_addr (thread) + int thread; +{ + CORE_ADDR ptr; + + if (thread == cached_thread) + return cached_pthread_addr; + + read_memory ((CORE_ADDR)P_thread_list, + (char *)&ptr, + sizeof ptr); + + while (ptr != 0) + { + if (find_pid(read_pthread_uniqueid(ptr)) == thread) + { + cached_thread = thread; + cached_pthread_addr = ptr; + read_cached_pthread(ptr, &cached_pthread); + return ptr; + } + ptr = read_pthread_next(ptr); + } + + return NULL; +} + +static struct cached_pthread * +find_pthread (thread) + int thread; +{ + CORE_ADDR ptr; + + if (thread == cached_thread) + return &cached_pthread; + + read_memory ((CORE_ADDR)P_thread_list, + (char *)&ptr, + sizeof ptr); + + while (ptr != 0) + { + if (find_pid(read_pthread_uniqueid(ptr)) == thread) + { + cached_thread = thread; + cached_pthread_addr = ptr; + read_cached_pthread(ptr, &cached_pthread); + return &cached_pthread; + } + ptr = read_pthread_next(ptr); + } + +#if 0 + error ("Can't find pthread %d,%d", + THREADID_TID(thread), THREADID_PID(thread)); +#endif + return NULL; +} + + +/* Most target vector functions from here on actually just pass through to + inftarg.c, as they don't need to do anything specific for threads. */ + +/* ARGSUSED */ +static void +freebsd_uthread_open (arg, from_tty) + char *arg; + int from_tty; +{ + child_ops.to_open (arg, from_tty); +} + +/* Attach to process PID, then initialize for debugging it + and wait for the trace-trap that results from attaching. */ + +static void +freebsd_uthread_attach (args, from_tty) + char *args; + int from_tty; +{ + child_ops.to_attach (args, from_tty); + push_target (&freebsd_uthread_ops); + freebsd_uthread_attaching = 1; +} + +/* After an attach, see if the target is threaded */ + +static void +freebsd_uthread_post_attach (pid) + int pid; +{ + if (freebsd_uthread_active) + { + read_thread_offsets (); + + main_pid = pid; + + bind_target_thread_vector (&freebsd_uthread_vec); + + inferior_pid = find_active_thread (); + + add_thread (inferior_pid); + } + else + { + unpush_target (&freebsd_uthread_ops); + push_target (&child_ops); + } + + freebsd_uthread_attaching = 0; +} + +/* Take a program previously attached to and detaches it. + The program resumes execution and will no longer stop + on signals, etc. We'd better not have left any breakpoints + in the program or it'll die when it hits one. For this + to work, it may be necessary for the process to have been + previously attached. It *might* work if the program was + started via the normal ptrace (PTRACE_TRACEME). */ + +static void +freebsd_uthread_detach (args, from_tty) + char *args; + int from_tty; +{ + child_ops.to_detach (args, from_tty); +} + +/* Resume execution of process PID. If STEP is nozero, then + just single step it. If SIGNAL is nonzero, restart it with that + signal activated. We may have to convert pid from a thread-id to an LWP id + for procfs. */ + +static void +freebsd_uthread_resume (pid, step, signo) + int pid; + int step; + enum target_signal signo; +{ + struct cleanup *old_chain; + + if (freebsd_uthread_attaching) + { + child_ops.to_resume (pid, step, signo); + return; + } + + old_chain = save_inferior_pid (); + + pid = inferior_pid = main_pid; + + child_ops.to_resume (pid, step, signo); + + cached_thread = 0; + + do_cleanups (old_chain); +} + +/* Wait for any threads to stop. We may have to convert PID from a thread id + to a LWP id, and vice versa on the way out. */ + +static int +freebsd_uthread_wait (pid, ourstatus) + int pid; + struct target_waitstatus *ourstatus; +{ + int rtnval; + struct cleanup *old_chain; + + if (freebsd_uthread_attaching) + { + return child_ops.to_wait (pid, ourstatus); + } + + old_chain = save_inferior_pid (); + + inferior_pid = main_pid; + + if (pid != -1) + pid = main_pid; + + rtnval = child_ops.to_wait (pid, ourstatus); + + if (rtnval >= 0) + { + rtnval = find_active_thread (); + if (!in_thread_list (rtnval)) + add_thread (rtnval); + } + + do_cleanups (old_chain); + + return rtnval; +} + +#ifdef __i386__ + +static char sigmap[NUM_REGS] = /* map reg to sigcontext */ +{ + 12, /* eax */ + 11, /* ecx */ + 10, /* edx */ + 9, /* ebx */ + 8, /* esp */ + 7, /* ebp */ + 6, /* esi */ + 5, /* edi */ + 15, /* eip */ + 17, /* eflags */ + 16, /* cs */ + 19, /* ss */ + 4, /* ds */ + 3, /* es */ + 2, /* fs */ + 1, /* gs */ +}; + +static char jmpmap[NUM_REGS] = /* map reg to jmp_buf */ +{ + 6, /* eax */ + -1, /* ecx */ + -1, /* edx */ + 1, /* ebx */ + 2, /* esp */ + 3, /* ebp */ + 4, /* esi */ + 5, /* edi */ + 0, /* eip */ + -1, /* eflags */ + -1, /* cs */ + -1, /* ss */ + -1, /* ds */ + -1, /* es */ + -1, /* fs */ + -1, /* gs */ +}; + +#endif + +#ifdef __alpha__ + +static char sigmap[NUM_REGS] = /* map reg to sigcontext */ +{ + 1, 2, 3, 4, 5, 6, 7, 8, /* v0 - t6 */ + 9, 10, 11, 12, 13, 14, 15, 16, /* t7 - fp */ + 17, 18, 19, 20, 21, 22, 23, 24, /* a0 - t9 */ + 25, 26, 27, 28, 29, 30, 31, 32, /* t10 - zero */ + 38, 39, 40, 41, 42, 43, 44, 45, /* f0 - f7 */ + 46, 47, 48, 49, 50, 51, 52, 53, /* f8 - f15 */ + 54, 55, 56, 57, 58, 59, 60, 61, /* f16 - f23 */ + 62, 63, 64, 65, 66, 67, 68, 69, /* f24 - f31 */ + 33, -1 /* pc, vfp */ +}; +static char jmpmap[NUM_REGS] = { + 4, 5, 6, 7, 8, 9, 10, 11, /* v0 - t6 */ + 12, 13, 14, 15, 16, 17, 18, 19, /* t7 - fp */ + 20, 21, 22, 23, 24, 25, 26, 27, /* a0 - t9 */ + 28, 29, 30, 31, 32, 33, 34, 35, /* t10 - zero */ + 37, 38, 39, 40, 41, 42, 43, 44, /* f0 - f7 */ + 45, 46, 47, 48, 49, 50, 51, 52, /* f8 - f15 */ + 53, 54, 55, 56, 57, 58, 59, 60, /* f16 - f23 */ + 61, 62, 63, 64, 65, 66, 67, 68, /* f24 - f31 */ + 2, -1, /* pc, vfp */ +}; + +#endif + +static void +freebsd_uthread_fetch_registers (regno) + int regno; +{ + struct cached_pthread *thread; + struct cleanup *old_chain; + int i; + int active; + int first_regno, last_regno; + register_t *regbase; + char *regmap; + + if (freebsd_uthread_attaching) + { + child_ops.to_fetch_registers (regno); + return; + } + + thread = find_pthread (inferior_pid); + + old_chain = save_inferior_pid (); + + active = (inferior_pid == find_active_thread()); + + inferior_pid = main_pid; + + if (active) + { + child_ops.to_fetch_registers (regno); + + do_cleanups (old_chain); + + return; + } + + if (regno == -1) + { + first_regno = 0; + last_regno = NUM_REGS - 1; + } + else + { + first_regno = regno; + last_regno = regno; + } + + if (thread->sig_saved) + { + regbase = (register_t*) &thread->saved_sigcontext.uc_mcontext; + regmap = sigmap; + } + else + { + regbase = (register_t*) &thread->saved_jmp_buf[0]; + regmap = jmpmap; + } + + for (regno = first_regno; regno <= last_regno; regno++) + { + if (regmap[regno] == -1) + child_ops.to_fetch_registers (regno); + else + supply_register (regno, (char*) ®base[regmap[regno]]); + } + + do_cleanups (old_chain); +} + +static void +freebsd_uthread_store_registers (regno) + int regno; +{ + struct cached_pthread *thread; + CORE_ADDR ptr; + struct cleanup *old_chain; + int i; + int first_regno, last_regno; + u_int32_t *regbase; + char *regmap; + + if (freebsd_uthread_attaching) + { + child_ops.to_store_registers (regno); + return; + } + + thread = find_pthread (inferior_pid); + + old_chain = save_inferior_pid (); + + inferior_pid = main_pid; + + if (thread->state == PS_RUNNING_value) + { + child_ops.to_store_registers (regno); + + do_cleanups (old_chain); + + return; + } + + if (regno == -1) + { + first_regno = 0; + last_regno = NUM_REGS - 1; + } + else + { + first_regno = regno; + last_regno = regno; + } + + if (thread->sig_saved) + { + regbase = (u_int32_t*) &thread->saved_sigcontext; + regmap = sigmap; + } + else + { + regbase = (u_int32_t*) &thread->saved_jmp_buf[0]; + regmap = jmpmap; + } + + ptr = find_pthread_addr (inferior_pid); + for (regno = first_regno; regno <= last_regno; regno++) + { + if (regmap[regno] == -1) + child_ops.to_store_registers (regno); + else + { + u_int32_t *reg = ®base[regmap[regno]]; + int off; + + /* Hang onto cached value */ + memcpy(reg, registers + REGISTER_BYTE (regno), + REGISTER_RAW_SIZE (regno)); + + /* And push out to inferior */ + off = (char *) reg - (char *) thread; + write_memory (ptr + off, + registers + REGISTER_BYTE (regno), + REGISTER_RAW_SIZE (regno)); + } + } + + do_cleanups (old_chain); +} + +/* Get ready to modify the registers array. On machines which store + individual registers, this doesn't need to do anything. On machines + which store all the registers in one fell swoop, this makes sure + that registers contains all the registers from the program being + debugged. */ + +static void +freebsd_uthread_prepare_to_store () +{ + struct cleanup *old_chain; + + if (freebsd_uthread_attaching) + { + child_ops.to_prepare_to_store (); + return; + } + + old_chain = save_inferior_pid (); + inferior_pid = main_pid; + + child_ops.to_prepare_to_store (); + + do_cleanups (old_chain); +} + +static int +freebsd_uthread_xfer_memory (memaddr, myaddr, len, dowrite, target) + CORE_ADDR memaddr; + char *myaddr; + int len; + int dowrite; + struct target_ops *target; /* ignored */ +{ + int retval; + struct cleanup *old_chain; + + if (freebsd_uthread_attaching) + { + return child_ops.to_xfer_memory (memaddr, myaddr, len, dowrite, target); + } + + old_chain = save_inferior_pid (); + + inferior_pid = main_pid; + + retval = child_ops.to_xfer_memory (memaddr, myaddr, len, dowrite, target); + + do_cleanups (old_chain); + + return retval; +} + +/* Print status information about what we're accessing. */ + +static void +freebsd_uthread_files_info (ignore) + struct target_ops *ignore; +{ + child_ops.to_files_info (ignore); +} + +static void +freebsd_uthread_kill_inferior () +{ + inferior_pid = main_pid; + child_ops.to_kill (); +} + +static void +freebsd_uthread_notice_signals (pid) + int pid; +{ + struct cleanup *old_chain; + old_chain = save_inferior_pid (); + inferior_pid = main_pid; + + child_ops.to_notice_signals (pid); + + do_cleanups (old_chain); +} + +/* Fork an inferior process, and start debugging it with /proc. */ + +static void +freebsd_uthread_create_inferior (exec_file, allargs, env) + char *exec_file; + char *allargs; + char **env; +{ + child_ops.to_create_inferior (exec_file, allargs, env); + + if (inferior_pid && freebsd_uthread_active) + { + read_thread_offsets (); + + main_pid = inferior_pid; + + push_target (&freebsd_uthread_ops); + bind_target_thread_vector (&freebsd_uthread_vec); + + inferior_pid = find_active_thread (); + + add_thread (inferior_pid); + } +} + +/* This routine is called to find out if the inferior is using threads. + We check for the _thread_run and _thread_list globals. */ + +void +freebsd_uthread_new_objfile (objfile) + struct objfile *objfile; +{ + struct minimal_symbol *ms; + + if (!objfile) + { + freebsd_uthread_active = 0; + return; + } + + ms = lookup_minimal_symbol ("_thread_run", NULL, objfile); + + if (!ms) + return; + + P_thread_run = SYMBOL_VALUE_ADDRESS (ms); + + ms = lookup_minimal_symbol ("_thread_list", NULL, objfile); + + if (!ms) + return; + + P_thread_list = SYMBOL_VALUE_ADDRESS (ms); + +#define OFFSET_SYM(field) "_thread_" #field "_offset" +#define LOOKUP_OFFSET(field) \ + do { \ + ms = lookup_minimal_symbol (OFFSET_SYM(field), NULL, objfile); \ + if (!ms) \ + return; \ + P_thread_##field##_offset = SYMBOL_VALUE_ADDRESS (ms); \ + } while (0); + +#define VALUE_SYM(name) "_thread_" #name "_value" +#define LOOKUP_VALUE(name) \ + do { \ + ms = lookup_minimal_symbol (VALUE_SYM(name), NULL, objfile); \ + if (!ms) \ + return; \ + P_thread_##name##_value = SYMBOL_VALUE_ADDRESS (ms); \ + } while (0); + + LOOKUP_OFFSET(next); + LOOKUP_OFFSET(uniqueid); + LOOKUP_OFFSET(state); + LOOKUP_OFFSET(name); + LOOKUP_OFFSET(sig_saved); + LOOKUP_OFFSET(saved_sigcontext); + LOOKUP_OFFSET(saved_jmp_buf); + + LOOKUP_VALUE(PS_RUNNING); + LOOKUP_VALUE(PS_DEAD); + + freebsd_uthread_active = 1; +} + +int +freebsd_uthread_has_exited (pid, wait_status, exit_status) + int pid; + int wait_status; + int * exit_status; +{ + int t = child_ops.to_has_exited (pid, wait_status, exit_status); + if (t) + main_pid = -1; + return t; +} + +/* Clean up after the inferior dies. */ + +static void +freebsd_uthread_mourn_inferior () +{ + inferior_pid = main_pid; /* don't bother to restore inferior_pid */ + child_ops.to_mourn_inferior (); + unpush_target (&freebsd_uthread_ops); +} + +/* Mark our target-struct as eligible for stray "run" and "attach" commands. */ + +static int +freebsd_uthread_can_run () +{ + return child_suppress_run; +} + +static int +freebsd_uthread_thread_alive (pid) + int pid; +{ + struct cleanup *old_chain; + struct cached_pthread *thread; + int ret = 0; + + if (freebsd_uthread_attaching) + return 1; + + /* + * We can get called from child_ops.to_wait() which passes the underlying + * pid (without a thread number). + */ + if (THREADID_TID(pid) == 0) + return 1; + + old_chain = save_inferior_pid (); + inferior_pid = main_pid; + + if (find_pthread_addr (pid) != 0) + { + thread = find_pthread (pid); + ret = (thread->state != PS_DEAD_value); + } + + do_cleanups (old_chain); + + if (!ret) + free_pid(pid); + + return ret; +} + +static void +freebsd_uthread_stop () +{ + struct cleanup *old_chain; + old_chain = save_inferior_pid (); + inferior_pid = main_pid; + + child_ops.to_stop (); + + do_cleanups (old_chain); +} + +static int +freebsd_uthread_find_new_threads () +{ + CORE_ADDR ptr; + int state; + u_int64_t uniqueid; + struct cleanup *old_chain; + + old_chain = save_inferior_pid (); + inferior_pid = main_pid; + + read_memory ((CORE_ADDR)P_thread_list, + (char *)&ptr, + sizeof ptr); + + while (ptr != 0) + { + READ_FIELD(ptr, int, state, state); + READ_FIELD(ptr, u_int64_t, uniqueid, uniqueid); + if (state != PS_DEAD_value && + !in_thread_list (find_pid(uniqueid))) + add_thread (find_pid(uniqueid)); + ptr = read_pthread_next(ptr); + } + + do_cleanups (old_chain); + + return 0; +} + +/* MUST MATCH enum pthread_state */ +static const char *statenames[] = { + "RUNNING", + "SIGTHREAD", + "MUTEX_WAIT", + "COND_WAIT", + "FDLR_WAIT", + "FDLW_WAIT", + "FDR_WAIT", + "FDW_WAIT", + "FILE_WAIT", + "SELECT_WAIT", + "SLEEP_WAIT", + "WAIT_WAIT", + "SIGSUSPEND", + "SIGWAIT", + "SPINBLOCK", + "JOIN", + "SUSPENDED", + "DEAD", + "DEADLOCK", +}; + +static int +freebsd_uthread_get_thread_info (ref, selection, info) + gdb_threadref *ref; + int selection; + struct gdb_ext_thread_info *info; +{ + int pid = *ref; + struct cached_pthread *thread = find_pthread (pid); + struct cleanup *old_chain; + + old_chain = save_inferior_pid (); + inferior_pid = main_pid; + + memset(&info->threadid, 0, OPAQUETHREADBYTES); + + memcpy(&info->threadid, ref, sizeof *ref); + info->active = thread->state == PS_RUNNING_value; + strcpy(info->display, statenames[thread->state]); + if (thread->name) + read_memory ((CORE_ADDR) thread->name, info->shortname, 32); + else + strcpy(info->shortname, ""); + + do_cleanups (old_chain); +} + +char * +freebsd_uthread_pid_to_str (pid) + int pid; +{ + static char buf[30]; + + if (STREQ (current_target.to_shortname, "freebsd-uthreads")) + sprintf (buf, "process %d, thread %d\0", + THREADID_PID(pid), THREADID_TID(pid)); + else + sprintf (buf, "process %d\0", pid); + + return buf; +} + + +static void +init_freebsd_uthread_ops () +{ + freebsd_uthread_ops.to_shortname = "freebsd-uthreads"; + freebsd_uthread_ops.to_longname = "FreeBSD uthreads"; + freebsd_uthread_ops.to_doc = "FreeBSD user threads support."; + freebsd_uthread_ops.to_open = freebsd_uthread_open; + freebsd_uthread_ops.to_attach = freebsd_uthread_attach; + freebsd_uthread_ops.to_post_attach = freebsd_uthread_post_attach; + freebsd_uthread_ops.to_detach = freebsd_uthread_detach; + freebsd_uthread_ops.to_resume = freebsd_uthread_resume; + freebsd_uthread_ops.to_wait = freebsd_uthread_wait; + freebsd_uthread_ops.to_fetch_registers = freebsd_uthread_fetch_registers; + freebsd_uthread_ops.to_store_registers = freebsd_uthread_store_registers; + freebsd_uthread_ops.to_prepare_to_store = freebsd_uthread_prepare_to_store; + freebsd_uthread_ops.to_xfer_memory = freebsd_uthread_xfer_memory; + freebsd_uthread_ops.to_files_info = freebsd_uthread_files_info; + freebsd_uthread_ops.to_insert_breakpoint = memory_insert_breakpoint; + freebsd_uthread_ops.to_remove_breakpoint = memory_remove_breakpoint; + freebsd_uthread_ops.to_terminal_init = terminal_init_inferior; + freebsd_uthread_ops.to_terminal_inferior = terminal_inferior; + freebsd_uthread_ops.to_terminal_ours_for_output = terminal_ours_for_output; + freebsd_uthread_ops.to_terminal_ours = terminal_ours; + freebsd_uthread_ops.to_terminal_info = child_terminal_info; + freebsd_uthread_ops.to_kill = freebsd_uthread_kill_inferior; + freebsd_uthread_ops.to_create_inferior = freebsd_uthread_create_inferior; + freebsd_uthread_ops.to_has_exited = freebsd_uthread_has_exited; + freebsd_uthread_ops.to_mourn_inferior = freebsd_uthread_mourn_inferior; + freebsd_uthread_ops.to_can_run = freebsd_uthread_can_run; + freebsd_uthread_ops.to_notice_signals = freebsd_uthread_notice_signals; + freebsd_uthread_ops.to_thread_alive = freebsd_uthread_thread_alive; + freebsd_uthread_ops.to_stop = freebsd_uthread_stop; + freebsd_uthread_ops.to_stratum = process_stratum; + freebsd_uthread_ops.to_has_all_memory = 1; + freebsd_uthread_ops.to_has_memory = 1; + freebsd_uthread_ops.to_has_stack = 1; + freebsd_uthread_ops.to_has_registers = 1; + freebsd_uthread_ops.to_has_execution = 1; + freebsd_uthread_ops.to_has_thread_control = 0; + freebsd_uthread_ops.to_magic = OPS_MAGIC; + + freebsd_uthread_vec.find_new_threads = freebsd_uthread_find_new_threads; + freebsd_uthread_vec.get_thread_info = freebsd_uthread_get_thread_info; +} + +void +_initialize_freebsd_uthread () +{ + init_freebsd_uthread_ops (); + add_target (&freebsd_uthread_ops); + + child_suppress_run = 1; +} Property changes on: stable/4/gnu/usr.bin/binutils/gdb/freebsd-uthread.c ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Index: stable/4/sys/alpha/alpha/dec_2100_a500.c =================================================================== --- stable/4/sys/alpha/alpha/dec_2100_a500.c (nonexistent) +++ stable/4/sys/alpha/alpha/dec_2100_a500.c (revision 60994) @@ -0,0 +1,155 @@ +/* + * Copyright (c) 2000 Andrew Gallatin + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include "opt_ddb.h" + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "sio.h" +#include "sc.h" +#ifndef CONSPEED +#define CONSPEED TTYDEF_SPEED +#endif +static int comcnrate = CONSPEED; + +void dec_2100_a500_init __P((int)); +static void dec_2100_a500_cons_init __P((void)); +static void dec_2100_a500_intr_map __P((void *)); +static void dec_2100_a500_intr_init __P((void )); + +extern int siocnattach __P((int, int)); +extern int siogdbattach __P((int, int)); +extern int sccnattach __P((void)); + +extern vm_offset_t t2_csr_base; + +void +dec_2100_a500_init(cputype) +{ + + /* + * see if we're a Sable or a Lynx + */ + if (cputype == ST_DEC_2100_A500) { + t2_csr_base = SABLE_BASE; + platform.family = "DEC AlphaServer 2100"; + } else if (cputype == ST_DEC_2100A_A500) { + t2_csr_base = LYNX_BASE; + platform.family = "DEC AlphaServer 2100A"; + } else { + t2_csr_base = SABLE_BASE; + platform.family = "DEC AlphaServer 2100?????"; + } + + + if ((platform.model = alpha_dsr_sysname()) == NULL) { + platform.model = alpha_unknown_sysname(); + } + + platform.iobus = "t2"; + platform.cons_init = dec_2100_a500_cons_init; + platform.pci_intr_map = dec_2100_a500_intr_map; + platform.pci_intr_init = dec_2100_a500_intr_init; + + + t2_init(); +} + +extern int comconsole; /* XXX for forcing comconsole when srm serial console is used */ + +static void +dec_2100_a500_cons_init() +{ + struct ctb *ctb; + t2_init(); + +#ifdef DDB + siogdbattach(0x2f8, 9600); +#endif + ctb = (struct ctb *)(((caddr_t)hwrpb) + hwrpb->rpb_ctb_off); + + switch (ctb->ctb_term_type) { + case 2: + /* serial console ... */ + /* XXX */ + /* + * Delay to allow PROM putchars to complete. + * FIFO depth * character time, + * character time = (1000000 / (defaultrate / 10)) + */ + DELAY(160000000 / comcnrate); + /* + * force a comconsole on com1 if the SRM has a serial console + */ + comconsole = 0; + if (siocnattach(0x3f8, comcnrate)) + panic("can't init serial console"); + break; + + case 3: + /* display console ... */ + /* XXX */ +#if NSC > 0 + sccnattach(); +#else + panic("not configured to use display && keyboard console"); +#endif + break; + + default: + printf("ctb->ctb_term_type = 0x%lx\n", ctb->ctb_term_type); + panic("consinit: unknown console type"); + } +} + +void +dec_2100_a500_intr_map(void *arg) +{ + pcicfgregs *cfg = (pcicfgregs *)arg; + + cfg->intline += 32; +} + +void +dec_2100_a500_intr_init(void ) +{ + outb(SLAVE0_ICU, 0); + outb(SLAVE1_ICU, 0); + outb(SLAVE2_ICU, 0); + outb(MASTER_ICU, 0x44); +} Property changes on: stable/4/sys/alpha/alpha/dec_2100_a500.c ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Index: stable/4/sys/alpha/pci/t2.c =================================================================== --- stable/4/sys/alpha/pci/t2.c (nonexistent) +++ stable/4/sys/alpha/pci/t2.c (revision 60994) @@ -0,0 +1,658 @@ +/* + * Copyright (c) 2000 Andrew Gallatin & Doug Rabson + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +/* + * T2 CBUS to PCI bridge + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#define KV(pa) ALPHA_PHYS_TO_K0SEG(pa + t2_csr_base) + +vm_offset_t t2_csr_base = 0UL; + +static devclass_t t2_devclass; +static device_t t2_0; /* XXX only one for now */ + +struct t2_softc { + int junk; +}; + +#define T2_SOFTC(dev) (struct t2_softc*) device_get_softc(dev) + +static alpha_chipset_inb_t t2_inb; +static alpha_chipset_inw_t t2_inw; +static alpha_chipset_inl_t t2_inl; +static alpha_chipset_outb_t t2_outb; +static alpha_chipset_outw_t t2_outw; +static alpha_chipset_outl_t t2_outl; +static alpha_chipset_readb_t t2_readb; +static alpha_chipset_readw_t t2_readw; +static alpha_chipset_readl_t t2_readl; +static alpha_chipset_writeb_t t2_writeb; +static alpha_chipset_writew_t t2_writew; +static alpha_chipset_writel_t t2_writel; +static alpha_chipset_maxdevs_t t2_maxdevs; +static alpha_chipset_cfgreadb_t t2_cfgreadb; +static alpha_chipset_cfgreadw_t t2_cfgreadw; +static alpha_chipset_cfgreadl_t t2_cfgreadl; +static alpha_chipset_cfgwriteb_t t2_cfgwriteb; +static alpha_chipset_cfgwritew_t t2_cfgwritew; +static alpha_chipset_cfgwritel_t t2_cfgwritel; +static alpha_chipset_addrcvt_t t2_cvt_dense; +static alpha_chipset_read_hae_t t2_read_hae; +static alpha_chipset_write_hae_t t2_write_hae; + +static alpha_chipset_t t2_chipset = { + t2_inb, + t2_inw, + t2_inl, + t2_outb, + t2_outw, + t2_outl, + t2_readb, + t2_readw, + t2_readl, + t2_writeb, + t2_writew, + t2_writel, + t2_maxdevs, + t2_cfgreadb, + t2_cfgreadw, + t2_cfgreadl, + t2_cfgwriteb, + t2_cfgwritew, + t2_cfgwritel, + t2_cvt_dense, + NULL, + t2_read_hae, + t2_write_hae, +}; + +static u_int8_t +t2_inb(u_int32_t port) +{ + alpha_mb(); + return SPARSE_READ_BYTE(KV(T2_PCI_SIO), port); +} + +static u_int16_t +t2_inw(u_int32_t port) +{ + alpha_mb(); + return SPARSE_READ_WORD(KV(T2_PCI_SIO), port); +} + +static u_int32_t +t2_inl(u_int32_t port) +{ + alpha_mb(); + return SPARSE_READ_LONG(KV(T2_PCI_SIO), port); +} + +static void +t2_outb(u_int32_t port, u_int8_t data) +{ + SPARSE_WRITE_BYTE(KV(T2_PCI_SIO), port, data); + alpha_wmb(); +} + +static void +t2_outw(u_int32_t port, u_int16_t data) +{ + SPARSE_WRITE_WORD(KV(T2_PCI_SIO), port, data); + alpha_wmb(); +} + +static void +t2_outl(u_int32_t port, u_int32_t data) +{ + SPARSE_WRITE_LONG(KV(T2_PCI_SIO), port, data); + alpha_wmb(); +} + +static u_int32_t t2_hae_mem; + +#define REG1 (1UL << 24) + +static __inline void +t2_set_hae_mem(u_int32_t *pa) +{ + int s; + u_int32_t msb; + + if(*pa >= REG1){ + msb = *pa & 0xf8000000; + *pa -= msb; + msb >>= 27; /* t2 puts high bits in the bottom of the register */ + s = splhigh(); + if (msb != t2_hae_mem) { + t2_hae_mem = msb; + REGVAL(T2_HAE0_1) = t2_hae_mem; + alpha_mb(); + t2_hae_mem = REGVAL(T2_HAE0_1); + } + splx(s); + } +} + +static u_int8_t +t2_readb(u_int32_t pa) +{ + alpha_mb(); + t2_set_hae_mem(&pa); + return SPARSE_READ_BYTE(KV(T2_PCI_SPARSE), pa); +} + +static u_int16_t +t2_readw(u_int32_t pa) +{ + alpha_mb(); + t2_set_hae_mem(&pa); + return SPARSE_READ_WORD(KV(T2_PCI_SPARSE), pa); +} + +static u_int32_t +t2_readl(u_int32_t pa) +{ + alpha_mb(); + t2_set_hae_mem(&pa); + return SPARSE_READ_LONG(KV(T2_PCI_SPARSE), pa); +} + +static void +t2_writeb(u_int32_t pa, u_int8_t data) +{ + t2_set_hae_mem(&pa); + SPARSE_WRITE_BYTE(KV(T2_PCI_SPARSE), pa, data); + alpha_wmb(); +} + +static void +t2_writew(u_int32_t pa, u_int16_t data) +{ + t2_set_hae_mem(&pa); + SPARSE_WRITE_WORD(KV(T2_PCI_SPARSE), pa, data); + alpha_wmb(); +} + +static void +t2_writel(u_int32_t pa, u_int32_t data) +{ + t2_set_hae_mem(&pa); + SPARSE_WRITE_LONG(KV(T2_PCI_SPARSE), pa, data); + alpha_wmb(); +} + +static int +t2_maxdevs(u_int b) +{ + return 12; /* XXX */ +} + + + +/* XXX config space access? */ + +static vm_offset_t +t2_cvt_dense(vm_offset_t addr) +{ + addr &= 0xffffffffUL; + return (addr | T2_PCI_DENSE); + +} + +static u_int64_t +t2_read_hae(void) +{ + return t2_hae_mem << 27; +} + +static void +t2_write_hae(u_int64_t hae) +{ + u_int32_t pa = hae; + t2_set_hae_mem(&pa); +} + +#define T2_CFGOFF(b, s, f, r) \ + ((b) ? (((b) << 16) | ((s) << 11) | ((f) << 8) | (r)) \ + : ((1 << ((s) + 11)) | ((f) << 8) | (r))) + +#define T2_TYPE1_SETUP(b,s,old_hae3) if((b)) { \ + do { \ + (s) = splhigh(); \ + (old_hae3) = REGVAL(T2_HAE0_3); \ + alpha_mb(); \ + REGVAL(T2_HAE0_3) = (old_hae3) | (1<<30); \ + alpha_mb(); \ + } while(0); \ +} + +#define T2_TYPE1_TEARDOWN(b,s,old_hae3) if((b)) { \ + do { \ + alpha_mb(); \ + REGVAL(T2_HAE0_3) = (old_hae3); \ + alpha_mb(); \ + splx((s)); \ + } while(0); \ +} + +#define SWIZ_CFGREAD(b, s, f, r, width, type) \ + type val = ~0; \ + int ipl = 0; \ + u_int32_t old_hae3 = 0; \ + vm_offset_t off = T2_CFGOFF(b, s, f, r); \ + vm_offset_t kv = SPARSE_##width##_ADDRESS(KV(T2_PCI_CONF), off); \ + alpha_mb(); \ + T2_TYPE1_SETUP(b,ipl,old_hae3); \ + if (!badaddr((caddr_t)kv, sizeof(type))) { \ + val = SPARSE_##width##_EXTRACT(off, SPARSE_READ(kv)); \ + } \ + T2_TYPE1_TEARDOWN(b,ipl,old_hae3); \ + return val; + +#define SWIZ_CFGWRITE(b, s, f, r, data, width, type) \ + int ipl = 0; \ + u_int32_t old_hae3 = 0; \ + vm_offset_t off = T2_CFGOFF(b, s, f, r); \ + vm_offset_t kv = SPARSE_##width##_ADDRESS(KV(T2_PCI_CONF), off); \ + alpha_mb(); \ + T2_TYPE1_SETUP(b,ipl,old_hae3); \ + if (!badaddr((caddr_t)kv, sizeof(type))) { \ + SPARSE_WRITE(kv, SPARSE_##width##_INSERT(off, data)); \ + alpha_wmb(); \ + } \ + T2_TYPE1_TEARDOWN(b,ipl,old_hae3); \ + return; + +static u_int8_t +t2_cfgreadb(u_int h, u_int b, u_int s, u_int f, u_int r) +{ + SWIZ_CFGREAD(b, s, f, r, BYTE, u_int8_t); +} + +static u_int16_t +t2_cfgreadw(u_int h, u_int b, u_int s, u_int f, u_int r) +{ + SWIZ_CFGREAD(b, s, f, r, WORD, u_int16_t); +} + +static u_int32_t +t2_cfgreadl(u_int h, u_int b, u_int s, u_int f, u_int r) +{ + SWIZ_CFGREAD(b, s, f, r, LONG, u_int32_t); +} + +static void +t2_cfgwriteb(u_int h, u_int b, u_int s, u_int f, u_int r, u_int8_t data) +{ + SWIZ_CFGWRITE(b, s, f, r, data, BYTE, u_int8_t); +} + +static void +t2_cfgwritew(u_int h, u_int b, u_int s, u_int f, u_int r, u_int16_t data) +{ + SWIZ_CFGWRITE(b, s, f, r, data, WORD, u_int16_t); +} + +static void +t2_cfgwritel(u_int h, u_int b, u_int s, u_int f, u_int r, u_int32_t data) +{ + SWIZ_CFGWRITE(b, s, f, r, data, LONG, u_int32_t); +} + +static int t2_probe(device_t dev); +static int t2_attach(device_t dev); +static int t2_setup_intr(device_t dev, device_t child, + struct resource *irq, int flags, + void *intr, void *arg, void **cookiep); +static int t2_teardown_intr(device_t dev, device_t child, + struct resource *irq, void *cookie); +static void +t2_dispatch_intr(void *frame, unsigned long vector); +static void +t2_machine_check(unsigned long mces, struct trapframe *framep, + unsigned long vector, unsigned long param); + + +static device_method_t t2_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, t2_probe), + DEVMETHOD(device_attach, t2_attach), + + /* Bus interface */ + DEVMETHOD(bus_alloc_resource, pci_alloc_resource), + DEVMETHOD(bus_release_resource, pci_release_resource), + DEVMETHOD(bus_activate_resource, pci_activate_resource), + DEVMETHOD(bus_deactivate_resource, pci_deactivate_resource), + DEVMETHOD(bus_setup_intr, t2_setup_intr), + DEVMETHOD(bus_teardown_intr, t2_teardown_intr), + + { 0, 0 } +}; + +static driver_t t2_driver = { + "t2", + t2_methods, + sizeof(struct t2_softc), +}; + + +#define T2_SGMAP_BASE (8*1024*1024) +#define T2_SGMAP_SIZE (8*1024*1024) + +static void +t2_sgmap_invalidate(void) +{ + u_int64_t val; + + alpha_mb(); + val = REGVAL64(T2_IOCSR); + val |= T2_IOCSRL_ITLB; + REGVAL64(T2_IOCSR) = val; + alpha_mb(); + alpha_mb(); + val = REGVAL64(T2_IOCSR); + val &= ~T2_IOCSRL_ITLB; + REGVAL64(T2_IOCSR) = val; + alpha_mb(); + alpha_mb(); +} + +static void +t2_sgmap_map(void *arg, vm_offset_t ba, vm_offset_t pa) +{ + u_int64_t *sgtable = arg; + int index = alpha_btop(ba - T2_SGMAP_BASE); + + if (pa) { + if (pa > (1L<<32)) + panic("t2_sgmap_map: can't map address 0x%lx", pa); + sgtable[index] = ((pa >> 13) << 1) | 1; + } else { + sgtable[index] = 0; + } + alpha_mb(); + t2_sgmap_invalidate(); +} + + +static void +t2_init_sgmap(void) +{ + void *sgtable; + + /* + * First setup Window 2 to map 8Mb to 16Mb with an + * sgmap. Allocate the map aligned to a 32 boundary. + * + * bits 31..20 of WBASE represent the pci start address + * (in units of 1Mb), and bits 11..0 represent the pci + * end address + */ + REGVAL(T2_WBASE2) = T2_WSIZE_8M|T2_WINDOW_ENABLE|T2_WINDOW_SG + | ((T2_SGMAP_BASE >> 20) << 20) + | ((T2_SGMAP_BASE + T2_SGMAP_SIZE) >> 20); + REGVAL(T2_WMASK2) = T2_WMASK_8M; + alpha_mb(); + + sgtable = contigmalloc(8192, M_DEVBUF, M_NOWAIT, + 0, (1L<<34), + 32*1024, (1L<<34)); + if (!sgtable) + panic("t2_init_sgmap: can't allocate page table"); + + REGVAL(T2_TBASE2) = + (pmap_kextract((vm_offset_t) sgtable) >> T2_TBASE_SHIFT); + + chipset.sgmap = sgmap_map_create(T2_SGMAP_BASE, + T2_SGMAP_BASE + T2_SGMAP_SIZE, + t2_sgmap_map, sgtable); +} + +/* + * Perform basic chipset init/fixup. Called by various early + * consumers to ensure that the system will work before the + * bus methods are invoked. + * + */ + +void +t2_init() +{ + static int initted = 0; + + if (initted) return; + initted = 1; + + chipset = t2_chipset; +} + +static int +t2_probe(device_t dev) +{ + device_t child; + + if (t2_0) + return ENXIO; + t2_0 = dev; + device_set_desc(dev, "T2 Core Logic chipset"); + + pci_init_resources(); + + /* + * initialize the DMA windows + */ + + REGVAL(T2_WBASE1) = T2_WSIZE_1G|T2_WINDOW_ENABLE|T2_WINDOW_DIRECT|0x7ff; + REGVAL(T2_WMASK1) = T2_WMASK_1G; + REGVAL(T2_TBASE1) = 0; + + REGVAL(T2_WBASE2) = 0x0; + + + /* + * enable the PCI "Hole" for ISA devices which use memory in + * the 512k - 1MB range + */ + REGVAL(T2_HBASE) = 1 << 13; + t2_init_sgmap(); + + + /* initialize the HAEs */ + REGVAL(T2_HAE0_1) = 0x0; + alpha_mb(); + REGVAL(T2_HAE0_2) = 0x0; + alpha_mb(); + REGVAL(T2_HAE0_3) = 0x0; + alpha_mb(); + + child = device_add_child(dev, "pcib", 0); + device_set_ivars(child, 0); + + return 0; +} + +static int +t2_attach(device_t dev) +{ + t2_init(); + + platform.mcheck_handler = t2_machine_check; + set_iointr(t2_dispatch_intr); + platform.isa_setup_intr = t2_setup_intr; + platform.isa_teardown_intr = t2_teardown_intr; + + snprintf(chipset_type, sizeof(chipset_type), "t2"); + + bus_generic_attach(dev); + + return 0; +} + +/* + * magical mystery table partly obtained from Linux + * at least some of their values for PCI masks + * were incorrect, and I've filled in my own extrapolations + * XXX this needs more testers + */ + +unsigned long t2_shadow_mask = -1L; +static const char irq_to_mask[40] = { + -1, 6, -1, 8, 15, 12, 7, 9, /* ISA 0-7 */ + -1, 16, 17, 18, 3, -1, 21, 22, /* ISA 8-15 */ + -1, -1, -1, -1, -1, -1, -1, -1, /* ?? EISA XXX */ + -1, -1, -1, -1, -1, -1, -1, -1, /* ?? EISA XXX */ + 0, 1, 2, 3, 4, 5, 6, 7 /* PCI 0-7 XXX */ +}; + +static int +t2_setup_intr(device_t dev, device_t child, + struct resource *irq, int flags, + void *intr, void *arg, void **cookiep) +{ + int error, mask, vector; + + mask = irq_to_mask[irq->r_start]; + vector = 0x800 + (mask << 4); + + error = rman_activate_resource(irq); + if (error) + return error; + + error = alpha_setup_intr(vector, + intr, arg, cookiep, + &intrcnt[irq->r_start]); + if (error) + return error; + + /* Enable interrupt */ + + t2_shadow_mask &= ~(1UL << mask); + + if (mask <= 7) + outb(SLAVE0_ICU, t2_shadow_mask); + else if (mask <= 15) + outb(SLAVE1_ICU, t2_shadow_mask >> 8); + else + outb(SLAVE2_ICU, t2_shadow_mask >> 16); + + device_printf(child, "interrupting at T2 irq %d\n", + (int) irq->r_start); + + return 0; +} + +static int +t2_teardown_intr(device_t dev, device_t child, + struct resource *irq, void *cookie) +{ + int mask; + + mask = irq_to_mask[irq->r_start]; + + /* Disable interrupt */ + + t2_shadow_mask |= (1UL << mask); + + if (mask <= 7) + outb(SLAVE0_ICU, t2_shadow_mask); + else if (mask <= 15) + outb(SLAVE1_ICU, t2_shadow_mask >> 8); + else + outb(SLAVE2_ICU, t2_shadow_mask >> 16); + + alpha_teardown_intr(cookie); + return rman_deactivate_resource(irq); +} + +static void +t2_ack_intr(unsigned long vector) +{ + int mask = (vector - 0x800) >> 4; + + switch (mask) { + case 0 ... 7: + outb(SLAVE0_ICU-1, (0xe0 | (mask))); + outb(MASTER_ICU-1, (0xe0 | 1)); + break; + case 8 ... 15: + outb(SLAVE1_ICU-1, (0xe0 | (mask - 8))); + outb(MASTER_ICU-1, (0xe0 | 3)); + break; + case 16 ... 24: + outb(SLAVE2_ICU-1, (0xe0 | (mask - 16))); + outb(MASTER_ICU-1, (0xe0 | 4)); + break; + } +} + + +static void +t2_dispatch_intr(void *frame, unsigned long vector) +{ + alpha_dispatch_intr(frame, vector); + t2_ack_intr(vector); +} + +static void +t2_machine_check(unsigned long mces, struct trapframe *framep, + unsigned long vector, unsigned long param) +{ + int expected; + + expected = mc_expected; + machine_check(mces, framep, vector, param); + /* for some reason the alpha_pal_wrmces() doesn't clear all + pending machine checks & we may take another */ + mc_expected = expected; +} + +DRIVER_MODULE(t2, root, t2_driver, t2_devclass, 0, 0); Property changes on: stable/4/sys/alpha/pci/t2.c ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Index: stable/4/sys/alpha/pci/t2_pci.c =================================================================== --- stable/4/sys/alpha/pci/t2_pci.c (nonexistent) +++ stable/4/sys/alpha/pci/t2_pci.c (revision 60994) @@ -0,0 +1,87 @@ +/*- + * Copyright (c) 2000 Doug Rabson + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPELCAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +static devclass_t pcib_devclass; + +static int +t2_pcib_probe(device_t dev) +{ + device_t child; + + device_set_desc(dev, "T2 PCI host bus adapter"); + + child = device_add_child(dev, "pci", 0); + device_set_ivars(child, 0); + + return 0; +} + +static int +t2_pcib_read_ivar(device_t dev, device_t child, int which, u_long *result) +{ + if (which == PCIB_IVAR_HOSE) { + *result = 0; + return 0; + } + return ENOENT; +} + +static device_method_t t2_pcib_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, t2_pcib_probe), + DEVMETHOD(device_attach, bus_generic_attach), + + /* Bus interface */ + DEVMETHOD(bus_print_child, bus_generic_print_child), + DEVMETHOD(bus_read_ivar, t2_pcib_read_ivar), + DEVMETHOD(bus_alloc_resource, bus_generic_alloc_resource), + DEVMETHOD(bus_release_resource, bus_generic_release_resource), + DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), + DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), + DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), + DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), + + { 0, 0 } +}; + +static driver_t t2_pcib_driver = { + "pcib", + t2_pcib_methods, + 1, +}; + +DRIVER_MODULE(pcib, t2, t2_pcib_driver, pcib_devclass, 0, 0); Property changes on: stable/4/sys/alpha/pci/t2_pci.c ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Index: stable/4/sys/alpha/pci/t2reg.h =================================================================== --- stable/4/sys/alpha/pci/t2reg.h (nonexistent) +++ stable/4/sys/alpha/pci/t2reg.h (revision 60994) @@ -0,0 +1,172 @@ +/* + * Copyright (c) 2000 Doug Rabson & Andrew Gallatin + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + + + +/* + * Registers in the T2 CBUS-to-PCI bridge as used in the SABLE + * systems. + */ + +#define REGVAL(r) (*(volatile int32_t *) \ + ALPHA_PHYS_TO_K0SEG(r + t2_csr_base)) +#define REGVAL64(r) (*(volatile int64_t *) \ + ALPHA_PHYS_TO_K0SEG(r + t2_csr_base)) + +#define SABLE_BASE 0x0UL /* offset of SABLE CSRs */ +#define LYNX_BASE 0x8000000000UL /* offset of LYNX CSRs */ + +#define CBUS_BASE 0x380000000 /* CBUS CSRs */ +#define T2_PCI_SIO 0x3a0000000 /* PCI sparse I/O space */ +#define T2_PCI_CONF 0x390000000 /* PCI configuration space */ +#define T2_PCI_SPARSE 0x200000000 /* PCI sparse memory space */ +#define T2_PCI_DENSE 0x3c0000000 /* PCI dense memory space */ + +#define T2_IOCSR (CBUS_BASE + 0xe000000) + /* Low word */ +#define T2_IOCSRL_EL 0x00000002UL /* loopback enable */ +#define T2_IOCSRL_ESMV 0x00000004UL /* enable state machine visibility */ +#define T2_IOCSRL_PDBP 0x00000008UL /* PCI drive bad parity */ +#define T2_IOCSRL_SLOT0 0x00000030UL /* PCI slot 0 present bits */ +#define T2_IOCSRL_PINT 0x00000040UL /* PCI interrupt */ +#define T2_IOCSRL_ENTLBEC 0x00000080UL /* enable TLB error check */ +#define T2_IOCSRL_ENCCDMA 0x00000100UL /* enable CXACK for DMA */ +#define T2_IOCSRL_ENXXCHG 0x00000400UL /* enable exclusive exchange for EV5 */ +#define T2_IOCSRL_CAWWP0 0x00001000UL /* CBUS command/address write wrong parity 0 */ +#define T2_IOCSRL_CAWWP2 0x00002000UL /* CBUS command/address write wrong parity 2 */ +#define T2_IOCSRL_CDWWPE 0x00004000UL /* CBUS data write wrong parity even */ +#define T2_IOCSRL_SLOT2 0x00008000UL /* PCI slot 2 present bit */ +#define T2_IOCSRL_PSERR 0x00010000UL /* power supply error */ +#define T2_IOCSRL_MBA7 0x00020000UL /* MBA7 asserted */ +#define T2_IOCSRL_SLOT1 0x000c0000UL /* PCI slot 1 present bits */ +#define T2_IOCSRL_PDWWP1 0x00100000UL /* PCI DMA write wrong parity HW1 */ +#define T2_IOCSRL_PDWWP0 0x00200000UL /* PCI DMA write wrong parity HW0 */ +#define T2_IOCSRL_PBR 0x00400000UL /* PCI bus reset */ +#define T2_IOCSRL_PIR 0x00800000UL /* PCI interface reset */ +#define T2_IOCSRL_ENCOI 0x01000000UL /* enable NOACK, CUCERR and out-of-sync int */ +#define T2_IOCSRL_EPMS 0x02000000UL /* enable PCI memory space */ +#define T2_IOCSRL_ETLB 0x04000000UL /* enable TLB */ +#define T2_IOCSRL_EACC 0x08000000UL /* enable atomic CBUS cycles */ +#define T2_IOCSRL_ITLB 0x10000000UL /* flush TLB */ +#define T2_IOCSRL_ECPC 0x20000000UL /* enable CBUS parity check */ +#define T2_IOCSRL_CIR 0x40000000UL /* CBUS interface reset */ +#define T2_IOCSRL_EPL 0x80000000UL /* enable PCI lock */ + /* High word */ +#define T2_IOCSRH_CBBCE 0x00000001UL /* CBUS back-to-back cycle enable */ +#define T2_IOCSRH_TM 0x0000000eUL /* T2 revision number */ +#define T2_IOCSRH_SMVL 0x00000070UL /* state machine visibility select */ +#define T2_IOCSRH_SLOT2 0x00000080UL /* PCI slot 2 present bit */ +#define T2_IOCSRH_EPR 0x00000100UL /* enable passive release */ +#define T2_IOCSRH_CAWWP1 0x00001000UL /* cbus command/address write wrong parity 1 */ +#define T2_IOCSRH_CAWWP3 0x00002000UL /* cbus command/address write wrong parity 3 */ +#define T2_IOCSRH_DWWPO 0x00004000UL /* CBUS data write wrong parity odd */ +#define T2_IOCSRH_PRM 0x00100000UL /* PCI read multiple */ +#define T2_IOCSRH_PWM 0x00200000UL /* PCI write multiple */ +#define T2_IOCSRH_FPRDPED 0x00400000UL /* force PCI RDPE detect */ +#define T2_IOCSRH_PFAPED 0x00800000UL /* force PCI APE detect */ +#define T2_IOCSRH_FPWDPED 0x01000000UL /* force PCI WDPE detect */ +#define T2_IOCSRH_EPNMI 0x02000000UL /* enable PCI NMI */ +#define T2_IOCSRH_EPDTI 0x04000000UL /* enable PCI DTI */ +#define T2_IOCSRH_EPSEI 0x08000000UL /* enable PCI SERR interrupt */ +#define T2_IOCSRH_EPPEI 0x10000000UL /* enable PCI PERR interrupt */ +#define T2_IOCSRH_ERDPC 0x20000000UL /* enable PCI RDP interrupt */ +#define T2_IOCSRH_EADPC 0x40000000UL /* enable PCI AP interrupt */ +#define T2_IOCSRH_EWDPC 0x80000000UL /* enable PCI WDP interrupt */ + +#define T2_CERR1 (CBUS_BASE + 0xe000020) +#define T2_CERR2 (CBUS_BASE + 0xe000040) +#define T2_CERR3 (CBUS_BASE + 0xe000060) +#define T2_PERR1 (CBUS_BASE + 0xe000080) +#define T2_PERR1_PWDPE 0x00000001 /* PCI write data parity error */ +#define T2_PERR1_PAPE 0x00000002 /* PCI address parity error */ +#define T2_PERR1_PRDPE 0x00000004 /* PCI read data parity error */ +#define T2_PERR1_PPE 0x00000008 /* PCI parity error */ +#define T2_PERR1_PSE 0x00000010 /* PCI system error */ +#define T2_PERR1_PDTE 0x00000020 /* PCI device timeout error */ +#define T2_PERR1_NMI 0x00000040 /* PCI NMI */ + +#define T2_PERR2 (CBUS_BASE + 0xe0000a0) +#define T2_PSCR (CBUS_BASE + 0xe0000c0) +#define T2_HAE0_1 (CBUS_BASE + 0xe0000e0) +#define T2_HAE0_2 (CBUS_BASE + 0xe000100) +#define T2_HBASE (CBUS_BASE + 0xe000120) +#define T2_WBASE1 (CBUS_BASE + 0xe000140) +#define T2_WMASK1 (CBUS_BASE + 0xe000160) +#define T2_TBASE1 (CBUS_BASE + 0xe000180) +#define T2_WBASE2 (CBUS_BASE + 0xe0001a0) +#define T2_WMASK2 (CBUS_BASE + 0xe0001c0) +#define T2_TBASE2 (CBUS_BASE + 0xe0001e0) +#define T2_TLBBR (CBUS_BASE + 0xe000200) +#define T2_HAE0_3 (CBUS_BASE + 0xe000240) +#define T2_HAE0_4 (CBUS_BASE + 0xe000280) + +/* + * DMA window constants, section 5.2.1.1.1 of the + * Sable I/O Specification + */ + +#define T2_WINDOW_ENABLE 0x00080000 +#define T2_WINDOW_DISABLE 0x00000000 +#define T2_WINDOW_SG 0x00040000 +#define T2_WINDOW_DIRECT 0x00000000 + +#define T2_WMASK_2G 0x7ff00000 +#define T2_WMASK_1G 0x3ff00000 +#define T2_WMASK_512M 0x1ff00000 +#define T2_WMASK_256M 0x0ff00000 +#define T2_WMASK_128M 0x07f00000 +#define T2_WMASK_64M 0x03f00000 +#define T2_WMASK_32M 0x01f00000 +#define T2_WMASK_16M 0x00f00000 +#define T2_WMASK_8M 0x00700000 +#define T2_WMASK_4M 0x00300000 +#define T2_WMASK_2M 0x00100000 +#define T2_WMASK_1M 0x00000000 + + +#define T2_WSIZE_2G 0x80000000 +#define T2_WSIZE_1G 0x40000000 +#define T2_WSIZE_512M 0x20000000 +#define T2_WSIZE_256M 0x10000000 +#define T2_WSIZE_128M 0x08000000 +#define T2_WSIZE_64M 0x04000000 +#define T2_WSIZE_32M 0x02000000 +#define T2_WSIZE_16M 0x01000000 +#define T2_WSIZE_8M 0x00800000 +#define T2_WSIZE_4M 0x00400000 +#define T2_WSIZE_2M 0x00200000 +#define T2_WSIZE_1M 0x00100000 +#define T2_WSIZE_0M 0x00000000 + +#define T2_TBASE_SHIFT 1 + +#define MASTER_ICU 0x535 +#define SLAVE0_ICU 0x537 +#define SLAVE1_ICU 0x53b +#define SLAVE2_ICU 0x53d +#define SLAVE3_ICU 0x53f Property changes on: stable/4/sys/alpha/pci/t2reg.h ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Index: stable/4/sys/modules/tx/Makefile =================================================================== --- stable/4/sys/modules/tx/Makefile (nonexistent) +++ stable/4/sys/modules/tx/Makefile (revision 60994) @@ -0,0 +1,8 @@ +# $FreeBSD$ + +.PATH: ${.CURDIR}/../../pci +KMOD = if_tx +SRCS = if_tx.c opt_bdg.h device_if.h bus_if.h pci_if.h +SRCS += miibus_if.h + +.include Property changes on: stable/4/sys/modules/tx/Makefile ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property