Skip to content

Commit

Permalink
move panic to default case
Browse files Browse the repository at this point in the history
  • Loading branch information
franciscozdo committed Jan 9, 2024
1 parent 6756a96 commit a721744
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
9 changes: 6 additions & 3 deletions include/aarch64/pmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,9 @@ static __no_profile inline size_t pde_index(int lvl, vaddr_t va) {
return L2_INDEX(va);
case 3:
return L3_INDEX(va);
default:
panic("Invalid level: %d", lvl);
}
panic("Invalid level: %d", lvl);
}

static __no_profile inline bool pde_valid_index(int lvl, size_t index) {
Expand All @@ -77,8 +78,9 @@ static __no_profile inline bool pde_valid_index(int lvl, size_t index) {
case 2:
case 3:
return index < Ln_ENTRIES;
default:
panic("Invalid level: %d", lvl);
}
panic("Invalid level: %d", lvl);
}

static __no_profile inline size_t pde_size(int lvl) {
Expand All @@ -91,8 +93,9 @@ static __no_profile inline size_t pde_size(int lvl) {
return L2_SIZE;
case 3:
return L3_SIZE;
default:
panic("Invalid level: %d", lvl);
}
panic("Invalid level: %d", lvl);
}

/*
Expand Down
9 changes: 6 additions & 3 deletions include/mips/pmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,9 @@ static __no_profile inline size_t pde_index(int lvl, vaddr_t va) {
return PDE_INDEX(va);
case 1:
return PTE_INDEX(va);
default:
panic("Invalid level: %d", lvl);
}
panic("Invalid level: %d", lvl);
}

static __no_profile inline bool pde_valid_index(int lvl, size_t index) {
Expand All @@ -101,8 +102,9 @@ static __no_profile inline bool pde_valid_index(int lvl, size_t index) {
case 2:
case 3:
return index < PT_ENTRIES;
default:
panic("Invalid level: %d", lvl);
}
panic("Invalid level: %d", lvl);
}

static __no_profile inline size_t pde_size(int lvl) {
Expand All @@ -111,8 +113,9 @@ static __no_profile inline size_t pde_size(int lvl) {
return PAGESIZE * PT_ENTRIES;
case 1:
return PAGESIZE;
default:
panic("Invalid level: %d", lvl);
}
panic("Invalid level: %d", lvl);
}

/*
Expand Down
9 changes: 6 additions & 3 deletions include/riscv/pmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@ static __no_profile inline size_t pde_index(int lvl, vaddr_t va) {
case 2:
return L2_INDEX(va);
#endif
default:
panic("Invalid level: %d", lvl);
}
panic("Invalid level: %d", lvl);
}

static __no_profile inline bool pde_valid_index(int lvl, size_t index) {
Expand All @@ -74,8 +75,9 @@ static __no_profile inline bool pde_valid_index(int lvl, size_t index) {
case 2:
#endif
return index < Ln_ENTRIES;
default:
panic("Invalid level: %d", lvl);
}
panic("Invalid level: %d", lvl);
}

static __no_profile inline size_t pde_size(int lvl) {
Expand All @@ -88,8 +90,9 @@ static __no_profile inline size_t pde_size(int lvl) {
case 2:
return L2_SIZE;
#endif
default:
panic("Invalid level: %d", lvl);
}
panic("Invalid level: %d", lvl);
}

/*
Expand Down

0 comments on commit a721744

Please sign in to comment.