Skip to content

Commit

Permalink
Merge pull request #568 from Ziemas/threadman-fix-gp
Browse files Browse the repository at this point in the history
threadman: Fix inline assembly for getting $gp
  • Loading branch information
uyjulian authored Mar 22, 2024
2 parents 85bc3c0 + 2ecc3f4 commit 913a7bf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions iop/system/threadman/src/thbase.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ int CreateThread(iop_thread_t *thparam)
thread->option = thparam->option;
thread->status = THS_DORMANT;

asm __volatile__("sw $gp, 0(%0)\n"
: "=r"(thread->gp)::);
asm __volatile__("sw $gp, %0\n"
: "=m"(thread->gp)::);

list_insert(&thctx.thread_list, &thread->thread_list);

Expand Down
8 changes: 4 additions & 4 deletions iop/system/threadman/src/thcommon.c
Original file line number Diff line number Diff line change
Expand Up @@ -651,8 +651,8 @@ int _start(int argc, char **argv)
idle->saved_regs = idle->stack_top + (((idle->stack_size << 2) >> 2) - RESERVED_REGCTX_SIZE);
memset(idle->saved_regs, 0, RESERVED_REGCTX_SIZE);

asm __volatile__("sw $gp, 0(%0)\n"
: "=r"(idle->gp)::);
asm __volatile__("sw $gp, %0\n"
: "=m"(idle->gp)::);

idle->saved_regs->unk = -2;
idle->saved_regs->sp = (u32)&idle->saved_regs[1];
Expand Down Expand Up @@ -680,8 +680,8 @@ int _start(int argc, char **argv)
current->attr = TH_C;
current->status = THS_RUN;

asm __volatile__("sw $gp, 0(%0)\n"
: "=r"(current->gp)::);
asm __volatile__("sw $gp, %0\n"
: "=m"(current->gp)::);

list_insert(&thctx.thread_list, &current->thread_list);
thctx.current_thread = current;
Expand Down

0 comments on commit 913a7bf

Please sign in to comment.