#define VMCTL_BOOTINHIBIT_CLEAR 33
/* Codes and field names for SYS_DIAGCTL. */
-#define DIAGCTL_CODE m1_i1 /* DIAGCTL_CODE_* below */
-#define DIAGCTL_ARG1 m1_p1
-#define DIAGCTL_ARG2 m1_i2
#define DIAGCTL_CODE_DIAG 1 /* Print diagnostics. */
#define DIAGCTL_CODE_STACKTRACE 2 /* Print process stack. */
#define DIAGCTL_CODE_REGISTER 3 /* Register for diagnostic signals */
} mess_pm_lsys_sigs_signal;
_ASSERT_MSG_SIZE(mess_pm_lsys_sigs_signal);
+typedef struct {
+ int code;
+ vir_bytes buf;
+ int len;
+ endpoint_t endpt;
+
+ uint8_t padding[40];
+} mess_lsys_krn_sys_diagctl;
+_ASSERT_MSG_SIZE(mess_lsys_krn_sys_diagctl);
+
typedef struct {
off_t offset;
void *addr;
mess_notify m_notify;
mess_sigcalls m_sigcalls;
+ mess_lsys_krn_sys_diagctl m_lsys_krn_sys_diagctl;
mess_lsys_krn_readbios m_lsys_krn_readbios;
mess_pm_lsys_sigs_signal m_pm_lsys_sigs_signal;
mess_input_tty_event m_input_tty_event;
* m_type: SYS_DIAGCTL
*
* The parameters for this kernel call are:
- * DIAGCTL_CODE request
- * and then request-specific arguments in DIAGCTL_ARG1 and DIAGCTL_ARG2.
+ * m_lsys_krn_sys_diagctl.code request
+ * and then request-specific arguments in
+ * m_lsys_krn_sys_diagctl.buf
+ * m_lsys_krn_sys_diagctl.len
+ * m_lsys_krn_sys_diagctl.endpt
*/
#include "kernel/system.h"
static char mybuf[DIAG_BUFSIZE];
int s, i, proc_nr;
- switch (m_ptr->DIAGCTL_CODE) {
+ switch (m_ptr->m_lsys_krn_sys_diagctl.code) {
case DIAGCTL_CODE_DIAG:
- buf = (vir_bytes) m_ptr->DIAGCTL_ARG1;
- len = (vir_bytes) m_ptr->DIAGCTL_ARG2;
+ buf = m_ptr->m_lsys_krn_sys_diagctl.buf;
+ len = m_ptr->m_lsys_krn_sys_diagctl.len;
if(len < 1 || len > DIAG_BUFSIZE) {
printf("do_diagctl: diag for %d: len %d out of range\n",
caller->p_endpoint, len);
kputc(END_OF_KMESS);
return OK;
case DIAGCTL_CODE_STACKTRACE:
- if(!isokendpt(m_ptr->DIAGCTL_ARG2, &proc_nr))
+ if(!isokendpt(m_ptr->m_lsys_krn_sys_diagctl.endpt, &proc_nr))
return EINVAL;
proc_stacktrace(proc_addr(proc_nr));
return OK;
priv(caller)->s_diag_sig = FALSE;
return OK;
default:
- printf("do_diagctl: invalid request %d\n", m_ptr->DIAGCTL_CODE);
+ printf("do_diagctl: invalid request %d\n", m_ptr->m_lsys_krn_sys_diagctl.code);
return(EINVAL);
}
}
#include "syslib.h"
+#include "sysutil.h"
int sys_diagctl(int code, char *arg1, int arg2)
{
message m;
- m.DIAGCTL_CODE = code;
- m.DIAGCTL_ARG1 = arg1;
- m.DIAGCTL_ARG2 = arg2;
+ m.m_lsys_krn_sys_diagctl.code = code;
+
+ switch(code) {
+ case DIAGCTL_CODE_DIAG:
+ m.m_lsys_krn_sys_diagctl.buf = (vir_bytes)arg1;
+ m.m_lsys_krn_sys_diagctl.len = arg2;
+ break;
+ case DIAGCTL_CODE_STACKTRACE:
+ m.m_lsys_krn_sys_diagctl.endpt = (endpoint_t)arg2;
+ break;
+ case DIAGCTL_CODE_REGISTER:
+ break;
+ case DIAGCTL_CODE_UNREGISTER:
+ break;
+ default:
+ panic("Unknown SYS_DIAGCTL request %d\n", code);
+ }
return(_kernel_call(SYS_DIAGCTL, &m));
}