Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 17 additions & 9 deletions elks/arch/i86/drivers/char/serfast.S
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
// struct ch_queue *q = &sp->tty->inq;
// unsigned char c;
//
// do {
// c = INB(sp->io + UART_RX); // Read received data
// if (q->len < q->size) {
// q->base[q->head] = c;
Expand All @@ -36,6 +37,7 @@
// }
// if (c == 03) // assumes VINTR = ^C and byte queued anyways
// sp->intrchar = c;
// } while (INB(sp->io + UART_LSR) & UART_LSR_DR);
// }

//
Expand All @@ -62,26 +64,32 @@ common_entry:
mov %cx,%bx // bx = sp = &ports[n]
mov (%bx),%si // si = q = &sp->tty->inq
mov 0x4(%bx),%dx // dx = sp->io + UART_RX
in (%dx),%al
0: in (%dx),%al // do {
mov %al,%dl // dl = c = INB(sp->io+UART_RX)
mov (%si),%ax // ax = q->len
cmp 0x2(%si),%ax // if (ax >= q->size)
jge 2f
mov 0x4(%si),%bx // bx = q->head
mov 0x8(%si),%di // di = q->base
mov %dl,(%bx,%di) // q->base[q->head] = c
mov 0x4(%si),%ax // ax = q->head
inc %ax
mov %ax,0x4(%si) // ++q->head
cmp 0x2(%si),%ax // if (q->size < q->head)
inc %bx
mov %bx,0x4(%si) // ++q->head
cmp 0x2(%si),%bx // if (q->size < q->head)
jl 1f
movw $0x0,0x4(%si) // q->head = 0
1: incw (%si)
2: cmp $0x3,%dl // if (c == 03)
1: incw (%si) // q->len++
2: mov %cx,%bx // bx = sp
cmp $0x3,%dl // if (c == 03)
jne 3f
mov %cx,%bx // bx = sp
movw $0x3,2(%bx) // sp->intrchar = c
3: pop %di
3: mov 0x4(%bx),%dx // dx = sp->io
add $5,%dx // dx = sp->io + UART_LSR
in (%dx),%al // al = INB(sp->io + UART_LSR)
test $1,%al // while (al & UART_LSR_DR)
jz 4f
sub $5,%dx // dx = sp->io + UART_RX
jmp 0b
4: pop %di
pop %si

mov $0x20,%al // EOI on primary controller
Expand Down
4 changes: 2 additions & 2 deletions elks/arch/i86/drivers/char/serial-8250.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ static void flush_input(register struct serial_info *sp)
#endif
}

static int rs_probe(register struct serial_info *sp)
static int INITPROC rs_probe(register struct serial_info *sp)
{
int status, type;
unsigned char scratch;
Expand Down Expand Up @@ -479,7 +479,7 @@ static int rs_ioctl(struct tty *tty, int cmd, char *arg)
return retval;
}

static void rs_init(void)
static void INITPROC rs_init(void)
{
register struct serial_info *sp = ports;
register struct tty *tty = ttys + NR_CONSOLES;
Expand Down
3 changes: 3 additions & 0 deletions elks/arch/i86/mm/malloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,9 @@ static int set_brk(segoff_t brk, int increment)
stacklow = current->t_begstack - current->t_minstack;
if (newbrk > stacklow) {
printk("(%P)SBRK %d FAIL, OUT OF HEAP SPACE\n", increment);
/*printk("BEGSTK %x MINSTK %x LOWSTK %x NEWBRK %x CURBRK %x\n",
current->t_begstack, current->t_minstack, stacklow, newbrk,
current->t_endbrk);*/
return -ENOMEM;
}
if (newbrk > current->t_regs.sp) {
Expand Down