Skip to content

Commit

Permalink
Revert "hal: remove unused code"
Browse files Browse the repository at this point in the history
This reverts commit 2d5ec61.
  • Loading branch information
HBuczynski authored and HBuczynski committed Nov 22, 2022
1 parent ca363b2 commit 22a9bb2
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 0 deletions.
6 changes: 6 additions & 0 deletions hal/armv7a/arch/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,12 @@ static inline void *hal_cpuGetUserSP(cpu_context_t *ctx)
}


static inline int hal_cpuSupervisorMode(cpu_context_t *ctx)
{
return ctx->psr & 0xf;
}


static inline unsigned int hal_cpuGetID(void)
{
return 0;
Expand Down
6 changes: 6 additions & 0 deletions hal/armv7m/arch/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,12 @@ static inline void *hal_cpuGetUserSP(cpu_context_t *ctx)
}


static inline int hal_cpuSupervisorMode(cpu_context_t *ctx)
{
return 0;
}


static inline int hal_cpuPushSignal(void *kstack, void (*handler)(void), int sig)
{
return 0;
Expand Down
3 changes: 3 additions & 0 deletions hal/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ extern void *hal_cpuGetSP(cpu_context_t *ctx);
extern void *hal_cpuGetUserSP(cpu_context_t *ctx);


extern int hal_cpuSupervisorMode(cpu_context_t *ctx);


extern int hal_cpuPushSignal(void *kstack, void (*handler)(void), int n);


Expand Down
6 changes: 6 additions & 0 deletions hal/ia32/arch/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,12 @@ static inline void *hal_cpuGetUserSP(cpu_context_t *ctx)
}


static inline int hal_cpuSupervisorMode(cpu_context_t *ctx)
{
return ((ctx->cs & 3) == 0);
}


#endif

#endif
6 changes: 6 additions & 0 deletions hal/riscv64/arch/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,12 @@ static inline void *hal_cpuGetUserSP(cpu_context_t *ctx)
}


static inline int hal_cpuSupervisorMode(cpu_context_t *ctx)
{
return (ctx->sscratch == 0);
}


static inline int hal_cpuPushSignal(void *kstack, void (*handler)(void), int n)
{
#if 0
Expand Down

0 comments on commit 22a9bb2

Please sign in to comment.