parent
bb5a2a3906
commit
5a427fbf1f
@ -135,9 +135,9 @@ irq_handler_t irq_get_exclusive_handler(uint num) {
|
|||||||
static uint16_t make_branch(uint16_t *from, void *to) {
|
static uint16_t make_branch(uint16_t *from, void *to) {
|
||||||
uint32_t ui_from = (uint32_t)from;
|
uint32_t ui_from = (uint32_t)from;
|
||||||
uint32_t ui_to = (uint32_t)to;
|
uint32_t ui_to = (uint32_t)to;
|
||||||
uint32_t delta = (ui_to - ui_from - 4) / 2;
|
int32_t delta = (int32_t)(ui_to - ui_from - 4);
|
||||||
assert(!(delta >> 11u));
|
assert(delta >= -2048 && delta <= 2046 && !(delta & 1));
|
||||||
return (uint16_t)(0xe000 | (delta & 0x7ff));
|
return (uint16_t)(0xe000 | ((delta >> 1) & 0x7ff));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void insert_branch_and_link(uint16_t *from, void *to) {
|
static void insert_branch_and_link(uint16_t *from, void *to) {
|
||||||
|
Loading…
Reference in New Issue
Block a user