summaryrefslogtreecommitdiffstats
path: root/package/busybox/busybox-1.16.2/busybox-devmem.patch
diff options
context:
space:
mode:
authorGustavo Zacarias <gustavo@zacarias.com.ar>2010-07-08 14:20:06 -0300
committerPeter Korsgaard <jacmet@sunsite.dk>2010-07-12 13:32:38 +0200
commit3169aae85ef4b26aec667376b0559b38582ccf52 (patch)
tree372426478e75977cf2f3664ae357986404ca3c21 /package/busybox/busybox-1.16.2/busybox-devmem.patch
parenta7c24b6395076d898fc1903e88c4648320a52d47 (diff)
downloadbuildroot-novena-3169aae85ef4b26aec667376b0559b38582ccf52.tar.gz
buildroot-novena-3169aae85ef4b26aec667376b0559b38582ccf52.zip
busybox: add 1.17.0, convert to gentargets, drop 1.12, deprecate 1.13 and 1.15
Closes #2167 [Peter: fix CONFIG_ID workaround for old uClibcs] Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar> Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Diffstat (limited to 'package/busybox/busybox-1.16.2/busybox-devmem.patch')
-rw-r--r--package/busybox/busybox-1.16.2/busybox-devmem.patch76
1 files changed, 76 insertions, 0 deletions
diff --git a/package/busybox/busybox-1.16.2/busybox-devmem.patch b/package/busybox/busybox-1.16.2/busybox-devmem.patch
new file mode 100644
index 000000000..f7d1d1df7
--- /dev/null
+++ b/package/busybox/busybox-1.16.2/busybox-devmem.patch
@@ -0,0 +1,76 @@
+From 351ef7188a1a2e2f154bbda6f703c2d3f4af6d79 Mon Sep 17 00:00:00 2001
+From: Denys Vlasenko <vda.linux@googlemail.com>
+Date: Wed, 14 Apr 2010 13:37:25 -0700
+Subject: [PATCH] devmem: map two pages only if it is necessary
+
+function old new delta
+devmem_main 463 469 +6
+
+Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
+---
+ miscutils/devmem.c | 21 ++++++++++++++-------
+ 1 files changed, 14 insertions(+), 7 deletions(-)
+
+diff --git a/miscutils/devmem.c b/miscutils/devmem.c
+index e13dedc..39b5808 100644
+--- a/miscutils/devmem.c
++++ b/miscutils/devmem.c
+@@ -13,9 +13,9 @@ int devmem_main(int argc UNUSED_PARAM, char **argv)
+ uint64_t read_result;
+ uint64_t writeval = writeval; /* for compiler */
+ off_t target;
+- unsigned page_size = getpagesize();
++ unsigned page_size, mapped_size, offset_in_page;
+ int fd;
+- int width = 8 * sizeof(int);
++ unsigned width = 8 * sizeof(int);
+
+ /* devmem ADDRESS [WIDTH [VALUE]] */
+ // TODO: options?
+@@ -50,15 +50,22 @@ int devmem_main(int argc UNUSED_PARAM, char **argv)
+ if (argv[3])
+ writeval = bb_strtoull(argv[3], NULL, 0);
+ } else { /* argv[2] == NULL */
+- /* make argv[3] to be a valid thing to use */
++ /* make argv[3] to be a valid thing to fetch */
+ argv--;
+ }
+ if (errno)
+- bb_show_usage(); /* bb_strtouXX failed */
++ bb_show_usage(); /* one of bb_strtouXX failed */
+
+ fd = xopen("/dev/mem", argv[3] ? (O_RDWR | O_SYNC) : (O_RDONLY | O_SYNC));
++ mapped_size = page_size = getpagesize();
++ offset_in_page = (unsigned)target & (page_size - 1);
++ if (offset_in_page + width > page_size) {
++ /* This access spans pages.
++ * Must map two pages to make it possible: */
++ mapped_size *= 2;
++ }
+ map_base = mmap(NULL,
+- page_size * 2 /* in case value spans page */,
++ mapped_size,
+ argv[3] ? (PROT_READ | PROT_WRITE) : PROT_READ,
+ MAP_SHARED,
+ fd,
+@@ -68,7 +75,7 @@ int devmem_main(int argc UNUSED_PARAM, char **argv)
+
+ // printf("Memory mapped at address %p.\n", map_base);
+
+- virt_addr = (char*)map_base + (target & (page_size - 1));
++ virt_addr = (char*)map_base + offset_in_page;
+
+ if (!argv[3]) {
+ switch (width) {
+@@ -119,7 +126,7 @@ int devmem_main(int argc UNUSED_PARAM, char **argv)
+ }
+
+ if (ENABLE_FEATURE_CLEAN_UP) {
+- if (munmap(map_base, page_size * 2) == -1)
++ if (munmap(map_base, mapped_size) == -1)
+ bb_perror_msg_and_die("munmap");
+ close(fd);
+ }
+--
+1.7.1
+