Warning, cross-references for /kernel/util/screen.c need to be fixed.
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018 #include "smp/spinlock.h"
0019 #include "util/screen.h"
0020 #include "util/debug.h"
0021
0022 spinlock screen_lock = { 0 };
0023
0024 int
0025 _putchar (int ch)
0026 {
0027
0028 static int x, y;
0029
0030 if (ch == '\n') {
0031 x = 0;
0032 y++;
0033
0034 if (y > 24)
0035 y = 0;
0036
0037 return (int) (uint8) ch;
0038 }
0039
0040 pchVideo[y * 160 + x * 2] = ch;
0041 pchVideo[y * 160 + x * 2 + 1] = 7;
0042 x++;
0043
0044 return (int) (uint8) ch;
0045 }
0046
0047 int
0048 putchar (int ch)
0049 {
0050 int x;
0051 spinlock_lock (&screen_lock);
0052 x = _putchar (ch);
0053 spinlock_unlock (&screen_lock);
0054 return x;
0055 }
0056
0057 int
0058 print (char *pch)
0059 {
0060 spinlock_lock (&screen_lock);
0061 while (*pch)
0062 _putchar (*pch++);
0063 spinlock_unlock (&screen_lock);
0064 return 0;
0065 }
0066
0067
0068 void
0069 putx (uint32 l)
0070 {
0071
0072 int i, li;
0073
0074 spinlock_lock (&screen_lock);
0075 for (i = 7; i >= 0; i--)
0076 if ((li = (l >> (i << 2)) & 0x0F) > 9)
0077 _putchar ('A' + li - 0x0A);
0078 else
0079 _putchar ('0' + li);
0080 spinlock_unlock (&screen_lock);
0081 }
0082
0083 int
0084 _print (char *pch)
0085 {
0086 while (*pch)
0087 _putchar (*pch++);
0088 return 0;
0089 }
0090
0091
0092 void
0093 _putx (uint32 l)
0094 {
0095
0096 int i, li;
0097
0098 for (i = 7; i >= 0; i--)
0099 if ((li = (l >> (i << 2)) & 0x0F) > 9)
0100 _putchar ('A' + li - 0x0A);
0101 else
0102 _putchar ('0' + li);
0103 }
0104
0105
0106
0107
0108
0109
0110
0111
0112
0113
0114