Merge pull request #152 from hcs64/clear-halt-save-pc

Preserve SP PC when clearing halt, don't re-init pipeline if not halted
This commit is contained in:
Mike Ryan 2020-05-30 06:55:51 -07:00 committed by GitHub
commit 736220010d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -101,8 +101,12 @@ void rsp_status_write(struct rsp *rsp, uint32_t rt) {
prev_status = rsp->regs[RSP_CP0_REGISTER_SP_STATUS];
status = prev_status;
if (rt & SP_CLR_HALT) {
if ((rt & SP_CLR_HALT) && (status & SP_STATUS_HALT)) {
// Save PC around pipeline init
uint32_t pc = rsp->pipeline.ifrd_latch.pc;
rsp_pipeline_init(&rsp->pipeline);
rsp->pipeline.ifrd_latch.pc = pc;
status &= ~SP_STATUS_HALT;
}