TAILIEUCHUNG - Embedded FreeBSD Cookbook phần 3

Chức năng copyin bản sao len byte của dữ liệu từ người sử dụng địa chỉ chế độ uaddr kaddr hạt nhân chế độ địa chỉ. Chức năng copyout bản sao len byte dữ liệu từ kaddr hạt nhân chế độ địa chỉ để người sử dụng địa chỉ chế độ uaddr. | 36 Embedded FreeBSD Cookbook The copyin function copies len bytes of data from the user mode address uaddr to the kernel mode address kaddr. The copyout function copies len bytes of data from the kernel mode address kaddr to the user mode address uaddr. The sysent Structure Every system call in the FreeBSD kernel has a sysent structure defined in usr include sys . The sysent structure takes two elements the number of parameters which is two as defined by the dumpmem_args structure and the name of the system call function. Listing 3-7 defines the copymem sysent. static 4 copymem struct sysent copymem sysent number of parameters system call Listing 3-7 System calls are contained in the sysent structure defined in sys kern . When a KLD system call is made a new entry is added to the kernel global sysent structure. Listing 3-8 contains a partial listing of the sysent structure. The struct casts are bogus but will do for now. sysent sysent 0 sy_call_t nosys 0 syscall AS rexit args sy call t exit 1 exit 0 sy_call_t fork 2 fork AS read_args sy call t read 3 read AS write_args sy call t write 4 write AS open_args sy call t open 5 open AS close_args sy call t close 6 close Listing 3-8 The System Call Number A system call number must be declared since there is no system call number defined this value should be set to NO_SYSCALL. The kernel defines the system call number dynamically. 37 Chapter Three System Calls static int32 t syscall num NO SYSCALL When the KLD system call is loaded into the kernel systent entry copymem_sysent is assigned to the first open index in the kernel global sysent structure. The index into the sysent array is the system call number. The specifics of installing a new system call are found in the syscall register function listed in sys kern kern . Listing 3-9 contains the syscall_register function. int syscall_register int offset struct sysent new_sysent struct sysent old_sysent if offset NO_SYSCALL int i for i 1 i .

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.