TAILIEUCHUNG - Advanced Linux Programming: 9-Inline Assembly Code

Tham khảo tài liệu 'advanced linux programming: 9-inline assembly code', 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ả | Inline Assembly Code TODAY FEW PROGRAMMERS USE ASSEMBLY LANGUAGE. Higher-level languages such as C and C run on nearly all architectures and yield higher productivity when writing and maintaining code. For occasions when programmers need to use assembly instructions in their programs the GNU Compiler Collection permits programmers to add architecture-dependent assembly language instructions to their programs. GCC s inline assembly statements should not be used indiscriminately. Assembly language instructions are architecture-dependent so for example programs using x86 instructions cannot be compiled on PowerPC use them you ll require a facility in the assembly language for your architecture. However inline assembly statements permit you to access hardware directly and can also yield faster code. An asm instruction allows you to insert assembly instructions into C and C programs. For example this instruction asm fsin t answer 0 angle is an x86-specific way of coding this C statement 1 answer sin angle expression sin angle is usually implemented as a function call into the math library but if you specify the -01 or higher optimization flag GCC is smart enough to replace the function call with a single fsin assembly instruction. 190 Chapter 9 Inline Assembly Code Observe that unlike ordinary assembly code instructions asm statements permit you to specify input and output operands using C syntax. To read more about the x86 instruction set which we will use in this chapter see http design pentiumii manuals and http documentation. When to Use Assembly Code Although asm statements can be abused they allow your programs to access the computer hardware directly and they can produce programs that execute quickly. You can use them when writing operating system code that directly needs to interact with hardware. For example usr include asm contains assembly instructions to access input output ports directly. The .

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.