forked from M-Labs/artiq
Rust: implement exceptional RPC replies.
This commit is contained in:
parent
226fa723bb
commit
e92f20546a
|
@ -110,7 +110,7 @@ impl<'a> Message<'a> {
|
|||
let msg = c::RpcRecvReply {
|
||||
ty: c::Type::RpcRecvReply,
|
||||
alloc_size: alloc_size as _,
|
||||
exception: exn.map_or(ptr::null(), |exn| &exn as *const _)
|
||||
exception: exn.as_ref().map_or(ptr::null(), |exn| exn as *const _)
|
||||
};
|
||||
f(&msg as *const _ as *const _)
|
||||
}
|
||||
|
|
|
@ -264,7 +264,36 @@ fn process_host_message(waiter: Waiter,
|
|||
Ok(())
|
||||
}
|
||||
|
||||
request => unexpected!("unexpected request {:?} from host machine", request)
|
||||
host::Request::RpcException {
|
||||
name, message, param, file, line, column, function
|
||||
} => {
|
||||
if session.kernel_state != KernelState::RpcWait {
|
||||
unexpected!("unsolicited RPC reply")
|
||||
}
|
||||
|
||||
try!(kern_recv(waiter, |reply| {
|
||||
match reply {
|
||||
kern::RpcRecvRequest { .. } => Ok(()),
|
||||
other =>
|
||||
unexpected!("unexpected reply from kernel CPU: {:?}", other)
|
||||
}
|
||||
}));
|
||||
try!(kern_send(waiter, kern::RpcRecvReply {
|
||||
alloc_size: 0,
|
||||
exception: Some(kern::Exception {
|
||||
name: &name,
|
||||
message: &message,
|
||||
param: param,
|
||||
file: &file,
|
||||
line: line,
|
||||
column: column,
|
||||
function: &function
|
||||
})
|
||||
}));
|
||||
|
||||
session.kernel_state = KernelState::Running;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,8 +15,8 @@ CFLAGS += -I$(LIBALLOC_DIRECTORY) \
|
|||
-I$(LIBUNWIND_DIRECTORY) \
|
||||
-I$(LIBUNWIND_DIRECTORY)/../unwinder/include \
|
||||
-I$(LIBLWIP_DIRECTORY)/../lwip/src/include \
|
||||
-I$(LIBLWIP_DIRECTORY) \
|
||||
-DNDEBUG
|
||||
-I$(LIBLWIP_DIRECTORY)
|
||||
CFLAGS += -DNDEBUG
|
||||
|
||||
all: runtime.bin runtime.fbi
|
||||
|
||||
|
|
Loading…
Reference in New Issue