浏览代码

Code segment may not be writable; create the temporary pointer to the GDT

on the stack.
tags/v0.9.3
Michael Brown 18 年前
父节点
当前提交
e7eca7b7cb
共有 1 个文件被更改,包括 7 次插入2 次删除
  1. 7
    2
      src/arch/i386/prefix/libprefix.S

+ 7
- 2
src/arch/i386/prefix/libprefix.S 查看文件

254
 	/* Preserve real-mode segment values and temporary registers */
254
 	/* Preserve real-mode segment values and temporary registers */
255
 	pushw	%es
255
 	pushw	%es
256
 	pushw	%ds
256
 	pushw	%ds
257
+	pushw	%bp
257
 	pushl	%eax
258
 	pushl	%eax
258
 
259
 
259
 	/* Set GDT base and load GDT */
260
 	/* Set GDT base and load GDT */
261
 	movw	%cs, %ax
262
 	movw	%cs, %ax
262
 	shll	$4, %eax
263
 	shll	$4, %eax
263
 	addl	$gdt, %eax
264
 	addl	$gdt, %eax
264
-	movl	%eax, %cs:gdt_base
265
-	lgdt	%cs:gdt
265
+	pushl	%eax
266
+	pushw	%cs:gdt_limit
267
+	movw	%sp, %bp
268
+	lgdt	(%bp)
269
+	addw	$6, %sp
266
 
270
 
267
 	/* Switch to protected mode */
271
 	/* Switch to protected mode */
268
 	movl	%cr0, %eax
272
 	movl	%cr0, %eax
281
 
285
 
282
 	/* Restore real-mode segment values and temporary registers */
286
 	/* Restore real-mode segment values and temporary registers */
283
 	popl	%eax
287
 	popl	%eax
288
+	popw	%bp
284
 	popw	%ds
289
 	popw	%ds
285
 	popw	%es
290
 	popw	%es
286
 	ret
291
 	ret

正在加载...
取消
保存