✨ Welcome to my page! 🥳
I'm GTY,
Currently a senior student in Tongji University, Majored in Computer Science.
小红书:枫云树
CSDN:枫铃树
一个简陋的 x86-64 操作系统。
License: Mulan Permissive Software License, Version 2
✨ Welcome to my page! 🥳
I'm GTY,
Currently a senior student in Tongji University, Majored in Computer Science.
小红书:枫云树
CSDN:枫铃树
涉及部分:X86Assembly -> struct HardwareContextRegisters
rbp来自软件压入。在栈上,errcode为软件压入的假code时,会在rbp上方。为硬件压入时,会在rbp下方。代码内硬件现场保存部分没有正确处理此问题。
例如,机器字长为8字节,需要拷贝的长度为26字节,则在拷贝完24字节后,memcpy_aligned 会直接结束,导致最后2字节未被拷贝。
src/lib/string.cpp
static inline void* memcpy_aligned(void* dest, const void* src, size_t count) {
char* pDest = (char*) dest;
char* pSrc = (char*) src;
while (pSrc < ((char*) src) + count && (intptr_t(pSrc) & (sizeof(long) - 1))) {
*pDest++ = *pSrc++;
}
while (pSrc + sizeof(long) - 1 < ((char*) src) + count) {
*(long*) pDest = *(long*) pSrc;
pSrc += sizeof(long);
pDest += sizeof(long);
}
return dest;
^~~~ 可能导致少拷贝数据。
}
void* memcpy(void* dest, const void* src, size_t count) {
// 如果 src 和 dest 可以互相对齐,则使用快速拷贝。
if (!((intptr_t(dest) ^ intptr_t(src)) & (sizeof(long) - 1))) {
return memcpy_aligned(dest, src, count);
}
// 单字节拷贝。
char* pDest = (char*) dest;
char* pSrc = (char*) src;
while (pSrc < ((char*) src) + count) {
*pDest++ = *pSrc++;
}
return dest;
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.