/SPARTAN/trunk/include/symtab.h |
---|
0,0 → 1,46 |
/* |
* Copyright (C) 2005 Ondrej Palkovsky |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#ifndef __SYMTAB_H__ |
#define __SYMTAB_H__ |
#include <arch/types.h> |
#define MAX_SYMBOL_NAME 32 |
struct symtab_entry { |
__u64 address; |
char symbol_name[MAX_SYMBOL_NAME]; |
}; |
extern char * get_symtab_entry(__native addr); |
/* Symtable linked together by build process */ |
extern struct symtab_entry symbol_table[]; |
#endif |
/SPARTAN/trunk/src/debug/symtab.c |
---|
0,0 → 1,47 |
/* |
* Copyright (C) 2005 Ondrej Palkovsky |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#include <symtab.h> |
#include <typedefs.h> |
/** Return entry that seems most likely to correspond to the @addr |
* |
*/ |
char * get_symtab_entry(__native addr) |
{ |
count_t i; |
for (i=1;symbol_table[i].address;++i) { |
if (addr < symbol_table[i].address) |
break; |
} |
if (addr >= symbol_table[i-1].address) |
return symbol_table[i-1].symbol_name; |
return NULL; |
} |
/SPARTAN/trunk/src/debug/genmap.py |
---|
0,0 → 1,60 |
#!/usr/bin/env python |
import sys |
import struct |
import re |
symline = re.compile(r'(0x[a-f0-9]+)\s+([^\s]+)$') |
symtabfmt = "<Q32s" |
MAXSTRING=31 |
def read_symbols(inp): |
while 1: |
line = inp.readline() |
if not line: |
return |
if 'memory map' in line: |
break |
symtable = {} |
while 1: |
line = inp.readline() |
if not line.strip(): |
continue |
if line[0] not in (' ','.'): |
break |
line = line.strip() |
# Search only for symbols |
res = symline.match(line) |
if res: |
symtable[int(res.group(1),16)] = res.group(2) |
return symtable |
def generate(inp, out): |
symtab = read_symbols(inp) |
if not symtab: |
print "Bad kernel.map format, empty." |
sys.exit(1) |
addrs = symtab.keys() |
addrs.sort() |
for addr in addrs: |
# Do not write address 0, it indicates end of data |
if addr == 0: |
continue |
data = struct.pack(symtabfmt,addr,symtab[addr][:MAXSTRING]) |
out.write(data) |
out.write(struct.pack(symtabfmt,0,'')) |
def main(): |
if len(sys.argv) != 3: |
print "Usage: %s <kernel.map> <output.bin>" % sys.argv[0] |
sys.exit(1) |
inp = open(sys.argv[1],'r') |
out = open(sys.argv[2],'w') |
generate(inp,out) |
inp.close() |
out.close() |
if __name__ == '__main__': |
main() |
Property changes: |
Added: svn:executable |
+* |
\ No newline at end of property |
/SPARTAN/trunk/src/build.amd64 |
---|
8,7 → 8,7 |
( |
set -e |
cd ../arch |
for a in drivers bios fpu_context.c mm/frame.c mm/tlb.c mm/memory_init.c boot/memmap.S; do |
for a in drivers bios fpu_context.c mm/frame.c mm/tlb.c mm/memory_init.c boot/memmap.S smp/apic.c smp/ipi.c smp/mps.c smp/smp.c acpi; do |
if [ \! -e amd64/src/$a ]; then |
echo ln -sf `pwd`/ia32/src/$a amd64/src/$a |
ln -sf `pwd`/ia32/src/$a amd64/src/$a |
/SPARTAN/trunk/src/Makefile |
---|
18,6 → 18,7 |
lib/memstr.c \ |
lib/the.c \ |
debug/print.c \ |
debug/symtab.c \ |
time/clock.c \ |
time/timeout.c \ |
time/delay.c \ |
64,7 → 65,7 |
clean: |
find . ../arch/$(ARCH)/src ../test -name '*.o' -exec rm \{\} \; |
-rm *.bin kernel.map |
-rm *.bin kernel.map kernel.map.pre debug/real_map.bin |
$(MAKE) -C ../arch/$(ARCH)/boot clean |
dist-clean: |
73,7 → 74,11 |
-$(MAKE) clean |
kernel.bin: $(arch_objects) $(objects) $(test_objects) |
$(LD) $(LFLAGS) $(arch_objects) $(objects) $(test_objects) -o $@ -Map kernel.map |
$(OBJCOPY) -I binary -O $(BFD_NAME) -B $(BFD_ARCH) --prefix-sections=symtab Makefile debug/empty_map.o |
$(LD) $(LFLAGS) $(arch_objects) $(objects) $(test_objects) debug/empty_map.o -o $@ -Map kernel.map.pre |
debug/genmap.py kernel.map.pre debug/real_map.bin |
$(OBJCOPY) -I binary -O $(BFD_NAME) -B $(BFD_ARCH) --prefix-sections=symtab debug/real_map.bin debug/real_map.o |
$(LD) $(LFLAGS) $(arch_objects) $(objects) $(test_objects) debug/real_map.o -o $@ -Map kernel.map |
%.s: %.S |
$(CC) $(CPPFLAGS) -E $< >$@ |
/SPARTAN/trunk/arch/mips/Makefile.inc |
---|
6,6 → 6,9 |
CC=$(MIPS_CC_DIR)/$(MIPS_TARGET)-gcc |
AS=$(MIPS_BINUTILS_DIR)/$(MIPS_TARGET)-as |
LD=$(MIPS_BINUTILS_DIR)/$(MIPS_TARGET)-ld |
OBJCOPY=$(MIPS_BINUTILS_DIR)/$(MIPS_TARGET)-objcopy |
BFD_NAME=elf32-tradlittlemips |
BFD_ARCH=mips |
ASFLAGS=-mips3 |
/SPARTAN/trunk/arch/mips/src/mm/tlb.c |
---|
33,11 → 33,10 |
#include <panic.h> |
#include <arch.h> |
#include <symtab.h> |
void main_bsp(void); |
int bootstrap = 1; |
void tlb_refill(void) |
52,7 → 51,15 |
void tlb_invalid(void) |
{ |
panic("%X: TLB exception at %X", cp0_badvaddr_read(), THREAD ? THREAD->saved_epc : 0); |
char *symbol = ""; |
if (THREAD) { |
char *s = get_symtab_entry(THREAD->saved_epc); |
if (s) |
symbol = s; |
} |
panic("%X: TLB exception at %X(%s)\n", cp0_badvaddr_read(), |
THREAD ? THREAD->saved_epc : 0, symbol); |
} |
void tlb_invalidate(int asid) |
/SPARTAN/trunk/arch/mips/_link.ld |
---|
36,6 → 36,10 |
*(.bss); /* uninitialized static variables */ |
*(.scommon); |
*(COMMON); /* global variables */ |
symbol_table = .; |
*(symtab.*); /* Symbol table, must be LAST symbol!*/ |
kdata_end = .; |
} = 0x00000000 |
/SPARTAN/trunk/arch/amd64/include/boot/boot.h |
---|
0,0 → 1,38 |
/* |
* Copyright (C) 2005 Ondrej Palkovsky |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#ifndef __amd64_BOOT_H__ |
#define __amd64_BOOT_H__ |
#define BOOTSTRAP_OFFSET 0x8000 |
#define BOOT_OFFSET 0x0 |
#define MULTIBOOT_HEADER_MAGIC 0x1BADB002 |
#define MULTIBOOT_HEADER_FLAGS 0x00010003 |
#endif |
/SPARTAN/trunk/arch/amd64/include/asm.h |
---|
165,6 → 165,24 |
static inline __u64 read_cr3(void) { __u64 v; __asm__ volatile ("movq %%cr3,%0" : "=r" (v)); return v; } |
/** Enable local APIC |
* |
* Enable local APIC in MSR. |
*/ |
static inline void enable_l_apic_in_msr() |
{ |
__asm__ volatile ( |
"movl $0x1b, %%ecx;" |
"rdmsr;" |
"orl $(1<<11),%%eax;" |
"orl $(0xfee00000),%%eax;" |
"wrmsr;" |
: |
: |
:"%eax","%ecx","%edx" |
); |
} |
extern size_t interrupt_handler_size; |
extern void interrupt_handlers(void); |
/SPARTAN/trunk/arch/amd64/Makefile.inc |
---|
5,9 → 5,10 |
CC=$(AMD64_CC_DIR)/$(AMD64_TARGET)-gcc |
AS=$(AMD64_BINUTILS_DIR)/$(AMD64_TARGET)-as |
LD=$(AMD64_BINUTILS_DIR)/$(AMD64_TARGET)-ld |
OBJCOPY=$(AMD64_BINUTILS_DIR)/$(AMD64_TARGET)-objcopy |
BFD_NAME=elf64-x86-64 |
BFD_ARCH=i386:x86-64 |
DEFS=-DARCH=$(ARCH) |
ifdef SMP |
46,4 → 47,13 |
arch/mm/memory_init.c \ |
arch/cpu/cpu.c \ |
arch/proc/scheduler.c \ |
arch/userspace.c |
arch/userspace.c \ |
arch/acpi/acpi.c \ |
arch/acpi/madt.c |
ifdef SMP |
arch_sources += arch/smp/apic.c \ |
arch/smp/ipi.c \ |
arch/smp/mps.c \ |
arch/smp/smp.c |
endif |
/SPARTAN/trunk/arch/amd64/src/dummy.s |
---|
28,5 → 28,7 |
.text |
0: |
.global ap_boot |
ap_boot: |
ret |
/SPARTAN/trunk/arch/amd64/src/interrupt.c |
---|
36,7 → 36,25 |
#include <arch/asm.h> |
#include <mm/tlb.h> |
#include <arch.h> |
#include <symtab.h> |
#define PRINT_INFO_ERRCODE(x) { \ |
char *symbol = get_symtab_entry(stack[1]); \ |
if (!symbol) \ |
symbol = ""; \ |
printf("----------------EXCEPTION OCCURED----------------\n"); \ |
printf("%%rip: %Q (%s)\n",x[1],symbol); \ |
printf("ERROR_WORD=%Q\n", x[0]); \ |
printf("%%rcs=%Q,flags=%Q\n", x[2], x[3]); \ |
printf("%%rax=%Q, %%rbx=%Q, %%rcx=%Q\n",x[-1],x[-2],x[-3]); \ |
printf("%%rdx=%Q, %%rsi=%Q, %%rdi=%Q\n",x[-4],x[-5],x[-6]); \ |
printf("%%r8 =%Q, %%r9 =%Q, %%r10=%Q\n",x[-7],x[-8],x[-9]); \ |
printf("%%r11=%Q, %%r12=%Q, %%r13=%Q\n",x[-10],x[-11],x[-12]); \ |
printf("%%r14=%Q, %%r15=%Q, %%rsp=%Q\n",x[-13],x[-14],x); \ |
printf("stack: %Q, %Q, %Q\n", x[5], x[6], x[7]); \ |
printf(" %Q, %Q, %Q\n", x[8], x[9], x[10]); \ |
} |
/* |
* Interrupt and exception dispatching. |
*/ |
72,6 → 90,7 |
void null_interrupt(__u8 n, __native stack[]) |
{ |
printf("----------------EXCEPTION OCCURED----------------\n"); |
printf("int %d: null_interrupt\n", n); |
printf("stack: %L, %L, %L, %L\n", stack[0], stack[1], stack[2], stack[3]); |
panic("unserviced interrupt\n"); |
79,17 → 98,13 |
void gp_fault(__u8 n, __native stack[]) |
{ |
printf("ERROR_WORD=%X, %%eip=%X, %%cs=%X, flags=%X\n", stack[0], stack[1], stack[2], stack[3]); |
printf("%%eax=%L, %%ebx=%L, %%ecx=%L, %%edx=%L,\n%%edi=%L, %%esi=%L, %%ebp=%L, %%esp=%L\n", stack[-2], stack[-5], stack[-3], stack[-4], stack[-9], stack[-8], stack[-1], stack); |
printf("stack: %X, %X, %X, %X\n", stack[4], stack[5], stack[6], stack[7]); |
PRINT_INFO_ERRCODE(stack); |
panic("general protection fault\n"); |
} |
void ss_fault(__u8 n, __native stack[]) |
{ |
printf("ERROR_WORD=%X, %%eip=%X, %%cs=%X, flags=%X\n", stack[0], stack[1], stack[2], stack[3]); |
printf("%%eax=%L, %%ebx=%L, %%ecx=%L, %%edx=%L,\n%%edi=%L, %%esi=%L, %%ebp=%L, %%esp=%L\n", stack[-2], stack[-5], stack[-3], stack[-4], stack[-9], stack[-8], stack[-1], stack); |
printf("stack: %X, %X, %X, %X\n", stack[4], stack[5], stack[6], stack[7]); |
PRINT_INFO_ERRCODE(stack); |
panic("stack fault\n"); |
} |
110,12 → 125,8 |
void page_fault(__u8 n, __native stack[]) |
{ |
printf("page fault address: %Q\n", read_cr2()); |
printf("ERROR_WORD=%Q, %%rip=%Q, %%rcs=%Q, flags=%Q\n", stack[0], stack[1], stack[2], stack[3]); |
printf("%%rax=%Q, %%rbx=%Q, %%rcx=%Q, %%rdx=%Q,\n%%rsi=%Q, %%rdi=%Q\n", |
stack[-1], stack[-2], stack[-3], stack[-4], stack[-5], stack[-6]); |
printf("stack: %X, %X, %X, %X\n", stack[5], stack[6], stack[7], stack[8]); |
PRINT_INFO_ERRCODE(stack); |
printf("Page fault address: %Q\n", read_cr2()); |
panic("page fault\n"); |
} |
/SPARTAN/trunk/arch/amd64/_link.ld |
---|
31,7 → 31,6 |
kdata_start = .; |
*(.data); /* initialized data */ |
*(.rodata*); /* string literals */ |
*(COMMON); /* global variables */ |
hardcoded_load_address = .; |
QUAD(0xffffffff80008000); |
hardcoded_ktext_size = .; |
38,9 → 37,17 |
QUAD(ktext_end - ktext_start + (unmapped_ktext_end - unmapped_ktext_start)); |
hardcoded_kdata_size = .; |
QUAD(kdata_end - kdata_start + (unmapped_kdata_end - unmapped_kdata_start)); |
*(COMMON); /* global variables */ |
*(.eh_frame); |
*(.bss); /* uninitialized static variables */ |
*(K_DATA_END); |
symbol_table = .; |
*(symtab.*); /* Symbol table, must be LAST symbol!*/ |
kdata_end = .; |
} |
_map_address = 0xffffffff80000000; |
/SPARTAN/trunk/arch/ia32/include/smp/apic.h |
---|
121,7 → 121,7 |
extern __u32 apic_id_mask; |
extern void apic_init(void); |
extern void apic_spurious(__u8 n, __u32 stack[]); |
extern void apic_spurious(__u8 n, __native stack[]); |
extern void l_apic_init(void); |
extern void l_apic_eoi(void); |
128,7 → 128,7 |
extern int l_apic_broadcast_custom_ipi(__u8 vector); |
extern int l_apic_send_init_ipi(__u8 apicid); |
extern void l_apic_debug(void); |
extern void l_apic_timer_interrupt(__u8 n, __u32 stack[]); |
extern void l_apic_timer_interrupt(__u8 n, __native stack[]); |
extern __u8 l_apic_id(void); |
extern __u32 io_apic_read(__u8 address); |
/SPARTAN/trunk/arch/ia32/Makefile.inc |
---|
1,7 → 1,11 |
CC=gcc |
AS=as |
LD=ld |
OBJCOPY=objcopy |
BFD_NAME=elf32-i386 |
BFD_ARCH=i386 |
DEFS:=-DARCH=$(ARCH) |
ifdef SMP |
/SPARTAN/trunk/arch/ia32/src/smp/apic.c |
---|
111,7 → 111,7 |
l_apic_debug(); |
} |
void apic_spurious(__u8 n, __u32 stack[]) |
void apic_spurious(__u8 n, __native stack[]) |
{ |
printf("cpu%d: APIC spurious interrupt\n", CPU->id); |
} |
319,7 → 319,7 |
#endif |
} |
void l_apic_timer_interrupt(__u8 n, __u32 stack[]) |
void l_apic_timer_interrupt(__u8 n, __native stack[]) |
{ |
l_apic_eoi(); |
clock(); |
/SPARTAN/trunk/arch/ia32/src/acpi/madt.c |
---|
114,7 → 114,7 |
__u8 prev_type = 0; /* used to detect inconsecutive entries */ |
l_apic = (__u32 *) acpi_madt->l_apic_address; |
l_apic = (__u32 *) (__native) acpi_madt->l_apic_address; |
while (h < end) { |
switch (h->type) { |
176,7 → 176,7 |
if (!madt_io_apic_entry_cnt++) { |
madt_io_apic_entries = ioa; |
io_apic = (__u32 *) ioa->io_apic_address; |
io_apic = (__u32 *) (__native) ioa->io_apic_address; |
} |
else { |
/* currently not supported */ |
/SPARTAN/trunk/arch/ia32/src/acpi/acpi.c |
---|
95,7 → 95,7 |
* 2. search 128K starting at 0xe0000 |
*/ |
addr[0] = (__u8 *) ebda; |
addr[0] = (__u8 *) PA2KA(ebda); |
for (i = (ebda ? 0 : 1); i < 2; i++) { |
for (j = 0; j < length[i]; j += 16) { |
if (*((__u64 *) &addr[i][j]) == *sig && rsdp_check(&addr[i][j])) { |
110,7 → 110,7 |
rsdp_found: |
printf("%L: ACPI Root System Description Pointer\n", acpi_rsdp); |
acpi_rsdt = (struct acpi_rsdt *) acpi_rsdp->rsdt_address; |
acpi_rsdt = (struct acpi_rsdt *) (__native) acpi_rsdp->rsdt_address; |
if (acpi_rsdp->revision) acpi_xsdt = (struct acpi_xsdt *) ((__address) acpi_rsdp->xsdt_address); |
if (acpi_rsdt) map_sdt((struct acpi_sdt_header *) acpi_rsdt); |
136,7 → 136,7 |
for (i=0; i<cnt; i++) { |
for (j=0; j<sizeof(signature_map)/sizeof(struct acpi_signature_map); j++) { |
struct acpi_sdt_header *h = (struct acpi_sdt_header *) acpi_rsdt->entry[i]; |
struct acpi_sdt_header *h = (struct acpi_sdt_header *) (__native) acpi_rsdt->entry[i]; |
map_sdt(h); |
if (*((__u32 *) &h->signature[0])==*((__u32 *) &signature_map[j].signature[0])) { |
/SPARTAN/trunk/arch/ia32/src/interrupt.c |
---|
36,6 → 36,7 |
#include <arch/asm.h> |
#include <mm/tlb.h> |
#include <arch.h> |
#include <symtab.h> |
/* |
* Interrupt and exception dispatching. |
47,6 → 48,22 |
void (* enable_irqs_function)(__u16 irqmask) = NULL; |
void (* eoi_function)(void) = NULL; |
#define PRINT_INFO_ERRCODE(x) { \ |
char *symbol = get_symtab_entry(stack[1]); \ |
if (!symbol) \ |
symbol = ""; \ |
printf("----------------EXCEPTION OCCURED----------------\n"); \ |
printf("%%eip: %X (%s)\n",x[1],symbol); \ |
printf("ERROR_WORD=%X\n", x[0]); \ |
printf("%%cs=%X,flags=%X\n", x[2], x[3]); \ |
printf("%%eax=%X, %%ebx=%X, %%ecx=%X, %%edx=%X\n",\ |
x[-2],x[-5],x[-3],x[-4]); \ |
printf("%%esi=%X, %%edi=%X, %%ebp=%X, %%esp=%X\n",\ |
x[-8],x[-9],x[-1],x); \ |
printf("stack: %X, %X, %X, %X\n", x[4], x[5], x[6], x[7]); \ |
printf(" %X, %X, %X, %X\n", x[8], x[9], x[10], x[11]); \ |
} |
iroutine trap_register(__u8 n, iroutine f) |
{ |
ASSERT(n < IVT_ITEMS); |
79,17 → 96,13 |
void gp_fault(__u8 n, __native stack[]) |
{ |
printf("ERROR_WORD=%X, %%eip=%X, %%cs=%X, flags=%X\n", stack[0], stack[1], stack[2], stack[3]); |
printf("%%eax=%L, %%ebx=%L, %%ecx=%L, %%edx=%L,\n%%edi=%L, %%esi=%L, %%ebp=%L, %%esp=%L\n", stack[-2], stack[-5], stack[-3], stack[-4], stack[-9], stack[-8], stack[-1], stack); |
printf("stack: %X, %X, %X, %X\n", stack[4], stack[5], stack[6], stack[7]); |
PRINT_INFO_ERRCODE(stack); |
panic("general protection fault\n"); |
} |
void ss_fault(__u8 n, __native stack[]) |
{ |
printf("ERROR_WORD=%X, %%eip=%X, %%cs=%X, flags=%X\n", stack[0], stack[1], stack[2], stack[3]); |
printf("%%eax=%L, %%ebx=%L, %%ecx=%L, %%edx=%L,\n%%edi=%L, %%esi=%L, %%ebp=%L, %%esp=%L\n", stack[-2], stack[-5], stack[-3], stack[-4], stack[-9], stack[-8], stack[-1], stack); |
printf("stack: %X, %X, %X, %X\n", stack[4], stack[5], stack[6], stack[7]); |
PRINT_INFO_ERRCODE(stack); |
panic("stack fault\n"); |
} |
110,10 → 123,8 |
void page_fault(__u8 n, __native stack[]) |
{ |
PRINT_INFO_ERRCODE(stack); |
printf("page fault address: %X\n", read_cr2()); |
printf("ERROR_WORD=%X, %%eip=%X, %%cs=%X, flags=%X\n", stack[0], stack[1], stack[2], stack[3]); |
printf("%%eax=%L, %%ebx=%L, %%ecx=%L, %%edx=%L,\n%%edi=%L, %%esi=%L, %%ebp=%L, %%esp=%L\n", stack[-2], stack[-5], stack[-3], stack[-4], stack[-9], stack[-8], stack[-1], stack); |
printf("stack: %X, %X, %X, %X\n", stack[4], stack[5], stack[6], stack[7]); |
panic("page fault\n"); |
} |
/SPARTAN/trunk/arch/ia32/_link.ld |
---|
45,6 → 45,10 |
LONG(unmapped_kdata_end - unmapped_kdata_start); |
*(.bss); /* uninitialized static variables */ |
*(K_DATA_END); |
symbol_table = .; |
*(symtab.*); /* Symbol table, must be LAST symbol!*/ |
kdata_end = .; |
} |