process context and interrupt context

Process context is its current state. We need to save the context of the current running process so it can be resumed after the interrupt is handled. Process context is basically its current state (what is in its registers). e.g. esp, ss, eip, cs, and more. We need to save the instruction pointer (EIP) and the CS (Code Segment) so that after the interrupt is handled we can continue running

linux socket

The code in this article is based on Linux kernel 5.13. This article is with reference to socket-interface-and-network-protocol and Send/Recv UDP. 1. Socket From man 2 socket 1 2 3 4 #include <sys/types.h> /* See NOTES */ #include <sys/socket.h> int socket(int domain, int type, int protocol); domain: like AF_IENT, AF_INET6, AF_NETLINK, AF_PACKET, see more with man 7 address_families, or see all domains defined in kernel file include/linux/socket.

debug tips

Q: What’s the code i40e_xmit_frame_ring+0x5667/0x5d50 related A: Please install debuginfo for the kernel that was running and provide the following output 1 2 # gdb /usr/lib/debug/usr/lib/modules/<yourkernel>/kernel/drivers/net/ethernet/intel/i40e/i40e.ko.debug (gdb) list *i40e_xmit_frame_ring+0x5667 But for buildin functions which don’t have .ko.debug file, just use vmlinux file, e.g. 1 2 # gdb /usr/lib/debug/lib/modules/<yourkernel>/vmlinux (gdb) list *icmp_rcv+0x193/0x3b0 Q: how to print pr_debug info A: Usually you should able to print it when DEBUG defined.

linux_tools

PDF unit 2 pdf file to 1 $ pdfunite input_1.pdf input_2.pdf output.pdf compress pdf $ convert -density 200 -compress jpeg input.pdf out.pdf

trace event

https://lwn.net/Articles/379903/ https://lwn.net/Articles/381064/ https://lwn.net/Articles/383362/ https://www.kernel.org/doc/html/v4.18/trace/events.html