Merge pull request #7 from 0xKSor/refactor/renamed-types-to-Types

ref: renamed types.h to Types.h for match naming convention; also add…
This commit is contained in:
hwachakarter
2026-04-25 15:06:20 +09:00
committed by GitHub
11 changed files with 78 additions and 7 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
#pragma once
#include <types.h>
#include <Types.h>
static inline void CPUYield() {
__asm__ volatile ("yield" ::: "memory");
+35
View File
@@ -0,0 +1,35 @@
#pragma once
#include <Types.h>
typedef struct FDTHeader {
UInt32 magic; // 0xd00dfeed
UInt32 totalSize;
UInt32 offDtStruct;
UInt32 offDtStrings;
UInt32 offMemRsvMap;
UInt32 version;
UInt32 lastCompVersion;
UInt32 bootCpuidPhys;
UInt32 sizeDtStrings;
UInt32 sizeDtStruct;
} FDTHeader;
typedef struct FDTProperty {
UInt32 length;
UInt32 nameOffset;
} FDTProperty;
typedef enum FDTToken {
FDTTokenBeginNode = 0x1,
FDTTokenEndNode = 0x2,
FDTTokenProperty = 0x3,
FDTTokenNOP = 0x4,
FDTTokenEnd = 0x9,
} FDTToken;
enum {
kFDTHeaderMagic = 0xd00dfeed,
};
void DTBParse(Pointer dtb);
+1 -1
View File
@@ -1,5 +1,5 @@
#pragma once
#include <types.h>
#include <Types.h>
typedef struct ExceptionsContext {
UInt64 x0;
+1 -1
View File
@@ -1,5 +1,5 @@
#pragma once
#include <types.h>
#include <Types.h>
static inline void IOAddressWrite32(Address address, UInt32 value) {
__asm__ volatile ("dsb sy" ::: "memory"); // wait till all previous writes are finished physically
+1 -1
View File
@@ -1,5 +1,5 @@
#pragma once
#include <types.h>
#include <Types.h>
enum {
kUARTBaseAddress = 0x09000000, // TODO: make it dynamic by parsing DTB
+19
View File
@@ -0,0 +1,19 @@
#pragma once
#include <Types.h>
static inline UInt64 AlignUp64(UInt64 value, UInt64 alignment) {
return (value + alignment - 1) & ~(alignment - 1);
}
static inline UInt64 AlignDown64(UInt64 value, UInt64 alignment) {
return value & ~(alignment - 1);
}
static inline UInt32 AlignUp32(UInt32 value, UInt32 alignment) {
return (value + alignment - 1) & ~(alignment - 1);
}
static inline UInt32 AlignDown32(UInt32 value, UInt32 alignment) {
return value & ~(alignment - 1);
}
+10
View File
@@ -0,0 +1,10 @@
#pragma once
#include <Types.h>
static inline UInt32 BytesSwap32(UInt32 value) {
return __builtin_bswap32(value);
}
static inline UInt64 BytesSwap64(UInt64 value) {
return __builtin_bswap64(value);
}
+1 -1
View File
@@ -1,5 +1,5 @@
#pragma once
#include <types.h>
#include <Types.h>
#include <Lib/VAArgs.h>
void* StringSet(BytePointer destination, ASCII value, Size count);
+1 -1
View File
@@ -1,5 +1,5 @@
#pragma once
#include <types.h>
#include <Types.h>
enum {
kOSLogBufferSize = 1024,
+1 -1
View File
@@ -1,6 +1,6 @@
#pragma once
#include <types.h>
#include <Types.h>
#include <Arch/Exceptions.h>
__attribute__((noreturn)) void OSPanicException(ExceptionsContext* frame);
+7
View File
@@ -3,12 +3,19 @@
#pragma once
#if defined(NDEBUG) || defined(__OPTIMIZE__)
#define IS_RELEASE 1
#else
#define IS_RELEASE 0
#endif
typedef unsigned char UInt8;
typedef unsigned short UInt16;
typedef unsigned int UInt32;
typedef unsigned long long UInt64;
typedef unsigned long long UInt;
typedef void* Pointer;
typedef UInt Address;
typedef UInt8* BytePointer;
typedef UInt8* MemoryPointer;