Fix compiler issues in 32-bit

This commit is contained in:
Alex
2023-08-24 04:45:13 +03:00
parent 83bd843e2b
commit 05610c7e7a
8 changed files with 98 additions and 35 deletions

View File

@ -298,23 +298,25 @@ typedef struct
uint64_t value;
} atomic_uint64_t;
uint64_t __atomic_load_8(const atomic_uint64_t *p)
{
uint64_t value;
__asm__ volatile("lock cmpxchg8b %1"
: "=A"(value)
: "m"(*p)
: "memory");
return value;
}
/* No longer needed? */
void __atomic_store_8(atomic_uint64_t *p, uint64_t value)
{
__asm__ volatile("lock cmpxchg8b %0"
: "=m"(p->value)
: "a"((uint32_t)value), "d"((uint32_t)(value >> 32)), "m"(*p)
: "memory");
}
// uint64_t __atomic_load_8(const atomic_uint64_t *p)
// {
// uint64_t value;
// __asm__ volatile("lock cmpxchg8b %1"
// : "=A"(value)
// : "m"(*p)
// : "memory");
// return value;
// }
// void __atomic_store_8(atomic_uint64_t *p, uint64_t value)
// {
// __asm__ volatile("lock cmpxchg8b %0"
// : "=m"(p->value)
// : "a"((uint32_t)value), "d"((uint32_t)(value >> 32)), "m"(*p)
// : "memory");
// }
int __fixsfsi(float a)
{

View File

@ -41,7 +41,6 @@ EXTERNC void multiboot_main(uintptr_t Magic, uintptr_t Info)
BootInfo mb2binfo{};
{
int pos = 0;
auto InfoAddress = Info;
for (auto Tag = (struct multiboot_tag *)((uint8_t *)InfoAddress + 8);
;

View File

@ -229,13 +229,9 @@ namespace GlobalDescriptorTable
gdt[Core].Entries->TaskStateSegment.BaseMiddle = uint8_t((Base >> 16) & 0xFF);
gdt[Core].Entries->TaskStateSegment.BaseHigh = uint8_t((Base >> 24) & 0xFF);
#pragma diagnostic push
#pragma GCC diagnostic ignored "-Wshift-count-overflow"
gdt[Core].Entries->TaskStateSegment.BaseUpper = s_cst(uint32_t, (Base >> 32) & 0xFFFFFFFF);
#pragma diagnostic pop
gdt[Core].Entries->TaskStateSegment.Access = {.A = 1, .RW = 0, .DC = 0, .E = 1, .S = 0, .DPL = 0, .P = 1};
gdt[Core].Entries->TaskStateSegment.Granularity = (0 << 4) | ((Limit >> 16) & 0xF);
@ -259,7 +255,7 @@ namespace GlobalDescriptorTable
SafeFunction void SetKernelStack(void *Stack)
{
long CPUID = GetCurrentCPU()->ID;
stub;
}
void *GetKernelStack() { return (void *)nullptr; }