aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2014-09-29 19:18:25 -0400
committerKevin O'Connor <kevin@koconnor.net>2014-09-30 09:42:55 -0400
commitfabc1b51451b466bc11c9f90814961666a265df8 (patch)
tree9661c9c4f01a891a99cd5e4f11d646ca9a9bb99c
parent1389eee20e6dccb5bf2fc92132cdde7b3b92a848 (diff)
downloadseabios-fabc1b51451b466bc11c9f90814961666a265df8.zip
seabios-fabc1b51451b466bc11c9f90814961666a265df8.tar.gz
seabios-fabc1b51451b466bc11c9f90814961666a265df8.tar.bz2
Add need_hop_back() call that determines if stack_hop_back is needed
Also, use need_hop_back() instead of on_extra_stack() in code that determines whether or not to call stack_hop_back(). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
-rw-r--r--src/stacks.c8
-rw-r--r--src/stacks.h10
2 files changed, 14 insertions, 4 deletions
diff --git a/src/stacks.c b/src/stacks.c
index dd955fb..4fd70a7 100644
--- a/src/stacks.c
+++ b/src/stacks.c
@@ -115,7 +115,7 @@ u8 ExtraStack[BUILD_EXTRA_STACK_SIZE+1] VARLOW __aligned(8);
u8 *StackPos VARLOW;
// Test if currently on the extra stack
-static inline int
+int
on_extra_stack(void)
{
return MODE16 && GET_SEG(SS) == SEG_LOW && getesp() > (u32)ExtraStack;
@@ -197,7 +197,7 @@ void VISIBLE16
_farcall16(struct bregs *callregs, u16 callregseg)
{
ASSERT16();
- if (on_extra_stack()) {
+ if (need_hop_back()) {
stack_hop_back((u32)callregs, callregseg, _farcall16);
return;
}
@@ -384,7 +384,7 @@ fail:
void VISIBLE16
check_irqs(void)
{
- if (on_extra_stack()) {
+ if (need_hop_back()) {
stack_hop_back(0, 0, check_irqs);
return;
}
@@ -416,7 +416,7 @@ yield(void)
void VISIBLE16
wait_irq(void)
{
- if (on_extra_stack()) {
+ if (need_hop_back()) {
stack_hop_back(0, 0, wait_irq);
return;
}
diff --git a/src/stacks.h b/src/stacks.h
index 9d3422f..265b404 100644
--- a/src/stacks.h
+++ b/src/stacks.h
@@ -9,6 +9,7 @@ u32 call32(void *func, u32 eax, u32 errret);
extern u8 ExtraStack[], *StackPos;
u32 stack_hop(u32 eax, u32 edx, void *func);
u32 stack_hop_back(u32 eax, u32 edx, void *func);
+int on_extra_stack(void);
struct bregs;
inline void farcall16(struct bregs *callregs);
inline void farcall16big(struct bregs *callregs);
@@ -35,4 +36,13 @@ int wait_preempt(void);
void check_preempt(void);
u32 call32_params(void *func, u32 eax, u32 edx, u32 ecx, u32 errret);
+// Inline functions
+
+// Check if a call to stack_hop_back is needed.
+static inline int
+need_hop_back(void)
+{
+ return on_extra_stack();
+}
+
#endif // stacks.h