Change argument types in se.c/h, implement read32le/be, etc.

This commit is contained in:
TuxSH 2018-02-19 00:02:37 +01:00
parent 9c588d4965
commit f629a629d1
5 changed files with 60 additions and 53 deletions

View file

@ -2,16 +2,22 @@
#define EXOSPHERE_UTILS_H
#include <stdint.h>
#include <stddef.h>
void panic(void);
unsigned int read32le(const unsigned char *dword, unsigned int offset);
unsigned int read32be(const unsigned char *dword, unsigned int offset);
static inline uint32_t read32le(const void *dword, size_t offset) {
return *(uint32_t *)((uintptr_t)dword + offset);
}
static inline uint32_t get_core_id(void) {
uint32_t core_id;
asm volatile("mrs %0, MPIDR_EL1" : "=r"(core_id));
static inline uint32_t read32be(const unsigned char *dword, size_t offset) {
return __builtin_bswap32(read32le(dword, offset));
}
static inline unsigned int get_core_id(void) {
unsigned int core_id;
__asm__ __volatile__ ("mrs %0, MPIDR_EL1" : "=r"(core_id));
return core_id;
}
#endif
#endif