Template Information

Trang

Chủ đề

BSP (44) Device Drivers (43) WinCE (38) WINDOWS DRIVER (19) Linux Device Drivers (18) ARM (17) Android tools and tips (17) DRIVER FILES (16) Windows Device Driver (16) AUDIO DRIVER (12) 8051 (8) OMAP (7) PRINTER DRIVER FILES (7) C Programming (6) ASUS MOTHERBOARD (5) Interfacing (5) NETWORK ADAPTER (5) VIDEO DRIVER (5) CANON (3) Device Driver Downloads (3) MOBILE PHONE (3) Asus Driver (2) EPSON (2) Epson Printer Driver (2) HP LAPTOP DRIVER (2) LAPTOP DRIVER FILES (2) Logitech Driver (2) NETWORK ADAPTOR (2) OMAP 4430 (2) drivers download (2) ACER (1) ACER TABLET (1) ALL IN ONE DRIVER (1) Acer Aspire 5738 Drivers (1) Analog-to-Digital (1) Asus Drivers (1) Asus Motherboard Drivers (1) Chip Architecture (1) DELL (1) Dell D610 Drivers (1) Dell Drivers (1) Device Drivers Download (1) Device drivers interview questions (1) Display Driver (1) Drivers Download for Windows 7 (1) EEPROMs (1) Free Asus Motherboard Drivers (1) Free Drivers Download for Windows 7 (1) GRAPHIC DRIVER (1) HP Driver (1) Hardware (1) Intel Drivers (1) Intel P35 (1) Intel P35 chipset drivers (1) I²C (1) LAPTOP SERVICE MANUAL (1) LCD (1) Logitech Mouse Driver (1) Logitech webcam driver (1) MODEM DRIVER (1) Motherboard Drivers for Windows 7 (1) PARALLEL PORT (1) Pc Driver (1) RTOS (1) Real Time Clock (1) Sensors (1) USB CABLE DRIVER (1) WEBCAM DRIVER (1) WIRELESS ADAPTOR (1) Windows 7 Drivers (1) Windows Mobile (1) acer driver (1) acer driver downloads (1) acer laptop driver (1) chipset drivers (1) network card driver (1) network driver download (1) sdcc (1)

Bài viết ngẫu nhiên

Xem phim HD Online

Số lượt views

System Calls

Thứ Tư, 18 tháng 5, 2011 / 08:42

System Calls

