TAILIEUCHUNG - Linux Device Drivers-Chapter 10 :Judicious Use of Data Types

Tham khảo tài liệu 'linux device drivers-chapter 10 :judicious use of data types', công nghệ thông tin, hệ điều hành phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | Chapter 10 Judicious Use of Data Types Before we go on to more advanced topics we need to stop for a quick note on portability issues. Modern versions of the Linux kernel are highly portable running on several very different architectures. Given the multiplatform nature of Linux drivers intended for serious use should be portable as well. But a core issue with kernel code is being able both to access data items of known length for example filesystem data structures or registers on device boards and to exploit the capabilities of different processors 32-bit and 64-bit architectures and possibly 16 bit as well . Several of the problems encountered by kernel developers while porting x86 code to new architectures have been related to incorrect data typing. Adherence to strict data typing and compiling with the - Wall -Wstrict-prototypes flags can prevent most bugs. Data types used by kernel data are divided into three main classes standard C types such as int explicitly sized types such as u32 and types used for specific kernel objects such as pid_t. We are going to see when and how each of the three typing classes should be used. The final sections of the chapter talk about some other typical problems you might run into when porting driver code from the x86 to other platforms and introduce the generalized support for linked lists exported by recent kernel headers. If you follow the guidelines we provide your driver should compile and run even on platforms on which you are unable to test it. Use of Standard C Types Although most programmers are accustomed to freely using standard types like int and long writing device drivers requires some care to avoid typing conflicts and obscure bugs. The problem is that you can t use the standard types when you need a two-byte filler or something representing a four-byte string because the normal C data types are not the same size on all architectures. To show the data size of the various C types the datasize program has been .

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.