From 476e109c81cfcfc90f6b7e24c6bf4e2d60e6af56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ciro=20Santilli=20=E5=85=AD=E5=9B=9B=E4=BA=8B=E4=BB=B6=20?= =?UTF-8?q?=E6=B3=95=E8=BD=AE=E5=8A=9F?= Date: Thu, 6 Aug 2020 02:00:01 +0000 Subject: [PATCH] mark physical address stuff as BSD --- README.adoc | 9 +++++++-- lkmc/pagemap.h | 6 ++++++ userland/linux/pagemap_dump.c | 5 ++++- userland/linux/virt_to_phys_user.c | 5 ++++- userland/posix/virt_to_phys_test.c | 5 ++++- 5 files changed, 25 insertions(+), 5 deletions(-) diff --git a/README.adoc b/README.adoc index d5f91fc..d6a5fcd 100644 --- a/README.adoc +++ b/README.adoc @@ -8109,6 +8109,13 @@ The Linux kernel exposes physical addresses to userland through: In this section we will play with them. +The following files contain examples to access that data and test it out: + +* link:lkmc/pagemap.h[] +* link:rootfs_overlay/lkmc/virt_to_phys.sh[] +* link:userland/linux/virt_to_phys_user.c[] +* link:userland/posix/virt_to_phys_test.c[] + First get a virtual address to play with: .... @@ -8142,8 +8149,6 @@ Sample output physical address: 0x7c7b800 .... -Source: link:userland/linux/virt_to_phys_user.c[] - Now we can verify that `linux/virt_to_phys_user.out` gave the correct physical address in the following ways: * <> diff --git a/lkmc/pagemap.h b/lkmc/pagemap.h index ddba470..36a4bb7 100644 --- a/lkmc/pagemap.h +++ b/lkmc/pagemap.h @@ -1,3 +1,9 @@ +/* https://cirosantilli.com/linux-kernel-module-cheat#userland-physical-address-experiments + * https://cirosantilli.com/linux-kernel-module-cheat#pagemap-dump-out + * + * This file is dual licensed as both 3-Clause BSD and GPLv3. + */ + #ifndef LKMC_PAGEMAP_H #define LKMC_PAGEMAP_H diff --git a/userland/linux/pagemap_dump.c b/userland/linux/pagemap_dump.c index 2579fb0..e22b2db 100644 --- a/userland/linux/pagemap_dump.c +++ b/userland/linux/pagemap_dump.c @@ -1,4 +1,7 @@ -/* https://cirosantilli.com/linux-kernel-module-cheat#pagemap-dump-out */ +/* https://cirosantilli.com/linux-kernel-module-cheat#pagemap-dump-out + * + * This file is dual licensed as both 3-Clause BSD and GPLv3. + */ #define _XOPEN_SOURCE 700 #include diff --git a/userland/linux/virt_to_phys_user.c b/userland/linux/virt_to_phys_user.c index a891fb9..91950ad 100644 --- a/userland/linux/virt_to_phys_user.c +++ b/userland/linux/virt_to_phys_user.c @@ -1,4 +1,7 @@ -/* https://cirosantilli.com/linux-kernel-module-cheat#userland-physical-address-experiments */ +/* https://cirosantilli.com/linux-kernel-module-cheat#userland-physical-address-experiments + * + * This file is dual licensed as both 3-Clause BSD and GPLv3. + */ #define _XOPEN_SOURCE 700 #include /* printf */ diff --git a/userland/posix/virt_to_phys_test.c b/userland/posix/virt_to_phys_test.c index 9fbac93..c369d3a 100644 --- a/userland/posix/virt_to_phys_test.c +++ b/userland/posix/virt_to_phys_test.c @@ -1,4 +1,7 @@ -/* https://cirosantilli.com/linux-kernel-module-cheat#userland-physical-address-experiments */ +/* https://cirosantilli.com/linux-kernel-module-cheat#userland-physical-address-experiments + * + * This file is dual licensed as both 3-Clause BSD and GPLv3. + */ #define _XOPEN_SOURCE 700 #include