So far, the only thing we've done was to use well defined kernel mechanisms to register /proc files and device handlers. This is fine if you want to do something the kernel programmers thought you'd want, such as write a device driver. But what if you want to do something unusual, to change the behavior of the system in some way? Then, you're mostly on your own.
This is where kernel programming gets dangerous. While writing the example below, I killed the open() system call. This meant I couldn't open any files, I couldn't run any programs, and I couldn't shutdown the computer. I had to pull the power switch. Luckily, no files died. To ensure you won't lose any files either, please run sync right before you do the insmod and the rmmod.
Forget about /proc files, forget about device files. They're just minor details. The real process to kernel communication mechanism, the one used by all processes, is system calls. When a process requests a service from the kernel (such as opening a file, forking to a new process, or requesting more memory), this is the mechanism used. If you want to change the behaviour of the kernel in interesting ways, this is the place to do it. By the way, if you want to see which system calls a program uses, run strace .
In general, a process is not supposed to be able to access the kernel. It can't access kernel memory and it can't call kernel functions. The hardware of the CPU enforces this (that's the reason why it's called `protected mode').
System calls are an exception to this general rule. What happens is that the process fills the registers with the appropriate values and then calls a special instruction which jumps to a previously defined location in the kernel (of course, that location is readable by user processes, it is not writable by them). Under Intel CPUs, this is done by means of interrupt 0x80. The hardware knows that once you jump to this location, you are no longer running in restricted user mode, but as the operating system kernel --- and therefore you're allowed to do whatever you want.
The location in the kernel a process can jump to is called system_call. The procedure at that location checks the system call number, which tells the kernel what service the process requested. Then, it looks at the table of system calls (sys_call_table) to see the address of the kernel function to call. Then it calls the function, and after it returns, does a few system checks and then return back to the process (or to a different process, if the process time ran out). If you want to read this code, it's at the source file arch/$<$architecture$>$/kernel/entry.S, after the line ENTRY(system_call).
So, if we want to change the way a certain system call works, what we need to do is to write our own function to implement it (usually by adding a bit of our own code, and then calling the original function) and then change the pointer at sys_call_table to point to our function. Because we might be removed later and we don't want to leave the system in an unstable state, it's important for cleanup_module to restore the table to its original state.
The source code here is an example of such a kernel module. We want to `spy' on a certain user, and to printk() a message whenever that user opens a file. Towards this end, we replace the system call to open a file with our own function, called our_sys_open. This function checks the uid (user's id) of the current process, and if it's equal to the uid we spy on, it calls printk() to display the name of the file to be opened. Then, either way, it calls the original open() function with the same parameters, to actually open the file.
The init_module function replaces the appropriate location in sys_call_table and keeps the original pointer in a variable. The cleanup_module function uses that variable to restore everything back to normal. This approach is dangerous, because of the possibility of two kernel modules changing the same system call. Imagine we have two kernel modules, A and B. A's open system call will be A_open and B's will be B_open. Now, when A is inserted into the kernel, the system call is replaced with A_open, which will call the original sys_open when it's done. Next, B is inserted into the kernel, which replaces the system call with B_open, which will call what it thinks is the original system call, A_open, when it's done.
Now, if B is removed first, everything will be well---it will simply restore the system call to A_open, which calls the original. However, if A is removed and then B is removed, the system will crash. A's removal will restore the system call to the original, sys_open, cutting B out of the loop. Then, when B is removed, it will restore the system call to what it thinks is the original, A_open, which is no longer in memory. At first glance, it appears we could solve this particular problem by checking if the system call is equal to our open function and if so not changing it at all (so that B won't change the system call when it's removed), but that will cause an even worse problem. When A is removed, it sees that the system call was changed to B_open so that it is no longer pointing to A_open, so it won't restore it to sys_open before it is removed from memory. Unfortunately, B_open will still try to call A_open which is no longer there, so that even without removing B the system would crash.
Note that all the related problems make syscall stealing unfeasiable for production use. In order to keep people from doing potential harmful things sys_call_table is no longer exported. This means, if you want to do something more than a mere dry run of this example, you will have to patch your current kernel in order to have sys_call_table exported. In the example directory you will find a README and the patch. As you can imagine, such modifications are not to be taken lightly. Do not try this on valueable systems (ie systems that you do not own - or cannot restore easily). You'll need to get the complete sourcecode of this guide as a tarball in order to get the patch and the README. Depending on your kernel version, you might even need to hand apply the patch. Still here? Well, so is this chapter. If Wyle E. Coyote was a kernel hacker, this would be the first thing he'd try. ;)

syscall.c
/*
* syscall.c
*
* System call "stealing" sample.
*/

/*
* Copyright (C) 2001 by Peter Jay Salzman
*/

/*
* The necessary header files
*/

/*
* Standard in kernel modules
*/
#include // here linux/kernel.h /* We're doing kernel work */
#include // here linux/module.h /* Specifically, a module, */
#include // here linux/moduleparam.h /* which will have params */
#include // here linux/unistd.h /* The list of system calls */

/*
* For the current (process) structure, we need
* this to know who the current user is.
*/
#include
#include

/*
* The system call table (a table of functions). We
* just define this as external, and the kernel will
* fill it up for us when we are insmod'ed
*
* sys_call_table is no longer exported in 2.6.x kernels.
* If you really want to try this DANGEROUS module you will
* have to apply the supplied patch against your current kernel
* and recompile it.
*/
extern void *sys_call_table[];

/*
* UID we want to spy on - will be filled from the
* command line
*/
static int uid;
module_param(uid, int, 0644);

/*
* A pointer to the original system call. The reason
* we keep this, rather than call the original function
* (sys_open), is because somebody else might have
* replaced the system call before us. Note that this
* is not 100% safe, because if another module
* replaced sys_open before us, then when we're inserted
* we'll call the function in that module - and it
* might be removed before we are.
*
* Another reason for this is that we can't get sys_open.
* It's a static variable, so it is not exported.
*/
asmlinkage int (*original_call) (const char *, int, int);

/*
* The function we'll replace sys_open (the function
* called when you call the open system call) with. To
* find the exact prototype, with the number and type
* of arguments, we find the original function first
* (it's at fs/open.c).
*
* In theory, this means that we're tied to the
* current version of the kernel. In practice, the
* system calls almost never change (it would wreck havoc
* and require programs to be recompiled, since the system
* calls are the interface between the kernel and the
* processes).
*/
asmlinkage int our_sys_open(const char *filename, int flags, int mode)
{
int i = 0;
char ch;

/*
* Check if this is the user we're spying on
*/
if (uid == current->uid) {
/*
* Report the file, if relevant
*/
printk("Opened file by %d: ", uid);
do {
get_user(ch, filename + i);
i++;
printk("%c", ch);
} while (ch != 0);
printk("\n");
}

/*
* Call the original sys_open - otherwise, we lose
* the ability to open files
*/
return original_call(filename, flags, mode);
}

/*
* Initialize the module - replace the system call
*/
int init_module()
{
/*
* Warning - too late for it now, but maybe for
* next time...
*/
printk(KERN_ALERT "I'm dangerous. I hope you did a ");
printk(KERN_ALERT "sync before you insmod'ed me.\n");
printk(KERN_ALERT "My counterpart, cleanup_module(), is even");
printk(KERN_ALERT "more dangerous. If\n");
printk(KERN_ALERT "you value your file system, it will ");
printk(KERN_ALERT "be \"sync; rmmod\" \n");
printk(KERN_ALERT "when you remove this module.\n");

/*
* Keep a pointer to the original function in
* original_call, and then replace the system call
* in the system call table with our_sys_open
*/
original_call = sys_call_table[__NR_open];
sys_call_table[__NR_open] = our_sys_open;

/*
* To get the address of the function for system
* call foo, go to sys_call_table[__NR_foo].
*/

printk(KERN_INFO "Spying on UID:%d\n", uid);

return 0;
}

/*
* Cleanup - unregister the appropriate file from /proc
*/
void cleanup_module()
{
/*
* Return the system call back to normal
*/
if (sys_call_table[__NR_open] != our_sys_open) {
printk(KERN_ALERT "Somebody else also played with the ");
printk(KERN_ALERT "open system call\n");
printk(KERN_ALERT "The system may be left in ");
printk(KERN_ALERT "an unstable state.\n");
}

sys_call_table[__NR_open] = original_call;
}
Thứ Tư, 18 tháng 5, 2011 08:42 Đọc tiếp >>

Device Drivers Interview Questions

1.What is Device driver?

A device driver is a code that performs device control operations specific to the device being addressed.It is software layer that lies between applications and the actual device.
or
A more formal definition would be Device drivers are distinct black boxes that make a particular piece of hardware respond to a well defined internal programming interface.
or
Device Driver lies between the Hardware & operating system.Through this layer only all the request/response between the OS & H/w are happening.

2.what kind of information the linux driver modules (.ko )files has ?


kernel 2.6 introduces a new file naming convention: kernel modules now have a .ko extension (in place of the old .o extension) which easily distinguishes them from conventional object files. The reason for this is that they contain an additional .modinfo section that where additional information about the module is kept. Linux program modpost can be used to convert .o files into .ko files.
3.what happens when we do insmod & rmmod in Linux Device Drivers ?


At time of insmod required o's brings in ram or updated the kernel with the perticular device driver. At the time of rmmod removes the o's by kmod it kills the process and refresh the kernel.
4.what are the different ways the Linux can swich from User Space to Kernel Space & vice-versa ?



There are 2 situations when Linux can switch from user Space
to Kernel Space:-


1) by doing System calls
2) When interrupt comes (to handle interrupt)


Linux can switch from kernel Space to User space:-
1) process in kernel mode is preempted.
2) After completion of Interrupt handler / System call
Thứ Tư, 18 tháng 5, 2011 08:34 Đọc tiếp >>

How to Install Your ASUS F5 Driver

Thứ Bảy, 12 tháng 2, 2011 / 03:29

There comes a time when your ASUS f5 laptop will slow down in performance for reasons that might not seem clear to you. This reduced performance does not necessarily mean that the laptop needs to be replaced. It could also mean that your drivers are terribly outdated. This is a very regular occurrence given the regularity with which hardware device manufacturers release driver updates. You therefore have to ensure that you have the correct ASUS f5 driver installed in your computer.

The first thing that you have to do is look for the ASUS f5 driver online. You will mostly find it on the manufacturer’s website. If not, it might be found on one of the diverse websites that offer drivers to be downloaded. You have to look for a driver that matches your computer’s operating system.

The task of installing the ASUS f5 driver is rather easy because it comes with simple instructions that you have to follow. The program will prompts you to click on certain places and will therefore lead you through the entire process of installation. You do have to first uninstall any old drivers because its presence will prevent your computer from functioning properly. Even the process of uninstallation of old drivers is very easy. You have to first click on the Start button and go to ‘Add or Remove Programs’. Once you have finished the entire process you should delete the installer for the driver. This will ensure that you free up valuable disk space on your computer.

You will be very pleased with the performance of your computer once you have installed the latest ASUS f5 driver. It will function just like it used to do when you had first bought it if you have completed the installation process correctly. This will save you a lot of time and headache.

Free Download Laptops Driver
Thứ Bảy, 12 tháng 2, 2011 03:29 Đọc tiếp >>

ASUS Eee PC 900 Driver – Get The Correct One For This Small Wonder

Thứ Sáu, 4 tháng 2, 2011 / 02:57

When the ASUS Eee PC 900 notebook hit the market it was an instant hit. This was a compact sized notebook computer that was cheap but which still was packed with a great many features. This notebook computer was considered perfect for carrying around because it could easily fit into a handbag. If you have this notebook computer then you will certainly be pleased with its performance. Needless to say, you do need to make sure that all the software you use is completely up to date in order to get the best performance from this computer. In other words, you need to have the correct ASUS Eee PC 900 drivers installed for the various hardware devices that you use along with this computer.


If you make the mistake of using the wrong ASUS Eee PC 900 drivers there is a great likelihood that your computer will malfunction. Even if it does function reasonably well there will always be certain features that are out of your reach because the software that makes these features work is out of date. You certainly have to be on your toes at all times in order to get the right software for any hardware device for your computer.

Most people just do not have the time to keep themselves updated regarding the status of the software they use. After all, one purchases a computer in order to simplify one’s life and not to complicate it further. If you are terribly hassled at the thought of spending time searching for software then you should just get a driver scan program. This will be an instant solution to your problem because it will be able to download the correct ASUS Eee PC 900 driver and install it so that your computer gives you the best performance.

Laptops Driver Download
Thứ Sáu, 4 tháng 2, 2011 02:57 Đọc tiếp >>

Epson Stylus CX3200 Driver – Ensure That Your Computer Has the Correct One

Thứ Năm, 27 tháng 1, 2011 / 01:51


Have you recently reinstalled Windows or have installed a new version? This can actually cause problems with using your computer since many of your drivers will become out of date. If you have an Epson Stylus CX3200 printer you will immediately start having problems with using it. The problem lies with the Epson Stylus CX3200 driver that your computer has. You will start experiencing many printer device errors due to having the wrong driver.

Device Driver Download

Epson manufactures many printers and each of them has its own driver. Additionally, the drivers can be used only for a particular operating system. The manufacturer puts in a lot of effort to keep these drivers updated so that all performance problems and security issues are corrected. You should therefore ensure that you use only the latest Epson Stylus CX3200 driver rather than the driver that your operating system will suggest. The drivers that the operating system is installed with will always lag behind what the manufacturer releases.

You will have to keep yourself updated regarding the latest driver releases by Epson so that you can immediately install the correct Epson Stylus CX3200 driver on your computer. This will certainly ensure that your printer works well. However this is a time consuming job and most people do not have the time to spare for this.

