Skip to content

Commit

Permalink
Ignore the Upper Bits due to T-Head MMU Flags
Browse files Browse the repository at this point in the history
  • Loading branch information
lupyuen committed Jan 19, 2024
1 parent 3be2162 commit bfa28e5
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions riscv_cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -374,10 +374,14 @@ int target_read_slow(RISCVCPUState *s, mem_uint_t *pval,
s->pending_exception = CAUSE_LOAD_PAGE_FAULT;
return -1;
}

//// Ignore the Upper Bits due to T-Head MMU Flags
paddr &= 0xfffffffffffful; ////

pr = get_phys_mem_range(s->mem_map, paddr);
if (!pr) {
//// Begin Test: Intercept Memory-Mapped I/O
switch(paddr & 0xfffffffffffful) { // TODO: Why does NuttX read from 0x4000000030002084?
switch(paddr) {
case 0x30002084: // uart_fifo_config_1: Is UART Ready?
ret = 32; break; // UART TX is always ready, default TX FIFO Available is 32

Expand Down Expand Up @@ -469,10 +473,14 @@ int target_write_slow(RISCVCPUState *s, target_ulong addr,
s->pending_exception = CAUSE_STORE_PAGE_FAULT;
return -1;
}

//// Ignore the Upper Bits due to T-Head MMU Flags
paddr &= 0xfffffffffffful; ////

pr = get_phys_mem_range(s->mem_map, paddr);
if (!pr) {
//// Begin Test: Intercept Memory-Mapped I/O
switch(paddr & 0xfffffffffffful) { // TODO: Why does NuttX write to 0x4000000030002088?
switch(paddr) {
case 0x30002088: { // uart_fifo_wdata: UART Output
// Print the character
char buf[1];
Expand Down

0 comments on commit bfa28e5

Please sign in to comment.