Skip to content

Commit 071768e

Browse files
committed
refactor: rename std::ostream with sk_std::
Signed-off-by: Zone.N <zone.niuzh@hotmail.com>
1 parent 58bb3db commit 071768e

File tree

11 files changed

+15
-15
lines changed

11 files changed

+15
-15
lines changed

src/kernel/arch/aarch64/include/cpu.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ class ReadWriteRegBase : public ReadOnlyRegBase<RegInfo>,
148148
// 第三部分:寄存器实例
149149
class X29 : public ReadWriteRegBase<reginfo::X29Info> {
150150
public:
151-
friend std::ostream &operator<<(std::ostream &os, const X29 &x29) {
151+
friend sk_std::ostream &operator<<(sk_std::ostream &os, const X29 &x29) {
152152
printf("val: 0x%p", (void *)x29.Read());
153153
return os;
154154
}

src/kernel/arch/riscv64/arch_main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ uint32_t ArchInit(uint32_t argc, uint8_t *argv) {
5858
kKernelFdt.GetInstance() = KernelFdt((uint64_t)argv);
5959

6060
kBasicInfo.GetInstance() = BasicInfo(argc, argv);
61-
std::cout << kBasicInfo.GetInstance();
61+
sk_std::cout << kBasicInfo.GetInstance();
6262

6363
auto [serial_base, serial_size] = kKernelFdt.GetInstance().GetSerial();
6464
auto uart = Ns16550a(serial_base);

src/kernel/arch/riscv64/include/cpu.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ class ReadWriteRegBase : public ReadOnlyRegBase<RegInfo>,
148148
// 第三部分:寄存器实例
149149
class Fp : public ReadWriteRegBase<reginfo::FpInfo> {
150150
public:
151-
friend std::ostream &operator<<(std::ostream &os, const Fp &fp) {
151+
friend sk_std::ostream &operator<<(sk_std::ostream &os, const Fp &fp) {
152152
printf("val: 0x%p", (void *)fp.Read());
153153
return os;
154154
}

src/kernel/arch/x86_64/arch_main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ uint32_t ArchInit(uint32_t argc, uint8_t *argv) {
5959
}
6060

6161
kBasicInfo.GetInstance() = BasicInfo(argc, argv);
62-
std::cout << kBasicInfo.GetInstance();
62+
sk_std::cout << kBasicInfo.GetInstance();
6363

6464
// 解析内核 elf 信息
6565
kKernelElf.GetInstance() = KernelElf(kBasicInfo.GetInstance().elf_addr,

src/kernel/arch/x86_64/include/cpu.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ class ReadWriteRegBase : public ReadOnlyRegBase<RegInfo>,
298298
// 第三部分:寄存器实例
299299
class Rbp : public ReadWriteRegBase<reginfo::RbpInfo> {
300300
public:
301-
friend std::ostream &operator<<(std::ostream &os, const Rbp &rbp) {
301+
friend sk_std::ostream &operator<<(sk_std::ostream &os, const Rbp &rbp) {
302302
printf("val: 0x%p", (void *)rbp.Read());
303303
return os;
304304
}

src/kernel/include/basic_info.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ struct BasicInfo {
6060
~BasicInfo() = default;
6161
/// @}
6262

63-
friend std::ostream &operator<<(std::ostream &os,
64-
const BasicInfo &basic_info) {
63+
friend sk_std::ostream &operator<<(sk_std::ostream &os,
64+
const BasicInfo &basic_info) {
6565
printf("physical_memory_addr: 0x%X, size 0x%X.\n",
6666
basic_info.physical_memory_addr, basic_info.physical_memory_size);
6767
printf("kernel_addr: 0x%X, size 0x%X.\n", basic_info.kernel_addr,

src/kernel/include/kernel_log.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ static constexpr const auto kCyan = "\033[36m";
3636
static constexpr const auto kWhite = "\033[37m";
3737

3838
template <void (*OutputFunction)(const char* format, ...)>
39-
class Logger : public std::ostream {
39+
class Logger : public sk_std::ostream {
4040
public:
4141
Logger& operator<<(int8_t val) override {
4242
OutputFunction("%d", val);

src/kernel/libcxx/include/cstring

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
#include "string.h"
2121

22-
namespace std {
22+
namespace sk_std {
2323

2424
using ::memcmp;
2525
using ::memcpy;
@@ -34,6 +34,6 @@ using ::strncmp;
3434
using ::strncpy;
3535
using ::strnlen;
3636

37-
}; // namespace std
37+
}; // namespace sk_std
3838

3939
#endif /* SIMPLEKERNEL_SRC_KERNEL_LIBCXX_INCLUDE_CSTRING_ */

src/kernel/libcxx/include/iostream

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
#include <cstdint>
2222

23-
namespace std {
23+
namespace sk_std {
2424
class ostream {
2525
public:
2626
enum openmode : uint8_t {
@@ -57,6 +57,6 @@ inline ostream& endl(ostream& os) { return os << "\n"; }
5757

5858
[[maybe_unused]] static ostream cout;
5959

60-
}; // namespace std
60+
}; // namespace sk_std
6161

6262
#endif /* SIMPLEKERNEL_SRC_KERNEL_LIBCXX_INCLUDE_IOSTREAM_ */

src/kernel/libcxx/iostream.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
#include "cstdio"
2323

24-
namespace std {
24+
namespace sk_std {
2525

2626
ostream& ostream::operator<<(int8_t val) {
2727
printf("%d", val);
@@ -72,4 +72,4 @@ ostream& ostream::operator<<(ostream& (*manip)(ostream&)) {
7272
return manip(*this);
7373
}
7474

75-
}; // namespace std
75+
}; // namespace sk_std

src/kernel/main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ uint32_t main(uint32_t argc, uint8_t *argv) {
4949

5050
DumpStack();
5151

52-
std::cout << "Hello ostream" << std::endl;
52+
sk_std::cout << "Hello ostream" << sk_std::endl;
5353

5454
return 0;
5555
}

0 commit comments

Comments
 (0)