GDB serial and backtrace support.

* grub-core/kern/i386/realmode.S (real_to_prot): Reload IDT.
	(prot_to_real): Likewise.
	* grub-core/kern/i386/int.S (grub_bios_interrupt): Remove IDT reload.
	* grub-core/Makefile.core.def (backtrace): New module.
	(gdb): Likewise.
	* grub-core/gdb/cstub.c: New file.
	* grub-core/gdb/gdb.c: Likewise.
	* grub-core/gdb/i386/idt.c: Likewise.
	* grub-core/gdb/i386/machdep.S: Likewise.
	* grub-core/gdb/i386/signal.c: Likewise.
	* grub-core/lib/i386/backtrace.c: Likewise.
	* include/grub/backtrace.h: Likewise.
	* include/grub/gdb.h: Likewise.
	* include/grub/i386/gdb.h: Likewise.

	Also-By: Vladimir Serbinenko <phcoder@gmail.com>
This commit is contained in:
Lubomir Kundrak 2012-02-26 19:17:37 +01:00 committed by Vladimir 'phcoder' Serbinenko
commit ff27c3dd5d
13 changed files with 1052 additions and 29 deletions

View file

@ -19,9 +19,6 @@
FUNCTION(grub_bios_interrupt)
pushf
cli
#ifndef GRUB_MACHINE_PCBIOS
sidt protidt
#endif
popf
pushl %ebp
pushl %ecx
@ -51,9 +48,6 @@ FUNCTION(grub_bios_interrupt)
.code16
pushf
cli
#ifndef GRUB_MACHINE_PCBIOS
lidt realidt
#endif
mov %ds, %ax
push %ax
@ -126,15 +120,4 @@ intno:
popl %eax
popl %ecx
popl %ebp
#ifndef GRUB_MACHINE_PCBIOS
lidt protidt
#endif
ret
#ifndef GRUB_MACHINE_PCBIOS
realidt:
.word 0x100
.long 0
protidt:
.word 0
.long 0
#endif

View file

@ -118,6 +118,12 @@ gdt:
gdtdesc:
.word 0x27 /* limit */
.long gdt /* addr */
realidt:
.word 0
.long 0
protidt:
.word 0
.long 0
/*
* These next two routines, "real_to_prot" and "prot_to_real" are structured
@ -169,6 +175,9 @@ protcseg:
/* zero %eax */
xorl %eax, %eax
sidt realidt
lidt protidt
/* return on the old (or initialized) stack! */
ret
/*
@ -195,6 +204,9 @@ prot_to_real:
/* just in case, set GDT */
lgdt gdtdesc
sidt protidt
lidt realidt
/* save the protected mode stack */
movl %esp, %eax
movl %eax, protstack