Problems encountered during simple task switching in linux0.11

Source: Internet
Author: User
The problem encountered during simple task switching in linux0.11-general Linux technology-Linux technology and application information. The following is a detailed description.
CODE :! Boot. s
!
! It then loads the system at 0x10000, using BIOS interrupts. Thereafter
! It disables all interrupts, changes to protected mode, and callthe

BOOTSEG = 0x07c0
SYSSEG = 0x1000! System loaded at 0x10000 (65536 ).
SYSLEN = 17! Sectors occupied.

Entry start
Start:
Jmpigo, # BOOTSEG
Go: movax, cs
Movds, ax
Movss, ax
Movsp, #0x400! Arbitrary value> & gt; 512

! OK, we 've written the message, now
Load_system:
Movdx, #0x0000
Movcx, #0x0002
Movax, # SYSSEG
Moves, ax
Xorbx, bx
Movax, #0x200 + SYSLEN
Int 0x13
Jncok_load
Die: jmpdie

! Now we want to move to protected mode...
OK _load:
Cli! No interrupts allowed!
Movax, # SYSSEG
Movds, ax
Xorax, ax
Moves, ax
Movcx, #0x2000
Subsi, si
Subdi, di
Rep
Movw
Movax, # BOOTSEG
Movds, ax
Required tidt_48! Load idt with 0, 0
Lgdtgdt_48! Load gdt with whatever appropriate

! Absolute address 0x00000, in 32-bit protected mode.
Movax, #0x0001! Protected mode (PE) bit
Lmswax! This is it!
Jmpi0, 8! Jmp offset 0 of segment 8 (cs)

Gdt:. word0, 0, 0! Dummy

. Word0x07FF! 8 Mb-limit = 2047 (2048*4096 = 8 Mb)
. Word0x0000! Base address = 0x00000
. Word0x9A00! Code read/exec
. Word0x00C0! Granularity = 4096,386

. Word0x07FF! 8 Mb-limit = 2047 (2048*4096 = 8 Mb)
. Word0x0000! Base address = 0x00000
. Word0x9200! Data read/write
. Word0x00C0! Granularity = 4096,386

Idt_48:. word0! Idt limit = 0
. Word0, 0! Idt base = 0L
Gdt_48:. word0x7ff! Gdt limit = 2048,256 GDT entries
. Word0x7c00 + gdt, 0! Gdt base = 07xxx
. Org 510
. Word 0xAA55
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.