Removed dead code.

This commit is contained in:
Florian Nücke
2020-09-20 13:58:06 +02:00
parent 1a5b1a47f4
commit 65e41b2490
2 changed files with 1 additions and 64 deletions

View File

@@ -1,44 +0,0 @@
package li.cil.circuity.api.vm.device;
/**
* An interrupter is an interrupt controller that will raise some interrupt based on interrupts
* it received.
* <p>
* Implementations track a list of registered interrupts to allow devices being connected to the
* controller without these devices having to know of each other. Additionally, this list
* of registered interrupt ids shall be persisted to allow devices to reclaim their interrupt
* ids after a load. Implementations may decide to only retain ids for reclaiming for one
* load iteration, i.e. any ids that have not been reclaimed after a load when the next save
* occurs may be freed for regular registration again.
*/
public interface Interrupter extends InterruptController {
/**
* Register a new interrupt.
* <p>
* Use this to reserve a new interrupt with an arbitrary id.
*
* @return the id of the registered interrupt; -1 if no more interrupts can be registered.
*/
int registerInterrupt();
/**
* Register an interrupt with a specific id.
* <p>
* Use this to reclaim an interrupt ID after state has been restored for example, i.e. a savegame has been loaded.
*
* @param id the id to reclaim.
* @return <code>true</code> if this id had not yet been claimed; <code>false</code> otherwise.
*/
boolean registerInterrupt(final int id);
/**
* Release an interrupt id.
* <p>
* This can be used to return the lease on an interrupt id to the controller so it can be handed out in future
* {@link #registerInterrupt()} calls. Typically this should be called by devices that have been disconnected
* from the controller for any reason.
*
* @param id the id to return to the pool of available ids.
*/
void releaseInterrupt(final int id);
}

View File

@@ -3,9 +3,7 @@ package li.cil.circuity.vm.riscv.device;
import li.cil.circuity.api.vm.Interrupt;
import li.cil.circuity.api.vm.device.InterruptController;
import li.cil.circuity.api.vm.device.InterruptSource;
import li.cil.circuity.api.vm.device.Interrupter;
import li.cil.circuity.api.vm.device.memory.MemoryMappedDevice;
import li.cil.circuity.vm.components.InterruptSourceRegistry;
import li.cil.circuity.vm.riscv.R5;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -20,7 +18,7 @@ import java.util.concurrent.atomic.AtomicInteger;
* See: https://github.com/riscv/riscv-plic-spec/blob/master/riscv-plic.adoc
* See: https://github.com/riscv/opensbi/blob/master/lib/utils/irqchip/plic.c
*/
public class R5PlatformLevelInterruptController implements MemoryMappedDevice, Interrupter, InterruptSource {
public class R5PlatformLevelInterruptController implements MemoryMappedDevice, InterruptController, InterruptSource {
private static final Logger LOGGER = LogManager.getLogger();
private static final int PLIC_PRIORITY_BASE = 0x000004;
@@ -35,8 +33,6 @@ public class R5PlatformLevelInterruptController implements MemoryMappedDevice, I
private static final int PLIC_CONTEXT_COUNT = 2; // MEIP and SEIP for one hart.
private static final int PLIC_MAX_PRIORITY = 7; // Number of priority level supported. Must have all bits set.
private final InterruptSourceRegistry interrupts = new InterruptSourceRegistry();
private final Interrupt meip = new Interrupt(R5.MEIP_SHIFT);
private final Interrupt seip = new Interrupt(R5.SEIP_SHIFT);
@@ -245,21 +241,6 @@ public class R5PlatformLevelInterruptController implements MemoryMappedDevice, I
return Arrays.asList(interruptByContext);
}
@Override
public int registerInterrupt() {
return interrupts.registerInterrupt();
}
@Override
public boolean registerInterrupt(final int id) {
return interrupts.registerInterrupt(id);
}
@Override
public void releaseInterrupt(final int id) {
interrupts.releaseInterrupt(id);
}
private boolean hasPending(final int context) {
for (int i = 0; i < sourceWords; i++) {
final int unclaimed = (pending[i].get() & ~claimed[i].get()) & enabled[context * sourceWords + i];