This repository was archived by the owner on Jan 14, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,6 +14,10 @@ typedef enum {
1414
1515uint32_t vmem_virt_to_phys (uint32_t virt );
1616uint32_t vmem_phys_to_virt (uint32_t phys );
17+ /* 64-bit helpers: return 64-bit physical/virtual addresses for kernels running in 64-bit mode.
18+ These wrap the 32-bit routines and zero-extend; replace with full 64-bit implementation when available. */
19+ uint64_t vmem_virt_to_phys64 (uint64_t virt );
20+ uint64_t vmem_phys_to_virt64 (uint64_t phys );
1721void vmem_set_offset (int32_t offset );
1822void vmem_reset (void );
1923void vmem_set_mode (vmem_mode_t mode );
Original file line number Diff line number Diff line change @@ -250,8 +250,7 @@ void memory_init() {
250250 uintptr_t heap_start = (base_end > bitmap_end ) ? base_end : bitmap_end ;
251251 // 4KBページ境界に切り上げてアライン
252252 heap_start = (heap_start + 0x0FFF ) & ~0x0FFF ;
253- /* 増やす: ブロックキャッシュなどで大きな動的確保が必要になるためヒープを256KBに拡張 */
254- uintptr_t heap_end = heap_start + 0x40000 ; // 256KBのヒープ領域
253+ uintptr_t heap_end = heap_start + 0x100000 ; // 1MBのヒープ領域
255254 mem_init ((uint32_t )heap_start , (uint32_t )heap_end );
256255 memmap_reserve ((uint32_t )heap_start , (uint32_t )heap_end );
257256}
Original file line number Diff line number Diff line change @@ -90,6 +90,15 @@ uint32_t vmem_virt_to_phys(uint32_t virt) {
9090 return phys ;
9191}
9292
93+ /* 64-bit wrapper: call 32-bit virt->phys and zero-extend to 64-bit.
94+ This is a compatibility helper for subsystems that expect 64-bit DMA addresses.
95+ Replace with a true 64-bit page-table walk implementation if/when needed. */
96+ uint64_t vmem_virt_to_phys64 (uint64_t virt ) {
97+ uint32_t v32 = (uint32_t )virt ;
98+ uint32_t p32 = vmem_virt_to_phys (v32 );
99+ return (uint64_t )p32 ;
100+ }
101+
93102// 物理アドレス→仮想アドレス変換
94103uint32_t vmem_phys_to_virt (uint32_t phys ) {
95104 /* Treat UINT32_MAX as error sentinel instead of 0 to allow phys==0 */
@@ -121,6 +130,12 @@ uint32_t vmem_phys_to_virt(uint32_t phys) {
121130 }
122131}
123132
133+ uint64_t vmem_phys_to_virt64 (uint64_t phys ) {
134+ uint32_t p32 = (uint32_t )phys ;
135+ uint32_t v32 = vmem_phys_to_virt (p32 );
136+ return (uint64_t )v32 ;
137+ }
138+
124139// オフセット設定
125140void vmem_set_offset (int32_t offset ) {
126141 vmem_offset = offset ;
You can’t perform that action at this time.
0 commit comments