Primitive no-op idt code. call to idt code in hardware main (via #ifdef)
Conditional idt code usage in Config. Make m1631 memory to 0xf0000
This commit is contained in:
parent
c50f85267b
commit
f69b932ac6
4 changed files with 40 additions and 128 deletions
|
|
@ -3,3 +3,4 @@ object params.o
|
|||
object hardwaremain.o
|
||||
object pirq_routing.o HAVE_PIRQ_TABLE
|
||||
object vgabios.o CONFIG_VGABIOS
|
||||
object idt.o CONFIG_REALMODE_IDT
|
||||
|
|
|
|||
|
|
@ -320,6 +320,10 @@ void hardwaremain(int boot_complete)
|
|||
/* make certain we are the only cpu running in linuxBIOS */
|
||||
wait_for_other_cpus();
|
||||
|
||||
#if CONFIG_REALMODE_IDT == 1
|
||||
printk_debug("INSTALL REAL-MODE IDT\n");
|
||||
setup_realmode_idt();
|
||||
#endif
|
||||
#if CONFIG_VGABIOS == 1
|
||||
printk_debug("DO THE VGA BIOS\n");
|
||||
do_vgabios();
|
||||
|
|
|
|||
|
|
@ -1,132 +1,36 @@
|
|||
#include <string.h>
|
||||
|
||||
// we had hoped to avoid this.
|
||||
#if 0
|
||||
/*
|
||||
* setup_idt
|
||||
*
|
||||
* sets up a idt with 256 entries pointing to
|
||||
* ignore_int, interrupt gates. It doesn't actually load
|
||||
* idt - that can be done only after paging has been enabled
|
||||
* and the kernel moved to PAGE_OFFSET. Interrupts
|
||||
* are enabled elsewhere, when we can be relatively
|
||||
* sure everything is ok.
|
||||
*/
|
||||
setup_idt:
|
||||
lea ignore_int,%edx
|
||||
movl $(__KERNEL_CS << 16),%eax
|
||||
movw %dx,%ax /* selector = 0x0010 = cs */
|
||||
movw $0x8E00,%dx /* interrupt gate - dpl=0, present */
|
||||
|
||||
lea SYMBOL_NAME(idt_table),%edi
|
||||
mov $256,%ecx
|
||||
rp_sidt:
|
||||
movl %eax,(%edi)
|
||||
movl %edx,4(%edi)
|
||||
addl $8,%edi
|
||||
dec %ecx
|
||||
jne rp_sidt
|
||||
ret
|
||||
|
||||
ENTRY(stack_start)
|
||||
.long SYMBOL_NAME(init_task_union)+8192
|
||||
.long __KERNEL_DS
|
||||
|
||||
/* This is the default interrupt "handler" :-) */
|
||||
int_msg:
|
||||
.asciz "Unknown interrupt\n"
|
||||
ALIGN
|
||||
ignore_int:
|
||||
cld
|
||||
pushl %eax
|
||||
pushl %ecx
|
||||
pushl %edx
|
||||
pushl %es
|
||||
pushl %ds
|
||||
movl $(__KERNEL_DS),%eax
|
||||
movl %eax,%ds
|
||||
movl %eax,%es
|
||||
pushl $int_msg
|
||||
call SYMBOL_NAME(printk)
|
||||
popl %eax
|
||||
popl %ds
|
||||
popl %es
|
||||
popl %edx
|
||||
popl %ecx
|
||||
popl %eax
|
||||
iret
|
||||
|
||||
/*
|
||||
* The interrupt descriptor table has room for 256 idt's,
|
||||
* the global descriptor table is dependent on the number
|
||||
* of tasks we can have..
|
||||
*/
|
||||
#define IDT_ENTRIES 256
|
||||
#define GDT_ENTRIES (__TSS(NR_CPUS))
|
||||
// this is a stub IDT only. It's main purpose is to ignore calls
|
||||
// to the BIOS.
|
||||
struct realidt {
|
||||
unsigned short offset, cs;
|
||||
};
|
||||
|
||||
|
||||
.globl SYMBOL_NAME(idt)
|
||||
.globl SYMBOL_NAME(gdt)
|
||||
|
||||
ALIGN
|
||||
.word 0
|
||||
idt_descr:
|
||||
.word IDT_ENTRIES*8-1 # idt contains 256 entries
|
||||
SYMBOL_NAME(idt):
|
||||
.long SYMBOL_NAME(idt_table)
|
||||
|
||||
.word 0
|
||||
#endif
|
||||
|
||||
/*
|
||||
* This starts the data section. Note that the above is all
|
||||
* in the text section because it has alignment requirements
|
||||
* that we cannot fulfill any other way.
|
||||
*/
|
||||
.data
|
||||
|
||||
ALIGN
|
||||
/*
|
||||
* This contains typically 140 quadwords, depending on NR_CPUS.
|
||||
*
|
||||
* NOTE! Make sure the gdt descriptor in head.S matches this if you
|
||||
* change anything.
|
||||
*/
|
||||
ENTRY(gdt_table)
|
||||
.quad 0x0000000000000000 /* NULL descriptor */
|
||||
.quad 0x0000000000000000 /* not used */
|
||||
.quad 0x00cf9a000000ffff /* 0x10 kernel 4GB code at 0x00000000 */
|
||||
.quad 0x00cf92000000ffff /* 0x18 kernel 4GB data at 0x00000000 */
|
||||
.quad 0x00cffa000000ffff /* 0x23 user 4GB code at 0x00000000 */
|
||||
.quad 0x00cff2000000ffff /* 0x2b user 4GB data at 0x00000000 */
|
||||
.quad 0x0000000000000000 /* not used */
|
||||
.quad 0x0000000000000000 /* not used */
|
||||
/*
|
||||
* The APM segments have byte granularity and their bases
|
||||
* and limits are set at run time.
|
||||
*/
|
||||
.quad 0x0040920000000000 /* 0x40 APM set up for bad BIOS's */
|
||||
.quad 0x00409a0000000000 /* 0x48 APM CS code */
|
||||
.quad 0x00009a0000000000 /* 0x50 APM CS 16 code (16 bit) */
|
||||
.quad 0x0040920000000000 /* 0x58 APM DS data */
|
||||
.fill NR_CPUS*4,8,0 /* space for TSS's and LDT's */
|
||||
|
||||
/*
|
||||
* This is to aid debugging, the various locking macros will be putting
|
||||
* code fragments here. When an oops occurs we'd rather know that it's
|
||||
* inside the .text.lock section rather than as some offset from whatever
|
||||
* function happens to be last in the .text segment.
|
||||
*/
|
||||
.section .text.lock
|
||||
ENTRY(stext_lock)
|
||||
#endif
|
||||
void handler(void) {
|
||||
__asm__ __volatile__ (
|
||||
".code16\n"
|
||||
"idthandle:\n"
|
||||
" movb $0x55, %al\n"
|
||||
" outb %al, $0x80\n"
|
||||
" iret\n"
|
||||
"end_idthandle:\n"
|
||||
".code32\n"
|
||||
);
|
||||
}
|
||||
|
||||
void
|
||||
lidt(void *base, unsigned int limit)
|
||||
{
|
||||
setup_realmode_idt(void) {
|
||||
extern unsigned char idthandle, end_idthandle;
|
||||
int i;
|
||||
struct realidt *idts = (struct realidt *) 0;
|
||||
|
||||
unsigned int i[2];
|
||||
for (i = 0; i < 256; i++) {
|
||||
idts[i].cs = 0;
|
||||
idts[i].offset = 1024;
|
||||
}
|
||||
|
||||
memcpy((void *) 1024, &idthandle, &end_idthandle - &idthandle);
|
||||
|
||||
i[0] = limit << 16;
|
||||
i[1] = // later
|
||||
}
|
||||
// this is too awful.
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,8 +50,11 @@ register_table:
|
|||
.byte 0x81, 0x33, 0x00
|
||||
|
||||
.byte 0x83, 0x00, 0x00
|
||||
.byte 0x84, 0xfe, 0x00
|
||||
.byte 0x87, 0xff, 0x00
|
||||
/* make the 0xc0000-effff region read/write */
|
||||
.byte 0x84, 0xfe, 0xf0
|
||||
.byte 0x85, 0xff, 0xff
|
||||
.byte 0x86, 0xff, 0xff
|
||||
.byte 0x87, 0xff, 0x0f
|
||||
.byte 0x88, 0xff, 0x08
|
||||
.byte 0x93, 0xff, 0x07
|
||||
.byte 0xa0, 0x00, 0x30
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue