Re: kernel module with debugging info

2025-03-25 Thread Beesdeckar
> Why not just build the driver into the kernel? Deliver it as a module when it all works. I think that it is more simple to rebuild, reload, test only kernel module than rebuild whole kernel, reboot and test.

reading ksyms

2025-03-26 Thread Beesdeckar
Hello, how to display kernel symbol list and other details from /dev/ksyms ? Does exist command line utility for this purpose ? Peter

crash dump module sections addresses

2025-03-27 Thread Beesdeckar
Hello, How can I retrieve kernel module's addresses of .text .data .bss sections from crash dump in gdb ? Peter

Re: crash dump module sections addresses

2025-03-27 Thread Beesdeckar
On 27-Mar-25 10:22 AM, Paul Goyette wrote: See src/sys/kern/subr_kobj.c (kern_module.c which calls some of the kobj routines.) I looked on it. If I want to retrieve .text module base address I found that modctl() is able to provide .text base address of kernel module to userspace and utility m

alignment requirements for kmutex_t

2025-03-30 Thread Beesdeckar
Hello, I found that global variable of type kmutex_t is on many places defined like: kmutex_t variable_name __cacheline_aligned; Two questions, 1. Is __cacheline_aligned mandatory for global/static variables of type kmutex in kernel space ? 2. Regarding to alignment what are requirements for k

Re: trap and frame address

2025-03-29 Thread Beesdeckar
Update: When I use address from gdb bt output: ... #4 0x8023c185 in trap (frame=0xb80384d5ae90) at /usr/src/ sys/arch/amd64/amd64/trap.c:326 ... and display content of memory then I can find error 2 and trap number 6 in down of output below. In accordance with struct trapframe for

Re: trap and frame address

2025-03-29 Thread Beesdeckar
Update: When I use address from gdb bt output: ... #4 0x8023c185 in trap (frame=0xb80384d5ae90) at /usr/src/ sys/arch/amd64/amd64/trap.c:326 ... and display content of memory then I can find error 2 and trap number 6 in down of output below. In accordance with struct trapframe for

trap and frame address

2025-03-29 Thread Beesdeckar
Hello, I am trying to analyze crash in kernel module. I already know C code line which is reason of crash but I am not able to find how to switch to stack which made trap like it is displayed in /var/log/message (mutex_enter()...) for investigating it's local argument. If I understand good I

ioctl() and driver function d_ioctl return values

2025-05-19 Thread Beesdeckar
Hello, I am calling ioctl() with control code created with __IOWR() macro and third argument contains address of user-mode structure. When module's d_ioctl() returns non-zero value then user-mode ioctl() returns always -1 and structure in user mode does not contain data filled by module. Are

Retrieving MAC address from struct ifnet

2025-06-08 Thread Beesdeckar
Hello, I am trying to read MAC address of network interface in kernel from member of struct ifnet: struct ifaddr *if_hwdl; When I try to cycle through interfaces and I read first member of if_hwdl (struct sockaddr *ifa_addr) the result for ethernet is: sa_family: 18, sa_len: 17, sa_data: