custom message type for VM_INFO

This commit is contained in:
Ben Gras 2014-07-26 13:53:48 +02:00 committed by Lionel Sambuc
parent 3c88d20cb5
commit 9e2efbd73d
4 changed files with 33 additions and 27 deletions

View file

@ -773,13 +773,8 @@
# define VM_NOTIFY_SIG_IPC m1_i2 # define VM_NOTIFY_SIG_IPC m1_i2
#define VM_INFO (VM_RQ_BASE+40) #define VM_INFO (VM_RQ_BASE+40)
# define VMI_WHAT m2_i1
# define VMI_EP m2_i2
# define VMI_COUNT m2_i3
# define VMI_PTR m2_p1
# define VMI_NEXT m2_l1
/* VMI_WHAT values. */ /* VM_INFO 'what' values. */
#define VMIW_STATS 1 #define VMIW_STATS 1
#define VMIW_USAGE 2 #define VMIW_USAGE 2
#define VMIW_REGION 3 #define VMIW_REGION 3

View file

@ -1741,6 +1741,16 @@ typedef struct {
} mess_lsys_vm_query_exit; } mess_lsys_vm_query_exit;
_ASSERT_MSG_SIZE(mess_lsys_vm_query_exit); _ASSERT_MSG_SIZE(mess_lsys_vm_query_exit);
typedef struct {
int what;
endpoint_t ep;
int count;
void *ptr;
vir_bytes next;
uint8_t padding[36];
} mess_lsys_vm_info;
_ASSERT_MSG_SIZE(mess_lsys_vm_info);
typedef struct { typedef struct {
endpoint_t m_source; /* who sent the message */ endpoint_t m_source; /* who sent the message */
int m_type; /* what kind of message is it */ int m_type; /* what kind of message is it */
@ -1964,6 +1974,7 @@ typedef struct {
mess_lc_vm_getphys m_lc_vm_getphys; mess_lc_vm_getphys m_lc_vm_getphys;
mess_lc_vm_shm_unmap m_lc_vm_shm_unmap; mess_lc_vm_shm_unmap m_lc_vm_shm_unmap;
mess_lsys_vm_query_exit m_lsys_vm_query_exit; mess_lsys_vm_query_exit m_lsys_vm_query_exit;
mess_lsys_vm_info m_lsys_vm_info;
mess_vfs_lchardriver_cancel m_vfs_lchardriver_cancel; mess_vfs_lchardriver_cancel m_vfs_lchardriver_cancel;
mess_vfs_lchardriver_openclose m_vfs_lchardriver_openclose; mess_vfs_lchardriver_openclose m_vfs_lchardriver_openclose;

View file

@ -12,8 +12,8 @@ int vm_info_stats(struct vm_stats_info *vsi)
message m; message m;
memset(&m, 0, sizeof(m)); memset(&m, 0, sizeof(m));
m.VMI_WHAT = VMIW_STATS; m.m_lsys_vm_info.what = VMIW_STATS;
m.VMI_PTR = (void *) vsi; m.m_lsys_vm_info.ptr = vsi;
return _taskcall(VM_PROC_NR, VM_INFO, &m); return _taskcall(VM_PROC_NR, VM_INFO, &m);
} }
@ -26,9 +26,9 @@ int vm_info_usage(endpoint_t who, struct vm_usage_info *vui)
message m; message m;
memset(&m, 0, sizeof(m)); memset(&m, 0, sizeof(m));
m.VMI_WHAT = VMIW_USAGE; m.m_lsys_vm_info.what = VMIW_USAGE;
m.VMI_EP = who; m.m_lsys_vm_info.ep = who;
m.VMI_PTR = (void *) vui; m.m_lsys_vm_info.ptr = vui;
return _taskcall(VM_PROC_NR, VM_INFO, &m); return _taskcall(VM_PROC_NR, VM_INFO, &m);
} }
@ -43,16 +43,16 @@ int vm_info_region(endpoint_t who, struct vm_region_info *vri,
int result; int result;
memset(&m, 0, sizeof(m)); memset(&m, 0, sizeof(m));
m.VMI_WHAT = VMIW_REGION; m.m_lsys_vm_info.what = VMIW_REGION;
m.VMI_EP = who; m.m_lsys_vm_info.ep = who;
m.VMI_COUNT = count; m.m_lsys_vm_info.count = count;
m.VMI_PTR = (void *) vri; m.m_lsys_vm_info.ptr = vri;
m.VMI_NEXT = *next; m.m_lsys_vm_info.next = *next;
if ((result = _taskcall(VM_PROC_NR, VM_INFO, &m)) != OK) if ((result = _taskcall(VM_PROC_NR, VM_INFO, &m)) != OK)
return result; return result;
*next = m.VMI_NEXT; *next = m.m_lsys_vm_info.next;
return m.VMI_COUNT; return m.m_lsys_vm_info.count;
} }

View file

@ -111,9 +111,9 @@ int do_info(message *m)
return EINVAL; return EINVAL;
vmp = &vmproc[pr]; vmp = &vmproc[pr];
ptr = (vir_bytes) m->VMI_PTR; ptr = (vir_bytes) m->m_lsys_vm_info.ptr;
switch(m->VMI_WHAT) { switch(m->m_lsys_vm_info.what) {
case VMIW_STATS: case VMIW_STATS:
vsi.vsi_pagesize = VM_PAGE_SIZE; vsi.vsi_pagesize = VM_PAGE_SIZE;
vsi.vsi_total = total_pages; vsi.vsi_total = total_pages;
@ -129,9 +129,9 @@ int do_info(message *m)
break; break;
case VMIW_USAGE: case VMIW_USAGE:
if(m->VMI_EP < 0) if(m->m_lsys_vm_info.ep < 0)
get_usage_info_kernel(&vui); get_usage_info_kernel(&vui);
else if (vm_isokendpt(m->VMI_EP, &pr) != OK) else if (vm_isokendpt(m->m_lsys_vm_info.ep, &pr) != OK)
return EINVAL; return EINVAL;
else get_usage_info(&vmproc[pr], &vui); else get_usage_info(&vmproc[pr], &vui);
@ -141,16 +141,16 @@ int do_info(message *m)
break; break;
case VMIW_REGION: case VMIW_REGION:
if (vm_isokendpt(m->VMI_EP, &pr) != OK) if (vm_isokendpt(m->m_lsys_vm_info.ep, &pr) != OK)
return EINVAL; return EINVAL;
count = MIN(m->VMI_COUNT, MAX_VRI_COUNT); count = MIN(m->m_lsys_vm_info.count, MAX_VRI_COUNT);
next = m->VMI_NEXT; next = m->m_lsys_vm_info.next;
count = get_region_info(&vmproc[pr], vri, count, &next); count = get_region_info(&vmproc[pr], vri, count, &next);
m->VMI_COUNT = count; m->m_lsys_vm_info.count = count;
m->VMI_NEXT = next; m->m_lsys_vm_info.next = next;
addr = (vir_bytes) vri; addr = (vir_bytes) vri;
size = sizeof(vri[0]) * count; size = sizeof(vri[0]) * count;