还是我,我的idt.S文件(使用gcc编译的Intel语法)出现了新问题。当我尝试编译以下代码时:
load_idt:
mov edx, (esp + 4) ; On this line
lidt (edx)
sti
ret
Run Code Online (Sandbox Code Playgroud)
我收到一个我真的不知道如何解决的错误:
Error: too many memory references for `mov'
Run Code Online (Sandbox Code Playgroud) 当我用GCC编译我的代码然后运行它时,当我在代码中调用函数时,它会打印出:“分段错误(内核已转储)”。
我尝试在Google上搜索解决方案。
这是我当前的代码:
char ** saveLevelPositions() {
int x, y;
char ** positions;
positions = malloc(sizeof(char *) * 25);
for (y = 0; y < 25; y++) {
positions[y] = malloc(sizeof(char) * 100);
for (x = 0; x < 100; x++) {
positions[x][y] = mvinch(y, x);
}
}
return positions;
}
Run Code Online (Sandbox Code Playgroud)
我希望该功能能够正常运行,并且只会给出细分错误。
编辑:有关上下文的一些信息,这是GitHub项目的链接:https : //github.com/xslendix/rogue