void __dead sef_exit(int status);
#define sef_receive(src, m_ptr) sef_receive_status(src, m_ptr, NULL)
+/* SEF global definitions. */
+#define SEF_STATE_TRANSFER_GID 0
+
/* SEF Debug. */
#include <stdio.h>
#define sef_dprint printf
*===========================================================================*/
/* What to intercept. */
#define INTERCEPT_SEF_INIT_REQUESTS 1
-#define IS_SEF_INIT_REQUEST(mp) ((mp)->m_type == RS_INIT \
- && (mp)->m_source == RS_PROC_NR)
+#define SEF_INIT_REQUEST_TYPE RS_INIT
+#define IS_SEF_INIT_REQUEST(mp, status) ((mp)->m_type == RS_INIT \
+ && (mp)->m_source == RS_PROC_NR)
+
+#define SEF_COPY_OLD_TO_NEW 0x001
+#define SEF_COPY_NEW_TO_NEW 0x002
+#define SEF_COPY_DEST_OFFSET 0x004
+#define SEF_COPY_SRC_OFFSET 0X008
/* Type definitions. */
typedef struct {
+ int flags;
cp_grant_id_t rproctab_gid;
endpoint_t endpoint;
endpoint_t old_endpoint;
+ int restarts;
+ void* init_buff_start;
+ void* init_buff_cleanup_start;
+ size_t init_buff_len;
} sef_init_info_t;
/* Callback type definitions. */
#define SEF_INIT_LU 1 /* init after live update */
#define SEF_INIT_RESTART 2 /* init after restart */
+/* Init flags (live update flags can be used as init flags as well). */
+#define SEF_INIT_CRASH 0x1
+#define SEF_INIT_FAIL 0x2
+#define SEF_INIT_TIMEOUT 0x4
+#define SEF_INIT_DEFCB 0x8
+#define SEF_INIT_SCRIPT_RESTART 0x10
+#define SEF_INIT_ST 0x20 /* force state transfer init */
+
/* Debug. */
-#define SEF_INIT_DEBUG_DEFAULT 0
+#define SEF_INIT_DEBUG_DEFAULT 0
+#define SEF_INIT_ALLOW_DEBUG_INIT_FLAGS 1
#ifndef SEF_INIT_DEBUG
#define SEF_INIT_DEBUG SEF_INIT_DEBUG_DEFAULT
*===========================================================================*/
/* What to intercept. */
#define INTERCEPT_SEF_PING_REQUESTS 1
+#define SEF_PING_REQUEST_TYPE NOTIFY_MESSAGE
#define IS_SEF_PING_REQUEST(mp, status) (is_ipc_notify(status) \
&& (mp)->m_source == RS_PROC_NR)
*===========================================================================*/
/* What to intercept. */
#define INTERCEPT_SEF_LU_REQUESTS 1
+#define SEF_LU_REQUEST_TYPE RS_LU_PREPARE
#define IS_SEF_LU_REQUEST(mp, status) ((mp)->m_type == RS_LU_PREPARE \
&& (mp)->m_source == RS_PROC_NR)
#define SEF_LU_IS_IDENTITY_UPDATE(F) (((F) & (SEF_LU_SELF|SEF_LU_NOMMAP|SEF_LU_ASR|SEF_INIT_ST)) == SEF_LU_SELF)
/* Debug. */
-#define SEF_LU_DEBUG_DEFAULT 1
+#define SEF_LU_DEBUG_DEFAULT 0
#define SEF_LU_ALWAYS_ALLOW_DEBUG_STATES 1
#ifndef SEF_LU_DEBUG
*===========================================================================*/
/* What to intercept. */
#define INTERCEPT_SEF_SIGNAL_REQUESTS 1
+#define SEF_SIGNAL_REQUEST_TYPE SIGS_SIGNAL_RECEIVED
#define IS_SEF_SIGNAL_REQUEST(mp, status) \
(((mp)->m_type == SIGS_SIGNAL_RECEIVED && (mp)->m_source < INIT_PROC_NR) \
|| (is_ipc_notify(status) && (mp)->m_source == SYSTEM))
*===========================================================================*/
/* What to intercept. */
#define INTERCEPT_SEF_FI_REQUESTS 1
+#define SEF_FI_REQUEST_TYPE COMMON_REQ_FI_CTL
#define IS_SEF_FI_REQUEST(mp, status) \
(m_ptr->m_type == COMMON_REQ_FI_CTL)
if(r != OK) {
panic("unable to ipc_receive from RS: %d", r);
}
- } while(!IS_SEF_INIT_REQUEST(&m));
+ } while(!IS_SEF_INIT_REQUEST(&m, status));
/* Process initialization request for this system service. */
if((r = do_sef_init_request(&m)) != OK) {
int sef_receive_status(endpoint_t src, message *m_ptr, int *status_ptr)
{
/* SEF receive() interface for system services. */
- int r, status;
+ int r, status, m_type;
sef_self_receiving = TRUE;
return r;
}
-#if INTERCEPT_SEF_PING_REQUESTS
- /* Intercept SEF Ping requests. */
- if(IS_SEF_PING_REQUEST(m_ptr, status)) {
- if(do_sef_ping_request(m_ptr) == OK) {
- continue;
+ m_type = m_ptr->m_type;
+ if (is_ipc_notify(status)) {
+ switch (m_ptr->m_source) {
+ case SYSTEM:
+ m_type = SEF_SIGNAL_REQUEST_TYPE;
+ break;
+ case RS_PROC_NR:
+ m_type = SEF_PING_REQUEST_TYPE;
+ break;
}
}
+ switch(m_type) {
+
+#if INTERCEPT_SEF_INIT_REQUESTS
+ case SEF_INIT_REQUEST_TYPE:
+ /* Intercept SEF Init requests. */
+ if(IS_SEF_INIT_REQUEST(m_ptr, status)) {
+ /* Ignore spurious init requests. */
+ if (m_ptr->m_rs_init.type != SEF_INIT_FRESH
+ || sef_self_endpoint != VM_PROC_NR)
+ continue;
+ }
+ break;
+#endif
+
+#if INTERCEPT_SEF_PING_REQUESTS
+ case SEF_PING_REQUEST_TYPE:
+ /* Intercept SEF Ping requests. */
+ if(IS_SEF_PING_REQUEST(m_ptr, status)) {
+ if(do_sef_ping_request(m_ptr) == OK) {
+ continue;
+ }
+ }
+ break;
#endif
#if INTERCEPT_SEF_LU_REQUESTS
- /* Intercept SEF Live update requests. */
- if(IS_SEF_LU_REQUEST(m_ptr, status)) {
- if(do_sef_lu_request(m_ptr) == OK) {
- continue;
+ case SEF_LU_REQUEST_TYPE:
+ /* Intercept SEF Live update requests. */
+ if(IS_SEF_LU_REQUEST(m_ptr, status)) {
+ if(do_sef_lu_request(m_ptr) == OK) {
+ continue;
+ }
}
- }
+ break;
#endif
#if INTERCEPT_SEF_SIGNAL_REQUESTS
- /* Intercept SEF Signal requests. */
- if(IS_SEF_SIGNAL_REQUEST(m_ptr, status)) {
- if(do_sef_signal_request(m_ptr) == OK) {
- continue;
+ case SEF_SIGNAL_REQUEST_TYPE:
+ /* Intercept SEF Signal requests. */
+ if(IS_SEF_SIGNAL_REQUEST(m_ptr, status)) {
+ if(do_sef_signal_request(m_ptr) == OK) {
+ continue;
+ }
}
- }
+ break;
#endif
#if INTERCEPT_SEF_GCOV_REQUESTS && USE_COVERAGE
- /* Intercept GCOV data requests (sent by VFS in vfs/gcov.c). */
- if(IS_SEF_GCOV_REQUEST(m_ptr, status)) {
- if(do_sef_gcov_request(m_ptr) == OK) {
- continue;
+ case SEF_GCOV_REQUEST_TYPE:
+ /* Intercept GCOV data requests (sent by VFS in vfs/gcov.c). */
+ if(IS_SEF_GCOV_REQUEST(m_ptr, status)) {
+ if(do_sef_gcov_request(m_ptr) == OK) {
+ continue;
+ }
}
- }
+ break;
#endif
-#ifdef INTERCEPT_SEF_FI_REQUESTS
- /* Intercept Fault injection requests. */
- if(IS_SEF_FI_REQUEST(m_ptr, status)) {
- if(do_sef_fi_request(m_ptr) == OK) {
- continue;
+#if INTERCEPT_SEF_FI_REQUESTS
+ case SEF_FI_REQUEST_TYPE:
+ /* Intercept SEF Fault Injection requests. */
+ if(IS_SEF_FI_REQUEST(m_ptr, status)) {
+ if(do_sef_fi_request(m_ptr) == OK) {
+ continue;
+ }
}
- }
+ break;
#endif
+ default:
+ break;
+ }
+
/* If we get this far, this is not a valid SEF request, return and
* let the caller deal with that.
*/