mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-26 23:52:26 +00:00
Further universalise function layout.
This commit is contained in:
parent
d7bb1a9ee1
commit
ec4a60b7da
@ -16,7 +16,10 @@ namespace InstructionSet::x86::Primitive {
|
|||||||
// The below takes a reference in order properly to handle PUSH SP,
|
// The below takes a reference in order properly to handle PUSH SP,
|
||||||
// which should place the value of SP after the push onto the stack.
|
// which should place the value of SP after the push onto the stack.
|
||||||
template <typename IntT, bool preauthorised, typename ContextT>
|
template <typename IntT, bool preauthorised, typename ContextT>
|
||||||
void push(IntT &value, ContextT &context) {
|
void push(
|
||||||
|
IntT &value,
|
||||||
|
ContextT &context
|
||||||
|
) {
|
||||||
context.registers.sp_ -= sizeof(IntT);
|
context.registers.sp_ -= sizeof(IntT);
|
||||||
if constexpr (preauthorised) {
|
if constexpr (preauthorised) {
|
||||||
context.memory.template preauthorised_write<IntT>(Source::SS, context.registers.sp_, value);
|
context.memory.template preauthorised_write<IntT>(Source::SS, context.registers.sp_, value);
|
||||||
@ -29,7 +32,9 @@ void push(IntT &value, ContextT &context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename IntT, bool preauthorised, typename ContextT>
|
template <typename IntT, bool preauthorised, typename ContextT>
|
||||||
IntT pop(ContextT &context) {
|
IntT pop(
|
||||||
|
ContextT &context
|
||||||
|
) {
|
||||||
const auto value = context.memory.template access<IntT, preauthorised ? AccessType::PreauthorisedRead : AccessType::Read>(
|
const auto value = context.memory.template access<IntT, preauthorised ? AccessType::PreauthorisedRead : AccessType::Read>(
|
||||||
Source::SS,
|
Source::SS,
|
||||||
context.registers.sp_);
|
context.registers.sp_);
|
||||||
|
Loading…
Reference in New Issue
Block a user