mirror of
https://github.com/drasko/codezero.git
synced 2026-03-03 02:53:15 +01:00
Fixed libposix munmap call where we used the MMAP tag.
This commit is contained in:
@@ -78,7 +78,7 @@ int l4_munmap(void *start, size_t length)
|
|||||||
write_mr(L4SYS_ARG1, length);
|
write_mr(L4SYS_ARG1, length);
|
||||||
|
|
||||||
/* Call pager with MMAP request. */
|
/* Call pager with MMAP request. */
|
||||||
if ((err = l4_sendrecv(PAGER_TID, PAGER_TID, L4_IPC_TAG_MMAP)) < 0) {
|
if ((err = l4_sendrecv(PAGER_TID, PAGER_TID, L4_IPC_TAG_MUNMAP)) < 0) {
|
||||||
printf("%s: IPC Error: %d.\n", __FUNCTION__, err);
|
printf("%s: IPC Error: %d.\n", __FUNCTION__, err);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
@@ -116,7 +116,7 @@ int l4_msync(void *start, size_t length, int flags)
|
|||||||
}
|
}
|
||||||
/* Check if syscall itself was successful */
|
/* Check if syscall itself was successful */
|
||||||
if ((errno = l4_get_retval()) < 0) {
|
if ((errno = l4_get_retval()) < 0) {
|
||||||
printf("%s: MUNMAP Error: %d.\n", __FUNCTION__, errno);
|
printf("%s: MSYNC Error: %d.\n", __FUNCTION__, errno);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -38,17 +38,20 @@ int mmaptest(void)
|
|||||||
else
|
else
|
||||||
printf("write: Success.\n");
|
printf("write: Success.\n");
|
||||||
|
|
||||||
|
printf("%s: Calling mmap()\n", __TASKNAME__);
|
||||||
if ((int)(base = mmap(0, PAGE_SIZE*16, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0)) < 0)
|
if ((int)(base = mmap(0, PAGE_SIZE*16, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0)) < 0)
|
||||||
perror("mmap");
|
perror("mmap");
|
||||||
else
|
else
|
||||||
printf("mmap: Success: %p\n", base);
|
printf("mmap: Success: %p\n", base);
|
||||||
|
|
||||||
*(unsigned int *)(base + PAGE_SIZE*2) = 0x1000;
|
*(unsigned int *)(base + PAGE_SIZE*2) = 0x1000;
|
||||||
|
printf("%s: Calling msync()\n", __TASKNAME__);
|
||||||
if (msync(base + PAGE_SIZE*2, PAGE_SIZE, MS_SYNC) < 0)
|
if (msync(base + PAGE_SIZE*2, PAGE_SIZE, MS_SYNC) < 0)
|
||||||
perror("msync");
|
perror("msync");
|
||||||
else
|
else
|
||||||
printf("msync: Success: %p\n", base);
|
printf("msync: Success: %p\n", base);
|
||||||
|
|
||||||
|
printf("%s: Calling munmap()\n", __TASKNAME__);
|
||||||
if (munmap(base + PAGE_SIZE*2, PAGE_SIZE) < 0)
|
if (munmap(base + PAGE_SIZE*2, PAGE_SIZE) < 0)
|
||||||
perror("munmap");
|
perror("munmap");
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user