kernel: Extend the sys_statectl() interface.
Change-Id: Ica37640f61513db9466dacf861a8148e3fb799d5
This commit is contained in:
parent
606626c691
commit
41022be182
10 changed files with 20 additions and 6 deletions
|
@ -432,6 +432,7 @@
|
|||
|
||||
/* Subfunctions for SYS_STATECTL */
|
||||
#define SYS_STATE_CLEAR_IPC_REFS 1 /* clear IPC references */
|
||||
#define SYS_STATE_SET_STATE_TABLE 2 /* set state map */
|
||||
|
||||
/* Subfunctions for SYS_SCHEDCTL */
|
||||
# define SCHEDCTL_FLAG_KERNEL 1 /* mark kernel scheduler and remove
|
||||
|
|
|
@ -1177,8 +1177,10 @@ _ASSERT_MSG_SIZE(mess_lsys_krn_sys_sprof);
|
|||
|
||||
typedef struct {
|
||||
int request;
|
||||
void *address;
|
||||
int length;
|
||||
|
||||
uint8_t padding[52];
|
||||
uint8_t padding[44];
|
||||
} mess_lsys_krn_sys_statectl;
|
||||
_ASSERT_MSG_SIZE(mess_lsys_krn_sys_statectl);
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ int sys_schedctl(unsigned flags, endpoint_t proc_ep, int priority, int
|
|||
int sys_runctl(endpoint_t proc_ep, int action, int flags);
|
||||
|
||||
int sys_update(endpoint_t src_ep, endpoint_t dst_ep);
|
||||
int sys_statectl(int request);
|
||||
int sys_statectl(int request, void* address, int length);
|
||||
int sys_privctl(endpoint_t proc_ep, int req, void *p);
|
||||
int sys_privquery_mem(endpoint_t proc_ep, phys_bytes physstart,
|
||||
phys_bytes physlen);
|
||||
|
|
|
@ -57,6 +57,8 @@ struct priv {
|
|||
int s_irq_tab[NR_IRQ];
|
||||
vir_bytes s_grant_table; /* grant table address of process, or 0 */
|
||||
int s_grant_entries; /* no. of entries, or 0 */
|
||||
vir_bytes s_state_table; /* state table address of process, or 0 */
|
||||
int s_state_entries; /* no. of entries, or 0 */
|
||||
};
|
||||
|
||||
/* Guard word for task stacks. */
|
||||
|
|
|
@ -150,6 +150,8 @@ int do_privctl(struct proc * caller, message * m_ptr)
|
|||
priv(rp)->s_nr_irq= 0;
|
||||
priv(rp)->s_grant_table= 0;
|
||||
priv(rp)->s_grant_entries= 0;
|
||||
priv(rp)->s_state_table= 0;
|
||||
priv(rp)->s_state_entries= 0;
|
||||
|
||||
/* Override defaults if the caller has supplied a privilege structure. */
|
||||
if (m_ptr->m_lsys_krn_sys_privctl.arg_ptr)
|
||||
|
|
|
@ -24,6 +24,11 @@ int do_statectl(struct proc * caller, message * m_ptr)
|
|||
*/
|
||||
clear_ipc_refs(caller, EDEADSRCDST);
|
||||
return(OK);
|
||||
case SYS_STATE_SET_STATE_TABLE:
|
||||
/* Set state table for the caller. */
|
||||
priv(caller)->s_state_table = (vir_bytes) m_ptr->m_lsys_krn_sys_statectl.address;
|
||||
priv(caller)->s_state_entries = m_ptr->m_lsys_krn_sys_statectl.length;
|
||||
return(OK);
|
||||
default:
|
||||
printf("do_statectl: bad request %d\n",
|
||||
m_ptr->m_lsys_krn_sys_statectl.request);
|
||||
|
|
|
@ -106,7 +106,7 @@ void blockdriver_announce(int type)
|
|||
* will not restart statefully, and thus will skip this code.
|
||||
*/
|
||||
if (type == SEF_INIT_RESTART) {
|
||||
if ((r = sys_statectl(SYS_STATE_CLEAR_IPC_REFS)) != OK)
|
||||
if ((r = sys_statectl(SYS_STATE_CLEAR_IPC_REFS, 0, 0)) != OK)
|
||||
panic("blockdriver_init: sys_statectl failed: %d", r);
|
||||
}
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@ void chardriver_announce(void)
|
|||
* For this reason, there may blocked callers when a driver restarts.
|
||||
* Ask the kernel to unblock them (if any).
|
||||
*/
|
||||
if ((r = sys_statectl(SYS_STATE_CLEAR_IPC_REFS)) != OK)
|
||||
if ((r = sys_statectl(SYS_STATE_CLEAR_IPC_REFS, 0, 0)) != OK)
|
||||
panic("chardriver_announce: sys_statectl failed: %d", r);
|
||||
|
||||
/* Publish a driver up event. */
|
||||
|
|
|
@ -21,7 +21,7 @@ i2cdriver_announce(uint32_t bus)
|
|||
* For this reason, there may blocked callers when a driver restarts.
|
||||
* Ask the kernel to unblock them (if any).
|
||||
*/
|
||||
if ((r = sys_statectl(SYS_STATE_CLEAR_IPC_REFS)) != OK) {
|
||||
if ((r = sys_statectl(SYS_STATE_CLEAR_IPC_REFS, 0, 0)) != OK) {
|
||||
panic("chardriver_init: sys_statectl failed: %d", r);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
#include "syslib.h"
|
||||
|
||||
int sys_statectl(int request)
|
||||
int sys_statectl(int request, void* address, int length)
|
||||
{
|
||||
message m;
|
||||
|
||||
m.m_lsys_krn_sys_statectl.request = request;
|
||||
m.m_lsys_krn_sys_statectl.address = address;
|
||||
m.m_lsys_krn_sys_statectl.length = length;
|
||||
|
||||
return _kernel_call(SYS_STATECTL, &m);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue