#ifndef __ARCH_ARM_H
#define __ARCH_ARM_H

#include <sys/types.h>

#if defined(__cplusplus)
extern "C" {
#endif

void arm_context_switch(vaddr_t *old_sp, vaddr_t new_sp);

static inline uint32_t read_cpsr() {
	uint32_t cpsr;

	__asm__ volatile("mrs   %0, cpsr" : "=r" (cpsr));
	return cpsr;
}

struct arm_iframe {
	uint32_t spsr;
	uint32_t r0;
	uint32_t r1;
	uint32_t r2;
	uint32_t r3;
	uint32_t r12;
	uint32_t lr;
	uint32_t pc;
};

#if defined(__cplusplus)
}
#endif

#endif
