Port to latest GCC and fix CD loading bug
This commit is contained in:
@@ -70,40 +70,6 @@ namespace JabyEngine {
|
||||
|
||||
static InterruptVerifierResult interrupt_verifier() {
|
||||
if(Interrupt::is_irq(Interrupt::CDROM)) {
|
||||
const uint8_t old_status = CD_IO::IndexStatus;
|
||||
|
||||
CD_IO::PortIndex1::change_to();
|
||||
const auto cur_irq = CD_IO::Interrupt::get_type(CD_IO::PortIndex1::InterruptFlag);
|
||||
last_interrupt = cur_irq;
|
||||
CD_IO::Interrupt::ack(CD_IO::PortIndex1::InterruptFlag);
|
||||
|
||||
cmd_interrupt_bit = bit::clear(cmd_interrupt_bit, cur_irq);
|
||||
if(cur_irq == CD_IO::Interrupt::DataReady) {
|
||||
// Obtain sector content here
|
||||
auto* sector = sector_allocator.allocate_sector();
|
||||
if(sector) {
|
||||
//Now obtain sector
|
||||
read_sector_to(*sector);
|
||||
|
||||
cur_lba++;
|
||||
if(cur_lba == dst_lba) {
|
||||
current_state = State::Done;
|
||||
pause_cd();
|
||||
}
|
||||
}
|
||||
|
||||
else {
|
||||
current_state = State::BufferFull;
|
||||
pause_cd();
|
||||
}
|
||||
}
|
||||
|
||||
else if(cur_irq == CD_IO::Interrupt::DiskError) {
|
||||
current_state = State::Error;
|
||||
}
|
||||
|
||||
// No masking required because we can only write bit 0 - 2
|
||||
CD_IO::IndexStatus = old_status;
|
||||
return InterruptVerifierResult::ExecuteHandler;
|
||||
}
|
||||
|
||||
@@ -113,6 +79,40 @@ namespace JabyEngine {
|
||||
}
|
||||
|
||||
static void interrupt_handler(uint32_t) {
|
||||
const uint8_t old_status = CD_IO::IndexStatus;
|
||||
|
||||
CD_IO::PortIndex1::change_to();
|
||||
const auto cur_irq = CD_IO::Interrupt::get_type(CD_IO::PortIndex1::InterruptFlag);
|
||||
last_interrupt = cur_irq;
|
||||
CD_IO::Interrupt::ack(CD_IO::PortIndex1::InterruptFlag);
|
||||
|
||||
cmd_interrupt_bit = bit::clear(cmd_interrupt_bit, cur_irq);
|
||||
if(cur_irq == CD_IO::Interrupt::DataReady) {
|
||||
// Obtain sector content here
|
||||
auto* sector = sector_allocator.allocate_sector();
|
||||
if(sector) {
|
||||
//Now obtain sector
|
||||
read_sector_to(*sector);
|
||||
|
||||
cur_lba++;
|
||||
if(cur_lba == dst_lba) {
|
||||
current_state = State::Done;
|
||||
pause_cd();
|
||||
}
|
||||
}
|
||||
|
||||
else {
|
||||
current_state = State::BufferFull;
|
||||
pause_cd();
|
||||
}
|
||||
}
|
||||
|
||||
else if(cur_irq == CD_IO::Interrupt::DiskError) {
|
||||
current_state = State::Error;
|
||||
}
|
||||
|
||||
// No masking required because we can only write bit 0 - 2
|
||||
CD_IO::IndexStatus = old_status;
|
||||
Interrupt::ack_irq(Interrupt::CDROM);
|
||||
__syscall_ReturnFromException();
|
||||
}
|
||||
|
Reference in New Issue
Block a user