28
28
#include <sys/cdefs.h>
29
29
#include <sys/types.h>
30
30
#include <stdio.h>
31
- #include <assert.h>
32
31
#include <errno.h>
33
32
#include <pthread.h>
34
33
#include <signal.h>
@@ -69,7 +68,6 @@ static int
69
68
reset_handler (struct vmctx * ctx , int vcpu , int in , int port , int bytes ,
70
69
uint32_t * eax , void * arg )
71
70
{
72
- int error ;
73
71
static uint8_t reset_control ;
74
72
75
73
if (bytes != 1 )
@@ -81,14 +79,12 @@ reset_handler(struct vmctx *ctx, int vcpu, int in, int port, int bytes,
81
79
82
80
if (* eax & 0x8 ) {
83
81
fprintf (stderr , "full reset\r\n" );
84
- error = vm_suspend (ctx , VM_SUSPEND_FULL_RESET );
85
- assert (error == 0 || errno == EALREADY );
82
+ vm_suspend (ctx , VM_SUSPEND_FULL_RESET );
86
83
mevent_notify ();
87
84
reset_control = 0 ;
88
85
} else if (* eax & 0x4 ) {
89
86
fprintf (stderr , "system reset\r\n" );
90
- error = vm_suspend (ctx , VM_SUSPEND_SYSTEM_RESET );
91
- assert (error == 0 || errno == EALREADY );
87
+ vm_suspend (ctx , VM_SUSPEND_SYSTEM_RESET );
92
88
mevent_notify ();
93
89
}
94
90
}
@@ -279,8 +275,6 @@ static int
279
275
pm1_control_handler (struct vmctx * ctx , int vcpu , int in , int port , int bytes ,
280
276
uint32_t * eax , void * arg )
281
277
{
282
- int error ;
283
-
284
278
if (bytes != 2 )
285
279
return -1 ;
286
280
if (in )
@@ -300,13 +294,11 @@ pm1_control_handler(struct vmctx *ctx, int vcpu, int in, int port, int bytes,
300
294
*/
301
295
if (* eax & VIRTUAL_PM1A_SLP_EN ) {
302
296
if ((pm1_control & VIRTUAL_PM1A_SLP_TYP ) >> 10 == 5 ) {
303
- error = vm_suspend (ctx , VM_SUSPEND_POWEROFF );
304
- assert (error == 0 || errno == EALREADY );
297
+ vm_suspend (ctx , VM_SUSPEND_POWEROFF );
305
298
}
306
299
307
300
if ((pm1_control & VIRTUAL_PM1A_SLP_TYP ) >> 10 == 3 ) {
308
- error = vm_suspend (ctx , VM_SUSPEND_SUSPEND );
309
- assert (error == 0 || errno == EALREADY );
301
+ vm_suspend (ctx , VM_SUSPEND_SUSPEND );
310
302
}
311
303
}
312
304
}
@@ -452,8 +444,7 @@ static int
452
444
smi_cmd_handler (struct vmctx * ctx , int vcpu , int in , int port , int bytes ,
453
445
uint32_t * eax , void * arg )
454
446
{
455
- assert (!in );
456
- if (bytes != 1 )
447
+ if (in || (bytes != 1 ))
457
448
return -1 ;
458
449
459
450
pthread_mutex_lock (& pm_lock );
0 commit comments