3 * Copyright (C) 2007 Tomas 'ZeXx86' Jedrzejek (zexx86@gmail.com)
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
29 #include "partition.h"
30 #include "../drivers/char/video/video.h"
34 #define CONSOLE_LOG 30
40 unsigned debug
; // developer mode
42 unsigned long long ctps
; // cpu ticks per second
44 partition_t
*curr_part
;
46 /* This defines what the stack looks like after an ISR was running */
49 unsigned int ds
, es
, fs
, gs
;
50 unsigned int edi
, esi
, ebp
, esp
, ebx
, edx
, ecx
, eax
;
51 unsigned int int_no
, err_code
;
52 unsigned int eip
, cs
, eflags
, useresp
, ss
;
55 #define _set_gate(gate_addr,type,dpl,addr) \
56 __asm__ ("movw %%dx,%%ax\n\t" \
61 : "i" ((short) (0x8000+(dpl<<13)+(type<<8))), \
62 "o" (*((char *) (gate_addr))), \
63 "o" (*(4+(char *) (gate_addr))), \
64 "d" ((char *) (addr)),"a" (0x00080000))
78 unsigned char *file_cache
;
86 extern void *malloc (unsigned size
);
87 extern void *realloc(void *blk
, unsigned size
);
88 extern void free (void *blk
);
90 extern unsigned int init_mm ();
93 extern unsigned int init_console ();
96 extern int exec_elf (unsigned char *image
, unsigned *entry
);
97 extern int flush_elf ();
100 extern bool exec (unsigned char *fi
);
103 extern void gdt_set_gate(int num
, unsigned long base
, unsigned long limit
, unsigned char access
, unsigned char gran
);
104 extern unsigned int gdt_install();
107 extern void idt_set_gate(unsigned char num
, unsigned long base
, unsigned short sel
, unsigned char flags
);
108 extern unsigned int idt_install();
111 extern unsigned int isrs_install();
114 extern void irq_install_handler (int irq
, void (*handler
)(struct regs
*r
));
115 extern void irq_uninstall_handler (int irq
);
116 extern unsigned int irq_install ();
119 extern void timer_wait (int ticks
);
120 extern unsigned int timer_install ();
123 extern unsigned int keyboard_install ();
125 extern unsigned int init_tasks (void);
126 extern void schedule (void);
127 extern unsigned int floppy_install (void);
128 extern void fda_print (int i
);
129 extern void console (int i
);
130 extern void uptime (void);
133 extern void read_dir (int aa
);
134 extern unsigned long read_file (int aa
);
137 extern int ls (unsigned char* fi
);
140 extern int cd (unsigned char* fi
);
143 extern int cat (partition_t
*p
, unsigned char *fi
);