Skip to content

Commit

Permalink
[kernel] Cleanup register decls in console*.c, cleanup init/main.c
Browse files Browse the repository at this point in the history
  • Loading branch information
ghaerr committed Sep 16, 2024
1 parent 97547d1 commit c137c61
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 55 deletions.
14 changes: 7 additions & 7 deletions elks/arch/i86/drivers/char/console-bios.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ static int Current_VCminor;
#define TERM_TYPE " dumb "
#endif

static void std_char(register Console *, int);
static void std_char(Console *, int);

static void PositionCursor(register Console * C)
static void PositionCursor(Console * C)
{
int x, y, p;

Expand All @@ -102,7 +102,7 @@ static void DisplayCursor(Console * C, int onoff)
{
}

static void VideoWrite(register Console * C, char c)
static void VideoWrite(Console * C, char c)
{
int a, p;

Expand All @@ -111,7 +111,7 @@ static void VideoWrite(register Console * C, char c)
bios_writecharattr (c, a, p);
}

static void scroll(register Console * C, int n, int x, int y, int xx, int yy)
static void scroll(Console * C, int n, int x, int y, int xx, int yy)
{
int a;

Expand All @@ -127,18 +127,18 @@ static void scroll(register Console * C, int n, int x, int y, int xx, int yy)
}
}

static void ClearRange(register Console * C, int x, int y, int xx, int yy)
static void ClearRange(Console * C, int x, int y, int xx, int yy)
{
scroll(C, 26, x, y, xx, yy);
}

static void ScrollUp(register Console * C, int y)
static void ScrollUp(Console * C, int y)
{
scroll(C, 1, 0, y, C->Width - 1, C->Height - 1);
}

#ifdef CONFIG_EMUL_ANSI
static void ScrollDown(register Console * C, int y)
static void ScrollDown(Console * C, int y)
{
scroll(C, -1, 0, y, C->Width - 1, C->Height - 1);
}
Expand Down
12 changes: 6 additions & 6 deletions elks/arch/i86/drivers/char/console-direct-pc98.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,11 @@ unsigned AttributeSeg;

static void std_char(Console *, int);

static void SetDisplayPage(register Console * C)
static void SetDisplayPage(Console * C)
{
}

static void PositionCursor(register Console * C)
static void PositionCursor(Console * C)
{
unsigned int Pos;

Expand Down Expand Up @@ -130,7 +130,7 @@ static word_t conv_pcattr(word_t attr)
return attr98;
}

static void VideoWrite(register Console * C, int c)
static void VideoWrite(Console * C, int c)
{
word_t addr;
word_t attr;
Expand All @@ -142,7 +142,7 @@ static void VideoWrite(register Console * C, int c)
pokew(addr, (seg_t) C->vseg, c & 255);
}

static void ClearRange(register Console * C, int x, int y, int xx, int yy)
static void ClearRange(Console * C, int x, int y, int xx, int yy)
{
__u16 *vp;
word_t attr;
Expand All @@ -160,7 +160,7 @@ static void ClearRange(register Console * C, int x, int y, int xx, int yy)
} while (++y <= yy);
}

static void ScrollUp(register Console * C, int y)
static void ScrollUp(Console * C, int y)
{
__u16 *vp;
int MaxRow = C->Height - 1;
Expand All @@ -175,7 +175,7 @@ static void ScrollUp(register Console * C, int y)
}

