tlk: 6/19 update
[3rdparty/ote_partner/tlk.git] / kernel / syscall.c
index 5e915d3..2358309 100644 (file)
@@ -345,7 +345,22 @@ bool platform_syscall_handler(void *arg)
                /* update brk, if within range */
                if ((brk >= task->start_brk) && (brk < task->end_brk)) {
                        task->curr_brk = brk;
+               } else {
+                       if (brk >= task->end_brk) {
+                               dprintf(CRITICAL,
+                                       "%s: task %d: "
+                                       "no more heap (size 0x%lx bytes)\n",
+                                       __func__, task->task_index,
+                                       task->end_brk - task->start_brk);
+                       } else if ((brk < task->start_brk) && (brk != 0)) {
+                               dprintf(CRITICAL,
+                                       "%s: task %d: "
+                                       "brk 0x%x < heap start 0x%lx\n",
+                                       __func__, task->task_index,
+                                       brk, task->start_brk);
+                       }
                }
+
                r[0] = task->curr_brk;
                return true;
        }
@@ -400,6 +415,20 @@ bool platform_syscall_handler(void *arg)
                if ((brk >= task->start_brk) && (brk < task->end_brk)) {
                        task->curr_brk = brk;
                        return true;
+               } else {
+                       if (brk >= task->end_brk) {
+                               dprintf(CRITICAL,
+                                       "%s: task %d: mmap2: "
+                                       "no more heap (size 0x%lx bytes)\n",
+                                       __func__, task->task_index,
+                                       task->end_brk - task->start_brk);
+                       } else if (brk < task->start_brk) {
+                               dprintf(CRITICAL,
+                                       "%s: task %d: mmap2: "
+                                       "brk 0x%x < heap start 0x%lx\n",
+                                       __func__, task->task_index,
+                                       brk, task->start_brk);
+                       }
                }
                r[0] = -ENOMEM;
                return true;