我目前正在学习本教程,但我不是该学校的学生。
GDB 给了我一个分段错误thread_start:
movq %rsp, (%rdi) # save sp in old thread's tcb
Run Code Online (Sandbox Code Playgroud)
当我回溯时,这是附加信息:
#0 thread_start () at thread_start.s:16
#1 0x0000000180219e83 in _cygtls::remove(unsigned int)::__PRETTY_FUNCTION__
() from /usr/bin/cygwin1.dll
#2 0x00000000ffffcc6b in ?? ()
Backtrace stopped: previous frame inner to this frame (corrupt stack?)
Run Code Online (Sandbox Code Playgroud)
作为一个新手,我一生都无法弄清楚为什么。这是我的主文件:
#define STACK_SIZE 1024*1024
//Thread TCB
struct thread {
unsigned char * stack_pointer;
void(*initial_function)(void *);
void * initial_argument;
};
struct thread * current_thread;
struct thread * inactive_thread;
void thread_switch(struct thread * old_t, struct thread …Run Code Online (Sandbox Code Playgroud)