#ifdef CONFIG_EMUL_ANSI
static void ScrollDown(register Console * C, int y)
static void ScrollDown(Console * C, int y)
{
__u16 *vp;
int MaxRow = C->Height - 1;
Expand Down
14 changes: 7 additions & 7 deletions elks/arch/i86/drivers/char/console-direct.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,15 @@ int kraw;
#define TERM_TYPE " dumb "
#endif

static void std_char(register Console *, int);
static void std_char(Console *, int);

static void SetDisplayPage(register Console * C)
static void SetDisplayPage(Console * C)
{
outw((C->vseg_offset & 0xff00) | 0x0c, C->crtc_base);
outw((C->vseg_offset << 8) | 0x0d, C->crtc_base);
}

static void PositionCursor(register Console * C)
static void PositionCursor(Console * C)
{
unsigned int Pos = C->cx + C->Width * C->cy + C->vseg_offset;

Expand All @@ -119,13 +119,13 @@ static void DisplayCursor(Console * C, int onoff)
outb(v, C->crtc_base + 1);
}

static void VideoWrite(register Console * C, int c)
static void VideoWrite(Console * C, int c)
{
pokew((C->cx + C->cy * C->Width) << 1, (seg_t) C->vseg,
(C->attr << 8) | (c & 255));
}

static void ClearRange(register Console * C, int x, int y, int x2, int y2)
static void ClearRange(Console * C, int x, int y, int x2, int y2)
{
int vp;

Expand All @@ -140,7 +140,7 @@ static void ClearRange(register Console * C, int x, int y, int x2, int y2)
} while (++y <= y2);
}

static void ScrollUp(register Console * C, int y)
static void ScrollUp(Console * C, int y)
{
int vp;
int MaxRow = C->Height - 1;
Expand All @@ -154,7 +154,7 @@ static void ScrollUp(register Console * C, int y)
}

#ifdef CONFIG_EMUL_ANSI
static void ScrollDown(register Console * C, int y)
static void ScrollDown(Console * C, int y)
{
int vp;
int yy = C->Height - 1;
Expand Down
6 changes: 3 additions & 3 deletions elks/arch/i86/drivers/char/console-headless.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ void INITPROC console_init(void)

void Console_conin(unsigned char Key)
{
register struct tty *ttyp = &ttys[0]; /* /dev/tty1*/
struct tty *ttyp = &ttys[0]; /* /dev/tty1*/

if (!tty_intcheck(ttyp, Key))
chq_addch(&ttyp->inq, Key);
Expand Down Expand Up @@ -55,7 +55,7 @@ static int Console_ioctl(struct tty *tty, int cmd, char *arg)
return -EINVAL;
}

static int Console_write(register struct tty *tty)
static int Console_write(struct tty *tty)
{
int cnt = 0;

Expand All @@ -71,7 +71,7 @@ static void Console_release(struct tty *tty)
ttystd_release(tty);
}

static int Console_open(register struct tty *tty)
static int Console_open(struct tty *tty)
{
return ttystd_open(tty);
}
Expand Down
4 changes: 2 additions & 2 deletions elks/arch/i86/drivers/char/console-serial-8018x.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ static int sercon_ioctl(struct tty *tty, int cmd, char *arg)
return 0;
}

static int sercon_write(register struct tty *tty)
static int sercon_write(struct tty *tty)
{
struct serial_info *port = &ports[0]; /* TODO: add support for Serial 1 */
int cnt = 0;
Expand All @@ -213,7 +213,7 @@ static void sercon_release(struct tty *tty)
ttystd_release(tty);
}

static int sercon_open(register struct tty *tty)
static int sercon_open(struct tty *tty)
{
return ttystd_open(tty);
}
Expand Down
18 changes: 9 additions & 9 deletions elks/arch/i86/drivers/char/console.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* shared console routines for Direct and BIOS consoles - #include in console drivers*/

static void WriteChar(register Console * C, int c)
static void WriteChar(Console * C, int c)
{
/* check for graphics lock */
while (glock) {
Expand Down Expand Up @@ -30,7 +30,7 @@ void Console_conin(unsigned char Key)
}

#ifdef CONFIG_EMUL_ANSI
static void Console_gotoxy(register Console * C, int x, int y)
static void Console_gotoxy(Console * C, int x, int y)
{
int xp = x;
int MaxRow = C->Height - 1;
Expand All @@ -42,7 +42,7 @@ static void Console_gotoxy(register Console * C, int x, int y)
C->XN = 0;
}

static int parm1(register unsigned char *buf)
static int parm1(unsigned char *buf)
{
int n;

Expand All @@ -51,7 +51,7 @@ static int parm1(register unsigned char *buf)
return n;
}

static int parm2(register unsigned char *buf)
static int parm2(unsigned char *buf)
{
while (*buf != ';' && *buf)
buf++;
Expand Down Expand Up @@ -79,7 +79,7 @@ static unsigned char ega_color[16] = { 0, 4, 2, 6, 1, 5, 3, 7,
8, 12, 10, 14, 9, 13, 11, 15 };

/* ESC [ processing */
static void AnsiCmd(register Console * C, int c)
static void AnsiCmd(Console * C, int c)
{
int n;
int MaxRow = C->Height - 1;
Expand Down Expand Up @@ -230,7 +230,7 @@ static void AnsiCmd(register Console * C, int c)
}

/* ANSI emulator - ESC seen */
static void esc_char(register Console * C, int c)
static void esc_char(Console * C, int c)
{
/* Parse CSI sequence */
C->parmptr = C->params;
Expand All @@ -252,7 +252,7 @@ static void esc_char(register Console * C, int c)
#endif

/* Normal character processing */
static void std_char(register Console * C, int c)
static void std_char(Console * C, int c)
{
int MaxRow = C->Height - 1;
int MaxCol = C->Width - 1;
Expand Down Expand Up @@ -366,7 +366,7 @@ static int Console_ioctl(struct tty *tty, int cmd, char *arg)
return -EINVAL;
}

static int Console_write(register struct tty *tty)
static int Console_write(struct tty *tty)
{
Console *C = &Con[tty->minor];
int cnt = 0;
Expand All @@ -385,7 +385,7 @@ static void Console_release(struct tty *tty)
ttystd_release(tty);
}

static int Console_open(register struct tty *tty)
static int Console_open(struct tty *tty)
{
if ((int)tty->minor >= NumConsoles)
return -ENODEV;
Expand Down
21 changes: 0 additions & 21 deletions elks/init/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,27 +114,6 @@ void start_kernel(void)
kfork_proc(init_task);
wake_up_process(&task[1]);

#if TIMER_TEST
/* printk rewrite debug statements */
printk("#04X: '%#04X'\n", 0x2ab);
printk("04X: '%04X'\n", 0x2ab);
printk("04x: '%04x'\n", 0x2ab);
printk(" 4x: '%4x'\n", 0x2ab);
printk("04d: '%04d'\n", 0x200);
printk(" 4d: '%4d'\n", 0x200);
printk("05d: '%05d'\n", -20);
printk(" 5d: '%5d'\n", -20);
printk("+5d: '%5d'\n", -20);
printk("+5d: '%5d'\n", 20);
printk(",ld: '%,ld'\n", -123456789L);
printk(" lx: '%lx'\n", 0x87654321L);
printk(" lo: '%lo'\n", 0xFFFFFFFFL);
printk(" s: '%s'\n", "thisisatest");
printk(" 6s: '%6s'\n", "thisisatest");
printk("20s: '%20s'\n", "thisisatest");
test_ptime_print();
#endif

/*
* We are now the idle task. We won't run unless no other process can run.
* The idle task always runs with _gint_count == 1 (switched from user mode syscall)
Expand Down
1 change: 1 addition & 0 deletions elkscmd/test/other/test_float.c
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ int main(int argc, char **argv) {
printf("-300000 %s\n", ltostr(-300000L, 10));
printf(" p: '%p'\n", 0x18AF);
printf(" lp: '%lp'\n", 0x02d018AFL);
/*printk("#04X: '%#04X'\n", 0x2ab);*/ /* kernel only */
printf("04X: '%04X'\n", 0x2ab);
printf("04x: '%04x'\n", 0x2ab);
printf(" 4x: '%4x'\n", 0x2ab);
Expand Down

0 comments on commit c137c61

Please sign in to comment.