diff options
Diffstat (limited to 'dev')
| -rw-r--r-- | dev/boot/BootKit/BootKit.h | 9 | ||||
| -rw-r--r-- | dev/boot/BootKit/HW/SATA.h | 4 | ||||
| -rw-r--r-- | dev/boot/src/BootString.cc | 2 | ||||
| -rw-r--r-- | dev/boot/src/HEL/AMD64/BootATA+Next.cc | 8 | ||||
| -rw-r--r-- | dev/boot/src/HEL/AMD64/BootATA.cc | 8 | ||||
| -rw-r--r-- | dev/boot/src/HEL/AMD64/BootSATA.cc | 4 | ||||
| -rw-r--r-- | dev/boot/src/docs/KERN_VER.md | 2 | ||||
| -rw-r--r-- | dev/kernel/FSKit/HeFS.h | 7 | ||||
| -rw-r--r-- | dev/kernel/HALKit/AMD64/Storage/AHCI+Generic.cc | 3 | ||||
| -rw-r--r-- | dev/kernel/NewKit/Utils.h | 6 | ||||
| -rw-r--r-- | dev/kernel/src/FS/HeFS+FileSystemParser.cc | 165 | ||||
| -rw-r--r-- | dev/kernel/src/MemoryMgr.cc | 2 | ||||
| -rw-r--r-- | dev/kernel/src/UtfUtils.cc | 10 |
13 files changed, 101 insertions, 129 deletions
diff --git a/dev/boot/BootKit/BootKit.h b/dev/boot/BootKit/BootKit.h index 181be973..cc80e359 100644 --- a/dev/boot/BootKit/BootKit.h +++ b/dev/boot/BootKit/BootKit.h @@ -40,7 +40,7 @@ /***********************************************************************************/ namespace Boot { -EXTERN void ThrowError(const WideChar* errorCode, const WideChar* reason) noexcept; +void ThrowError(const WideChar* errorCode, const WideChar* reason) noexcept; class BootTextWriter; class BootFileReader; @@ -51,7 +51,8 @@ typedef Char* PEFImagePtr; typedef Char* PEImagePtr; typedef WideChar CharacterTypeUTF16; -typedef Char CharacterTypeUTF8; +typedef Char CharacterTypeASCII; +typedef char8_t CharacterTypeUTF8; using namespace Kernel; @@ -86,7 +87,7 @@ class BootTextWriter final { Kernel::SizeT BCopyMem(CharacterTypeUTF16* dest, CharacterTypeUTF16* src, const Kernel::SizeT len); -Kernel::SizeT BSetMem(CharacterTypeUTF8* src, const CharacterTypeUTF8 byte, +Kernel::SizeT BSetMem(CharacterTypeASCII* src, const CharacterTypeASCII byte, const Kernel::SizeT len); /// String length functions. @@ -151,7 +152,7 @@ typedef UInt8* BlobType; /// @brief Bootloader Version String. class BVersionString final { public: - static const CharacterTypeUTF8* The() { return BOOTLOADER_VERSION; } + static const CharacterTypeASCII* The() { return BOOTLOADER_VERSION; } }; /***********************************************************************************/ diff --git a/dev/boot/BootKit/HW/SATA.h b/dev/boot/BootKit/HW/SATA.h index 7285ceac..eecf426d 100644 --- a/dev/boot/BootKit/HW/SATA.h +++ b/dev/boot/BootKit/HW/SATA.h @@ -34,8 +34,8 @@ class BootDeviceSATA final { constexpr static auto kSectorSize = kAHCISectorSize; - BootDeviceSATA& Read(Boot::CharacterTypeUTF8* Buf, const Kernel::SizeT SecCount); - BootDeviceSATA& Write(Boot::CharacterTypeUTF8* Buf, const Kernel::SizeT SecCount); + BootDeviceSATA& Read(Boot::CharacterTypeASCII* Buf, const Kernel::SizeT SecCount); + BootDeviceSATA& Write(Boot::CharacterTypeASCII* Buf, const Kernel::SizeT SecCount); SATATrait& Leak(); diff --git a/dev/boot/src/BootString.cc b/dev/boot/src/BootString.cc index 8762a151..277f3273 100644 --- a/dev/boot/src/BootString.cc +++ b/dev/boot/src/BootString.cc @@ -62,7 +62,7 @@ Kernel::SizeT Boot::BSetMem(CharacterTypeUTF16* src, const CharacterTypeUTF16 by return cnt; } -Kernel::SizeT Boot::BSetMem(CharacterTypeUTF8* src, const CharacterTypeUTF8 byte, +Kernel::SizeT Boot::BSetMem(CharacterTypeASCII* src, const CharacterTypeASCII byte, const Kernel::SizeT len) { if (!src) return 0; diff --git a/dev/boot/src/HEL/AMD64/BootATA+Next.cc b/dev/boot/src/HEL/AMD64/BootATA+Next.cc index 723224c1..547d4f99 100644 --- a/dev/boot/src/HEL/AMD64/BootATA+Next.cc +++ b/dev/boot/src/HEL/AMD64/BootATA+Next.cc @@ -103,7 +103,7 @@ ATAInit_Retry: return true; } -Void boot_ata_read(UInt64 Lba, UInt16 IO, UInt8 Master, CharacterTypeUTF8* Buf, SizeT SectorSz, +Void boot_ata_read(UInt64 Lba, UInt16 IO, UInt8 Master, CharacterTypeASCII* Buf, SizeT SectorSz, SizeT Size) { Lba /= SectorSz; @@ -136,7 +136,7 @@ Void boot_ata_read(UInt64 Lba, UInt16 IO, UInt8 Master, CharacterTypeUTF8* Buf, } } -Void boot_ata_write(UInt64 Lba, UInt16 IO, UInt8 Master, CharacterTypeUTF8* Buf, SizeT SectorSz, +Void boot_ata_write(UInt64 Lba, UInt16 IO, UInt8 Master, CharacterTypeASCII* Buf, SizeT SectorSz, SizeT Size) { Lba /= SectorSz; @@ -208,7 +208,7 @@ BootDeviceATA::operator bool() { @param Sz Sector size @param Buf buffer */ -BootDeviceATA& BootDeviceATA::Read(CharacterTypeUTF8* Buf, SizeT SectorSz) { +BootDeviceATA& BootDeviceATA::Read(CharacterTypeASCII* Buf, SizeT SectorSz) { if (!boot_ata_detected()) { Leak().mErr = true; return *this; @@ -229,7 +229,7 @@ BootDeviceATA& BootDeviceATA::Read(CharacterTypeUTF8* Buf, SizeT SectorSz) { @param Sz Sector size @param Buf buffer */ -BootDeviceATA& BootDeviceATA::Write(CharacterTypeUTF8* Buf, SizeT SectorSz) { +BootDeviceATA& BootDeviceATA::Write(CharacterTypeASCII* Buf, SizeT SectorSz) { if (!boot_ata_detected()) { Leak().mErr = true; return *this; diff --git a/dev/boot/src/HEL/AMD64/BootATA.cc b/dev/boot/src/HEL/AMD64/BootATA.cc index 0fd46832..e1ccbfc3 100644 --- a/dev/boot/src/HEL/AMD64/BootATA.cc +++ b/dev/boot/src/HEL/AMD64/BootATA.cc @@ -101,7 +101,7 @@ ATAInit_Retry: return NO; } -Void boot_ata_read(UInt64 Lba, UInt16 IO, UInt8 Master, CharacterTypeUTF8* Buf, SizeT SectorSz, +Void boot_ata_read(UInt64 Lba, UInt16 IO, UInt8 Master, CharacterTypeASCII* Buf, SizeT SectorSz, SizeT Size) { Lba /= SectorSz; @@ -130,7 +130,7 @@ Void boot_ata_read(UInt64 Lba, UInt16 IO, UInt8 Master, CharacterTypeUTF8* Buf, } } -Void boot_ata_write(UInt64 Lba, UInt16 IO, UInt8 Master, CharacterTypeUTF8* Buf, SizeT SectorSz, +Void boot_ata_write(UInt64 Lba, UInt16 IO, UInt8 Master, CharacterTypeASCII* Buf, SizeT SectorSz, SizeT Size) { Lba /= SectorSz; @@ -196,7 +196,7 @@ BootDeviceATA::operator bool() { @param Sz Sector size @param Buf buffer */ -BootDeviceATA& BootDeviceATA::Read(CharacterTypeUTF8* Buf, SizeT SectorSz) { +BootDeviceATA& BootDeviceATA::Read(CharacterTypeASCII* Buf, SizeT SectorSz) { if (!boot_ata_detected()) { Leak().mErr = true; return *this; @@ -217,7 +217,7 @@ BootDeviceATA& BootDeviceATA::Read(CharacterTypeUTF8* Buf, SizeT SectorSz) { @param Sz Sector size @param Buf buffer */ -BootDeviceATA& BootDeviceATA::Write(CharacterTypeUTF8* Buf, SizeT SectorSz) { +BootDeviceATA& BootDeviceATA::Write(CharacterTypeASCII* Buf, SizeT SectorSz) { if (!boot_ata_detected()) { Leak().mErr = true; return *this; diff --git a/dev/boot/src/HEL/AMD64/BootSATA.cc b/dev/boot/src/HEL/AMD64/BootSATA.cc index 2b1bc78e..b0b0b52f 100644 --- a/dev/boot/src/HEL/AMD64/BootSATA.cc +++ b/dev/boot/src/HEL/AMD64/BootSATA.cc @@ -48,7 +48,7 @@ BootDeviceSATA::BootDeviceSATA() noexcept { @param Sz Sector size @param Buf buffer */ -BootDeviceSATA& BootDeviceSATA::Read(CharacterTypeUTF8* Buf, SizeT SectorSz) { +BootDeviceSATA& BootDeviceSATA::Read(CharacterTypeASCII* Buf, SizeT SectorSz) { NE_UNUSED(Buf); NE_UNUSED(SectorSz); @@ -62,7 +62,7 @@ BootDeviceSATA& BootDeviceSATA::Read(CharacterTypeUTF8* Buf, SizeT SectorSz) { @param Sz Sector size @param Buf buffer */ -BootDeviceSATA& BootDeviceSATA::Write(CharacterTypeUTF8* Buf, SizeT SectorSz) { +BootDeviceSATA& BootDeviceSATA::Write(CharacterTypeASCII* Buf, SizeT SectorSz) { NE_UNUSED(Buf); NE_UNUSED(SectorSz); diff --git a/dev/boot/src/docs/KERN_VER.md b/dev/boot/src/docs/KERN_VER.md index abe3e823..cabdb1d2 100644 --- a/dev/boot/src/docs/KERN_VER.md +++ b/dev/boot/src/docs/KERN_VER.md @@ -1,4 +1,4 @@ -# /props/kern_ver +# The `/props/kern_ver` NVRAM variable The `/props/kern_ver` variable is used to track NeKernel's current version in a BCD format. diff --git a/dev/kernel/FSKit/HeFS.h b/dev/kernel/FSKit/HeFS.h index c4f31836..85421069 100644 --- a/dev/kernel/FSKit/HeFS.h +++ b/dev/kernel/FSKit/HeFS.h @@ -198,8 +198,7 @@ struct PACKED HEFS_INDEX_NODE_DIRECTORY final { UInt64 fHashPath; /// @brief Directory path as FNV hash.
UInt32 fFlags; /// @brief File flags.
- UInt16 fKind; /// @brief File kind. (Regular, Directory, Block, Character, FIFO, Socket,
- /// Symbolic Link, Unknown).
+ UInt16 fReserved; /// @note Reserved for future use.
UInt32 fEntryCount; /// @brief Entry Count of this directory inode.
UInt32 fChecksum; /// @brief Checksum of the file, index node checksum.
@@ -405,8 +404,8 @@ class HeFileSystemParser final { const Utf8Char* name, const UInt8 kind);
_Output Bool INodeManip(_Input DriveTrait* drive, VoidPtr block, SizeT block_sz,
- const Utf8Char* dir, const UInt8 kind, const Utf8Char* name,
- const BOOL in);
+ const Utf8Char* dir, const Utf8Char* name, const UInt8 kind,
+ const BOOL input);
private:
_Output Bool INodeCtlManip(_Input DriveTrait* drive, _Input const Int32 flags,
diff --git a/dev/kernel/HALKit/AMD64/Storage/AHCI+Generic.cc b/dev/kernel/HALKit/AMD64/Storage/AHCI+Generic.cc index 80053ea8..bb6caf87 100644 --- a/dev/kernel/HALKit/AMD64/Storage/AHCI+Generic.cc +++ b/dev/kernel/HALKit/AMD64/Storage/AHCI+Generic.cc @@ -264,8 +264,7 @@ STATIC Void drv_std_input_output_ahci(UInt64 lba, UInt8* buffer, SizeT sector_sz while (YES) { if (timeout > kTimeout) { kout << "Disk hangup!\r"; - - err_global_get() = kErrorDisk; + kSATAHba->Ports[kSATAIndex].Ci = 0; return; } diff --git a/dev/kernel/NewKit/Utils.h b/dev/kernel/NewKit/Utils.h index 0cf0484a..e3420d84 100644 --- a/dev/kernel/NewKit/Utils.h +++ b/dev/kernel/NewKit/Utils.h @@ -26,7 +26,7 @@ Int rt_to_uppercase(Int c); Int rt_to_lower(Int c); voidPtr rt_string_in_string(const Char* in, const Char* needle); char* rt_string_has_char(Char* str, Char chr); - -Int urt_copy_memory(const voidPtr src, voidPtr dst, Size len); -Size urt_string_len(const Utf8Char* str); +Void urt_set_memory(const voidPtr src, UInt32 dst, Size len); +Int urt_copy_memory(const voidPtr src, voidPtr dst, Size len); +Size urt_string_len(const Utf8Char* str); } // namespace Kernel diff --git a/dev/kernel/src/FS/HeFS+FileSystemParser.cc b/dev/kernel/src/FS/HeFS+FileSystemParser.cc index b2d39dbe..9be598ac 100644 --- a/dev/kernel/src/FS/HeFS+FileSystemParser.cc +++ b/dev/kernel/src/FS/HeFS+FileSystemParser.cc @@ -47,7 +47,7 @@ namespace Detail { DriveTrait* mnt, const Utf8Char* dir_name, const Utf8Char* file_name, - UInt8 kind, SizeT* cnt); + UInt8 kind); /***********************************************************************************/ /// @brief Allocate a new index node-> @@ -111,40 +111,41 @@ namespace Detail { const Lba& ind_start, Lba& start) { if (!mnt || !dir) return; - BOOL check_is_good = NO; + BOOL check_is_good = NO; + HEFS_INDEX_NODE_DIRECTORY* dir_tmp = new HEFS_INDEX_NODE_DIRECTORY(); while (YES) { mnt->fPacket.fPacketLba = start; mnt->fPacket.fPacketSize = sizeof(HEFS_INDEX_NODE_DIRECTORY); - mnt->fPacket.fPacketContent = dir; + mnt->fPacket.fPacketContent = dir_tmp; mnt->fInput(mnt->fPacket); if (!mnt->fPacket.fPacketGood) break; - if (dir->fNext != 0) { + if (dir_tmp->fNext != 0) { if (check_is_good) break; - start = dir->fNext; + start = dir_tmp->fNext; check_is_good = YES; continue; - } else if (dir->fPrev != 0) { + } else if (dir_tmp->fPrev != 0) { if (check_is_good) break; - start = dir->fPrev; + start = dir_tmp->fPrev; check_is_good = YES; continue; } else { - if (dir->fParent != 0) { + if (dir_tmp->fParent != 0) { if (check_is_good) break; - start = dir->fParent; + start = dir_tmp->fParent; check_is_good = YES; continue; - } else if (dir->fPrev != 0) { + } else if (dir_tmp->fPrev != 0) { if (check_is_good) break; - start = dir->fPrev; + start = dir_tmp->fPrev; check_is_good = YES; continue; } else { @@ -159,6 +160,8 @@ namespace Detail { } } + delete dir_tmp; + start += sizeof(HEFS_INDEX_NODE_DIRECTORY); if (start == 0) start = ind_start; } @@ -302,7 +305,7 @@ namespace Detail { dirent->fModified = 0UL; dirent->fEntryCount = 0UL; - dirent->fKind = kHeFSFileKindDirectory; + dirent->fReserved = 0; dirent->fFlags = flags; dirent->fChecksum = 0; @@ -455,20 +458,13 @@ namespace Detail { DriveTrait* mnt, const Utf8Char* dir_name, const Utf8Char* file_name, - UInt8 kind, SizeT* cnt) { - if (mnt && cnt) { + UInt8 kind) { + if (mnt) { if (root->fStartIND > root->fEndIND) return nullptr; if (root->fStartIN > root->fEndIN) return nullptr; - auto start = root->fStartIND; - - auto start_cnt = 0UL; - - HEFS_INDEX_NODE* node_arr = new HEFS_INDEX_NODE[*cnt]; - - if (!node_arr) { - return nullptr; - } + auto start = root->fStartIND; + HEFS_INDEX_NODE* node = new HEFS_INDEX_NODE(); HEFS_INDEX_NODE_DIRECTORY* dir = (HEFS_INDEX_NODE_DIRECTORY*) mm_new_heap(sizeof(HEFS_INDEX_NODE_DIRECTORY), Yes, No); @@ -480,57 +476,37 @@ namespace Detail { mnt->fInput(mnt->fPacket); - if (hefsi_hash_64(dir_name) == dir->fHashPath && dir->fKind == kHeFSFileKindDirectory) { - HEFS_INDEX_NODE* node = new HEFS_INDEX_NODE(); + (Void)(kout << hex_number(hefsi_hash_64(dir_name)) << kendl); + (Void)(kout << hex_number(dir->fHashPath) << kendl); + if (hefsi_hash_64(dir_name) == dir->fHashPath) { for (SizeT inode_index = 0UL; inode_index < kHeFSSliceCount; ++inode_index) { - if (dir->fINSlices[inode_index] != 0) { - mnt->fPacket.fPacketLba = dir->fINSlices[inode_index]; - mnt->fPacket.fPacketSize = sizeof(HEFS_INDEX_NODE); - mnt->fPacket.fPacketContent = node; - - mnt->fInput(mnt->fPacket); - - if (hefsi_hash_64(file_name) == node->fHashPath && node->fKind == kind && - ke_calculate_crc32((Char*) node, sizeof(HEFS_INDEX_NODE)) == node->fChecksum) { - node_arr[start_cnt] = *node; - ++start_cnt; + mnt->fPacket.fPacketLba = dir->fINSlices[inode_index]; + mnt->fPacket.fPacketSize = sizeof(HEFS_INDEX_NODE); + mnt->fPacket.fPacketContent = node; - if (start_cnt > *cnt) { - err_global_get() = kErrorSuccess; - - delete node; - node = nullptr; + mnt->fInput(mnt->fPacket); - delete dir; - dir = nullptr; + (Void)(kout << hex_number(hefsi_hash_64(file_name)) << kendl); + (Void)(kout << hex_number(node->fHashPath) << kendl); - return node_arr; - } - } + if (hefsi_hash_64(file_name) == node->fHashPath && node->fKind == kind) { + return node; } } - - delete node; - node = nullptr; } hefsi_traverse_tree(dir, mnt, root->fStartIND, start); - if (start > root->fEndIND || start == 0) break; } - err_global_get() = kErrorSuccess; - delete dir; + delete node; + node = nullptr; - if (start_cnt == 0) { - delete[] node_arr; - node_arr = nullptr; - } - - return node_arr; + delete dir; + dir = nullptr; } - kout << "Error: Failed to find index node->\r"; + kout << "Error: Failed to find IN.\r"; err_global_get() = kErrorFileNotFound; @@ -580,13 +556,8 @@ namespace Detail { auto lba = dir->fINSlices[inode_index]; - if (root->fStartBlock > (1ULL << 21)) { - node->fOffsetSliceLow = (UInt32) (root->fStartBlock & 0xFFFFFFFF); - node->fOffsetSliceHigh = (UInt32) (root->fStartBlock >> 32); - } else { - node->fOffsetSliceLow = (UInt32) root->fStartBlock; - node->fOffsetSliceHigh = 0UL; - } + node->fOffsetSliceLow = (UInt32) (root->fStartBlock); + node->fOffsetSliceHigh = (UInt32) (root->fStartBlock >> 32); node->fChecksum = ke_calculate_crc32((Char*) node, sizeof(HEFS_INDEX_NODE)); @@ -982,8 +953,8 @@ _Output Bool HeFileSystemParser::CreateINode(_Input DriveTrait* mnt, _Input cons } _Output Bool HeFileSystemParser::INodeManip(_Input DriveTrait* mnt, VoidPtr block, SizeT block_sz, - const Utf8Char* dir, const UInt8 kind, - const Utf8Char* name, const BOOL in) { + const Utf8Char* dir, const Utf8Char* name, + const UInt8 kind, const BOOL in) { if (urt_string_len(dir) > kHeFSFileNameLen) { err_global_get() = kErrorDisk; return NO; @@ -1011,43 +982,34 @@ _Output Bool HeFileSystemParser::INodeManip(_Input DriveTrait* mnt, VoidPtr bloc mnt->fInput(mnt->fPacket); if (!KStringBuilder::Equals(root->fMagic, kHeFSMagic) || root->fVersion != kHeFSVersion) { + (Void)(kout << "Invalid Boot Node, HeFS partition is invalid." << kendl); + mm_delete_heap((VoidPtr) root); err_global_get() = kErrorDisk; return NO; } - SizeT cnt = block_sz / sizeof(HEFS_INDEX_NODE) + 1; - auto nodes = Detail::hefsi_fetch_in(root, mnt, dir, name, kind, &cnt); - - if (!nodes) return NO; - - for (SizeT i = 0UL; i < cnt; ++i) { - auto& start = nodes[i]; - - kout << hex_number(start.fHashPath) << kendl; - kout << hex_number(start.fOffsetSliceLow) << kendl; + auto start = Detail::hefsi_fetch_in(root, mnt, dir, name, kind); - if (!start.fHashPath || !start.fOffsetSliceLow) continue; + if (start) { + (Void)(kout << hex_number(start->fHashPath) << kendl); + (Void)(kout << hex_number(start->fOffsetSliceLow) << kendl); - mnt->fPacket.fPacketLba = start.fOffsetSliceLow + start.fOffsetSliceHigh; - mnt->fPacket.fPacketSize = kHeFSBlockLen; - mnt->fPacket.fPacketContent = block; + if (start->fOffsetSliceLow) { + mnt->fPacket.fPacketLba = start->fOffsetSliceLow | start->fOffsetSliceHigh << 32; + mnt->fPacket.fPacketSize = block_sz; + mnt->fPacket.fPacketContent = block; - if (in) { - mnt->fInput(mnt->fPacket); - } else { - mnt->fOutput(mnt->fPacket); + if (in) { + mnt->fInput(mnt->fPacket); + } else { + mnt->fOutput(mnt->fPacket); + } } - - mm_delete_heap((VoidPtr) root); - delete[] nodes; - return mnt->fPacket.fPacketGood == YES; } - delete[] nodes; - nodes = nullptr; - mm_delete_heap((VoidPtr) root); - return NO; + delete start; + return YES; } /// @brief Create a new file on the disk. @@ -1165,16 +1127,17 @@ Boolean fs_init_hefs(Void) { parser.Format(&kMountPoint, kHeFSEncodingFlagsUTF8, kHeFSDefaultVolumeName); - MUST_PASS(parser.CreateINode(&kMountPoint, kHeFSEncodingFlagsBinary | kHeFSFlagsReadOnly, - u8"/boot", u8"ジェット警察.txt", kHeFSFileKindRegular)); + MUST_PASS(parser.CreateINode(&kMountPoint, kHeFSEncodingFlagsBinary | kHeFSFlagsReadOnly, u8"/boot", + u8"bootinfo.cfg", kHeFSFileKindRegular)); + + Utf8Char contents_1[kHeFSBlockLen] = {0}; - Utf8Char contents_1[kHeFSBlockLen] = {u8"ロケットにはジエットエンジン\r\0"}; + urt_set_memory(contents_1, 0, kHeFSBlockLen); - MUST_PASS(parser.INodeManip(&kMountPoint, contents_1, kHeFSBlockLen, u8"/boot", - kHeFSFileKindRegular, u8"ジェット警察.txt", NO)); + MUST_PASS(parser.INodeManip(&kMountPoint, contents_1, kHeFSBlockLen, u8"/boot", u8"bootinfo.cfg", + kHeFSFileKindRegular, YES)); - MUST_PASS(parser.INodeManip(&kMountPoint, contents_1, kHeFSBlockLen, u8"/boot", - kHeFSFileKindRegular, u8"ジェット警察.txt", YES)); + kout8 << text << kendl8; return YES; } diff --git a/dev/kernel/src/MemoryMgr.cc b/dev/kernel/src/MemoryMgr.cc index 001f970a..9b7bea43 100644 --- a/dev/kernel/src/MemoryMgr.cc +++ b/dev/kernel/src/MemoryMgr.cc @@ -219,7 +219,7 @@ _Output Int32 mm_delete_heap(VoidPtr heap_ptr) { heap_info_ptr->fMagic = 0; heap_info_ptr->fPad = 0; - (Void)(kout << "Address has been successfully freed: " << hex_number((UIntPtr) heap_info_ptr) + (Void)(kout << "Freed heap address: " << hex_number(reinterpret_cast<UIntPtr>(heap_info_ptr)) << kendl); PTEWrapper page_wrapper( diff --git a/dev/kernel/src/UtfUtils.cc b/dev/kernel/src/UtfUtils.cc index 079efb7b..ed0e4591 100644 --- a/dev/kernel/src/UtfUtils.cc +++ b/dev/kernel/src/UtfUtils.cc @@ -15,6 +15,16 @@ Size urt_string_len(const Utf8Char* str) { return len; } +Void urt_set_memory(const voidPtr src, UInt32 dst, Size len) { + Utf8Char* srcChr = reinterpret_cast<Utf8Char*>(src); + Size index = 0; + + while (index < len) { + srcChr[index] = dst; + ++index; + } +} + Int urt_copy_memory(const voidPtr src, voidPtr dst, Size len) { Utf8Char* srcChr = reinterpret_cast<Utf8Char*>(src); Utf8Char* dstChar = reinterpret_cast<Utf8Char*>(dst); |
