void con_init(void)
{
if(!(devfile = dev_open(CONDEV, 0, O_RDWR))) {
- //panic("can't open console device %d,%d\n", CONDEV, 0);
- }
-}
-
-void con_printf(const char *fmt, ...)
-{
- /* TODO */
- while(*fmt) {
- con_putchar(*fmt++);
+ panic("can't open console device %d,%d\n", CONDEV, 0);
}
}
void con_putchar(int c)
{
if(devfile) {
- devfile->dev->fop->write(devfile, &c, 1);
+ vid_putchar(c); /* XXX dbg */
+ //devfile->dev->fop->write(devfile, &c, 1);
} else {
vid_putchar(c);
}
#define VERSTR "v0.0"
/* CONDEV: which device to use for the kernel console (DEV_VID or DEV_SER) */
-#define CONDEV DEV_VID
+#define CONDEV DEV_SER
#endif /* CONFIG_H_ */
vprintf(fmt, ap);
va_end(ap);
- printf("ax:%04x bx:%04x cx:%04x dx:%04x\n", regs.ax, regs.bx, regs.cx, regs.dx);
+ printf("\nax:%04x bx:%04x cx:%04x dx:%04x\n", regs.ax, regs.bx, regs.cx, regs.dx);
printf("bp:%04x si:%04x di:%04x flags:%04x\n", regs.bp, regs.si, regs.di, regs.flags);
printf("ss:sp %04x:%04x cs:ip %04x:%04x ds:%04x es:%04x\n", sregs.ss, regs.sp,
sregs.cs, regs.ip, sregs.ds, sregs.es);
+#include <stdio.h>
#include "dev.h"
+#include "dbg.h"
struct device devices[MAX_DEVICES];
if(!devices[major].fop) {
return 0;
}
+ printf("dev_open(%x, %x, %x)\n", major, minor, flags);
if(devices[major].fop->open(&file, &fakenode, flags) < 0) {
+ panic("open failed");
return 0;
}
+ panic("WTF");
+
return &file;
}
void intr_entry_irq6();
void intr_entry_irq7();
-extern int _kern_start_seg;
-#define KERN_CS ((uint16_t)(&_kern_start_seg))
-
void init_intr(void)
{
intrfunc[i] = 0;
}
- set_intr_vect(0, KERN_CS, (uint16_t)intr_entry_div);
+ set_intr_vect(0, 0, (uint16_t)intr_entry_div);
}
void dispatch_intr(struct intr_frame frm)
while(*end) end++;
return end - s;
}
+
+/*
+void *memset(void *s, int c, unsigned int n)
+{
+ unsigned char *ptr = s;
+ while(n-- > 0) {
+ *ptr++ = c;
+ }
+ return s;
+}
+*/
+#include <stdio.h>
#include <string.h>
#include <errno.h>
#include "ser.h"
#include "file.h"
#include "dev.h"
#include "asmutil.h"
+#include "dbg.h"
#define UART1_BASE 0x3f8
#define UART2_BASE 0x2f8
static void setuart(int portidx, int baud);
static void serput(int portidx, int c);
-static int ser_open(struct file *file, struct inode *inode, unsigned int flags);
+int ser_open(struct file *file, struct inode *inode, unsigned int flags);
static int ser_close(struct file *file);
static int ser_read(struct file *file, void *buf, int sz);
static int ser_write(struct file *file, void *buf, int sz);
outp(iobase | UART_DATA, c);
}
-static int ser_open(struct file *file, struct inode *inode, unsigned int flags)
+int ser_open(struct file *file, struct inode *inode, unsigned int flags)
{
int port = inode->dev_minor;
+ panic("ser_open");
+
if(port < 0 || port >= 2) {
return -ENXIO;
}