Skip to content
Open
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
6 changes: 3 additions & 3 deletions tlvc/arch/i86/drivers/char/mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ int memory_lseek(struct inode *inode, register struct file *filp,
default:
return -EINVAL;
}
if (offset != filp->f_pos) {
//if (offset != filp->f_pos) {
filp->f_pos = offset;
}
//}
return 0;
}

Expand Down Expand Up @@ -354,7 +354,7 @@ static struct file_operations kmem_fops = {
*/
int memory_open(register struct inode *inode, struct file *filp)
{
#ifdef DEBUG
#ifdef DEBUG_MM
static char *mdev_nam[] = {

/* Unimplemented minors will print out the correct device name
Expand Down
66 changes: 65 additions & 1 deletion tlvc/arch/i86/drivers/char/ntty.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ size_t tty_write(struct inode *inode, struct file *file, char *data, size_t len)
while (count < len) {
ret = chq_wait_wr(&tty->outq, (file->f_flags & O_NONBLOCK) | count);
if (ret < 0) {
if (count != 0 && ret == -EAGAIN) {
if (count != 0 && ret == -EAGAIN) { /* queue is full and something has been written already */
tty->ops->write(tty);
wake_up(&tty->outq.wait);
schedule();
Expand Down Expand Up @@ -395,6 +395,9 @@ int tty_ioctl(struct inode *inode, struct file *file, int cmd, char *arg)
register struct tty *tty = determine_tty(inode->i_rdev);
int ret, dev;

if (!determine_tty(inode->i_rdev)) /* not a tty device */
return -EINVAL;

switch (cmd) {
case TCGETS:
ret = verified_memcpy_tofs(arg, &tty->termios, sizeof(struct termios));
Expand All @@ -414,6 +417,67 @@ int tty_ioctl(struct inode *inode, struct file *file, int cmd, char *arg)
return -EINVAL;
set_console(dev);
return 0;
case TIOCGETP: /* Unix v7 gtty() */
#ifdef CONFIG_COMPAT_V7
{
struct sgttyb st;
st.sg_ispeed = st.sg_ospeed = tty->termios.c_cflag&CBAUD;
st.sg_erase = tty->termios.c_cc[VERASE];
st.sg_kill = tty->termios.c_cc[VKILL];
st.sg_flags = (O_RAW * !(tty->termios.c_oflag & OPOST)) +
(O_CBREAK * !(tty->termios.c_lflag & ICANON)) +
(O_ECHO * (tty->termios.c_lflag & ECHO)) +
(O_CRMOD * (tty->termios.c_iflag & ICRNL));
if (tty->termios.c_cflag&PARENB) {
if (tty->termios.c_cflag&PARODD) st.sg_flags |= O_ODDP;
else st.sg_flags |= O_EVENP;
}
ret = verified_memcpy_tofs(arg, &st, sizeof(struct sgttyb));
break;
}
#else
return -EINVAL;
#endif
case TIOCSETP: /* Unix V7 stty() */
#ifdef CONFIG_COMPAT_V7
{
struct sgttyb st;
ret = verified_memcpy_fromfs(&st, arg, sizeof(struct sgttyb));
if (ret == 0) {
int fl;

fl = st.sg_flags;
if (fl&O_RAW) {
tty->termios.c_lflag &= ~(ICANON | ISIG | ECHO);
tty->termios.c_iflag &= ~(BRKINT | ICRNL | INPCK | ISTRIP | IXON);
tty->termios.c_oflag &= ~OPOST;
}
if (fl&O_CBREAK) tty->termios.c_lflag &= ~ICANON;
if (fl&O_ECHO) tty->termios.c_lflag |= ECHO;
if (fl&O_CRMOD) {
tty->termios.c_iflag |= ICRNL;
tty->termios.c_oflag |= ONLCR;
}
if (fl&O_ODDP) {
tty->termios.c_cflag |= (PARENB | PARODD);
tty->termios.c_iflag |= ISTRIP;
}
if (fl&O_EVENP) {
tty->termios.c_cflag |= PARENB;
tty->termios.c_cflag &= ~PARODD;
tty->termios.c_iflag |= ISTRIP;
}
tty->termios.c_cflag &= ~CBAUD;
tty->termios.c_cflag |= st.sg_ispeed;

/* Inform subdriver of new settings TEST THIS MAY NOT BE REQUIRED */
//if (ret == 0 && tty->ops->ioctl != NULL)
ret = tty->ops->ioctl(tty, TCSETS, &tty->termios);
break;
}
}
#endif
return -EINVAL;
default:
ret = ((tty->ops->ioctl == NULL)
? -EINVAL
Expand Down
3 changes: 2 additions & 1 deletion tlvc/arch/i86/kernel/asm-offsets.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include <linuxmt/sched.h>

extern int TASK_KRNL_SP, TASK_USER_DS, TASK_USER_AX, TASK_USER_SS;
extern int TASK_USER_BX, TASK_USER_SI, TASK_USER_DI;
extern int TASK_USER_BX, TASK_USER_SI, TASK_USER_DI, TASK_USER_V7;

void asm_offsets(void)
{
Expand All @@ -13,5 +13,6 @@ void asm_offsets(void)
TASK_USER_BX = offsetof(struct task_struct, t_regs.bx);
TASK_USER_SI = offsetof(struct task_struct, t_regs.si);
TASK_USER_DI = offsetof(struct task_struct, t_regs.di);
TASK_USER_V7 = offsetof(struct task_struct, task_is_V7); /* (temporary) V7 binary flag */
}

14 changes: 8 additions & 6 deletions tlvc/arch/i86/kernel/divzero.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@

/*
* Divide by zero and divide overflow exception handler
* NOTE: This handler is currently unused, see div0_handler_panic in irqtab.S
*
* 19 Aug 24 Greg Haerr
*/

void div0_handler(int i, struct pt_regs *regs)
#define DEBUG 0 /* =1 for CS:IP detail of fault */

void div0_handler(int irq, struct pt_regs *regs)
{
/* divide by 0 from nested interrupt or idle task means kernel code was executing */
if (intr_count > 1 /*|| current->t_regs.ss == kernel_ds*/) {
/*
* Trap from kernel code or idle task.
*
* Not panicing at this point involves determining the CS:IP of the
* Not calling panic at this point involves determining the CS:IP of the
* faulting instruction, then doing two different things depending on
* whether the CPU is 8088/8086/V20/V30 or 286/386+: the former trap
* pushes the CS:IP following the DIV, while the latter pushes CS:IP of
Expand All @@ -30,15 +30,17 @@ void div0_handler(int i, struct pt_regs *regs)
sys_stack = _MK_FP(regs->ss, regs->sp);
printk("CS:IP %04x:%04x\n", sys_stack->cs, sys_stack->ip);
#endif

panic("DIVIDE FAULT\n");
} else {
/* For user mode faults, display error message and kill the process */
} else { /* For user mode faults, display error message and kill the process */
printk("DIVIDE FAULT\n");

#if DEBUG
struct uregs __far *user_stack;
user_stack = _MK_FP(current->t_regs.ss, current->t_regs.sp);
printk("CS:IP %04x:%04x\n", user_stack->cs, user_stack->ip);
#endif

sys_kill(current->pid, SIGABRT); /* no SIGFPE so send SIGABRT for now */
}
}
20 changes: 19 additions & 1 deletion tlvc/arch/i86/kernel/irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ struct int_handler {

static struct int_handler trampoline[NR_IRQS];
static irq_handler irq_action[NR_IRQS];
#ifdef CONFIG_COMPAT_V7
void abort_v7(void);
#endif

/* called by _irqit assembler hook after saving registers */
void do_IRQ(int i, struct pt_regs *regs)
Expand Down Expand Up @@ -120,7 +123,14 @@ int free_irq(int irq)
*/
void INITPROC irq_init(void)
{
int_handler_add(IDX_SYSCALL, 0x80, _irqit); /* INT 80 for system calls */
int_handler_add(IDX_SYSCALL, 0x80, _irqit); /* INT 80 for system calls */
#ifdef CONFIG_COMPAT_V7
int_handler_add(IDX_SYSCALL_V7, 0xf1, _irqit_v7); /* INT F1 for V7 system calls */
int_handler_add(IDX_SYSFPU_V7, 0xf4, _sysfpu_v7); /* FPU check, precedes FPU instructions */
int_handler_add(IDX_SYSIOT_V7, 0xf3, _abort_v7); /* Used by the V7 abort() library call */
int_handler_add(IDX_SYSMAP_V7, 0xf5, _sysmap_v7); /* code mapper */
int_handler_add(IDX_STKTRAP_V7, 0xf2, _stktrap_v7); /* Venix stack overflow trap */
#endif

#if defined(CONFIG_ARCH_IBMPC) || defined(CONFIG_ARCH_PC98) || \
defined(CONFIG_ARCH_SOLO86) || defined(CONFIG_ARCH_SWAN) || \
Expand Down Expand Up @@ -162,3 +172,11 @@ void INITPROC irq_init(void)
enable_timer_tick(); /* reprogram timer for 100 HZ */
#endif
}

#ifdef CONFIG_COMPAT_V7_UNUSED
void abort_v7(void)
{
printk("V7 IOT trap\n");
sys_kill(current->pid, SIGABRT);
}
#endif
Loading