If you do not have the time for so many follow ups you could always entrust the task to driver update software. The software will scan the internet in order to detect the correct Epson Stylus CX3200 driver. It will then install it in your computer after uninstalling the older version that is no longer up to date. Increasing numbers of people are opting for this method to keep their hardware devices working properly because of the immense convenience it offers.

Free Download Printer Driver.
Thứ Năm, 27 tháng 1, 2011 01:51 Đọc tiếp >>

How to Simply Download Windows Drivers from the Internet in a Safe Manner

Thứ Sáu, 31 tháng 12, 2010 / 03:21

To get the right drivers for each of your hardware device attached with your computer system, best is to install them by downloading appropriate Windows drivers from the Internet.

Windows drivers are software programs that actually permit the application to utilize the functionality of the installed hardware device. The software actually interprets the command instructed in order to capture the exact result from the hardware device. Windows drivers are specially created and coded for device drivers present in Windows operating computer system.

Mostly all the hardware devices come with an installation CD or DVD with all the basic drivers. But incase if you’ve got an updated Windows operating system the basic driver version might not function in the same way. These drivers are released at an early date and an outdated version will not be suitable with the latest computer updates.

Therefore it is essential to download and install correct driver versions easily available on the internet in order to make your hardware devices work properly. Do take care that the latest updates are compatible with your operating system and devices. When you search internet for the right driver updates, make sure you get them from an authentic place as many of the fake driver downloads come with malicious applications. The following tricks will help you in getting the valid driver updates without any Trojans, spyware programs, viruses, and harmful adware components.

1. Before you start to download a driver from the web, you need to check and keep in mind various things like the manufacturer of the hardware device for exact driver model and of course your computer’s operating system.

2. Another important point to remember is to download the Windows drivers for your specific device from the manufacturer’s website. Incase this option is not available always try to download the right drivers from a reputed website in order to protect your computer from malwares and viruses.

3. Remember to get the driver compatible with your operating system. Device drivers are coded for a specific OS version and they will perform properly only with the compatible variant.

4. Download the most recent version of the Windows driver so that your computer renders peak performance. Updated versions are very much essential, they actually fixes all the patches and upgrades outdated drivers making your computer function flawlessly.

Computer experts always recommend scanning the downloaded Windows driver from the web before installing them in your system. It is just because many of them are inscribed with malicious applications and malware programs. In order to protect your PC from such applications make sure before installing you scan the downloaded Windows drivers.

Thứ Sáu, 31 tháng 12, 2010 03:21 Đọc tiếp >>

Importance Of Device Drivers And Their Updates

Thứ Tư, 8 tháng 12, 2010 / 00:49

Device drivers work as the technological inter-agents between a computer and its devices. The main work done they do is help your operating system recognize the hardware installed on your PC. These are as important as the DNA present in our bodies without which you can’t get essential genetic instruction that works behind all your bodily developments and functioning. So are these for your PC, essential set of instructions without which the devices can’t function.

Have you ever imagined how is it possible to get songs added or deleted from your iPod, photos and videos transferred to the PC from your digital camera, or how your printer print pages for you, or how you get things scanned using your scanner? Each of the hardware you use requires a driver for better functioning. So, it is totally impossible to think that your PC will work without device drivers.

All the external components like mice or the keyboards also require device drivers to work properly. Interestingly, sometimes the drivers are internally built in the operating system of a PC or a laptop. But in many cases, you don’t get them inbuilt and need to get them from the store or downloaded from the internet and installed in your PC or laptop.

Both types of device drivers the inbuilt one as well as externally downloaded and installed one requires you to update them time to time for their proper functioning. Devices come up in their new versions every next day. It is not at all possible for your operating system to be compatible with each of the latest versions of the devices. Manufacturing companies keep introducing new versions of the devices either because the older versions become outdated or develop some glitches, thus to overcome such problems, new versions keep coming. They do solve the one problem but other problem arises i.e. compatibility problem.

In order to overcome the compatibility problem you need to update the drivers time to time. Sometimes, viruses, malware, spywares, corrupt the drivers which then stop working properly and you require an update for the proper working of the device drivers.

Thứ Tư, 8 tháng 12, 2010 00:49 Đọc tiếp >>