mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-23 02:05:57 +01:00
PCI interrupts work
This commit is contained in:
@@ -6,11 +6,11 @@ set -ex
|
||||
insmod /pci.ko
|
||||
/mknoddev.sh pci
|
||||
|
||||
# Identifiction.
|
||||
# Identifiction: just returns some fixed magic bytes.
|
||||
dd bs=4 status=none if=/dev/lkmc_pci count=1 skip=0 | od -An -t x1
|
||||
# => 010000ed
|
||||
|
||||
# Negator.
|
||||
# Negator. Sanity check that the hardware is getting updated.
|
||||
dd bs=4 status=none if=/dev/lkmc_pci count=1 skip=1 | od -An -t x1
|
||||
printf '\xF0\xF0\xF0\xF0' | dd bs=4 status=none of=/dev/lkmc_pci count=1 seek=1
|
||||
dd bs=4 status=none if=/dev/lkmc_pci count=1 skip=1 | od -An -t x1
|
||||
@@ -18,13 +18,20 @@ dd bs=4 status=none if=/dev/lkmc_pci count=1 skip=1 | od -An -t x1
|
||||
|
||||
# Factorial calculator.
|
||||
# factorial(0xC) = 0x1c8cfc00
|
||||
printf '\x00\x00\x00\x0C' | dd bs=4 status=none of=/dev/lkmc_pci count=1 seek=2
|
||||
printf '\x00\x00\x00\x00' | dd bs=4 status=none of=/dev/lkmc_pci count=1 seek=8
|
||||
printf '\x0C\x00\x00\x00' | dd bs=4 status=none of=/dev/lkmc_pci count=1 seek=2
|
||||
sleep 1
|
||||
dd bs=4 status=none if=/dev/lkmc_pci count=1 skip=2 | od -An -t x1
|
||||
dd bs=4 status=none if=/dev/lkmc_pci count=1 skip=8 | od -An -t x1
|
||||
# => 1c8cfc00
|
||||
|
||||
# Manual IRQ raising.
|
||||
printf '\x04\x03\x02\x01' | dd bs=4 status=none of=/dev/lkmc_pci count=1 seek=24
|
||||
# => interrupt
|
||||
sleep 1
|
||||
printf '\x08\x07\x06\x05' | dd bs=4 status=none of=/dev/lkmc_pci count=1 seek=24
|
||||
# => interrupt
|
||||
sleep 1
|
||||
|
||||
# Teardown.
|
||||
rm /dev/lkmc_pci
|
||||
rmmod pci
|
||||
|
||||
Reference in New Issue
Block a user