58 lines
1.5 KiB
ArmAsm
58 lines
1.5 KiB
ArmAsm
|
|
// vim: ft=gas:et:sw=12:ts=12:sts=12
|
||
|
|
|
||
|
|
.set SS_CODE16, 0x08
|
||
|
|
.set SS_DATA16, 0x10
|
||
|
|
.set SS_CODE32, 0x18
|
||
|
|
.set SS_DATA32, 0x20
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
.macro PROT16
|
||
|
|
.code32
|
||
|
|
mov $SS_DATA16, %ax
|
||
|
|
mov %ax, %ds
|
||
|
|
mov %ax, %es
|
||
|
|
mov %ax, %ss
|
||
|
|
ljmp $SS_CODE16, $9f
|
||
|
|
9: .code16
|
||
|
|
.endm
|
||
|
|
|
||
|
|
.macro PROT32
|
||
|
|
.code16
|
||
|
|
mov $SS_DATA32, %ax
|
||
|
|
mov %ax, %ds
|
||
|
|
mov %ax, %es
|
||
|
|
mov %ax, %ss
|
||
|
|
ljmp $SS_CODE32, $9f
|
||
|
|
9: .code32
|
||
|
|
.endm
|
||
|
|
|
||
|
|
.macro REAL
|
||
|
|
mov %cr0, %eax
|
||
|
|
and $0xFFFE, %ax
|
||
|
|
mov %eax, %cr0
|
||
|
|
xor %ax, %ax
|
||
|
|
mov %ax, %ds
|
||
|
|
mov %ax, %es
|
||
|
|
mov real_ss, %ax
|
||
|
|
mov %ax, %ss
|
||
|
|
shl $4, %eax
|
||
|
|
sub %eax, %esp
|
||
|
|
ljmp $0x0000, $9f
|
||
|
|
9:
|
||
|
|
.endm
|
||
|
|
|
||
|
|
.macro PROT
|
||
|
|
mov %cr0, %eax
|
||
|
|
or $1, %eax
|
||
|
|
mov %eax, %cr0
|
||
|
|
xor %eax, %eax
|
||
|
|
mov $SS_DATA16, %ax
|
||
|
|
mov %ax, %ds
|
||
|
|
mov %ax, %es
|
||
|
|
mov %ax, %ss
|
||
|
|
mov real_ss, %ax
|
||
|
|
shl $4, %eax
|
||
|
|
add %eax, %esp
|
||
|
|
.endm
|