summaryrefslogtreecommitdiff
path: root/core/include
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2009-09-02 17:44:32 -0700
committerH. Peter Anvin <hpa@zytor.com>2009-09-02 17:44:32 -0700
commit75d4dec2f651c9f25fa95d6b6960db7c4dcfd7a0 (patch)
tree1fc477d5f43577a31eaaff7c5a17f719c4e69e1d /core/include
parent94a6e382a7a253fdab67a3bff981844dd5f6d4cb (diff)
downloadsyslinux-75d4dec2f651c9f25fa95d6b6960db7c4dcfd7a0.tar.gz
core: hook INT 1Ch for a simple monotonic timer
The BIOS_timer variable at 4C6h is somewhat unreliable... it is documented to wrap at "midnight", norminally after 1627419 ticks (0x18d51b), which is a rather awkward number to deal with modulo. Instead, hook the INT 1Ch secondary timer interrupt and just count a simple incrementing variable. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'core/include')
-rw-r--r--core/include/core.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/core/include/core.h b/core/include/core.h
index c13aa16f..dbcbff1c 100644
--- a/core/include/core.h
+++ b/core/include/core.h
@@ -43,5 +43,13 @@ void call16(void (*)(void), const com32sys_t *, com32sys_t *);
__noreturn _kaboom(void);
#define kaboom() _kaboom()
+/*
+ * Basic timer function...
+ */
+extern const volatile uint32_t __jiffies;
+static inline uint32_t jiffies(void)
+{
+ return __jiffies;
+}
#endif /* CORE_H */