gpt4 book ai didi

linux - 为什么这个 int $0x10 BIOS INT 在 Linux 上不工作?

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:20:33 24 4
gpt4 key购买 nike

我不确定我是否做错了什么。我正在使用英特尔芯片的 Linux 机器上学习 AT&T 语法中的汇编语言。我了解到 INT 10H 用于为各种视频目的调用 BIOS 子程序。

我写了这个简单的汇编代码来清除屏幕。

.section .data

data_items:

.section .text

.global _start
_start:

mov $6, %ah # to select the scroll function
mov $0, %al # the entire page
mov $7, %bh # for normal attribute
mov $0, %ch # row value of the start point
mov $0, %cl # column value of the starting point
mov $24, %dh # row value of ending point
mov $79, %dl # column value of the ending point
int $0x10 # invoke the BIOS INT 10H interrupt

movl $1, %eax # exiting the program
int $0x80

我在 gnome 终端中组装了它(使用英特尔芯片上的 fedora 19)。组装和链接没有问题。但它无法运行并出现段错误。为什么失败以及如何更正代码?

最佳答案

啊哈,得到答案了。我完全做错了。 INT 10H 是 DOS/windows 的东西,根本不是 LINUX。

http://docs.cs.up.ac.za/programming/asm/derick_tut/#maindiff

  1. Introduction to Linux Assembly 4.1 Main Differences Between DOS and Linux Assembly

    In DOS assembly, most things get done with the DOS services interrupt int 21h, and the BIOS service interrupts like int 10h and int 16h. In Linux, all these functions are handled by the kernel. Everything gets done with "kernel system calls", and you call the kernel with int 80h.

关于linux - 为什么这个 int $0x10 BIOS INT 在 Linux 上不工作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19440487/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com