OSDev.org

The Place to Start for Operating System Developers
It is currently Fri Apr 19, 2024 7:18 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: ISR trouble
PostPosted: Sun Mar 10, 2019 7:57 am 
Offline
Member
Member

Joined: Wed Feb 13, 2019 3:07 pm
Posts: 28
When i get interrupt i have that output on a screen. https://ibb.co/1bPsH5Z.
How to fix it?

OS github - https://github.com/s04v/locOS


Top
 Profile  
 
 Post subject: Re: ISR trouble
PostPosted: Sun Mar 10, 2019 9:17 am 
Offline
Member
Member

Joined: Fri Apr 20, 2018 9:15 am
Posts: 35
Location: Cambridge, UK
You should narrow down the problem a bit more. What source line is the page fault happening on? etc.


Top
 Profile  
 
 Post subject: Re: ISR trouble
PostPosted: Sun Mar 10, 2019 5:29 pm 
Offline
Member
Member

Joined: Fri Aug 26, 2016 1:41 pm
Posts: 692
I recommended BOCHS for debugging, but stepping through the code in QEMU would have found this as well. In kernel.c
Code:
u32 *ptr = (u32*)0xA00000;
should have been:
Code:
u32 *ptr = (u32*)0xA0000;
You had one too many zeroes and your original memory address was not mapped, thus the page fault.
A few changes to your Makefile to improve/enable debugging with QEMU, and some cleanup:
Code:
C_SOURCES = $(wildcard kernel/*.c drivers/*.c cpu/*.c shell/*.c mm/*.c)
HEADERS = $(wildcard kernel/*.h drivers/*.h cpu/*.h shell/*.h mm/*.h)
# Nice syntax for file extension replacement
OBJ = ${C_SOURCES:.c=.o cpu/interrupt.o}

# Change this if your cross-compiler is somewhere else
CC = gcc
GDB = gdb
# -g: Use debugging symbols in gcc
CFLAGS = -g -m32 -nostdlib -nostdinc -fno-builtin -fno-stack-protector \
         -nostartfiles -nodefaultlibs -std=gnu99 -fno-PIC
# First rule is run by default
os-image.bin: boot/boot.bin kernel.bin
        cat $^ > os-image.bin

# '--oformat binary' deletes all symbols as a collateral, so we don't need
# to 'strip' them manually on this case
kernel.bin: kernel.elf
        objcopy -O binary $^ $@
# or you can use:
#       ld -melf_i386 -o $@ -T link.ld $^ --oformat binary

# Used for debugging purposes
kernel.elf: kernel/kernel.o ${OBJ}
        ld -melf_i386 -o $@ -T link.ld $^

run: os-image.bin
        qemu-system-i386 -fda os-image.bin

# Open the connection to qemu and load our kernel-object file with symbols
debug: os-image.bin kernel.elf
        qemu-system-i386 -s -fda os-image.bin &
        ${GDB} kernel.elf \
           -ex "target remote localhost:1234" \
           -ex "b start" \
           -ex "continue"
# If running from a terminal use these layouts to improve the debug experience
# by placing them before -ex "continue"
#           -ex "layout src" \
#           -ex "layout reg" \

# Generic rules for wildcards
# To make an object, always compile from its .c
%.o: %.c ${HEADERS}
        ${CC} ${CFLAGS} -ffreestanding -c $< -o $@

%.o: %.asm
        nasm $< -f elf -Fdwarf -g -o $@

%.bin: %.asm
        nasm $< -f bin -o $@

clean:
        rm -rf *.bin *.dis  os-image.bin *.elf
        rm -rf  boot/*.bin drivers/*.o boot/*.o cpu/*.o mm/*.o shell/*.o kernel/*.o


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot] and 148 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group