Date: Mon, 24 Nov 2003 16:18:14 +0100 (MET) From: Peter B <pb@ludd.luth.se> To: freebsd-hackers@freebsd.org Subject: Going realmode in kernel drivers? Message-ID: <200311241518.hAOFIEl13682@brother.ludd.luth.se>
next in thread | raw e-mail | index | archive | help
i386/FreeBSD-4.x/lkm. How does one get into 'realmode' inside a kernel driver? The reason for the need is a tight timeing loop that measures the lenght of pulses. And disableing interrupts is just not enough. Target cpu's are AMD K5 + AMD XP. Asfair when reading cycles per opcode. The number of cycles required increase about three times when useing protected mode or similar. Code excerpt: u_int32_t register cnt1; u_int32_t register cnt_max=0xFF; u_int32_t register *store_ptr; u_int32_t register *store_end; u_int8_t register last_val=0; store_ptr = ..; store_end = ..+ SIZ; disable_intr(); for(;;) { for(cnt1=0; cnt1<cnt_max && ((inb(0x379)&0x20) != last_val); cnt1++) ; *(store_ptr++) = cnt1; if( store_ptr>=store_end ) break; last_val ^= 0x20; } enable_intr(); (Will start on a new count every signal flank). /P
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200311241518.hAOFIEl13682>