Skip to content

Commit

Permalink
Merge pull request #2090 from ghaerr/xmsmsg
Browse files Browse the repository at this point in the history
[kernel] Minor cleanup to precision timer, XMS A20 boot msg, fdreg.h
  • Loading branch information
ghaerr authored Oct 31, 2024
2 parents 2d59813 + faf275b commit 6e2bf76
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 22 deletions.
2 changes: 1 addition & 1 deletion elks/arch/i86/drivers/block/directfd.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,14 @@
#include <linuxmt/timer.h>
#include <linuxmt/mm.h>
#include <linuxmt/signal.h>
#include <linuxmt/fdreg.h>
#include <linuxmt/fd.h>
#include <linuxmt/errno.h>
#include <linuxmt/string.h>
#include <linuxmt/heap.h>
#include <linuxmt/debug.h>

#include <arch/dma.h>
#include <arch/fdreg.h>
#include <arch/system.h>
#include <arch/io.h>
#include <arch/irq.h>
Expand Down
9 changes: 0 additions & 9 deletions elks/arch/i86/lib/prectimer.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,21 +113,12 @@ unsigned long get_ptime(void)
count = lo | hi;
pticks = lastcount - count;
lastcount = count;
#if 1
if ((int)pticks < 0) { /* wrapped, jiffies is higher */
pticks += MAX_PTICK; /* = MAX_PTICK - count + lastcount */
jdiff--; /* adjust jiffies for wrap, won't ever be negative */
}
if (jdiff < 4286) /* < ~42.86s */
return jdiff * (unsigned long)MAX_PTICK + pticks;
#else /* incorrect (old) version - to be removed */
if ((int)pticks < 0) /* wrapped */
pticks += MAX_PTICK; /* = MAX_PTICK - count + lastcount */
if (jdiff < 2) /* < 10ms: 1..11931 */
return pticks;
if (jdiff < 4286) /* < ~42.86s */
return (jdiff - 1) * (unsigned long)MAX_PTICK + pticks;
#endif
return 0; /* overflow displays 0s */
}

Expand Down
6 changes: 3 additions & 3 deletions elks/arch/i86/mm/xms.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
#include <linuxmt/memory.h>
#include <linuxmt/kernel.h>
#include <linuxmt/init.h>

#include <linuxmt/string.h>
#include <linuxmt/debug.h>
#include <arch/segment.h>

/* linear address to start XMS buffer allocations from */
Expand Down Expand Up @@ -51,10 +51,10 @@ int xms_init(void)
return 0;
}
#endif
printk("A20 was %s", verify_a20()? "on" : "off");
debug("A20 was %s", verify_a20()? "on" : "off");
enable_a20_gate();
enabled = verify_a20();
printk(" now %s, ", enabled? "on" : "off");
debug(" now %s, ", enabled? "on" : "off");
if (!enabled) {
printk("disabled, A20 error, ");
return 0;
Expand Down
File renamed without changes.
9 changes: 0 additions & 9 deletions libc/debug/prectimer.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,21 +113,12 @@ unsigned long get_ptime(void)
count = lo | hi;
pticks = lastcount - count;
lastcount = count;
#if 1
if ((int)pticks < 0) { /* wrapped, jiffies is higher */
pticks += MAX_PTICK; /* = MAX_PTICK - count + lastcount */
jdiff--; /* adjust jiffies for wrap, won't ever be negative */
}
if (jdiff < 4286) /* < ~42.86s */
return jdiff * (unsigned long)MAX_PTICK + pticks;
#else /* incorrect (old) version - to be removed */
if ((int)pticks < 0) /* wrapped */
pticks += MAX_PTICK; /* = MAX_PTICK - count + lastcount */
if (jdiff < 2) /* < 10ms: 1..11931 */
return pticks;
if (jdiff < 4286) /* < ~42.86s */
return (jdiff - 1) * (unsigned long)MAX_PTICK + pticks;
#endif
return 0; /* overflow displays 0s */
}

Expand Down

0 comments on commit 6e2bf76

Please sign in to comment.