[Xenomai-git] Philippe Gerum : boilerplate/heapmem: move heap limit to ~4GB

2018-05-13 Thread git repository hosting
Module: xenomai-3
Branch: wip/heapmem
Commit: bac489be0f19b236dd5f7d18480f4557c6a34e0a
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=bac489be0f19b236dd5f7d18480f4557c6a34e0a

Author: Philippe Gerum 
Date:   Sun May 13 17:17:06 2018 +0200

boilerplate/heapmem: move heap limit to ~4GB

---

 include/boilerplate/heapmem.h |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/boilerplate/heapmem.h b/include/boilerplate/heapmem.h
index c4348b0..0ddd1ce 100644
--- a/include/boilerplate/heapmem.h
+++ b/include/boilerplate/heapmem.h
@@ -35,10 +35,10 @@
  */
 #define HEAPMEM_MAX(HEAPMEM_PAGE_SHIFT - HEAPMEM_MIN_LOG2)
 #define HEAPMEM_MIN_ALIGN  (1U << HEAPMEM_MIN_LOG2)
-/* Max size of an extent (2Gb). */
-#define HEAPMEM_MAX_EXTSZ  (1U << 31)
+/* Max size of an extent (4Gb - HEAPMEM_PAGE_SIZE). */
+#define HEAPMEM_MAX_EXTSZ  (4294967295U - HEAPMEM_PAGE_SIZE + 1)
 /* Bits we need for encoding a page # */
-#define HEAPMEM_PGENT_BITS   (31 - HEAPMEM_PAGE_SHIFT - 1)
+#define HEAPMEM_PGENT_BITS  (32 - HEAPMEM_PAGE_SHIFT)
 
 /* Each page is represented by a page map entry. */
 #define HEAPMEM_PGMAP_BYTESsizeof(struct heapmem_pgentry)


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : drivers/serial: imx: prevent call from invalid runtime mode

2018-05-13 Thread git repository hosting
Module: xenomai-3
Branch: stable-3.0.x
Commit: 50ef005105d07916d4202bf6d09a5c87fca828f5
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=50ef005105d07916d4202bf6d09a5c87fca828f5

Author: Philippe Gerum 
Date:   Sun May 13 16:21:13 2018 +0200

drivers/serial: imx: prevent call from invalid runtime mode

---

 kernel/drivers/serial/rt_imx_uart.c |   17 +
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/kernel/drivers/serial/rt_imx_uart.c 
b/kernel/drivers/serial/rt_imx_uart.c
index 61836ae..1aec219 100644
--- a/kernel/drivers/serial/rt_imx_uart.c
+++ b/kernel/drivers/serial/rt_imx_uart.c
@@ -963,6 +963,13 @@ static int rt_imx_uart_ioctl(struct rtdm_fd *fd,
struct rtser_config config_buf;
uint64_t *hist_buf = NULL;
 
+   /*
+* We may call regular kernel services ahead, ask for
+* re-entering secondary mode if need be.
+*/
+   if (rtdm_in_rt_context())
+   return -ENOSYS;
+
config = (struct rtser_config *)arg;
 
if (rtdm_fd_is_user(fd)) {
@@ -984,13 +991,6 @@ static int rt_imx_uart_ioctl(struct rtdm_fd *fd,
return -EINVAL;
 
if (config->config_mask & RTSER_SET_TIMESTAMP_HISTORY) {
-   /*
-* Reflect the call to non-RT as we will likely
-* allocate or free the buffer.
-*/
-   if (rtdm_in_rt_context())
-   return -ENOSYS;
-
if (config->timestamp_history &
RTSER_RX_TIMESTAMP_HISTORY)
hist_buf = kmalloc(IN_BUFFER_SIZE *
@@ -1000,7 +1000,8 @@ static int rt_imx_uart_ioctl(struct rtdm_fd *fd,
 
rt_imx_uart_set_config(ctx, config, _buf);
 
-   kfree(hist_buf);
+   if (hist_buf)
+   kfree(hist_buf);
break;
}
 


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git