Skip to content

Commit f7f6133

Browse files
committed
Fixed some issues
1 parent e30af32 commit f7f6133

File tree

9 files changed

+174
-75
lines changed

9 files changed

+174
-75
lines changed

include/bitmap.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ int bitmap_get(const bitmap_t *bitmap, size_t index);
2929
/* Setting the memory bitmap */
3030
void bitmap_set(bitmap_t *bitmap, size_t index, int value);
3131

32+
/* Fill the memory bitmap */
33+
void bitmap_fill(bitmap_t *bitmap, int value);
34+
3235
/* Set the memory bitmap range */
3336
void bitmap_set_range(bitmap_t *bitmap, size_t start, size_t end, int value);
3437

include/limine.h

Lines changed: 110 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,10 @@ struct limine_file {
8484

8585
/* Boot info */
8686

87-
#define LIMINE_BOOTLOADER_INFO_REQUEST {LIMINE_COMMON_MAGIC, 0xf55038d8e2a1202f, 0x279426fcf5f59740}
87+
#define LIMINE_BOOTLOADER_INFO_REQUEST \
88+
{ \
89+
LIMINE_COMMON_MAGIC, 0xf55038d8e2a1202f, 0x279426fcf5f59740 \
90+
}
8891

8992
struct limine_bootloader_info_response {
9093
uint64_t revision;
@@ -100,7 +103,10 @@ struct limine_bootloader_info_request {
100103

101104
/* Executable command line */
102105

103-
#define LIMINE_EXECUTABLE_CMDLINE_REQUEST {LIMINE_COMMON_MAGIC, 0x4b161536e598651e, 0xb390ad4a2f1f303a}
106+
#define LIMINE_EXECUTABLE_CMDLINE_REQUEST \
107+
{ \
108+
LIMINE_COMMON_MAGIC, 0x4b161536e598651e, 0xb390ad4a2f1f303a \
109+
}
104110

105111
struct limine_executable_cmdline_response {
106112
uint64_t revision;
@@ -115,7 +121,10 @@ struct limine_executable_cmdline_request {
115121

116122
/* Firmware type */
117123

118-
#define LIMINE_FIRMWARE_TYPE_REQUEST {LIMINE_COMMON_MAGIC, 0x8c2f75d90bef28a8, 0x7045a4688eac00c3}
124+
#define LIMINE_FIRMWARE_TYPE_REQUEST \
125+
{ \
126+
LIMINE_COMMON_MAGIC, 0x8c2f75d90bef28a8, 0x7045a4688eac00c3 \
127+
}
119128

120129
#define LIMINE_FIRMWARE_TYPE_X86BIOS 0
121130
#define LIMINE_FIRMWARE_TYPE_UEFI32 1
@@ -135,7 +144,10 @@ struct limine_firmware_type_request {
135144

136145
/* Stack size */
137146

138-
#define LIMINE_STACK_SIZE_REQUEST {LIMINE_COMMON_MAGIC, 0x224ef0460a8e8926, 0xe1cb0fc25f46ea3d}
147+
#define LIMINE_STACK_SIZE_REQUEST \
148+
{ \
149+
LIMINE_COMMON_MAGIC, 0x224ef0460a8e8926, 0xe1cb0fc25f46ea3d \
150+
}
139151

140152
struct limine_stack_size_response {
141153
uint64_t revision;
@@ -150,7 +162,10 @@ struct limine_stack_size_request {
150162

151163
/* HHDM */
152164

153-
#define LIMINE_HHDM_REQUEST {LIMINE_COMMON_MAGIC, 0x48dcf1cb8ad2b852, 0x63984e959a98244b}
165+
#define LIMINE_HHDM_REQUEST \
166+
{ \
167+
LIMINE_COMMON_MAGIC, 0x48dcf1cb8ad2b852, 0x63984e959a98244b \
168+
}
154169

155170
struct limine_hhdm_response {
156171
uint64_t revision;
@@ -165,7 +180,10 @@ struct limine_hhdm_request {
165180

166181
/* Framebuffer */
167182

168-
#define LIMINE_FRAMEBUFFER_REQUEST {LIMINE_COMMON_MAGIC, 0x9d5827dcd881dd75, 0xa3148604f6fab11b}
183+
#define LIMINE_FRAMEBUFFER_REQUEST \
184+
{ \
185+
LIMINE_COMMON_MAGIC, 0x9d5827dcd881dd75, 0xa3148604f6fab11b \
186+
}
169187

170188
#define LIMINE_FRAMEBUFFER_RGB 1
171189

@@ -218,7 +236,10 @@ struct limine_framebuffer_request {
218236

219237
/* Terminal */
220238

221-
#define LIMINE_TERMINAL_REQUEST {LIMINE_COMMON_MAGIC, 0xc8ac59310c2b0844, 0xa68d0c7265d38878}
239+
#define LIMINE_TERMINAL_REQUEST \
240+
{ \
241+
LIMINE_COMMON_MAGIC, 0xc8ac59310c2b0844, 0xa68d0c7265d38878 \
242+
}
222243

223244
#define LIMINE_TERMINAL_CB_DEC 10
224245
#define LIMINE_TERMINAL_CB_BELL 20
@@ -278,7 +299,10 @@ LIMINE_DEPRECATED_IGNORE_END
278299

279300
/* Paging mode */
280301

281-
#define LIMINE_PAGING_MODE_REQUEST {LIMINE_COMMON_MAGIC, 0x95c1a0edab0944cb, 0xa4e5cb3842f7488a}
302+
#define LIMINE_PAGING_MODE_REQUEST \
303+
{ \
304+
LIMINE_COMMON_MAGIC, 0x95c1a0edab0944cb, 0xa4e5cb3842f7488a \
305+
}
282306

283307
#if defined(__x86_64__) || defined(__i386__)
284308
# define LIMINE_PAGING_MODE_X86_64_4LVL 0
@@ -320,7 +344,10 @@ struct limine_paging_mode_request {
320344

321345
/* 5-level paging */
322346

323-
#define LIMINE_5_LEVEL_PAGING_REQUEST {LIMINE_COMMON_MAGIC, 0x94469551da9b3192, 0xebe5e86db7382888}
347+
#define LIMINE_5_LEVEL_PAGING_REQUEST \
348+
{ \
349+
LIMINE_COMMON_MAGIC, 0x94469551da9b3192, 0xebe5e86db7382888 \
350+
}
324351

325352
LIMINE_DEPRECATED_IGNORE_START
326353

@@ -339,11 +366,17 @@ LIMINE_DEPRECATED_IGNORE_END
339366
/* MP */
340367

341368
#if LIMINE_API_REVISION >= 1
342-
# define LIMINE_MP_REQUEST {LIMINE_COMMON_MAGIC, 0x95a67b819a1b857e, 0xa0b61b723b6a73e0}
343-
# define LIMINE_MP(TEXT) limine_mp_##TEXT
369+
# define LIMINE_MP_REQUEST \
370+
{ \
371+
LIMINE_COMMON_MAGIC, 0x95a67b819a1b857e, 0xa0b61b723b6a73e0 \
372+
}
373+
# define LIMINE_MP(TEXT) limine_mp_##TEXT
344374
#else
345-
# define LIMINE_SMP_REQUEST {LIMINE_COMMON_MAGIC, 0x95a67b819a1b857e, 0xa0b61b723b6a73e0}
346-
# define LIMINE_MP(TEXT) limine_smp_##TEXT
375+
# define LIMINE_SMP_REQUEST \
376+
{ \
377+
LIMINE_COMMON_MAGIC, 0x95a67b819a1b857e, 0xa0b61b723b6a73e0 \
378+
}
379+
# define LIMINE_MP(TEXT) limine_smp_##TEXT
347380
#endif
348381

349382
struct LIMINE_MP(info);
@@ -434,7 +467,10 @@ struct LIMINE_MP(request) {
434467

435468
/* Memory map */
436469

437-
#define LIMINE_MEMMAP_REQUEST {LIMINE_COMMON_MAGIC, 0x67cf3d9d378a806f, 0xe304acdfc50c3c62}
470+
#define LIMINE_MEMMAP_REQUEST \
471+
{ \
472+
LIMINE_COMMON_MAGIC, 0x67cf3d9d378a806f, 0xe304acdfc50c3c62 \
473+
}
438474

439475
#define LIMINE_MEMMAP_USABLE 0
440476
#define LIMINE_MEMMAP_RESERVED 1
@@ -470,7 +506,10 @@ struct limine_memmap_request {
470506

471507
/* Entry point */
472508

473-
#define LIMINE_ENTRY_POINT_REQUEST {LIMINE_COMMON_MAGIC, 0x13d86c035a1cd3e1, 0x2b0caa89d8f3026a}
509+
#define LIMINE_ENTRY_POINT_REQUEST \
510+
{ \
511+
LIMINE_COMMON_MAGIC, 0x13d86c035a1cd3e1, 0x2b0caa89d8f3026a \
512+
}
474513

475514
typedef void (*limine_entry_point)(void);
476515

@@ -488,9 +527,15 @@ struct limine_entry_point_request {
488527
/* Executable File */
489528

490529
#if LIMINE_API_REVISION >= 2
491-
# define LIMINE_EXECUTABLE_FILE_REQUEST {LIMINE_COMMON_MAGIC, 0xad97e90e83f1ed67, 0x31eb5d1c5ff23b69}
530+
# define LIMINE_EXECUTABLE_FILE_REQUEST \
531+
{ \
532+
LIMINE_COMMON_MAGIC, 0xad97e90e83f1ed67, 0x31eb5d1c5ff23b69 \
533+
}
492534
#else
493-
# define LIMINE_KERNEL_FILE_REQUEST {LIMINE_COMMON_MAGIC, 0xad97e90e83f1ed67, 0x31eb5d1c5ff23b69}
535+
# define LIMINE_KERNEL_FILE_REQUEST \
536+
{ \
537+
LIMINE_COMMON_MAGIC, 0xad97e90e83f1ed67, 0x31eb5d1c5ff23b69 \
538+
}
494539
#endif
495540

496541
#if LIMINE_API_REVISION >= 2
@@ -522,7 +567,10 @@ struct limine_kernel_file_request {
522567

523568
/* Module */
524569

525-
#define LIMINE_MODULE_REQUEST {LIMINE_COMMON_MAGIC, 0x3e7e279702be32af, 0xca1c4f3bd1280cee}
570+
#define LIMINE_MODULE_REQUEST \
571+
{ \
572+
LIMINE_COMMON_MAGIC, 0x3e7e279702be32af, 0xca1c4f3bd1280cee \
573+
}
526574

527575
#define LIMINE_INTERNAL_MODULE_REQUIRED (1 << 0)
528576
#define LIMINE_INTERNAL_MODULE_COMPRESSED (1 << 1)
@@ -555,7 +603,10 @@ struct limine_module_request {
555603

556604
/* RSDP */
557605

558-
#define LIMINE_RSDP_REQUEST {LIMINE_COMMON_MAGIC, 0xc5e77b6b397e7b43, 0x27637845accdcf3c}
606+
#define LIMINE_RSDP_REQUEST \
607+
{ \
608+
LIMINE_COMMON_MAGIC, 0xc5e77b6b397e7b43, 0x27637845accdcf3c \
609+
}
559610

560611
struct limine_rsdp_response {
561612
uint64_t revision;
@@ -574,7 +625,10 @@ struct limine_rsdp_request {
574625

575626
/* SMBIOS */
576627

577-
#define LIMINE_SMBIOS_REQUEST {LIMINE_COMMON_MAGIC, 0x9e9046f11e095391, 0xaa4a520fefbde5ee}
628+
#define LIMINE_SMBIOS_REQUEST \
629+
{ \
630+
LIMINE_COMMON_MAGIC, 0x9e9046f11e095391, 0xaa4a520fefbde5ee \
631+
}
578632

579633
struct limine_smbios_response {
580634
uint64_t revision;
@@ -595,7 +649,10 @@ struct limine_smbios_request {
595649

596650
/* EFI system table */
597651

598-
#define LIMINE_EFI_SYSTEM_TABLE_REQUEST {LIMINE_COMMON_MAGIC, 0x5ceba5163eaaf6d6, 0x0a6981610cf65fcc}
652+
#define LIMINE_EFI_SYSTEM_TABLE_REQUEST \
653+
{ \
654+
LIMINE_COMMON_MAGIC, 0x5ceba5163eaaf6d6, 0x0a6981610cf65fcc \
655+
}
599656

600657
struct limine_efi_system_table_response {
601658
uint64_t revision;
@@ -614,7 +671,10 @@ struct limine_efi_system_table_request {
614671

615672
/* EFI memory map */
616673

617-
#define LIMINE_EFI_MEMMAP_REQUEST {LIMINE_COMMON_MAGIC, 0x7df62a431d6872d5, 0xa4fcdfb3e57306c8}
674+
#define LIMINE_EFI_MEMMAP_REQUEST \
675+
{ \
676+
LIMINE_COMMON_MAGIC, 0x7df62a431d6872d5, 0xa4fcdfb3e57306c8 \
677+
}
618678

619679
struct limine_efi_memmap_response {
620680
uint64_t revision;
@@ -633,9 +693,15 @@ struct limine_efi_memmap_request {
633693
/* Date at boot */
634694

635695
#if LIMINE_API_REVISION >= 3
636-
# define LIMINE_DATE_AT_BOOT_REQUEST {LIMINE_COMMON_MAGIC, 0x502746e184c088aa, 0xfbc5ec83e6327893}
696+
# define LIMINE_DATE_AT_BOOT_REQUEST \
697+
{ \
698+
LIMINE_COMMON_MAGIC, 0x502746e184c088aa, 0xfbc5ec83e6327893 \
699+
}
637700
#else
638-
# define LIMINE_BOOT_TIME_REQUEST {LIMINE_COMMON_MAGIC, 0x502746e184c088aa, 0xfbc5ec83e6327893}
701+
# define LIMINE_BOOT_TIME_REQUEST \
702+
{ \
703+
LIMINE_COMMON_MAGIC, 0x502746e184c088aa, 0xfbc5ec83e6327893 \
704+
}
639705
#endif
640706

641707
#if LIMINE_API_REVISION >= 3
@@ -668,9 +734,15 @@ struct limine_boot_time_request {
668734
/* Executable address */
669735

670736
#if LIMINE_API_REVISION >= 2
671-
# define LIMINE_EXECUTABLE_ADDRESS_REQUEST {LIMINE_COMMON_MAGIC, 0x71ba76863cc55f63, 0xb2644a48c516a487}
737+
# define LIMINE_EXECUTABLE_ADDRESS_REQUEST \
738+
{ \
739+
LIMINE_COMMON_MAGIC, 0x71ba76863cc55f63, 0xb2644a48c516a487 \
740+
}
672741
#else
673-
# define LIMINE_KERNEL_ADDRESS_REQUEST {LIMINE_COMMON_MAGIC, 0x71ba76863cc55f63, 0xb2644a48c516a487}
742+
# define LIMINE_KERNEL_ADDRESS_REQUEST \
743+
{ \
744+
LIMINE_COMMON_MAGIC, 0x71ba76863cc55f63, 0xb2644a48c516a487 \
745+
}
674746
#endif
675747

676748
#if LIMINE_API_REVISION >= 2
@@ -699,7 +771,10 @@ struct limine_kernel_address_request {
699771

700772
/* Device Tree Blob */
701773

702-
#define LIMINE_DTB_REQUEST {LIMINE_COMMON_MAGIC, 0xb40ddb48fb54bac7, 0x545081493f81ffb7}
774+
#define LIMINE_DTB_REQUEST \
775+
{ \
776+
LIMINE_COMMON_MAGIC, 0xb40ddb48fb54bac7, 0x545081493f81ffb7 \
777+
}
703778

704779
struct limine_dtb_response {
705780
uint64_t revision;
@@ -714,7 +789,10 @@ struct limine_dtb_request {
714789

715790
/* RISC-V Boot Hart ID */
716791

717-
#define LIMINE_RISCV_BSP_HARTID_REQUEST {LIMINE_COMMON_MAGIC, 0x1369359f025525f9, 0x2ff2a56178391bb6}
792+
#define LIMINE_RISCV_BSP_HARTID_REQUEST \
793+
{ \
794+
LIMINE_COMMON_MAGIC, 0x1369359f025525f9, 0x2ff2a56178391bb6 \
795+
}
718796

719797
struct limine_riscv_bsp_hartid_response {
720798
uint64_t revision;
@@ -729,7 +807,10 @@ struct limine_riscv_bsp_hartid_request {
729807

730808
/* Bootloader Performance */
731809

732-
#define LIMINE_BOOTLOADER_PERFORMANCE_REQUEST {LIMINE_COMMON_MAGIC, 0x6b50ad9bf36d13ad, 0xdc4c7e88fc759e17}
810+
#define LIMINE_BOOTLOADER_PERFORMANCE_REQUEST \
811+
{ \
812+
LIMINE_COMMON_MAGIC, 0x6b50ad9bf36d13ad, 0xdc4c7e88fc759e17 \
813+
}
733814

734815
struct limine_bootloader_performance_response {
735816
uint64_t revision;

include/stb_truetype.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1945,7 +1945,10 @@ typedef struct {
19451945
int num_vertices;
19461946
} stbtt__csctx;
19471947

1948-
# define STBTT__CSCTX_INIT(bounds) {bounds, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, 0}
1948+
# define STBTT__CSCTX_INIT(bounds) \
1949+
{ \
1950+
bounds, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, 0 \
1951+
}
19491952

19501953
static void stbtt__track_vertex(stbtt__csctx *c, stbtt_int32 x, stbtt_int32 y)
19511954
{

include/uinxed.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#define BUILD_DATE __DATE__ // Compilation Date
1616
#define BUILD_TIME __TIME__ // Compile time
1717
#define KERNEL_NAME "Uinxed-Kernel" // Kernel name
18-
#define KERNEL_VERSION "0.0.251108" // Kernel version (major.minor.yymmdd)
18+
#define KERNEL_VERSION "0.0.260113" // Kernel version (major.minor.yymmdd)
1919

2020
/* Compiler judgment */
2121
#if defined(__clang__)

kernel/cpu/eis.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ void init_sse(void)
3939
uint64_t cr4;
4040
__asm__ volatile("mov %%cr4, %0" : "=r"(cr4)::"memory");
4141

42-
cr4 |= (1 << 9); // OSFXSR = 1
43-
cr4 |= (1 << 10); // OSXMMEXCPT = 1
42+
cr4 |= (1UL << 9); // OSFXSR = 1
43+
cr4 |= (1UL << 10); // OSXMMEXCPT = 1
4444

4545
__asm__ volatile("mov %0, %%cr4" ::"r"(cr4) : "memory");
4646
#else
@@ -55,10 +55,10 @@ void init_avx(void)
5555
if (!cpu_support_avx()) return;
5656

5757
uint64_t cr4;
58-
uint64_t xcr0 = 0x7;
58+
uint64_t xcr0 = 0xE7;
5959
__asm__ volatile("mov %%cr4, %0" : "=r"(cr4)::"memory");
6060

61-
cr4 |= (1 << 18); // OSXSAVE = 1
61+
cr4 |= (1UL << 18); // OSXSAVE = 1
6262

6363
__asm__ volatile("mov %0, %%cr4" ::"r"(cr4) : "memory");
6464
__asm__ volatile("xsetbv" ::"a"((uint32_t)xcr0), "d"((uint32_t)(xcr0 >> 32)), "c"(0) : "memory");

mem/bitmap.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,13 @@ void bitmap_set(bitmap_t *bitmap, size_t index, int value)
4040
bitmap->buffer[word_index] &= ~((size_t)1 << bit_index);
4141
}
4242

43+
/* Fill the memory bitmap */
44+
void bitmap_fill(bitmap_t *bitmap, int value)
45+
{
46+
uint8_t fill_val = (value) ? 0xff : 0x00;
47+
memset(bitmap->buffer, fill_val, bitmap->length);
48+
}
49+
4350
/* Set the memory bitmap range */
4451
void bitmap_set_range(bitmap_t *bitmap, size_t start, size_t end, int value)
4552
{

0 commit comments

Comments
 (0)