OSDev.org

The Place to Start for Operating System Developers
It is currently Fri Apr 19, 2024 10:35 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: General protection exception with updated Pure64
PostPosted: Mon Oct 30, 2017 7:39 pm 
Offline

Joined: Fri Oct 27, 2017 6:49 pm
Posts: 2
I am using an updated version of Pure64 system to build our own simple OS in flat mode under QEMU
https://bitbucket.org/RowDaBoat/x64barebones/

As I want to define my own IRQ handler I update the kernel.c file to call a load_idt function

typedef struct {
uint16_t offset_l, selector;
uint8_t cero, access;
uint16_t offset_m;
uint32_t offset_h, other_cero;
} DESCR_INT;

#pragma pack(pop)


DESCR_INT * idt = (DESCR_INT *) 0;

void setup_IDT_entry (int index, uint8_t selector, uint64_t offset, uint8_t access);

void load_idt() {
_cli();
setup_IDT_entry (0x20, 0x08, (uint64_t)&_irq00Handler, ACS_INT); // timer tick
setup_IDT_entry (0x21, 0x08, (uint64_t)&_irq01Handler, ACS_INT); // keyboard

picMasterMask(0xFC);
picSlaveMask(0xFF);

_sti();
}

void setup_IDT_entry (int index, uint8_t selector, uint64_t offset, uint8_t access) {
idt[index].selector = selector;
idt[index].offset_l = offset & 0xFFFF;
idt[index].offset_m = (offset >> 16) & 0xFFFF;
idt[index].offset_h = (offset >> 32) & 0xFFFFFFFF;
idt[index].access = access;
idt[index].cero = 0;
idt[index].other_cero = (uint64_t) 0;
}

but I get an exception 13 as soon as I get the first interrupt so I add

ncNewline();
ncPrint(" irq00Handler entry at 0x");
ncPrintHex((uint64_t)&_irq00Handler);
ncNewline();
and I find that the function pointer to _irq00handler is 0x4156575552515350.
This problem happens with Ubuntu 17.04 but when I rum the code with Ubuntu 14.04 it works fine and the pointer is around 0x100000 as expected.

Any idea about the cuase of this behavior?

Thanks in advance


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

All times are UTC - 6 hours


Who is online

Users browsing this forum: SemrushBot [Bot] and 80 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