xiaoxiang781216 commented on code in PR #9070:
URL: https://github.com/apache/nuttx/pull/9070#discussion_r1174502446
##########
arch/sim/src/sim/posix/sim_hostmemory.c:
##########
@@ -54,6 +54,46 @@ static atomic_int g_uordblks;
extern uint64_t up_irq_save(void);
extern void up_irq_restore(uint64_t flags);
+/****************************************************************************
+ * Name: up_textheap_memalign
+ *
+ * Description:
+ * Allocate memory for text sections with the specified alignment.
+ *
+ ****************************************************************************/
+
+void *up_textheap_memalign(size_t align, size_t size)
+{
+ uint64_t flags = up_irq_save();
+ void *p;
+
+ /* host_allocheap (mmap) returns memory aligned to the page size, which
+ * is always a multiple of the alignment (4/8) for text section. So, we
+ * don't need to do anything here.
+ */
+
+ p = host_allocheap(size);
+
+ up_irq_restore(flags);
+
+ return p;
+}
+
+/****************************************************************************
+ * Name: up_textheap_free
+ *
+ * Description:
+ * Free memory allocated for text sections.
+ *
+ ****************************************************************************/
+
+void up_textheap_free(void *p)
+{
+ uint64_t flags = up_irq_save();
+ munmap(p, 0);
Review Comment:
let's add host_freeheap
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]