mirror of
https://github.com/reactos/reactos.git
synced 2024-06-28 08:51:29 +00:00
[ASM]
Merge asm related changes from cmake branch. svn path=/trunk/; revision=49826
This commit is contained in:
parent
9ce5939959
commit
1d70b8136a
|
@ -1,10 +1,13 @@
|
|||
.intel_syntax noprefix
|
||||
.text
|
||||
.code16
|
||||
|
||||
#define ASM
|
||||
|
||||
#include <asm.inc>
|
||||
|
||||
#include <arch.h>
|
||||
|
||||
.text
|
||||
.code16
|
||||
|
||||
//.org 0x8000
|
||||
|
||||
.global RealEntryPoint
|
||||
|
|
|
@ -17,14 +17,17 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include <asm.inc>
|
||||
|
||||
|
||||
.text
|
||||
.code16
|
||||
|
||||
#define ASM
|
||||
#include <arch.h>
|
||||
|
||||
|
||||
EXTERN(ChainLoadBiosBootSectorCode)
|
||||
PUBLIC ChainLoadBiosBootSectorCode
|
||||
ChainLoadBiosBootSectorCode:
|
||||
.code64
|
||||
|
||||
call x86_64_SwitchToReal
|
||||
|
@ -46,7 +49,8 @@ EXTERN(ChainLoadBiosBootSectorCode)
|
|||
// ljmpl $0x0000,$0x7C00
|
||||
jmp 0x7c00:0x0000
|
||||
|
||||
EXTERN(SoftReboot)
|
||||
PUBLIC SoftReboot
|
||||
SoftReboot:
|
||||
.code64
|
||||
|
||||
call x86_64_SwitchToReal
|
||||
|
|
|
@ -17,6 +17,9 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include <asm.inc>
|
||||
|
||||
|
||||
.text
|
||||
.code16
|
||||
|
||||
|
@ -255,4 +258,5 @@ EXTERN(PnpBiosGetDeviceNode)
|
|||
|
||||
ret
|
||||
|
||||
END
|
||||
/* EOF */
|
||||
|
|
|
@ -17,6 +17,9 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include <asm.inc>
|
||||
|
||||
|
||||
.intel_syntax noprefix
|
||||
.text
|
||||
.code16
|
||||
|
@ -168,3 +171,5 @@ Int386_vector_opcode:
|
|||
mov eax, Int386_eax
|
||||
|
||||
ret
|
||||
|
||||
END
|
||||
|
|
|
@ -17,6 +17,9 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include <asm.inc>
|
||||
|
||||
|
||||
.text
|
||||
.code16
|
||||
|
||||
|
@ -61,3 +64,5 @@ pd_startup:
|
|||
.fill 4096, 1, 0
|
||||
|
||||
PageDirectoryEnd:
|
||||
|
||||
END
|
||||
|
|
|
@ -17,27 +17,29 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
.text
|
||||
.code16
|
||||
.intel_syntax noprefix
|
||||
#define HEX(y) 0x##y
|
||||
|
||||
#define ASM
|
||||
#include <arch.h>
|
||||
#include <multiboot.h>
|
||||
|
||||
.code16
|
||||
|
||||
EXTERN(RealEntryPoint)
|
||||
|
||||
cli
|
||||
|
||||
/* Setup segment registers */
|
||||
xorw %ax,%ax
|
||||
movw %ax,%ds
|
||||
movw %ax,%es
|
||||
movw %ax,%fs
|
||||
movw %ax,%gs
|
||||
movw %ax,%ss
|
||||
xor ax, ax
|
||||
mov ds, ax
|
||||
mov es, ax
|
||||
mov fs, ax
|
||||
mov gs, ax
|
||||
mov ss, ax
|
||||
|
||||
/* Setup a stack */
|
||||
movw stack16,%sp
|
||||
mov sp, word ptr ds:stack16
|
||||
|
||||
sti
|
||||
|
||||
|
@ -47,24 +49,24 @@ EXTERN(RealEntryPoint)
|
|||
.code32
|
||||
|
||||
/* Zero BootDrive and BootPartition */
|
||||
xorl %eax,%eax
|
||||
movl %eax,(_BootDrive)
|
||||
movl %eax,(_BootPartition)
|
||||
xor eax, eax
|
||||
mov dword ptr [_BootDrive], eax
|
||||
mov dword ptr [_BootPartition], eax
|
||||
|
||||
/* Store the boot drive */
|
||||
movb %dl,(_BootDrive)
|
||||
mov byte ptr [_BootDrive], dl
|
||||
|
||||
/* Store the boot partition */
|
||||
movb %dh,(_BootPartition)
|
||||
mov byte ptr [_BootPartition], dh
|
||||
|
||||
/* GO! */
|
||||
pushl %eax
|
||||
push eax
|
||||
call _BootMain
|
||||
|
||||
call switch_to_real
|
||||
.code16
|
||||
|
||||
int $0x19
|
||||
int HEX(19)
|
||||
|
||||
/* We should never get here */
|
||||
stop:
|
||||
|
@ -78,7 +80,7 @@ stop:
|
|||
*/
|
||||
EXTERN(switch_to_prot)
|
||||
|
||||
.code16
|
||||
.code16
|
||||
|
||||
cli /* None of these */
|
||||
|
||||
|
@ -88,18 +90,18 @@ EXTERN(switch_to_prot)
|
|||
/* Of course CS has to already be valid. */
|
||||
/* We are currently in real-mode so we */
|
||||
/* need real-mode segment values. */
|
||||
xorw %ax,%ax
|
||||
movw %ax,%ds
|
||||
movw %ax,%es
|
||||
movw %ax,%fs
|
||||
movw %ax,%gs
|
||||
movw %ax,%ss
|
||||
xor ax, ax
|
||||
mov ds, ax
|
||||
mov es, ax
|
||||
mov fs, ax
|
||||
mov gs, ax
|
||||
mov ss, ax
|
||||
|
||||
/* Get the return address off the stack */
|
||||
popw (code32ret)
|
||||
pop word ptr ds:[code32ret]
|
||||
|
||||
/* Save 16-bit stack pointer */
|
||||
movw %sp,stack16
|
||||
mov word ptr ds:[stack16], sp
|
||||
|
||||
/* Load the GDT */
|
||||
lgdt gdtptr
|
||||
|
@ -107,28 +109,28 @@ EXTERN(switch_to_prot)
|
|||
lidt i386idtptr
|
||||
|
||||
/* Enable Protected Mode */
|
||||
mov %cr0,%eax
|
||||
orl $CR0_PE_SET,%eax
|
||||
mov %eax,%cr0
|
||||
mov eax, cr0
|
||||
or eax, CR0_PE_SET
|
||||
mov cr0, eax
|
||||
|
||||
/* Clear prefetch queue & correct CS */
|
||||
ljmp $PMODE_CS, $inpmode
|
||||
//ljmp PMODE_CS, inpmode
|
||||
jmp far ptr PMODE_CS:inpmode
|
||||
|
||||
|
||||
.code32
|
||||
.code32
|
||||
|
||||
inpmode:
|
||||
/* Setup segment selectors */
|
||||
movw $PMODE_DS,%ax
|
||||
movw %ax,%ds
|
||||
movw %ax,%es
|
||||
movw %ax,%fs
|
||||
movw %ax,%gs
|
||||
movw %ax,%ss
|
||||
movl stack32,%esp
|
||||
mov ax, PMODE_DS
|
||||
mov ds, ax
|
||||
mov es, ax
|
||||
mov fs, ax
|
||||
mov gs, ax
|
||||
mov ss, ax
|
||||
mov esp, dword ptr [stack32]
|
||||
|
||||
/* Put the return address back onto the stack */
|
||||
pushl (code32ret)
|
||||
push dword ptr [code32ret]
|
||||
|
||||
/* Now return in p-mode! */
|
||||
ret
|
||||
|
@ -139,7 +141,7 @@ inpmode:
|
|||
*/
|
||||
EXTERN(switch_to_real)
|
||||
|
||||
.code32
|
||||
.code32
|
||||
|
||||
/* We don't know what values are currently */
|
||||
/* in the segment registers. So we are */
|
||||
|
@ -147,48 +149,49 @@ EXTERN(switch_to_real)
|
|||
/* Of course CS has to already be valid. */
|
||||
/* We are currently in protected-mode so we */
|
||||
/* need protected-mode segment values. */
|
||||
movw $PMODE_DS,%ax
|
||||
movw %ax,%ds
|
||||
movw %ax,%es
|
||||
movw %ax,%fs
|
||||
movw %ax,%gs
|
||||
movw %ax,%ss
|
||||
mov ax, PMODE_DS
|
||||
mov ds, ax
|
||||
mov es, ax
|
||||
mov fs, ax
|
||||
mov gs, ax
|
||||
mov ss, ax
|
||||
|
||||
/* Get the return address off the stack */
|
||||
popl (code16ret)
|
||||
pop dword ptr [code16ret]
|
||||
|
||||
/* Save 32-bit stack pointer */
|
||||
movl %esp,stack32
|
||||
mov dword ptr [stack32], esp
|
||||
|
||||
/* jmp to 16-bit segment to set the limit correctly */
|
||||
ljmp $RMODE_CS, $switch_to_real16
|
||||
ljmp RMODE_CS, switch_to_real16
|
||||
|
||||
switch_to_real16:
|
||||
.code16
|
||||
.code16
|
||||
|
||||
/* Restore segment registers to correct limit */
|
||||
movw $RMODE_DS,%ax
|
||||
movw %ax,%ds
|
||||
movw %ax,%es
|
||||
movw %ax,%fs
|
||||
movw %ax,%gs
|
||||
movw %ax,%ss
|
||||
mov ax, RMODE_DS
|
||||
mov ds, ax
|
||||
mov es, ax
|
||||
mov fs, ax
|
||||
mov gs, ax
|
||||
mov ss, ax
|
||||
|
||||
/* Disable Protected Mode */
|
||||
mov %cr0,%eax
|
||||
andl $CR0_PE_CLR,%eax
|
||||
mov %eax,%cr0
|
||||
mov eax, cr0
|
||||
and eax, CR0_PE_CLR
|
||||
mov cr0, eax
|
||||
|
||||
/* Clear prefetch queue & correct CS */
|
||||
ljmp $0, $inrmode
|
||||
//ljmp $0, $inrmode
|
||||
jmp far ptr 0:inrmode
|
||||
|
||||
inrmode:
|
||||
movw %cs,%ax
|
||||
movw %ax,%ds
|
||||
movw %ax,%es
|
||||
movw %ax,%fs
|
||||
movw %ax,%gs
|
||||
movw %ax,%ss
|
||||
mov ax, cs
|
||||
mov ds, ax
|
||||
mov es, ax
|
||||
mov fs, ax
|
||||
mov gs, ax
|
||||
mov ss, ax
|
||||
|
||||
/* Clear out the high 16-bits of ESP */
|
||||
/* This is needed because I have one */
|
||||
|
@ -196,12 +199,12 @@ inrmode:
|
|||
/* anything other than 0x0000 is in the high */
|
||||
/* 16-bits of ESP. Even though real-mode */
|
||||
/* code should only use SP and not ESP. */
|
||||
xorl %esp,%esp
|
||||
xor esp, esp
|
||||
|
||||
movw stack16,%sp
|
||||
mov sp, word ptr ds:[stack16]
|
||||
|
||||
/* Put the return address back onto the stack */
|
||||
pushw (code16ret)
|
||||
push word ptr ds:[code16ret]
|
||||
|
||||
/* Load IDTR with real mode value */
|
||||
lidt rmode_idtptr
|
||||
|
@ -215,14 +218,14 @@ inrmode:
|
|||
/*
|
||||
* Needed for enabling the a20 address line
|
||||
*/
|
||||
.code16
|
||||
.code16
|
||||
empty_8042:
|
||||
.word 0x00eb,0x00eb // jmp $+2, jmp $+2
|
||||
inb $0x64,%al
|
||||
cmp $0xff, %al // legacy-free machine without keyboard
|
||||
jz empty_8042_ret // controllers on Intel Macs read back 0xFF
|
||||
testb $0x02,%al
|
||||
jnz empty_8042
|
||||
in al, HEX(64)
|
||||
cmp al, HEX(ff) // legacy-free machine without keyboard
|
||||
jz empty_8042_ret // controllers on Intel Macs read back 0xFF
|
||||
test al, 2
|
||||
jnz empty_8042
|
||||
empty_8042_ret:
|
||||
ret
|
||||
|
||||
|
@ -230,24 +233,24 @@ empty_8042_ret:
|
|||
* Enable the A20 address line (to allow access to over 1mb)
|
||||
*/
|
||||
EXTERN(_EnableA20)
|
||||
.code32
|
||||
|
||||
pusha
|
||||
|
||||
call switch_to_real
|
||||
.code16
|
||||
|
||||
call empty_8042
|
||||
mov al, HEX(D1) // command write
|
||||
out HEX(64), al
|
||||
call empty_8042
|
||||
mov al, HEX(DF) // A20 on
|
||||
out HEX(60), al
|
||||
call empty_8042
|
||||
call switch_to_prot
|
||||
.code32
|
||||
|
||||
pushal
|
||||
|
||||
call switch_to_real
|
||||
.code16
|
||||
|
||||
call empty_8042
|
||||
movb $0xD1,%al // command write
|
||||
outb %al,$0x64
|
||||
call empty_8042
|
||||
mov $0xDF,%al // A20 on
|
||||
out %al,$0x60
|
||||
call empty_8042
|
||||
call switch_to_prot
|
||||
.code32
|
||||
|
||||
popal
|
||||
popa
|
||||
|
||||
ret
|
||||
|
||||
|
@ -255,24 +258,24 @@ EXTERN(_EnableA20)
|
|||
* Disable the A20 address line
|
||||
*/
|
||||
EXTERN(_DisableA20)
|
||||
.code32
|
||||
.code32
|
||||
|
||||
pushal
|
||||
pusha
|
||||
|
||||
call switch_to_real
|
||||
call switch_to_real
|
||||
.code16
|
||||
|
||||
call empty_8042
|
||||
movb $0xD1,%al // command write
|
||||
outb %al,$0x64
|
||||
call empty_8042
|
||||
mov $0xDD,%al // A20 off
|
||||
out %al,$0x60
|
||||
mov al, HEX(D1) // command write
|
||||
out HEX(64), al
|
||||
call empty_8042
|
||||
mov al, HEX(DD) // A20 off
|
||||
out HEX(60), al
|
||||
call empty_8042
|
||||
call switch_to_prot
|
||||
.code32
|
||||
|
||||
popal
|
||||
popa
|
||||
|
||||
ret
|
||||
|
||||
|
@ -294,11 +297,11 @@ EXTERN(_DisableA20)
|
|||
* above 1MB. So we let Grub load us there and then relocate
|
||||
* ourself to 0x8000
|
||||
*/
|
||||
#define FREELDR_BASE 0x8000
|
||||
#define INITIAL_BASE 0x200000
|
||||
#define FREELDR_BASE HEX(8000)
|
||||
#define INITIAL_BASE HEX(200000)
|
||||
|
||||
/* Align 32 bits boundary */
|
||||
.align 4
|
||||
.align 4
|
||||
|
||||
/* Multiboot header */
|
||||
MultibootHeader:
|
||||
|
@ -330,44 +333,45 @@ MultibootEntry:
|
|||
* our own */
|
||||
lgdt gdtptrhigh + INITIAL_BASE - FREELDR_BASE
|
||||
/* Reload segment selectors */
|
||||
ljmp $PMODE_CS, $(mb1 + INITIAL_BASE - FREELDR_BASE)
|
||||
//ljmp $PMODE_CS, $(mb1 + INITIAL_BASE - FREELDR_BASE)
|
||||
jmp far ptr PMODE_CS: (mb1 + INITIAL_BASE - FREELDR_BASE)
|
||||
mb1:
|
||||
movw $PMODE_DS,%dx
|
||||
movw %dx,%ds
|
||||
movw %dx,%es
|
||||
mov dx, PMODE_DS
|
||||
mov ds, dx
|
||||
mov es, dx
|
||||
|
||||
/* Check for valid multiboot signature */
|
||||
cmpl $MULTIBOOT_BOOTLOADER_MAGIC,%eax
|
||||
jne mbfail
|
||||
cmp eax, MULTIBOOT_BOOTLOADER_MAGIC
|
||||
jne mbfail
|
||||
|
||||
/* Store multiboot info in a safe place */
|
||||
movl %ebx,%esi
|
||||
movl $(mb_info + INITIAL_BASE - FREELDR_BASE),%edi
|
||||
movl $MB_INFO_SIZE,%ecx
|
||||
mov esi, ebx
|
||||
mov edi, offset mb_info + INITIAL_BASE - FREELDR_BASE
|
||||
mov ecx, MB_INFO_SIZE
|
||||
rep movsb
|
||||
|
||||
/* Save commandline */
|
||||
movl MB_INFO_FLAGS_OFFSET(%ebx),%edx
|
||||
testl $MB_INFO_FLAG_COMMAND_LINE,MB_INFO_FLAGS_OFFSET(%ebx)
|
||||
jz mb3
|
||||
movl MB_INFO_COMMAND_LINE_OFFSET(%ebx),%esi
|
||||
movl $(cmdline + INITIAL_BASE - FREELDR_BASE),%edi
|
||||
movl $CMDLINE_SIZE,%ecx
|
||||
mov edx, [ebx + MB_INFO_FLAGS_OFFSET]
|
||||
test dword ptr [ebx + MB_INFO_FLAGS_OFFSET], MB_INFO_FLAG_COMMAND_LINE
|
||||
jz mb3
|
||||
mov esi, [ebx + MB_INFO_COMMAND_LINE_OFFSET]
|
||||
mov edi, offset cmdline + INITIAL_BASE - FREELDR_BASE
|
||||
mov ecx, CMDLINE_SIZE
|
||||
mb2: lodsb
|
||||
stosb
|
||||
testb %al,%al
|
||||
jz mb3
|
||||
dec %ecx
|
||||
jnz mb2
|
||||
test al, al
|
||||
jz mb3
|
||||
dec ecx
|
||||
jnz mb2
|
||||
mb3:
|
||||
|
||||
/* Copy to low mem */
|
||||
movl $INITIAL_BASE,%esi
|
||||
movl $FREELDR_BASE,%edi
|
||||
movl $(__bss_end__ - FREELDR_BASE),%ecx
|
||||
addl $3,%ecx
|
||||
shrl $2,%ecx
|
||||
rep movsl
|
||||
mov esi, INITIAL_BASE
|
||||
mov edi, FREELDR_BASE
|
||||
mov ecx, (offset __bss_end__ - FREELDR_BASE)
|
||||
add ecx, 3
|
||||
shr ecx, 2
|
||||
rep movsd
|
||||
|
||||
/* Load the GDT and IDT */
|
||||
lgdt gdtptr
|
||||
|
@ -375,47 +379,49 @@ mb3:
|
|||
|
||||
/* Clear prefetch queue & correct CS,
|
||||
* jump to low mem */
|
||||
ljmp $PMODE_CS, $mb4
|
||||
//ljmp $PMODE_CS, $mb4
|
||||
jmp far ptr PMODE_CS:mb4
|
||||
mb4:
|
||||
/* Reload segment selectors */
|
||||
movw $PMODE_DS,%dx
|
||||
movw %dx,%ds
|
||||
movw %dx,%es
|
||||
movw %dx,%fs
|
||||
movw %dx,%gs
|
||||
movw %dx,%ss
|
||||
movl $STACK32ADDR,%esp
|
||||
mov dx, PMODE_DS
|
||||
mov ds, dx
|
||||
mov es, dx
|
||||
mov fs, dx
|
||||
mov gs, dx
|
||||
mov ss, dx
|
||||
mov esp, STACK32ADDR
|
||||
|
||||
movl $mb_info,%ebx
|
||||
mov ebx, offset mb_info
|
||||
/* See if the boot device was passed in */
|
||||
movl MB_INFO_FLAGS_OFFSET(%ebx),%edx
|
||||
testl $MB_INFO_FLAG_BOOT_DEVICE,%edx
|
||||
jz mb5
|
||||
mov edx, [ebx + MB_INFO_FLAGS_OFFSET]
|
||||
test edx, MB_INFO_FLAG_BOOT_DEVICE
|
||||
jz mb5
|
||||
/* Retrieve boot device info */
|
||||
movl MB_INFO_BOOT_DEVICE_OFFSET(%ebx),%eax
|
||||
shrl $16,%eax
|
||||
incb %al
|
||||
movb %al,_BootPartition
|
||||
movb %ah,_BootDrive
|
||||
jmp mb6
|
||||
mov eax, [ebx + MB_INFO_BOOT_DEVICE_OFFSET]
|
||||
shr eax, 16
|
||||
inc al
|
||||
mov byte ptr _BootPartition, al
|
||||
mov byte ptr _BootDrive, ah
|
||||
jmp mb6
|
||||
mb5: /* No boot device known, assume first partition of first harddisk */
|
||||
movb $0x80,_BootDrive
|
||||
movb $1,_BootPartition
|
||||
mov byte ptr _BootDrive, HEX(80)
|
||||
mov byte ptr _BootPartition, 1
|
||||
mb6:
|
||||
/* Check for command line */
|
||||
mov $cmdline,%eax
|
||||
testl $MB_INFO_FLAG_COMMAND_LINE,MB_INFO_FLAGS_OFFSET(%ebx)
|
||||
jnz mb7
|
||||
xorl %eax,%eax
|
||||
mov eax, offset cmdline
|
||||
test dword ptr [ebx + MB_INFO_FLAGS_OFFSET], MB_INFO_FLAG_COMMAND_LINE
|
||||
jnz mb7
|
||||
xor eax, eax
|
||||
mb7:
|
||||
|
||||
/* GO! */
|
||||
pushl %eax
|
||||
push eax
|
||||
call _BootMain
|
||||
|
||||
mbfail: call switch_to_real
|
||||
mbfail:
|
||||
call switch_to_real
|
||||
.code16
|
||||
int $0x19
|
||||
int 0x19
|
||||
mbstop: jmp mbstop /* We should never get here */
|
||||
|
||||
.code32
|
||||
|
@ -437,52 +443,52 @@ code32ret:
|
|||
.long 0
|
||||
|
||||
|
||||
.p2align 2 /* force 4-byte alignment */
|
||||
.align 4 /* force 4-byte alignment */
|
||||
gdt:
|
||||
/* NULL Descriptor */
|
||||
.word 0x0000
|
||||
.word 0x0000
|
||||
.word 0x0000
|
||||
.word 0x0000
|
||||
.word HEX(0000)
|
||||
.word HEX(0000)
|
||||
.word HEX(0000)
|
||||
.word HEX(0000)
|
||||
|
||||
/* 32-bit flat CS */
|
||||
.word 0xFFFF
|
||||
.word 0x0000
|
||||
.word 0x9A00
|
||||
.word 0x00CF
|
||||
.word HEX(FFFF)
|
||||
.word HEX(0000)
|
||||
.word HEX(9A00)
|
||||
.word HEX(00CF)
|
||||
|
||||
/* 32-bit flat DS */
|
||||
.word 0xFFFF
|
||||
.word 0x0000
|
||||
.word 0x9200
|
||||
.word 0x00CF
|
||||
.word HEX(FFFF)
|
||||
.word HEX(0000)
|
||||
.word HEX(9200)
|
||||
.word HEX(00CF)
|
||||
|
||||
/* 16-bit real mode CS */
|
||||
.word 0xFFFF
|
||||
.word 0x0000
|
||||
.word 0x9E00
|
||||
.word 0x0000
|
||||
.word HEX(FFFF)
|
||||
.word HEX(0000)
|
||||
.word HEX(9E00)
|
||||
.word HEX(0000)
|
||||
|
||||
/* 16-bit real mode DS */
|
||||
.word 0xFFFF
|
||||
.word 0x0000
|
||||
.word 0x9200
|
||||
.word 0x0000
|
||||
.word HEX(FFFF)
|
||||
.word HEX(0000)
|
||||
.word HEX(9200)
|
||||
.word HEX(0000)
|
||||
|
||||
/* GDT table pointer */
|
||||
gdtptr:
|
||||
.word 0x27 /* Limit */
|
||||
.long gdt /* Base Address */
|
||||
.word HEX(27) /* Limit */
|
||||
.long gdt /* Base Address */
|
||||
|
||||
/* Initial GDT table pointer for multiboot */
|
||||
gdtptrhigh:
|
||||
.word 0x27 /* Limit */
|
||||
.long gdt + INITIAL_BASE - FREELDR_BASE /* Base Address */
|
||||
.word HEX(27) /* Limit */
|
||||
.long gdt + INITIAL_BASE - FREELDR_BASE /* Base Address */
|
||||
|
||||
/* Real-mode IDT pointer */
|
||||
rmode_idtptr:
|
||||
.word 0x3ff /* Limit */
|
||||
.long 0 /* Base Address */
|
||||
.word HEX(3ff) /* Limit */
|
||||
.long 0 /* Base Address */
|
||||
|
||||
mb_info:
|
||||
.fill MB_INFO_SIZE, 1, 0
|
||||
|
|
|
@ -8,13 +8,22 @@
|
|||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include <ndk/asm.h>
|
||||
.intel_syntax noprefix
|
||||
#include <asm.inc>
|
||||
#include <ks386.inc>
|
||||
|
||||
EXTERN _LdrpInit@12:PROC
|
||||
EXTERN _NtTestAlert@0:PROC
|
||||
EXTERN _RtlDispatchException@8:PROC
|
||||
EXTERN _RtlRaiseException@4:PROC
|
||||
EXTERN _RtlRaiseStatus@4:PROC
|
||||
EXTERN _ZwCallbackReturn@12:PROC
|
||||
EXTERN _ZwContinue@8:PROC
|
||||
EXTERN _ZwRaiseException@12:PROC
|
||||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
.code
|
||||
|
||||
.func LdrInitializeThunk@16
|
||||
.globl _LdrInitializeThunk@16
|
||||
PUBLIC _LdrInitializeThunk@16
|
||||
_LdrInitializeThunk@16:
|
||||
|
||||
/* Get the APC Context */
|
||||
|
@ -28,9 +37,8 @@ _LdrInitializeThunk@16:
|
|||
|
||||
/* Jump into the C initialization routine */
|
||||
jmp _LdrpInit@12
|
||||
.endfunc
|
||||
|
||||
.func KiUserApcExceptionHandler
|
||||
|
||||
_KiUserApcExceptionHandler:
|
||||
|
||||
/* Put the exception record in ECX and check the Flags */
|
||||
|
@ -45,10 +53,9 @@ _KiUserApcExceptionHandler:
|
|||
/* We'll execute handler */
|
||||
mov eax, EXCEPTION_EXECUTE_HANDLER
|
||||
ret 16
|
||||
.endfunc
|
||||
|
||||
.func KiUserApcDispatcher@16
|
||||
.globl _KiUserApcDispatcher@16
|
||||
|
||||
PUBLIC _KiUserApcDispatcher@16
|
||||
_KiUserApcDispatcher@16:
|
||||
|
||||
/* Setup SEH stack */
|
||||
|
@ -86,9 +93,8 @@ StatusRaiseApc:
|
|||
call _RtlRaiseStatus@4
|
||||
jmp StatusRaiseApc
|
||||
ret 16
|
||||
.endfunc
|
||||
|
||||
.func KiUserCallbackExceptionHandler
|
||||
|
||||
_KiUserCallbackExceptionHandler:
|
||||
|
||||
/* Put the exception record in ECX and check the Flags */
|
||||
|
@ -106,10 +112,9 @@ return:
|
|||
/* We'll execute the handler */
|
||||
mov eax, EXCEPTION_EXECUTE_HANDLER
|
||||
ret 16
|
||||
.endfunc
|
||||
|
||||
.func KiUserCallbackDispatcher@12
|
||||
.globl _KiUserCallbackDispatcher@12
|
||||
|
||||
PUBLIC _KiUserCallbackDispatcher@12
|
||||
_KiUserCallbackDispatcher@12:
|
||||
|
||||
/* Setup SEH stack */
|
||||
|
@ -131,7 +136,7 @@ _KiUserCallbackDispatcher@12:
|
|||
mov eax, [eax+PEB_KERNEL_CALLBACK_TABLE]
|
||||
|
||||
/* Call the routine */
|
||||
call [eax+edx*4]
|
||||
call dword ptr [eax+edx*4]
|
||||
|
||||
/* Return from callback */
|
||||
push eax
|
||||
|
@ -148,10 +153,9 @@ StatusRaise:
|
|||
call _RtlRaiseStatus@4
|
||||
jmp StatusRaise
|
||||
ret 12
|
||||
.endfunc
|
||||
|
||||
.func KiRaiseUserExceptionDispatcher@0
|
||||
.globl _KiRaiseUserExceptionDispatcher@0
|
||||
|
||||
PUBLIC _KiRaiseUserExceptionDispatcher@0
|
||||
_KiRaiseUserExceptionDispatcher@0:
|
||||
|
||||
/* Setup stack for EXCEPTION_RECORD */
|
||||
|
@ -177,10 +181,9 @@ _KiRaiseUserExceptionDispatcher@0:
|
|||
mov esp, ebp
|
||||
pop ebp
|
||||
ret
|
||||
.endfunc
|
||||
|
||||
.func KiUserExceptionDispatcher@8
|
||||
.globl _KiUserExceptionDispatcher@8
|
||||
|
||||
PUBLIC _KiUserExceptionDispatcher@8
|
||||
_KiUserExceptionDispatcher@8:
|
||||
|
||||
/* Clear direction flag */
|
||||
|
@ -236,39 +239,35 @@ Exit:
|
|||
push esp
|
||||
call _RtlRaiseException@4
|
||||
ret 8
|
||||
.endfunc
|
||||
|
||||
.func KiIntSystemCall@0
|
||||
.globl _KiIntSystemCall@0
|
||||
|
||||
PUBLIC _KiIntSystemCall@0
|
||||
_KiIntSystemCall@0:
|
||||
|
||||
/* Set stack in EDX and do the interrupt */
|
||||
lea edx, [esp+8]
|
||||
int 0x2E
|
||||
int HEX(2E)
|
||||
|
||||
/* Return to caller */
|
||||
ret
|
||||
.endfunc
|
||||
|
||||
.func KiFastSystemCall@0
|
||||
.globl _KiFastSystemCall@0
|
||||
|
||||
PUBLIC _KiFastSystemCall@0
|
||||
_KiFastSystemCall@0:
|
||||
|
||||
/* Put ESP in EDX and do the SYSENTER */
|
||||
mov edx, esp
|
||||
sysenter
|
||||
.endfunc
|
||||
|
||||
.func KiFastSystemCallRet@0
|
||||
.globl _KiFastSystemCallRet@0
|
||||
|
||||
PUBLIC _KiFastSystemCallRet@0
|
||||
_KiFastSystemCallRet@0:
|
||||
|
||||
/* Just return to caller */
|
||||
ret
|
||||
.endfunc
|
||||
|
||||
.func RtlpGetStackLimits@8
|
||||
.globl _RtlpGetStackLimits@8
|
||||
|
||||
PUBLIC _RtlpGetStackLimits@8
|
||||
_RtlpGetStackLimits@8:
|
||||
|
||||
/* Get the stack limits */
|
||||
|
@ -283,4 +282,5 @@ _RtlpGetStackLimits@8:
|
|||
|
||||
/* return */
|
||||
ret 8
|
||||
.endfunc
|
||||
|
||||
END
|
||||
|
|
|
@ -7,11 +7,13 @@
|
|||
* KJK::Hyperion <noog@libero.it>
|
||||
*/
|
||||
|
||||
#include <ndk/asm.h>
|
||||
#include <asm.inc>
|
||||
|
||||
.globl SwitchToFiber
|
||||
.intel_syntax noprefix
|
||||
|
||||
PUBLIC SwitchToFiber
|
||||
|
||||
SwitchToFiber:
|
||||
/* FIXME: TODO */
|
||||
ret 4
|
||||
|
||||
END
|
||||
|
|
|
@ -6,9 +6,11 @@
|
|||
* PROGRAMMER: Alex Ionescu (alex@relsoft.net)
|
||||
*/
|
||||
|
||||
.globl BaseThreadStartupThunk
|
||||
.globl BaseProcessStartThunk
|
||||
.intel_syntax noprefix
|
||||
#include <asm.inc>
|
||||
|
||||
|
||||
PUBLIC BaseThreadStartupThunk
|
||||
PUBLIC BaseProcessStartThunk
|
||||
|
||||
BaseThreadStartupThunk:
|
||||
|
||||
|
@ -29,4 +31,5 @@ BaseProcessStartThunk:
|
|||
push 0 /* Return RIP */
|
||||
jmp BaseProcessStartup
|
||||
|
||||
END
|
||||
/* EOF */
|
||||
|
|
|
@ -7,11 +7,12 @@
|
|||
* KJK::Hyperion <noog@libero.it>
|
||||
*/
|
||||
|
||||
#include <ndk/asm.h>
|
||||
#include <asm.inc>
|
||||
#include <ks386.inc>
|
||||
|
||||
.globl _SwitchToFiber@4
|
||||
.intel_syntax noprefix
|
||||
.code
|
||||
|
||||
PUBLIC _SwitchToFiber@4
|
||||
_SwitchToFiber@4:
|
||||
/* Get the TEB */
|
||||
mov edx, fs:[TEB_SELF]
|
||||
|
@ -30,7 +31,7 @@ _SwitchToFiber@4:
|
|||
mov [eax+FIBER_CONTEXT_EIP], ebx
|
||||
|
||||
/* Check if we're to save FPU State */
|
||||
cmp dword ptr [eax+FIBER_CONTEXT_FLAGS], CONTEXT_FULL | CONTEXT_FLOATING_POINT
|
||||
cmp dword ptr [eax+FIBER_CONTEXT_FLAGS], CONTEXT_FULL OR CONTEXT_FLOATING_POINT
|
||||
jnz NoFpuStateSave
|
||||
|
||||
/* Save the FPU State (Status and Control)*/
|
||||
|
@ -80,7 +81,7 @@ NoFpuStateSave:
|
|||
mov [edx+TEB_ACTIVATION_CONTEXT_STACK_POINTER], esi
|
||||
|
||||
/* Restore FPU State */
|
||||
cmp dword ptr [eax+FIBER_CONTEXT_FLAGS], CONTEXT_FULL | CONTEXT_FLOATING_POINT
|
||||
cmp dword ptr [eax+FIBER_CONTEXT_FLAGS], CONTEXT_FULL OR CONTEXT_FLOATING_POINT
|
||||
jnz NoFpuStateRestore
|
||||
|
||||
/* Check if the Status Word Changed */
|
||||
|
@ -96,7 +97,7 @@ NoFpuStateSave:
|
|||
StatusWordChanged:
|
||||
|
||||
/* Load the new one */
|
||||
mov word ptr [ecx+FIBER_CONTEXT_FLOAT_SAVE_TAG_WORD], 0xFFFF
|
||||
mov word ptr [ecx+FIBER_CONTEXT_FLOAT_SAVE_TAG_WORD], HEX(0FFFF)
|
||||
fldenv [ecx+FIBER_CONTEXT_FLOAT_SAVE_CONTROL_WORD]
|
||||
|
||||
ControlWordEqual:
|
||||
|
@ -120,6 +121,7 @@ NoFpuStateRestore:
|
|||
mov [edx+TEB_FLS_DATA], eax
|
||||
|
||||
/* Jump to new fiber */
|
||||
jmp [ecx+FIBER_CONTEXT_EIP]
|
||||
jmp dword ptr [ecx+FIBER_CONTEXT_EIP]
|
||||
|
||||
END
|
||||
/* EOF */
|
||||
|
|
|
@ -6,9 +6,15 @@
|
|||
* PROGRAMMER: Alex Ionescu (alex@relsoft.net)
|
||||
*/
|
||||
|
||||
.globl _BaseThreadStartupThunk@0
|
||||
.globl _BaseProcessStartThunk@0
|
||||
.intel_syntax noprefix
|
||||
#include <asm.inc>
|
||||
|
||||
.code
|
||||
|
||||
EXTERN _BaseThreadStartup@8:PROC
|
||||
EXTERN _BaseProcessStartup@4:PROC
|
||||
|
||||
PUBLIC _BaseThreadStartupThunk@0
|
||||
PUBLIC _BaseProcessStartThunk@0
|
||||
|
||||
_BaseThreadStartupThunk@0:
|
||||
|
||||
|
@ -29,4 +35,5 @@ _BaseProcessStartThunk@0:
|
|||
push 0 /* Return EIP */
|
||||
jmp _BaseProcessStartup@4
|
||||
|
||||
END
|
||||
/* EOF */
|
||||
|
|
|
@ -8,8 +8,9 @@
|
|||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include <reactos/asm.h>
|
||||
#include <ndk/amd64/asm.h>
|
||||
#include <asm.inc>
|
||||
|
||||
#include <ksamd64.inc>
|
||||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
|
@ -92,5 +93,5 @@ MpsTimerInterrupt:
|
|||
AFTER
|
||||
iret
|
||||
|
||||
|
||||
END
|
||||
/* EOF */
|
||||
|
|
|
@ -7,8 +7,9 @@
|
|||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include <reactos/asm.h>
|
||||
#include <ndk/amd64/asm.h>
|
||||
#include <asm.inc>
|
||||
|
||||
#include <ksamd64.inc>
|
||||
|
||||
/* GLOBALS *******************************************************************/
|
||||
|
||||
|
@ -90,3 +91,4 @@ HalpClockInterrupt:
|
|||
UNIMPLEMENTED _HalpClockInterrupt
|
||||
iret
|
||||
|
||||
END
|
||||
|
|
|
@ -7,12 +7,42 @@
|
|||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include <asm.h>
|
||||
.intel_syntax noprefix
|
||||
#include <asm.inc>
|
||||
|
||||
#include <ks386.inc>
|
||||
|
||||
EXTERN _HalpAcquireSystemHardwareSpinLock@0:PROC
|
||||
EXTERN _HalpReleaseCmosSpinLock@0:PROC
|
||||
EXTERN _DbgBreakPoint@0:PROC
|
||||
EXTERN _HalpCurrentRollOver:DWORD
|
||||
EXTERN _HalpPerfCounterCutoff:DWORD
|
||||
|
||||
#define PIC1_BASE HEX(20) /* IO base address for master PIC */
|
||||
#define PIC2_BASE HEX(A0) /* IO base address for slave PIC */
|
||||
#define PIC1_COMMAND PIC1_BASE
|
||||
#define PIC1_DATA (PIC1_BASE+1)
|
||||
#define PIC2_COMMAND PIC2_BASE
|
||||
#define PIC2_DATA (PIC2_BASE+1)
|
||||
#define PIC_EOI HEX(20)
|
||||
#define PIC_SPECIFIC_EOI2 HEX(62)
|
||||
|
||||
#define CMOS_ADDR HEX(70)
|
||||
#define CMOS_DATA HEX(71)
|
||||
#define CMOS_REGISTER_A HEX(0A)
|
||||
#define CMOS_REGISTER_B HEX(0B)
|
||||
#define CMOS_REGISTER_C HEX(0C)
|
||||
#define CMOS_REGISTER_D HEX(0D)
|
||||
|
||||
#define PIT_CH0 HEX(40)
|
||||
#define PIT_MODE HEX(43)
|
||||
#define SYSTEM_CTRL_PORT_A HEX(92)
|
||||
|
||||
/* GLOBALS *******************************************************************/
|
||||
|
||||
.globl _HalpPerfCounter
|
||||
.data
|
||||
ASSUME CS:NOTHING, DS:NOTHING, ES:NOTHING, FS:NOTHING, GS:NOTHING
|
||||
|
||||
PUBLIC _HalpPerfCounter
|
||||
_HalpLastPerfCounterLow: .long 0
|
||||
_HalpLastPerfCounterHigh: .long 0
|
||||
_HalpPerfCounter:
|
||||
|
@ -22,8 +52,8 @@ _HalpSystemHardwareFlags: .long 0
|
|||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
.global _HalpCalibrateStallExecution@0
|
||||
.func HalpCalibrateStallExecution@0
|
||||
.code
|
||||
PUBLIC _HalpCalibrateStallExecution@0
|
||||
_HalpCalibrateStallExecution@0:
|
||||
|
||||
/* Setup the stack frame */
|
||||
|
@ -37,27 +67,27 @@ _HalpCalibrateStallExecution@0:
|
|||
|
||||
/* Get the current interrupt mask on the PICs */
|
||||
xor eax, eax
|
||||
in al, 0xA1
|
||||
in al, PIC2_DATA
|
||||
shl eax, 8
|
||||
in al, 0x21
|
||||
in al, PIC1_DATA
|
||||
|
||||
/* Save it */
|
||||
push eax
|
||||
|
||||
/* Now mask everything except the RTC and PIC 2 chain-interrupt */
|
||||
mov eax, ~((1 << 2) | (1 << 8))
|
||||
mov eax, NOT (HEX(04) OR HEX(100))
|
||||
|
||||
/* Program the PICs */
|
||||
out 0x21, al
|
||||
out PIC1_DATA, al
|
||||
shr eax, 8
|
||||
out 0xA1, al
|
||||
out PIC2_DATA, al
|
||||
|
||||
/* Now get the IDT */
|
||||
sidt [ebp-8]
|
||||
mov ecx, [ebp-6]
|
||||
|
||||
/* Get the IDT entry for the RTC */
|
||||
mov eax, 0x38
|
||||
mov eax, HEX(38)
|
||||
shl eax, 3
|
||||
add ecx, eax
|
||||
|
||||
|
@ -70,7 +100,7 @@ _HalpCalibrateStallExecution@0:
|
|||
mov eax, offset OnlyOnePersonCanWriteHalCode
|
||||
mov [ecx], ax
|
||||
mov word ptr [ecx+2], KGDT_R0_CODE
|
||||
mov word ptr [ecx+4], 0x8E00
|
||||
mov word ptr [ecx+4], HEX(08E00)
|
||||
shr eax, 16
|
||||
mov [ecx+6], ax
|
||||
|
||||
|
@ -81,18 +111,18 @@ _HalpCalibrateStallExecution@0:
|
|||
call _HalpAcquireSystemHardwareSpinLock@0
|
||||
|
||||
/* Now initialize register A on the CMOS */
|
||||
mov ax, (0x2D << 8) | 0xA
|
||||
out 0x70, al
|
||||
mov ax, HEX(2D00) OR CMOS_REGISTER_A
|
||||
out CMOS_ADDR, al
|
||||
jmp $+2
|
||||
mov al, ah
|
||||
out 0x71, al
|
||||
out CMOS_DATA, al
|
||||
jmp $+2
|
||||
|
||||
/* Read register B */
|
||||
mov ax, 0xB
|
||||
out 0x70, al
|
||||
mov ax, CMOS_REGISTER_B
|
||||
out CMOS_ADDR, al
|
||||
jmp $+2
|
||||
in al, 0x71
|
||||
in al, CMOS_DATA
|
||||
jmp $+2
|
||||
|
||||
/* Don't touch the LastKnownGoodConfig hack */
|
||||
|
@ -100,28 +130,28 @@ _HalpCalibrateStallExecution@0:
|
|||
mov ah, al
|
||||
|
||||
/* Enable the interrupt */
|
||||
or ah, 0x42
|
||||
or ah, HEX(42)
|
||||
|
||||
/* Now write the register B */
|
||||
mov al, 0xB
|
||||
out 0x70, al
|
||||
mov al, CMOS_REGISTER_B
|
||||
out CMOS_ADDR, al
|
||||
jmp $+2
|
||||
mov al, ah
|
||||
out 0x71, al
|
||||
out CMOS_DATA, al
|
||||
jmp $+2
|
||||
|
||||
/* Read register C */
|
||||
mov al, 0xC
|
||||
out 0x70, al
|
||||
mov al, CMOS_REGISTER_C
|
||||
out CMOS_ADDR, al
|
||||
jmp $+2
|
||||
in al, 0x71
|
||||
in al, CMOS_DATA
|
||||
jmp $+2
|
||||
|
||||
/* Read register D */
|
||||
mov al, 0xD
|
||||
out 0x70, al
|
||||
mov al, CMOS_REGISTER_D
|
||||
out CMOS_ADDR, al
|
||||
jmp $+2
|
||||
in al, 0x71
|
||||
in al, CMOS_DATA
|
||||
jmp $+2
|
||||
|
||||
/* Release CMOS lock */
|
||||
|
@ -169,18 +199,18 @@ OnlyOnePersonCanWriteHalCode:
|
|||
call _HalpAcquireSystemHardwareSpinLock@0
|
||||
|
||||
/* Now initialize register A on the CMOS */
|
||||
mov ax, (0x2D << 8) | 0xA
|
||||
out 0x70, al
|
||||
mov ax, HEX(2D00) OR CMOS_REGISTER_A
|
||||
out CMOS_ADDR, al
|
||||
jmp $+2
|
||||
mov al, ah
|
||||
out 0x71, al
|
||||
out CMOS_DATA, al
|
||||
jmp $+2
|
||||
|
||||
/* Read register B */
|
||||
mov ax, 0xB
|
||||
out 0x70, al
|
||||
mov ax, CMOS_REGISTER_B
|
||||
out CMOS_ADDR, al
|
||||
jmp $+2
|
||||
in al, 0x71
|
||||
in al, CMOS_DATA
|
||||
jmp $+2
|
||||
|
||||
/* Don't touch the LastKnownGoodConfig hack */
|
||||
|
@ -188,38 +218,38 @@ OnlyOnePersonCanWriteHalCode:
|
|||
mov ah, al
|
||||
|
||||
/* Enable the interrupt */
|
||||
or ah, 0x42
|
||||
or ah, HEX(42)
|
||||
|
||||
/* Now write the register B */
|
||||
mov al, 0xB
|
||||
out 0x70, al
|
||||
mov al, CMOS_REGISTER_B
|
||||
out CMOS_ADDR, al
|
||||
jmp $+2
|
||||
mov al, ah
|
||||
out 0x71, al
|
||||
out CMOS_DATA, al
|
||||
jmp $+2
|
||||
|
||||
/* Read register C */
|
||||
mov al, 0xC
|
||||
out 0x70, al
|
||||
mov al, CMOS_REGISTER_C
|
||||
out CMOS_ADDR, al
|
||||
jmp $+2
|
||||
in al, 0x71
|
||||
in al, CMOS_DATA
|
||||
jmp $+2
|
||||
|
||||
/* Read register D */
|
||||
mov al, 0xD
|
||||
out 0x70, al
|
||||
mov al, CMOS_REGISTER_D
|
||||
out CMOS_ADDR, al
|
||||
jmp $+2
|
||||
in al, 0x71
|
||||
in al, CMOS_DATA
|
||||
jmp $+2
|
||||
|
||||
/* Release CMOS lock */
|
||||
call _HalpReleaseCmosSpinLock@0
|
||||
|
||||
/* Dismiss the interrupt */
|
||||
mov al, 0x20
|
||||
out 0xA0, al
|
||||
mov al, 0x62
|
||||
out 0x20, al
|
||||
mov al, PIC_EOI
|
||||
out PIC2_COMMAND, al
|
||||
mov al, PIC_SPECIFIC_EOI2
|
||||
out PIC1_COMMAND, al
|
||||
|
||||
/* Reset the counter and return back to the looper */
|
||||
xor eax, eax
|
||||
|
@ -248,24 +278,24 @@ FoundFactor:
|
|||
/* Prepare for interrupt return */
|
||||
pop eax
|
||||
push offset AndItsNotYou
|
||||
mov eax, 0x13
|
||||
mov eax, HEX(13)
|
||||
|
||||
/* Acquire CMOS lock */
|
||||
call _HalpAcquireSystemHardwareSpinLock@0
|
||||
|
||||
/* Now initialize register A on the CMOS */
|
||||
mov ax, (0x2D << 8) | 0xA
|
||||
out 0x70, al
|
||||
mov ax, HEX(2D00) OR CMOS_REGISTER_A
|
||||
out CMOS_ADDR, al
|
||||
jmp $+2
|
||||
mov al, ah
|
||||
out 0x71, al
|
||||
out CMOS_DATA, al
|
||||
jmp $+2
|
||||
|
||||
/* Read register B */
|
||||
mov ax, 0xB
|
||||
out 0x70, al
|
||||
mov ax, CMOS_REGISTER_B
|
||||
out CMOS_ADDR, al
|
||||
jmp $+2
|
||||
in al, 0x71
|
||||
in al, CMOS_DATA
|
||||
jmp $+2
|
||||
|
||||
/* Don't touch the LastKnownGoodConfig hack */
|
||||
|
@ -273,34 +303,34 @@ FoundFactor:
|
|||
mov ah, al
|
||||
|
||||
/* Disable the interrupt */
|
||||
or ah, 0x2
|
||||
or ah, 2
|
||||
|
||||
/* Now write the register B */
|
||||
mov al, 0xB
|
||||
out 0x70, al
|
||||
mov al, CMOS_REGISTER_B
|
||||
out CMOS_ADDR, al
|
||||
jmp $+2
|
||||
mov al, ah
|
||||
out 0x71, al
|
||||
out CMOS_DATA, al
|
||||
jmp $+2
|
||||
|
||||
/* Read register C */
|
||||
mov al, 0xC
|
||||
out 0x70, al
|
||||
mov al, CMOS_REGISTER_C
|
||||
out CMOS_ADDR, al
|
||||
jmp $+2
|
||||
in al, 0x71
|
||||
in al, CMOS_DATA
|
||||
jmp $+2
|
||||
|
||||
/* Release CMOS lock */
|
||||
call _HalpReleaseCmosSpinLock@0
|
||||
|
||||
/* Dismiss the interrupt */
|
||||
mov al, 0x20
|
||||
out 0xA0, al
|
||||
mov al, 0x62
|
||||
out 0x20, al
|
||||
mov al, PIC_EOI
|
||||
out PIC2_COMMAND, al
|
||||
mov al, PIC_SPECIFIC_EOI2
|
||||
out PIC1_COMMAND, al
|
||||
|
||||
/* Disable interrupts on return */
|
||||
and word ptr [esp+8], ~EFLAGS_INTERRUPT_MASK
|
||||
and word ptr [esp+8], NOT EFLAGS_INTERRUPT_MASK
|
||||
iretd
|
||||
|
||||
/************************* WE ARE BACK FROM RTC ***************************/
|
||||
|
@ -313,9 +343,9 @@ AndItsNotYou:
|
|||
|
||||
/* Restore the mask */
|
||||
pop eax
|
||||
out 0x21, al
|
||||
out PIC1_DATA, al
|
||||
shr eax, 8
|
||||
out 0xA1, al
|
||||
out PIC2_DATA, al
|
||||
|
||||
/* Restore EFLAGS */
|
||||
popf
|
||||
|
@ -324,11 +354,10 @@ AndItsNotYou:
|
|||
mov esp, ebp
|
||||
pop ebp
|
||||
ret
|
||||
.endfunc
|
||||
|
||||
|
||||
#ifndef _MINIHAL_
|
||||
.globl _KeStallExecutionProcessor@4
|
||||
.func KeStallExecutionProcessor@4
|
||||
PUBLIC _KeStallExecutionProcessor@4
|
||||
_KeStallExecutionProcessor@4:
|
||||
|
||||
/* Get the number of microseconds required */
|
||||
|
@ -356,11 +385,9 @@ SubtractLoop:
|
|||
Done:
|
||||
/* Return */
|
||||
ret 4
|
||||
.endfunc
|
||||
#endif
|
||||
|
||||
.global _KeQueryPerformanceCounter@4
|
||||
.func KeQueryPerformanceCounter@4
|
||||
PUBLIC _KeQueryPerformanceCounter@4
|
||||
_KeQueryPerformanceCounter@4:
|
||||
|
||||
/* Check if we were called too early */
|
||||
|
@ -380,20 +407,20 @@ LoopPreInt:
|
|||
LoopPostInt:
|
||||
|
||||
/* Get the current value */
|
||||
mov ebx, _HalpPerfCounterLow
|
||||
mov esi, _HalpPerfCounterHigh
|
||||
mov ebx, dword ptr _HalpPerfCounterLow
|
||||
mov esi, dword ptr _HalpPerfCounterHigh
|
||||
|
||||
/* Read 8254 timer */
|
||||
mov al, 0
|
||||
out 0x43, al
|
||||
in al, 0x92
|
||||
or al, _HalpPerfCounterCutoff
|
||||
out 0x92, al
|
||||
mov al, 0 /* Interrupt on terminal count */
|
||||
out PIT_MODE, al
|
||||
in al, SYSTEM_CTRL_PORT_A
|
||||
or al, byte ptr _HalpPerfCounterCutoff
|
||||
out SYSTEM_CTRL_PORT_A, al
|
||||
jmp $+2
|
||||
in al, 0x40
|
||||
in al, PIT_CH0
|
||||
jmp $+2
|
||||
movzx ecx, al
|
||||
in al, 0x40
|
||||
in al, PIT_CH0
|
||||
mov ch, al
|
||||
|
||||
/* Enable interrupts and do a short wait */
|
||||
|
@ -406,8 +433,8 @@ LoopPostInt:
|
|||
cli
|
||||
|
||||
/* Get the counter value again */
|
||||
mov eax, _HalpPerfCounterLow
|
||||
mov edx, _HalpPerfCounterHigh
|
||||
mov eax, dword ptr _HalpPerfCounterLow
|
||||
mov edx, dword ptr _HalpPerfCounterHigh
|
||||
|
||||
/* Check if someone updated the counter */
|
||||
cmp eax, ebx
|
||||
|
@ -417,7 +444,7 @@ LoopPostInt:
|
|||
|
||||
/* Check if the current 8254 value causes rollover */
|
||||
neg ecx
|
||||
add ecx, _HalpCurrentRollOver
|
||||
add ecx, dword ptr _HalpCurrentRollOver
|
||||
jnb DoRollOver
|
||||
|
||||
SetSum:
|
||||
|
@ -427,19 +454,19 @@ SetSum:
|
|||
adc edx, 0
|
||||
|
||||
/* Check if we're above or below the last high value */
|
||||
cmp edx, _HalpLastPerfCounterHigh
|
||||
cmp edx, dword ptr _HalpLastPerfCounterHigh
|
||||
jb short BelowHigh
|
||||
jnz short BelowLow
|
||||
|
||||
/* Check if we're above or below the last low value */
|
||||
cmp eax, _HalpLastPerfCounterLow
|
||||
cmp eax, dword ptr _HalpLastPerfCounterLow
|
||||
jb BelowHigh
|
||||
|
||||
BelowLow:
|
||||
|
||||
/* Update the last value and bring back interrupts */
|
||||
mov _HalpLastPerfCounterLow, eax
|
||||
mov _HalpLastPerfCounterHigh, edx
|
||||
mov dword ptr _HalpLastPerfCounterLow, eax
|
||||
mov dword ptr _HalpLastPerfCounterHigh, edx
|
||||
popf
|
||||
|
||||
/* Check if caller wants frequency */
|
||||
|
@ -469,7 +496,7 @@ DoRollOver:
|
|||
|
||||
/* We might have an incoming interrupt, save EFLAGS and reset rollover */
|
||||
mov esi, [esp]
|
||||
mov ecx, _HalpCurrentRollOver
|
||||
mov ecx, dword ptr _HalpCurrentRollOver
|
||||
popf
|
||||
|
||||
/* Check if interrupts were enabled and try again */
|
||||
|
@ -483,8 +510,8 @@ DoRollOver:
|
|||
BelowHigh:
|
||||
|
||||
/* Get the last counter values */
|
||||
mov ebx, _HalpLastPerfCounterLow
|
||||
mov esi, _HalpLastPerfCounterHigh
|
||||
mov ebx, dword ptr _HalpLastPerfCounterLow
|
||||
mov esi, dword ptr _HalpLastPerfCounterHigh
|
||||
|
||||
/* Check if the previous value was 0 and go back if yes */
|
||||
mov ecx, ebx
|
||||
|
@ -495,7 +522,7 @@ BelowHigh:
|
|||
sub ebx, eax
|
||||
sbb esi, edx
|
||||
jnz InvalidCount
|
||||
cmp ebx, _HalpCurrentRollOver
|
||||
cmp ebx, dword ptr _HalpCurrentRollOver
|
||||
jg InvalidCount
|
||||
|
||||
/* Fixup the count with the last known value */
|
||||
|
@ -517,7 +544,8 @@ BelowHigh:
|
|||
InvalidCount:
|
||||
popf
|
||||
xor eax, eax
|
||||
mov _HalpLastPerfCounterLow, eax
|
||||
mov _HalpLastPerfCounterHigh, eax
|
||||
mov dword ptr _HalpLastPerfCounterLow, eax
|
||||
mov dword ptr _HalpLastPerfCounterHigh, eax
|
||||
jmp LoopPreInt
|
||||
.endfunc
|
||||
|
||||
END
|
||||
|
|
|
@ -8,12 +8,12 @@
|
|||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include <reactos/asm.h>
|
||||
#include <ndk/i386/asm.h>
|
||||
#include <asm.inc>
|
||||
|
||||
#include <ks386.inc>
|
||||
#include <internal/i386/asmmacro.S>
|
||||
|
||||
.code32
|
||||
.text
|
||||
.code
|
||||
|
||||
TRAP_ENTRY HalpTrap0D, 0
|
||||
TRAP_ENTRY HalpApcInterrupt, KI_SOFTWARE_TRAP
|
||||
|
@ -42,4 +42,6 @@ _HalpRealModeStart:
|
|||
.space 2048
|
||||
_HalpRealModeEnd:
|
||||
PUBLIC _HalpRealModeEnd
|
||||
.endcode16
|
||||
|
||||
END
|
||||
|
|
262
reactos/include/reactos/asm.inc
Normal file
262
reactos/include/reactos/asm.inc
Normal file
|
@ -0,0 +1,262 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS Kernel
|
||||
* FILE: ntoskrnl/include/amd64/asmmacro.S
|
||||
* PURPOSE: ASM macros for for GAS and MASM/ML64
|
||||
* PROGRAMMERS: Timo Kreuzer (timo.kreuzer@reactos.org)
|
||||
*/
|
||||
|
||||
#ifdef _USE_ML
|
||||
|
||||
/* Allow ".name" identifiers */
|
||||
OPTION DOTNAME
|
||||
|
||||
.686P
|
||||
.XMM
|
||||
.MODEL FLAT
|
||||
ASSUME CS:NOTHING, DS:NOTHING, ES:NOTHING, FS:NOTHING, GS:NOTHING
|
||||
|
||||
/* Hex numbers need to be in 01ABh format */
|
||||
#define HEX(x) 0##x##h
|
||||
|
||||
/* Macro values need to be marked */
|
||||
#define VAL(x) x
|
||||
|
||||
/* MASM/ML doesn't want explicit [rip] addressing */
|
||||
rip = 0
|
||||
|
||||
/* Due to MASM's reverse syntax, we are forced to use a precompiler macro */
|
||||
#define MACRO(name, ...) name MACRO __VA_ARGS__
|
||||
|
||||
/* To avoid reverse syntax we provide a new macro .PROC, replacing PROC... */
|
||||
.PROC MACRO name
|
||||
name PROC FRAME
|
||||
_name:
|
||||
ENDM
|
||||
|
||||
/* ... and .ENDP, replacing ENDP */
|
||||
.ENDP MACRO name
|
||||
name ENDP
|
||||
ENDM
|
||||
|
||||
/* MASM doesn't have an ASCII macro */
|
||||
.ASCII MACRO text
|
||||
DB text
|
||||
ENDM
|
||||
|
||||
/* MASM doesn't have an ASCIZ macro */
|
||||
.ASCIZ MACRO text
|
||||
DB text, 0
|
||||
ENDM
|
||||
|
||||
#define lgdt lgdt fword ptr ds:
|
||||
|
||||
#define lidt lidt fword ptr ds:
|
||||
|
||||
ljmp MACRO segment, offset
|
||||
DB 0
|
||||
ENDM
|
||||
|
||||
.code64 MACRO
|
||||
.code
|
||||
ENDM
|
||||
|
||||
.code32 MACRO
|
||||
.code
|
||||
.586P
|
||||
ENDM
|
||||
|
||||
.code16 MACRO
|
||||
ASSUME nothing
|
||||
.text SEGMENT use16
|
||||
ENDM
|
||||
|
||||
.endcode16 MACRO
|
||||
.text ENDS
|
||||
ENDM
|
||||
|
||||
.bss MACRO
|
||||
.DATA?
|
||||
ASSUME nothing
|
||||
ENDM
|
||||
|
||||
//.text MACRO
|
||||
//ENDM
|
||||
|
||||
.align MACRO alignment
|
||||
ALIGN alignment
|
||||
ENDM
|
||||
|
||||
.byte MACRO args:VARARG
|
||||
db args
|
||||
ENDM
|
||||
|
||||
.short MACRO args:VARARG
|
||||
dw args
|
||||
ENDM
|
||||
|
||||
.word MACRO args:VARARG
|
||||
dw args
|
||||
ENDM
|
||||
|
||||
.long MACRO args:VARARG
|
||||
dd args
|
||||
ENDM
|
||||
|
||||
.double MACRO args:VARARG
|
||||
dq args
|
||||
ENDM
|
||||
|
||||
.org MACRO value
|
||||
ORG value
|
||||
ENDM
|
||||
|
||||
.fill MACRO repeat, size, value
|
||||
// FIXME
|
||||
ENDM
|
||||
|
||||
ljmp MACRO segment, offset
|
||||
// FIXME
|
||||
ENDM
|
||||
|
||||
UNIMPLEMENTED MACRO name
|
||||
ENDM
|
||||
|
||||
/* We need this to distinguish repeat from macros */
|
||||
#define ENDR ENDM
|
||||
|
||||
#else /***********************************************************************/
|
||||
|
||||
/* Force intel syntax */
|
||||
.intel_syntax noprefix
|
||||
|
||||
.altmacro
|
||||
|
||||
/* Hex numbers need to be in 0x1AB format */
|
||||
#define HEX(y) 0x##y
|
||||
|
||||
/* Macro values need to be marked */
|
||||
#define VAL(x) \x
|
||||
|
||||
/* Due to MASM's reverse syntax, we are forced to use a precompiler macro */
|
||||
#define MACRO(...) .macro __VA_ARGS__
|
||||
#define ENDM .endm
|
||||
|
||||
/* To avoid reverse syntax we provide a new macro .PROC, replacing PROC... */
|
||||
.macro .PROC name
|
||||
.func \name
|
||||
\name:
|
||||
.cfi_startproc
|
||||
.equ cfa_current_offset, -8
|
||||
.endm
|
||||
|
||||
/* ... and .ENDP, replacing ENDP */
|
||||
.macro .ENDP name
|
||||
.cfi_endproc
|
||||
.endfunc
|
||||
.endm
|
||||
|
||||
/* MASM compatible PUBLIC */
|
||||
.macro PUBLIC symbol
|
||||
.global \symbol
|
||||
.endm
|
||||
|
||||
/* Dummy ASSUME */
|
||||
.macro ASSUME p1 p2 p3 p4 p5 p6 p7 p8
|
||||
.endm
|
||||
|
||||
/* MASM needs an end tag for segments */
|
||||
.macro .endcode16
|
||||
.endm
|
||||
|
||||
/* MASM compatible ALIGN */
|
||||
#define ALIGN .align
|
||||
|
||||
/* MASM compatible REPEAT, additional ENDR */
|
||||
#define REPEAT .rept
|
||||
#define ENDR .endr
|
||||
|
||||
.macro ljmp segment, offset
|
||||
jmp far ptr \segment:\offset
|
||||
.endm
|
||||
|
||||
/* MASM compatible EXTERN */
|
||||
.macro EXTERN name
|
||||
.endm
|
||||
|
||||
/* MASM needs an END tag */
|
||||
#define END
|
||||
|
||||
.macro .MODEL model
|
||||
.endm
|
||||
|
||||
.macro .code
|
||||
.text
|
||||
.endm
|
||||
|
||||
/* Macros for x64 stack unwind OPs */
|
||||
|
||||
.macro .allocstack size
|
||||
.cfi_adjust_cfa_offset \size
|
||||
.set cfa_current_offset, cfa_current_offset - \size
|
||||
.endm
|
||||
|
||||
code = 1
|
||||
.macro .pushframe param=0
|
||||
.if (\param)
|
||||
.cfi_adjust_cfa_offset 0x30
|
||||
.set cfa_current_offset, cfa_current_offset - 0x30
|
||||
.else
|
||||
.cfi_adjust_cfa_offset 0x28
|
||||
.set cfa_current_offset, cfa_current_offset - 0x28
|
||||
.endif
|
||||
.endm
|
||||
|
||||
.macro .pushreg reg
|
||||
.cfi_adjust_cfa_offset 8
|
||||
.equ cfa_current_offset, cfa_current_offset - 8
|
||||
.cfi_offset \reg, cfa_current_offset
|
||||
.endm
|
||||
|
||||
.macro .savereg reg, offset
|
||||
// checkme!!!
|
||||
.cfi_offset \reg, \offset
|
||||
.endm
|
||||
|
||||
.macro .savexmm128 reg, offset
|
||||
// checkme!!!
|
||||
.cfi_offset \reg, \offset
|
||||
.endm
|
||||
|
||||
.macro .setframe reg, offset
|
||||
.cfi_def_cfa reg, \offset
|
||||
.equ cfa_current_offset, \offset
|
||||
.endm
|
||||
|
||||
.macro .endprolog
|
||||
.endm
|
||||
|
||||
.macro UNIMPLEMENTED2 file, line, func
|
||||
|
||||
jmp 3f
|
||||
1: .asciz "\func"
|
||||
2: .asciz \file
|
||||
3:
|
||||
sub rsp, 0x20
|
||||
lea rcx, MsgUnimplemented[rip]
|
||||
lea rdx, 1b[rip]
|
||||
lea r8, 2b[rip]
|
||||
mov r9, \line
|
||||
call DbgPrint
|
||||
add rsp, 0x20
|
||||
.endm
|
||||
#define UNIMPLEMENTED UNIMPLEMENTED2 __FILE__, __LINE__,
|
||||
|
||||
/* MASM/ML uses ".if" for runtime conditionals, and "if" for compile time
|
||||
conditionals. We therefore use "if", too. .if shouldn't be used at all */
|
||||
#define if .if
|
||||
#define endif .endif
|
||||
#define else .else
|
||||
#define elseif .elseif
|
||||
|
||||
#endif
|
946
reactos/include/reactos/ks386.inc
Normal file
946
reactos/include/reactos/ks386.inc
Normal file
|
@ -0,0 +1,946 @@
|
|||
|
||||
/* Pointer size */
|
||||
SizeofPointer = 0x4
|
||||
|
||||
/* Breakpoints */
|
||||
BREAKPOINT_BREAK = 0x0
|
||||
BREAKPOINT_PRINT = 0x1
|
||||
BREAKPOINT_PROMPT = 0x2
|
||||
BREAKPOINT_LOAD_SYMBOLS = 0x3
|
||||
BREAKPOINT_UNLOAD_SYMBOLS = 0x4
|
||||
BREAKPOINT_COMMAND_STRING = 0x5
|
||||
|
||||
/* Context Frame Flags */
|
||||
CONTEXT_FULL = 0x10007
|
||||
CONTEXT_CONTROL = 0x10001
|
||||
CONTEXT_INTEGER = 0x10002
|
||||
CONTEXT_SEGMENTS = 0x10004
|
||||
CONTEXT_FLOATING_POINT = 0x10008
|
||||
CONTEXT_DEBUG_REGISTERS = 0x10010
|
||||
|
||||
/* Exception flags */
|
||||
EXCEPTION_NONCONTINUABLE = 0x1
|
||||
EXCEPTION_UNWINDING = 0x2
|
||||
EXCEPTION_EXIT_UNWIND = 0x4
|
||||
EXCEPTION_STACK_INVALID = 0x8
|
||||
EXCEPTION_NESTED_CALL = 0x10
|
||||
EXCEPTION_TARGET_UNWIND = 0x20
|
||||
EXCEPTION_COLLIDED_UNWIND = 0x20
|
||||
EXCEPTION_UNWIND = 0x6
|
||||
EXCEPTION_EXECUTE_HANDLER = 0x1
|
||||
EXCEPTION_CONTINUE_SEARCH = 0x0
|
||||
EXCEPTION_CONTINUE_EXECUTION = 0xffffffff
|
||||
EXCEPTION_CHAIN_END = 0xffffffff
|
||||
|
||||
/* Exception types */
|
||||
ExceptionContinueExecution = 0x0
|
||||
ExceptionContinueSearch = 0x1
|
||||
ExceptionNestedException = 0x2
|
||||
ExceptionCollidedUnwind = 0x3
|
||||
|
||||
/* Lock Queue */
|
||||
LOCK_QUEUE_WAIT = 0x1
|
||||
LOCK_QUEUE_OWNER = 0x2
|
||||
LockQueueDispatcherLock = 0x0
|
||||
|
||||
/* Process states */
|
||||
ProcessInMemory = 0x0
|
||||
ProcessOutOfMemory = 0x1
|
||||
ProcessInTransition = 0x2
|
||||
|
||||
/* Processor mode */
|
||||
KernelMode = 0x0
|
||||
UserMode = 0x1
|
||||
|
||||
/* Status codes */
|
||||
STATUS_ACCESS_VIOLATION = 0xc0000005
|
||||
STATUS_ASSERTION_FAILURE = 0xc0000420
|
||||
STATUS_ARRAY_BOUNDS_EXCEEDED = 0xc000008c
|
||||
STATUS_BAD_COMPRESSION_BUFFER = 0xc0000242
|
||||
STATUS_BREAKPOINT = 0x80000003
|
||||
STATUS_CALLBACK_POP_STACK = 0xc0000423
|
||||
STATUS_DATATYPE_MISALIGNMENT = 0x80000002
|
||||
STATUS_FLOAT_DENORMAL_OPERAND = 0xc000008d
|
||||
STATUS_FLOAT_DIVIDE_BY_ZERO = 0xc000008e
|
||||
STATUS_FLOAT_INEXACT_RESULT = 0xc000008f
|
||||
STATUS_FLOAT_INVALID_OPERATION = 0xc0000090
|
||||
STATUS_FLOAT_OVERFLOW = 0xc0000091
|
||||
STATUS_FLOAT_STACK_CHECK = 0xc0000092
|
||||
STATUS_FLOAT_UNDERFLOW = 0xc0000093
|
||||
STATUS_FLOAT_MULTIPLE_FAULTS = 0xc00002b4
|
||||
STATUS_FLOAT_MULTIPLE_TRAPS = 0xc00002b5
|
||||
STATUS_GUARD_PAGE_VIOLATION = 0x80000001
|
||||
STATUS_ILLEGAL_FLOAT_CONTEXT = 0xc000014a
|
||||
STATUS_ILLEGAL_INSTRUCTION = 0xc000001d
|
||||
STATUS_INSTRUCTION_MISALIGNMENT = 0xc00000aa
|
||||
STATUS_INVALID_HANDLE = 0xc0000008
|
||||
STATUS_INVALID_LOCK_SEQUENCE = 0xc000001e
|
||||
STATUS_INVALID_OWNER = 0xc000005a
|
||||
STATUS_INVALID_PARAMETER = 0xc000000d
|
||||
STATUS_INVALID_PARAMETER_1 = 0xc00000ef
|
||||
STATUS_INVALID_SYSTEM_SERVICE = 0xc000001c
|
||||
STATUS_INTEGER_DIVIDE_BY_ZERO = 0xc0000094
|
||||
STATUS_INTEGER_OVERFLOW = 0xc0000095
|
||||
STATUS_IN_PAGE_ERROR = 0xc0000006
|
||||
STATUS_KERNEL_APC = 0x100
|
||||
STATUS_LONGJUMP = 0x80000026
|
||||
STATUS_NO_CALLBACK_ACTIVE = 0xc0000258
|
||||
STATUS_NO_EVENT_PAIR = 0xc000014e
|
||||
STATUS_PRIVILEGED_INSTRUCTION = 0xc0000096
|
||||
STATUS_SINGLE_STEP = 0x80000004
|
||||
STATUS_STACK_BUFFER_OVERRUN = 0xc0000409
|
||||
STATUS_STACK_OVERFLOW = 0xc00000fd
|
||||
STATUS_SUCCESS = 0x0
|
||||
STATUS_THREAD_IS_TERMINATING = 0xc000004b
|
||||
STATUS_TIMEOUT = 0x102
|
||||
STATUS_UNWIND = 0xc0000027
|
||||
STATUS_UNWIND_CONSOLIDATE = 0x80000029
|
||||
STATUS_USER_APC = 0xc0
|
||||
STATUS_WAKE_SYSTEM_DEBUGGER = 0x80000007
|
||||
|
||||
/* TLS defines */
|
||||
TLS_MINIMUM_AVAILABLE = 0x40
|
||||
TLS_EXPANSION_SLOTS = 0x400
|
||||
|
||||
/* Thread states */
|
||||
Initialized = 0x0
|
||||
Ready = 0x1
|
||||
Running = 0x2
|
||||
Standby = 0x3
|
||||
Terminated = 0x4
|
||||
Waiting = 0x5
|
||||
|
||||
/* Wait type / reason */
|
||||
WrExecutive = 0x7
|
||||
WrMutex = 0x1d
|
||||
WrDispatchInt = 0x1f
|
||||
WrQuantumEnd = 0x1e
|
||||
WrEventPair = 0xe
|
||||
WaitAny = 0x1
|
||||
WaitAll = 0x0
|
||||
|
||||
/* Interrupt object types */
|
||||
InLevelSensitive = 0x0
|
||||
InLatched = 0x1
|
||||
|
||||
/* Bug Check Codes */
|
||||
APC_INDEX_MISMATCH = 0x1
|
||||
INVALID_AFFINITY_SET = 0x3
|
||||
INVALID_DATA_ACCESS_TRAP = 0x4
|
||||
IRQL_NOT_GREATER_OR_EQUAL = 0x9
|
||||
IRQL_NOT_LESS_OR_EQUAL = 0xa
|
||||
NO_USER_MODE_CONTEXT = 0xe
|
||||
SPIN_LOCK_ALREADY_OWNED = 0xf
|
||||
SPIN_LOCK_NOT_OWNED = 0x10
|
||||
THREAD_NOT_MUTEX_OWNER = 0x11
|
||||
TRAP_CAUSE_UNKNOWN = 0x12
|
||||
KMODE_EXCEPTION_NOT_HANDLED = 0x1e
|
||||
KERNEL_APC_PENDING_DURING_EXIT = 0x20
|
||||
PANIC_STACK_SWITCH = 0x2b
|
||||
DATA_BUS_ERROR = 0x2e
|
||||
INSTRUCTION_BUS_ERROR = 0x2f
|
||||
SYSTEM_EXIT_OWNED_MUTEX = 0x39
|
||||
PAGE_FAULT_WITH_INTERRUPTS_OFF = 0x49
|
||||
IRQL_GT_ZERO_AT_SYSTEM_SERVICE = 0x4a
|
||||
DATA_COHERENCY_EXCEPTION = 0x55
|
||||
INSTRUCTION_COHERENCY_EXCEPTION = 0x56
|
||||
HAL1_INITIALIZATION_FAILED = 0x61
|
||||
UNEXPECTED_KERNEL_MODE_TRAP = 0x7f
|
||||
NMI_HARDWARE_FAILURE = 0x80
|
||||
SPIN_LOCK_INIT_FAILURE = 0x81
|
||||
ATTEMPTED_SWITCH_FROM_DPC = 0xb8
|
||||
|
||||
/* IRQL */
|
||||
PASSIVE_LEVEL = 0x0
|
||||
APC_LEVEL = 0x1
|
||||
DISPATCH_LEVEL = 0x2
|
||||
CLOCK1_LEVEL = 0x1c
|
||||
CLOCK2_LEVEL = 0x1c
|
||||
IPI_LEVEL = 0x1d
|
||||
POWER_LEVEL = 0x1e
|
||||
PROFILE_LEVEL = 0x1b
|
||||
HIGH_LEVEL = 0x1f
|
||||
#ifdef NT_UP
|
||||
SYNCH_LEVEL = 0x2
|
||||
#else
|
||||
SYNCH_LEVEL = 0x1b
|
||||
#endif
|
||||
|
||||
/* Stack sizes */
|
||||
KERNEL_STACK_SIZE = 0x3000
|
||||
KERNEL_LARGE_STACK_SIZE = 0xf000
|
||||
KERNEL_LARGE_STACK_COMMIT = 0x3000
|
||||
|
||||
/* Miscellaneous Definitions */
|
||||
LOW_REALTIME_PRIORITY = 0x10
|
||||
CLOCK_QUANTUM_DECREMENT = 0x3
|
||||
WAIT_QUANTUM_DECREMENT = 0x1
|
||||
MAXIMUM_PROCESSORS = 0x20
|
||||
INITIAL_STALL_COUNT = 0x64
|
||||
KI_EXCEPTION_ACCESS_VIOLATION = 0x10000004
|
||||
Executive = 0x0
|
||||
FALSE = 0x0
|
||||
TRUE = 0x1
|
||||
DBG_STATUS_CONTROL_C = 0x1
|
||||
USER_SHARED_DATA = 0x7ffe0000
|
||||
PAGE_SIZE = 0x1000
|
||||
MAXIMUM_IDTVECTOR = 0xff
|
||||
PRIMARY_VECTOR_BASE = 0x30
|
||||
RPL_MASK = 0x3
|
||||
MODE_MASK = 0x1
|
||||
NUMBER_SERVICE_TABLES = 0x2
|
||||
SERVICE_NUMBER_MASK = 0xfff
|
||||
SERVICE_TABLE_SHIFT = 0x8
|
||||
SERVICE_TABLE_MASK = 0x10
|
||||
SERVICE_TABLE_TEST = 0x10
|
||||
|
||||
/* KAPC */
|
||||
ApType = 0x0
|
||||
ApSize = 0x2
|
||||
ApThread = 0x8
|
||||
ApApcListEntry = 0xc
|
||||
ApKernelRoutine = 0x14
|
||||
ApRundownRoutine = 0x18
|
||||
ApNormalRoutine = 0x1c
|
||||
ApNormalContext = 0x20
|
||||
ApSystemArgument1 = 0x24
|
||||
ApSystemArgument2 = 0x28
|
||||
ApApcStateIndex = 0x2c
|
||||
ApApcMode = 0x2d
|
||||
ApInserted = 0x2e
|
||||
ApcObjectLength = 0x30
|
||||
|
||||
/* KAPC_STATE */
|
||||
AsApcListHead = 0x0
|
||||
AsProcess = 0x10
|
||||
AsKernelApcInProgress = 0x14
|
||||
AsKernelApcPending = 0x15
|
||||
AsUserApcPending = 0x16
|
||||
|
||||
/* CLIENT_ID */
|
||||
CidUniqueProcess = 0x0
|
||||
CidUniqueThread = 0x4
|
||||
|
||||
/* RTL_CRITICAL_SECTION */
|
||||
CsDebugInfo = 0x0
|
||||
CsLockCount = 0x4
|
||||
CsRecursionCount = 0x8
|
||||
CsOwningThread = 0xc
|
||||
CsLockSemaphore = 0x10
|
||||
CsSpinCount = 0x14
|
||||
|
||||
/* RTL_CRITICAL_SECTION_DEBUG */
|
||||
CsType = 0x0
|
||||
CsCreatorBackTraceIndex = 0x2
|
||||
CsCriticalSection = 0x4
|
||||
CsProcessLocksList = 0x8
|
||||
CsEntryCount = 0x10
|
||||
CsContentionCount = 0x14
|
||||
|
||||
/* KDEVICE_QUEUE_ENTRY */
|
||||
DeDeviceListEntry = 0x0
|
||||
DeSortKey = 0x8
|
||||
DeInserted = 0xc
|
||||
DeviceQueueEntryLength = 0x10
|
||||
|
||||
/* KDPC */
|
||||
DpType = 0x0
|
||||
DpImportance = 0x1
|
||||
DpNumber = 0x2
|
||||
DpDpcListEntry = 0x4
|
||||
DpDeferredRoutine = 0xc
|
||||
DpDeferredContext = 0x10
|
||||
DpSystemArgument1 = 0x14
|
||||
DpSystemArgument2 = 0x18
|
||||
DpDpcData = 0x1c
|
||||
DpcObjectLength = 0x20
|
||||
|
||||
/* KDEVICE_QUEUE */
|
||||
DvType = 0x0
|
||||
DvSize = 0x2
|
||||
DvDeviceListHead = 0x4
|
||||
DvSpinLock = 0xc
|
||||
DvBusy = 0x10
|
||||
DeviceQueueObjectLength = 0x14
|
||||
|
||||
/* EXCEPTION_RECORD */
|
||||
ErExceptionCode = 0x0
|
||||
ErExceptionFlags = 0x4
|
||||
ErExceptionRecord = 0x8
|
||||
ErExceptionAddress = 0xc
|
||||
ErNumberParameters = 0x10
|
||||
ErExceptionInformation = 0x14
|
||||
ExceptionRecordLength = 0x50
|
||||
EXCEPTION_RECORD_LENGTH = 0x50
|
||||
|
||||
/* EPROCESS */
|
||||
EpDebugPort = 0xcc
|
||||
EpVdmObjects = 0x144
|
||||
ExecutiveProcessObjectLength = 0x278
|
||||
|
||||
/* KEVENT */
|
||||
EvType = 0x0
|
||||
EvSize = 0x2
|
||||
EvSignalState = 0x4
|
||||
EvWaitListHead = 0x8
|
||||
EventObjectLength = 0x10
|
||||
|
||||
/* FAST_MUTEX */
|
||||
FmCount = 0x0
|
||||
FmOwner = 0x4
|
||||
FmContention = 0x8
|
||||
FmOldIrql = 0x1c
|
||||
|
||||
/* KINTERRUPT */
|
||||
InType = 0x0
|
||||
InSize = 0x2
|
||||
InInterruptListEntry = 0x4
|
||||
InServiceRoutine = 0xc
|
||||
InServiceContext = 0x10
|
||||
InSpinLock = 0x14
|
||||
InTickCount = 0x18
|
||||
InActualLock = 0x1c
|
||||
InDispatchAddress = 0x20
|
||||
InVector = 0x24
|
||||
InIrql = 0x28
|
||||
InSynchronizeIrql = 0x29
|
||||
InFloatingSave = 0x2a
|
||||
InConnected = 0x2b
|
||||
InNumber = 0x2c
|
||||
InShareVector = 0x2d
|
||||
InMode = 0x30
|
||||
InServiceCount = 0x34
|
||||
InDispatchCount = 0x38
|
||||
InDispatchCode = 0x3c
|
||||
InterruptObjectLength = 0x1e4
|
||||
|
||||
/* IO_STATUS_BLOCK */
|
||||
IoStatus = 0x0
|
||||
IoPointer = 0x0
|
||||
IoInformation = 0x4
|
||||
|
||||
/* KNODE */
|
||||
KnPfnDereferenceSListHead = 0x8
|
||||
KnProcessorMask = 0x10
|
||||
KnColor = 0x14
|
||||
KnSeed = 0x18
|
||||
KnNodeNumber = 0x19
|
||||
KnFlags = 0x1a
|
||||
knMmShiftedColor = 0x1e
|
||||
KnFreeCount = 0x22
|
||||
KnPfnDeferredList = 0x2a
|
||||
KNODE_SIZE = 0x2e
|
||||
|
||||
/* KSPIN_LOCK_QUEUE */
|
||||
LqNext = 0x0
|
||||
LqLock = 0x4
|
||||
|
||||
/* KLOCK_QUEUE_HANDLE */
|
||||
LqhNext = 0x0
|
||||
LqhLock = 0x4
|
||||
LqhOldIrql = 0x8
|
||||
LOCK_QUEUE_HEADER_SIZE = 0xc
|
||||
|
||||
/* LARGE_INTEGER */
|
||||
LiLowPart = 0x0
|
||||
LiHighPart = 0x4
|
||||
|
||||
/* LIST_ENTRY */
|
||||
LsFlink = 0x0
|
||||
LsBlink = 0x4
|
||||
|
||||
/* PEB */
|
||||
PeKernelCallbackTable = 0x2c
|
||||
ProcessEnvironmentBlockLength = 0x230
|
||||
|
||||
/* KPROFILE */
|
||||
PfType = 0x0
|
||||
PfSize = 0x2
|
||||
PfProfileListEntry = 0x4
|
||||
PfProcess = 0xc
|
||||
PfRangeBase = 0x10
|
||||
PfRangeLimit = 0x14
|
||||
PfBucketShift = 0x18
|
||||
PfBuffer = 0x1c
|
||||
PfSegment = 0x20
|
||||
PfAffinity = 0x24
|
||||
PfSource = 0x28
|
||||
PfStarted = 0x2c
|
||||
ProfileObjectLength = 0x30
|
||||
|
||||
/* PORT_MESSAGE */
|
||||
PmLength = 0x0
|
||||
PmZeroInit = 0x4
|
||||
PmClientId = 0x8
|
||||
PmProcess = 0x8
|
||||
PmThread = 0xc
|
||||
PmMessageId = 0x10
|
||||
PmClientViewSize = 0x14
|
||||
PortMessageLength = 0x18
|
||||
|
||||
/* KPROCESS */
|
||||
PrType = 0x0
|
||||
PrSize = 0x2
|
||||
PrSignalState = 0x4
|
||||
PrProfileListHead = 0x10
|
||||
PrDirectoryTableBase = 0x18
|
||||
PrLdtDescriptor = 0x20
|
||||
PrIopmOffset = 0x30
|
||||
PrInt21Descriptor = 0x28
|
||||
PrVdmTrapcHandler = 0x4c
|
||||
PrFlags = 0x6b
|
||||
PrActiveProcessors = 0x34
|
||||
PrKernelTime = 0x38
|
||||
PrUserTime = 0x3c
|
||||
PrReadyListHead = 0x40
|
||||
PrSwapListEntry = 0x48
|
||||
PrThreadListHead = 0x50
|
||||
PrProcessLock = 0x58
|
||||
PrAffinity = 0x5c
|
||||
PrProcessFlags = 0x60
|
||||
PrBasePriority = 0x64
|
||||
PrQuantumReset = 0x65
|
||||
PrState = 0x66
|
||||
PrStackCount = 0x6c
|
||||
KernelProcessObjectLength = 0x78
|
||||
|
||||
/* KQUEUE */
|
||||
QuType = 0x0
|
||||
QuSize = 0x2
|
||||
QuSignalState = 0x4
|
||||
QuEntryListHead = 0x10
|
||||
QuCurrentCount = 0x18
|
||||
QuMaximumCount = 0x1c
|
||||
QuThreadListHead = 0x20
|
||||
QueueObjectLength = 0x28
|
||||
|
||||
/* STRING */
|
||||
StrLength = 0x0
|
||||
StrMaximumLength = 0x2
|
||||
StrBuffer = 0x4
|
||||
|
||||
/* TEB */
|
||||
TeCmTeb = 0x0
|
||||
TeExceptionList = 0x0
|
||||
TeStackBase = 0x4
|
||||
TeStackLimit = 0x8
|
||||
TeFiberData = 0x10
|
||||
TeSelf = 0x18
|
||||
TeEnvironmentPointer = 0x1c
|
||||
TeClientId = 0x20
|
||||
TeActiveRpcHandle = 0x28
|
||||
TeThreadLocalStoragePointer = 0x2c
|
||||
TeCountOfOwnedCriticalSections = 0x38
|
||||
TePeb = 0x30
|
||||
TeCsrClientThread = 0x3c
|
||||
TeWOW32Reserved = 0xc0
|
||||
TeExceptionCode = 0x1a4
|
||||
TeActivationContextStackPointer = 0x1a8
|
||||
TeGdiClientPID = 0x6c0
|
||||
TeGdiClientTID = 0x6c4
|
||||
TeGdiThreadLocalInfo = 0x6c8
|
||||
TeglDispatchTable = 0x7c4
|
||||
TeglReserved1 = 0xb68
|
||||
TeglReserved2 = 0xbdc
|
||||
TeglSectionInfo = 0xbe0
|
||||
TeglSection = 0xbe4
|
||||
TeglTable = 0xbe8
|
||||
TeglCurrentRC = 0xbec
|
||||
TeglContext = 0xbf0
|
||||
TeDeallocationStack = 0xe0c
|
||||
TeTlsSlots = 0xe10
|
||||
TeTlsExpansionSlots = 0xf94
|
||||
TeLastErrorValue = 0x34
|
||||
TeVdm = 0xf18
|
||||
TeInstrumentation = 0xf2c
|
||||
TeGdiBatchCount = 0xf70
|
||||
TeGuaranteedStackBytes = 0xf78
|
||||
TeFlsData = 0xfb4
|
||||
ThreadEnvironmentBlockLength = 0xfbc
|
||||
|
||||
/* TIME_FIELDS */
|
||||
TfSecond = 0xa
|
||||
TfMinute = 0x8
|
||||
TfHour = 0x6
|
||||
TfWeekday = 0xe
|
||||
TfDay = 0x4
|
||||
TfMonth = 0x2
|
||||
TfYear = 0x0
|
||||
TfMilliseconds = 0xc
|
||||
|
||||
/* KTHREAD */
|
||||
ThType = 0x0
|
||||
ThSize = 0x2
|
||||
ThLock = 0x0
|
||||
ThDebugActive = 0x3
|
||||
ThSignalState = 0x4
|
||||
ThInitialStack = 0x18
|
||||
ThStackLimit = 0x1c
|
||||
ThKernelStack = 0x20
|
||||
ThThreadLock = 0x24
|
||||
ThAlerted = 0x5e
|
||||
ThApcState = 0x28
|
||||
ThPriority = 0x5b
|
||||
ThSwapBusy = 0x5d
|
||||
ThNextProcessor = 0x40
|
||||
ThDeferredProcessor = 0x41
|
||||
ThApcQueueLock = 0x44
|
||||
ThContextSwitches = 0x48
|
||||
ThState = 0x4c
|
||||
ThNpxState = 0x4d
|
||||
ThWaitIrql = 0x4e
|
||||
ThWaitMode = 0x4f
|
||||
ThWaitStatus = 0x50
|
||||
ThWaitBlockList = 0x54
|
||||
ThGateObject = 0x54
|
||||
ThWaitListEntry = 0x60
|
||||
ThSwapListEntry = 0x60
|
||||
ThQueue = 0x68
|
||||
ThWaitTime = 0x6c
|
||||
ThCombinedApcDisable = 0x70
|
||||
ThKernelApcDisable = 0x70
|
||||
ThSpecialApcDisable = 0x72
|
||||
ThTeb = 0x74
|
||||
ThTimer = 0x78
|
||||
ThThreadFlags = 0xa0
|
||||
ThServiceTable = 0x118
|
||||
ThWaitBlock = 0xa8
|
||||
ThResourceIndex = 0xef
|
||||
ThQueueListEntry = 0x108
|
||||
ThTrapFrame = 0x110
|
||||
ThCallbackStack = 0x114
|
||||
ThApcStateIndex = 0x11c
|
||||
ThIdealProcessor = 0x11d
|
||||
ThBasePriority = 0x121
|
||||
ThPriorityDecrement = 0x122
|
||||
ThAdjustReason = 0x42
|
||||
ThAdjustIncrement = 0x43
|
||||
ThPreviousMode = 0xd7
|
||||
ThSaturation = 0x123
|
||||
ThFreezeCount = 0x14f
|
||||
ThUserAffinity = 0x124
|
||||
ThProcess = 0x128
|
||||
ThAffinity = 0x12c
|
||||
ThUserIdealProcessor = 0x151
|
||||
ThApcStatePointer = 0x130
|
||||
ThSavedApcState = 0x138
|
||||
ThWaitReason = 0x5a
|
||||
ThSuspendCount = 0x150
|
||||
ThWin32Thread = 0x154
|
||||
ThStackBase = 0x158
|
||||
ThSuspendApc = 0x15c
|
||||
ThPowerState = 0x18b
|
||||
ThKernelTime = 0x160
|
||||
ThLegoData = 0x184
|
||||
ThLargeStack = 0x107
|
||||
ThUserTime = 0x18c
|
||||
ThSuspendSemaphore = 0x190
|
||||
ThSListFaultCount = 0x1a4
|
||||
ThThreadListEntry = 0x1a8
|
||||
ThMutantListHead = 0x10
|
||||
ThSListFaultAddress = 0x1b0
|
||||
KernelThreadObjectLength = 0x1b8
|
||||
ExecutiveThreadObjectLength = 0x250
|
||||
|
||||
/* KTIMER */
|
||||
TiType = 0x0
|
||||
TiSize = 0x2
|
||||
TiInserted = 0x3
|
||||
TiSignalState = 0x4
|
||||
TiDueTime = 0x10
|
||||
TiTimerListEntry = 0x18
|
||||
TiDpc = 0x20
|
||||
TiPeriod = 0x24
|
||||
TimerObjectLength = 0x28
|
||||
|
||||
/* TIME */
|
||||
|
||||
/* KUSER_SHARED_DATA */
|
||||
UsTickCountMultiplier = 0x4
|
||||
UsInterruptTime = 0x8
|
||||
UsSystemTime = 0x14
|
||||
UsTimeZoneBias = 0x20
|
||||
UsImageNumberLow = 0x2c
|
||||
UsImageNumberHigh = 0x2e
|
||||
UsNtSystemRoot = 0x30
|
||||
UsMaxStackTraceDepth = 0x238
|
||||
UsCryptoExponent = 0x23c
|
||||
UsTimeZoneId = 0x240
|
||||
UsLargePageMinimum = 0x244
|
||||
UsReserved2 = 0x248
|
||||
UsNtProductType = 0x264
|
||||
UsProductTypeIsValid = 0x268
|
||||
UsNtMajorVersion = 0x26c
|
||||
UsNtMinorVersion = 0x270
|
||||
UsProcessorFeatures = 0x274
|
||||
UsReserved1 = 0x2b4
|
||||
UsReserved3 = 0x2b8
|
||||
UsTimeSlip = 0x2bc
|
||||
UsAlternativeArchitecture = 0x2c0
|
||||
UsSystemExpirationDate = 0x2c8
|
||||
UsSuiteMask = 0x2d0
|
||||
UsKdDebuggerEnabled = 0x2d4
|
||||
UsActiveConsoleId = 0x2d8
|
||||
UsDismountCount = 0x2dc
|
||||
UsComPlusPackage = 0x2e0
|
||||
UsLastSystemRITEventTickCount = 0x2e4
|
||||
UsNumberOfPhysicalPages = 0x2e8
|
||||
UsSafeBootMode = 0x2ec
|
||||
UsTestRetInstruction = 0x2f8
|
||||
UsSystemCall = 0x300
|
||||
UsSystemCallReturn = 0x304
|
||||
UsSystemCallPad = 0x308
|
||||
UsTickCount = 0x320
|
||||
UsTickCountQuad = 0x320
|
||||
UsWow64SharedInformation = 0x340
|
||||
|
||||
/* KWAIT_BLOCK */
|
||||
WbWaitListEntry = 0x0
|
||||
WbThread = 0x8
|
||||
WbObject = 0xc
|
||||
WbNextWaitBlock = 0x10
|
||||
WbWaitKey = 0x14
|
||||
WbWaitType = 0x16
|
||||
|
||||
/* CR0 flags */
|
||||
CR0_PE = 0x1
|
||||
CR0_MP = 0x2
|
||||
CR0_EM = 0x4
|
||||
CR0_TS = 0x8
|
||||
CR0_ET = 0x10
|
||||
CR0_NE = 0x20
|
||||
CR0_WP = 0x10000
|
||||
CR0_AM = 0x40000
|
||||
CR0_NW = 0x20000000
|
||||
CR0_CD = 0x40000000
|
||||
CR0_PG = 0x80000000
|
||||
|
||||
/* CR4 flags */
|
||||
CR4_VME = 0x1
|
||||
CR4_PVI = 0x2
|
||||
CR4_TSD = 0x4
|
||||
CR4_DE = 0x8
|
||||
CR4_PSE = 0x10
|
||||
CR4_PAE = 0x20
|
||||
CR4_MCE = 0x40
|
||||
CR4_PGE = 0x80
|
||||
CR4_FXSR = 0x200
|
||||
CR4_XMMEXCPT = 0x400
|
||||
|
||||
/* KeFeatureBits flags */
|
||||
KF_RDTSC = 0x2
|
||||
KF_CR4 = 0x4
|
||||
KF_GLOBAL_PAGE = 0x10
|
||||
KF_LARGE_PAGE = 0x20
|
||||
KF_CMPXCHG8B = 0x80
|
||||
KF_FAST_SYSCALL = 0x1000
|
||||
KF_V86_VIS = 0x1
|
||||
|
||||
/* Machine type definitions */
|
||||
MACHINE_TYPE_ISA = 0x0
|
||||
MACHINE_TYPE_EISA = 0x1
|
||||
MACHINE_TYPE_MCA = 0x2
|
||||
|
||||
/* EFLAGS */
|
||||
EFLAGS_TF = 0x100
|
||||
EFLAGS_INTERRUPT_MASK = 0x200
|
||||
EFLAGS_V86_MASK = 0x20000
|
||||
EFLAGS_ALIGN_CHECK = 0x40000
|
||||
EFLAGS_VIF = 0x80000
|
||||
EFLAGS_VIP = 0x100000
|
||||
EFLAGS_USER_SANITIZE = 0x3f4dd7
|
||||
|
||||
/* KDGT selectors */
|
||||
KGDT_R3_DATA = 0x20
|
||||
KGDT_R3_CODE = 0x18
|
||||
KGDT_R0_CODE = 0x8
|
||||
KGDT_R0_DATA = 0x10
|
||||
KGDT_R0_PCR = 0x30
|
||||
KGDT_TSS = 0x28
|
||||
KGDT_R3_TEB = 0x38
|
||||
KGDT_DF_TSS = 0x50
|
||||
KGDT_NMI_TSS = 0x58
|
||||
KGDT_LDT = 0x48
|
||||
NPX_STATE_NOT_LOADED = 0xa
|
||||
NPX_STATE_LOADED = 0x0
|
||||
PF_XMMI_INSTRUCTIONS_AVAILABLE = 0x6
|
||||
EFLAG_SELECT = 0xc000
|
||||
|
||||
/* CONTEXT */
|
||||
CsContextFlags = 0x0
|
||||
CsDr0 = 0x4
|
||||
CsDr1 = 0x8
|
||||
CsDr2 = 0xc
|
||||
CsDr3 = 0x10
|
||||
CsDr6 = 0x14
|
||||
CsDr7 = 0x18
|
||||
CsFloatSave = 0x1c
|
||||
CsSegGs = 0x8c
|
||||
CsSegFs = 0x90
|
||||
CsSegEs = 0x94
|
||||
CsSegDs = 0x98
|
||||
CsEdi = 0x9c
|
||||
CsEsi = 0xa0
|
||||
CsEbx = 0xa4
|
||||
CsEdx = 0xa8
|
||||
CsEcx = 0xac
|
||||
CsEax = 0xb0
|
||||
CsEbp = 0xb4
|
||||
CsEip = 0xb8
|
||||
CsSegCs = 0xbc
|
||||
CsEflags = 0xc0
|
||||
CsEsp = 0xc4
|
||||
CsSegSs = 0xc8
|
||||
CsExtendedRegisters = 0xcc
|
||||
ContextFrameLength = 0x2cc
|
||||
CONTEXT_LENGTH = 0x2cc
|
||||
|
||||
/* KGDTENTRY */
|
||||
KgdtBaseLow = 0x2
|
||||
KgdtBaseMid = 0x4
|
||||
KgdtBaseHi = 0x7
|
||||
KgdtLimitHi = 0x6
|
||||
KgdtLimitLow = 0x0
|
||||
|
||||
/* KTRAP_FRAME */
|
||||
TsExceptionList = 0x4c
|
||||
TsPreviousPreviousMode = 0x48
|
||||
TsSegGs = 0x30
|
||||
TsSegFs = 0x50
|
||||
TsSegEs = 0x34
|
||||
TsSegDs = 0x38
|
||||
TsEdi = 0x54
|
||||
TsEsi = 0x58
|
||||
TsEbp = 0x60
|
||||
TsEbx = 0x5c
|
||||
TsEdx = 0x3c
|
||||
TsEcx = 0x40
|
||||
TsEax = 0x44
|
||||
TsErrCode = 0x64
|
||||
TsEip = 0x68
|
||||
TsSegCs = 0x6c
|
||||
TsEflags = 0x70
|
||||
TsHardwareEsp = 0x74
|
||||
TsHardwareSegSs = 0x78
|
||||
TsTempSegCs = 0x10
|
||||
TsTempEsp = 0x14
|
||||
TsDbgEbp = 0x0
|
||||
TsDbgEip = 0x4
|
||||
TsDbgArgMark = 0x8
|
||||
TsDbgArgPointer = 0xc
|
||||
TsDr0 = 0x18
|
||||
TsDr1 = 0x1c
|
||||
TsDr2 = 0x20
|
||||
TsDr3 = 0x24
|
||||
TsDr6 = 0x28
|
||||
TsDr7 = 0x2c
|
||||
TsV86Es = 0x7c
|
||||
TsV86Ds = 0x80
|
||||
TsV86Fs = 0x84
|
||||
TsV86Gs = 0x88
|
||||
KTRAP_FRAME_LENGTH = 0x8c
|
||||
KTRAP_FRAME_ALIGN = 0x4
|
||||
FRAME_EDITED = 0xfff8
|
||||
|
||||
/* KTSS */
|
||||
TssEsp0 = 0x4
|
||||
TssCR3 = 0x1c
|
||||
TssEip = 0x20
|
||||
TssEFlags = 0x24
|
||||
TssEax = 0x28
|
||||
TssEbx = 0x34
|
||||
TssEcx = 0x2c
|
||||
TssEdx = 0x30
|
||||
TssEsp = 0x38
|
||||
TssEbp = 0x3c
|
||||
TssEsi = 0x40
|
||||
TssEdi = 0x44
|
||||
TssEs = 0x48
|
||||
TssCs = 0x4c
|
||||
TssSs = 0x50
|
||||
TssDs = 0x54
|
||||
TssFs = 0x58
|
||||
TssGs = 0x5c
|
||||
TssLDT = 0x60
|
||||
TssIoMapBase = 0x66
|
||||
TssIoMaps = 0x68
|
||||
TssLength = 0x20ac
|
||||
|
||||
/* KPCR */
|
||||
KPCR_EXCEPTION_LIST = 0x0
|
||||
KPCR_PERF_GLOBAL_GROUP_MASK = 0x8
|
||||
KPCR_CONTEXT_SWITCHES = 0x10
|
||||
KPCR_TEB = 0x18
|
||||
KPCR_SELF = 0x1c
|
||||
KPCR_PRCB = 0x20
|
||||
KPCR_IDT = 0x38
|
||||
KPCR_GDT = 0x3c
|
||||
KPCR_TSS = 0x40
|
||||
KPCR_STALL_SCALE_FACTOR = 0x4c
|
||||
KPCR_PRCB_DATA = 0x120
|
||||
KPCR_CURRENT_THREAD = 0x124
|
||||
KPCR_PRCB_NEXT_THREAD = 0x128
|
||||
KPCR_PRCB_DPC_QUEUE_DEPTH = 0xa4c
|
||||
KPCR_PRCB_DPC_STACK = 0xa68
|
||||
KPCR_PRCB_MAXIMUM_DPC_QUEUE_DEPTH = 0xa6c
|
||||
KPCR_PRCB_DPC_ROUTINE_ACTIVE = 0xa7a
|
||||
KPCR_PRCB_TIMER_REQUEST = 0xa88
|
||||
KPCR_PRCB_QUANTUM_END = 0xaa1
|
||||
KPCR_PRCB_DEFERRED_READY_LIST_HEAD = 0xc10
|
||||
KPCR_PRCB_POWER_STATE_IDLE_FUNCTION = 0xec0
|
||||
|
||||
/* KTRAP_FRAME */
|
||||
KTRAP_FRAME_DEBUGEBP = 0x0
|
||||
KTRAP_FRAME_DEBUGEIP = 0x4
|
||||
KTRAP_FRAME_TEMPESP = 0x14
|
||||
KTRAP_FRAME_DR0 = 0x18
|
||||
KTRAP_FRAME_DR1 = 0x1c
|
||||
KTRAP_FRAME_DR2 = 0x20
|
||||
KTRAP_FRAME_DR3 = 0x24
|
||||
KTRAP_FRAME_DR6 = 0x28
|
||||
KTRAP_FRAME_DR7 = 0x2c
|
||||
KTRAP_FRAME_GS = 0x30
|
||||
KTRAP_FRAME_ES = 0x34
|
||||
KTRAP_FRAME_DS = 0x38
|
||||
KTRAP_FRAME_EDX = 0x3c
|
||||
KTRAP_FRAME_ECX = 0x40
|
||||
KTRAP_FRAME_EAX = 0x44
|
||||
KTRAP_FRAME_PREVIOUS_MODE = 0x48
|
||||
KTRAP_FRAME_EXCEPTION_LIST = 0x4c
|
||||
KTRAP_FRAME_FS = 0x50
|
||||
KTRAP_FRAME_EDI = 0x54
|
||||
KTRAP_FRAME_ESI = 0x58
|
||||
KTRAP_FRAME_EBX = 0x5c
|
||||
KTRAP_FRAME_EBP = 0x60
|
||||
KTRAP_FRAME_ERROR_CODE = 0x64
|
||||
KTRAP_FRAME_EIP = 0x68
|
||||
KTRAP_FRAME_EFLAGS = 0x70
|
||||
KTRAP_FRAME_ESP = 0x74
|
||||
KTRAP_FRAME_SS = 0x78
|
||||
KTRAP_FRAME_V86_ES = 0x7c
|
||||
KTRAP_FRAME_V86_DS = 0x80
|
||||
KTRAP_FRAME_V86_FS = 0x84
|
||||
KTRAP_FRAME_V86_GS = 0x88
|
||||
KTRAP_FRAME_SIZE = 0x8c
|
||||
FRAME_EDITED = 0xfff8
|
||||
|
||||
/* CONTEXT */
|
||||
CONTEXT_FLAGS = 0x0
|
||||
CONTEXT_SEGGS = 0x8c
|
||||
CONTEXT_SEGFS = 0x90
|
||||
CONTEXT_SEGES = 0x94
|
||||
CONTEXT_SEGDS = 0x98
|
||||
CONTEXT_EDI = 0x9c
|
||||
CONTEXT_ESI = 0xa0
|
||||
CONTEXT_EBX = 0xa4
|
||||
CONTEXT_EDX = 0xa8
|
||||
CONTEXT_ECX = 0xac
|
||||
CONTEXT_EAX = 0xb0
|
||||
CONTEXT_EBP = 0xb4
|
||||
CONTEXT_EIP = 0xb8
|
||||
CONTEXT_SEGCS = 0xbc
|
||||
CONTEXT_EFLAGS = 0xc0
|
||||
CONTEXT_ESP = 0xc4
|
||||
CONTEXT_SEGSS = 0xc8
|
||||
CONTEXT_FRAME_LENGTH = 0x2cc
|
||||
|
||||
/* FIBER */
|
||||
FIBER_PARAMETER = 0x0
|
||||
FIBER_EXCEPTION_LIST = 0x4
|
||||
FIBER_STACK_BASE = 0x8
|
||||
FIBER_STACK_LIMIT = 0xc
|
||||
FIBER_DEALLOCATION_STACK = 0x10
|
||||
FIBER_CONTEXT = 0x14
|
||||
FIBER_CONTEXT_FLAGS = 0x14
|
||||
FIBER_CONTEXT_EAX = 0xc4
|
||||
FIBER_CONTEXT_EBX = 0xb8
|
||||
FIBER_CONTEXT_ECX = 0xc0
|
||||
FIBER_CONTEXT_EDX = 0xbc
|
||||
FIBER_CONTEXT_ESI = 0xb4
|
||||
FIBER_CONTEXT_EDI = 0xb0
|
||||
FIBER_CONTEXT_EBP = 0xc8
|
||||
FIBER_CONTEXT_EIP = 0xcc
|
||||
FIBER_CONTEXT_ESP = 0xd8
|
||||
FIBER_CONTEXT_DR6 = 0x28
|
||||
FIBER_CONTEXT_FLOAT_SAVE_CONTROL_WORD = 0x30
|
||||
FIBER_CONTEXT_FLOAT_SAVE_STATUS_WORD = 0x34
|
||||
FIBER_CONTEXT_FLOAT_SAVE_TAG_WORD = 0x38
|
||||
FIBER_GUARANTEED_STACK_BYTES = 0x2e0
|
||||
FIBER_FLS_DATA = 0x2e4
|
||||
FIBER_ACTIVATION_CONTEXT_STACK = 0x2e8
|
||||
|
||||
/* KTSS */
|
||||
KTSS_IOMAPBASE = 0x66
|
||||
KTSS_ESP0 = 0x4
|
||||
|
||||
/* EXCEPTION_RECORD */
|
||||
EXCEPTION_RECORD_EXCEPTION_CODE = 0x0
|
||||
EXCEPTION_RECORD_EXCEPTION_FLAGS = 0x4
|
||||
EXCEPTION_RECORD_EXCEPTION_RECORD = 0x8
|
||||
EXCEPTION_RECORD_EXCEPTION_ADDRESS = 0xc
|
||||
EXCEPTION_RECORD_NUMBER_PARAMETERS = 0x10
|
||||
EXCEPTION_RECORD_EXCEPTION_ADDRESS = 0xc
|
||||
SIZEOF_EXCEPTION_RECORD = 0x50
|
||||
EXCEPTION_RECORD_LENGTH = 0x50
|
||||
|
||||
/* KTHREAD */
|
||||
KTHREAD_DEBUG_ACTIVE = 0x3
|
||||
KTHREAD_INITIAL_STACK = 0x18
|
||||
KTHREAD_STACK_LIMIT = 0x1c
|
||||
KTHREAD_TEB = 0x74
|
||||
KTHREAD_KERNEL_STACK = 0x20
|
||||
KTHREAD_APCSTATE_PROCESS = 0x38
|
||||
KTHREAD_PENDING_KERNEL_APC = 0x3d
|
||||
KTHREAD_CONTEXT_SWITCHES = 0x48
|
||||
KTHREAD_STATE_ = 0x4c
|
||||
KTHREAD_NPX_STATE = 0x4d
|
||||
KTHREAD_WAIT_IRQL = 0x4e
|
||||
KTHREAD_WAIT_REASON = 0x5a
|
||||
KTHREAD_COMBINED_APC_DISABLE = 0x70
|
||||
KTHREAD_SPECIAL_APC_DISABLE = 0x72
|
||||
KTHREAD_LARGE_STACK = 0x107
|
||||
KTHREAD_TRAP_FRAME = 0x110
|
||||
KTHREAD_CALLBACK_STACK = 0x114
|
||||
KTHREAD_APC_STATE_INDEX = 0x11c
|
||||
KTHREAD_STACK_BASE = 0x158
|
||||
|
||||
/* KPROCESS */
|
||||
KPROCESS_DIRECTORY_TABLE_BASE = 0x18
|
||||
KPROCESS_LDT_DESCRIPTOR0 = 0x20
|
||||
KPROCESS_LDT_DESCRIPTOR1 = 0x24
|
||||
KPROCESS_INT21_DESCRIPTOR0 = 0x28
|
||||
KPROCESS_INT21_DESCRIPTOR1 = 0x2c
|
||||
KPROCESS_IOPM_OFFSET = 0x30
|
||||
|
||||
/* Teb */
|
||||
TEB_EXCEPTION_LIST = 0x0
|
||||
TEB_STACK_LIMIT = 0x8
|
||||
TEB_STACK_BASE = 0x4
|
||||
TEB_SELF = 0x18
|
||||
TEB_FIBER_DATA = 0x10
|
||||
TEB_PEB = 0x30
|
||||
TEB_EXCEPTION_CODE = 0x1a4
|
||||
PEB_KERNEL_CALLBACK_TABLE = 0x2c
|
||||
TEB_FLS_DATA = 0xfb4
|
||||
TEB_ACTIVATION_CONTEXT_STACK_POINTER = 0x1a8
|
||||
TEB_GUARANTEED_STACK_BYTES = 0xf78
|
||||
TEB_DEALLOCATION_STACK = 0xe0c
|
||||
|
||||
/* Misc */
|
||||
NPX_FRAME_LENGTH = 0x210
|
||||
FN_CR0_NPX_STATE = 0x20c
|
||||
DR7_RESERVED_MASK = 0xdc00
|
||||
FP_CONTROL_WORD = 0x0
|
||||
FP_STATUS_WORD = 0x4
|
||||
FP_TAG_WORD = 0x8
|
||||
FP_DATA_SELECTOR = 0x18
|
||||
CBSTACK_RESULT = 0x20
|
||||
CBSTACK_RESULT_LENGTH = 0x24
|
||||
CBSTACK_TRAP_FRAME = 0x4
|
||||
CBSTACK_CALLBACK_STACK = 0x8
|
||||
SIZEOF_FX_SAVE_AREA = 0x210
|
||||
KUSER_SHARED_SYSCALL = 0x7ffe0300
|
||||
EXCEPTION_EXECUTE_HANDLER = 0x1
|
||||
STATUS_CALLBACK_POP_STACK = 0xc0000423
|
||||
CONTEXT_ALIGNED_SIZE = 0x2cc
|
||||
PROCESSOR_FEATURE_FXSR = 0x7ffe0278
|
|
@ -6,7 +6,7 @@
|
|||
* PROGRAMER: Timo Kreuzer (timo.kreuzer@reactos.org)
|
||||
*/
|
||||
|
||||
#include <reactos/asm.h>
|
||||
#include <asm.inc>
|
||||
|
||||
/* GLOBALS ****************************************************************/
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include <reactos/asm.h>
|
||||
#include <ndk/amd64/asm.h>
|
||||
#include <asm.inc>
|
||||
#include <ksamd64.inc>
|
||||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
|
|
|
@ -8,8 +8,7 @@
|
|||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include <reactos/asm.h>
|
||||
#include <ndk/amd64/asm.h>
|
||||
#include <asm.inc>
|
||||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
* PROGRAMMERS: Timo Kreuzer
|
||||
*/
|
||||
|
||||
#include <reactos/asm.h>
|
||||
#include <ndk/amd64/asm.h>
|
||||
#include <asm.inc>
|
||||
#include <ksamd64.inc>
|
||||
|
||||
#define SLIST8A_DEPTH_MASK HEX(000000000000FFFF)
|
||||
#define SLIST8A_DEPTH_INC HEX(0000000000000001)
|
||||
|
|
|
@ -6,43 +6,39 @@
|
|||
* PROGRAMER: Alex Ionescu (alex@relsoft.net)
|
||||
*/
|
||||
|
||||
.intel_syntax noprefix
|
||||
#include <asm.inc>
|
||||
|
||||
/* GLOBALS ****************************************************************/
|
||||
|
||||
.globl _DbgBreakPoint@0
|
||||
.globl _DbgBreakPointWithStatus@4
|
||||
.globl _DbgUserBreakPoint@0
|
||||
.globl _DebugService@20
|
||||
.globl _DebugService2@12
|
||||
.globl _DbgBreakPointNoBugCheck@0
|
||||
.globl _RtlpBreakWithStatusInstruction@0
|
||||
PUBLIC _DbgBreakPoint@0
|
||||
PUBLIC _DbgBreakPointWithStatus@4
|
||||
PUBLIC _DbgUserBreakPoint@0
|
||||
PUBLIC _DebugService@20
|
||||
PUBLIC _DebugService2@12
|
||||
PUBLIC _DbgBreakPointNoBugCheck@0
|
||||
PUBLIC _RtlpBreakWithStatusInstruction@0
|
||||
|
||||
/* FUNCTIONS ***************************************************************/
|
||||
|
||||
.func DbgBreakPointNoBugCheck@0
|
||||
.code
|
||||
|
||||
_DbgBreakPointNoBugCheck@0:
|
||||
int 3
|
||||
ret
|
||||
.endfunc
|
||||
|
||||
.func DbgBreakPoint@0
|
||||
_DbgBreakPoint@0:
|
||||
_DbgUserBreakPoint@0:
|
||||
int 3
|
||||
ret
|
||||
.endfunc
|
||||
|
||||
.func DbgBreakPointWithStatus@4
|
||||
_DbgBreakPointWithStatus@4:
|
||||
mov eax, [esp+4]
|
||||
|
||||
_RtlpBreakWithStatusInstruction@0:
|
||||
int 3
|
||||
ret 4
|
||||
.endfunc
|
||||
|
||||
.func DebugService2@12
|
||||
|
||||
_DebugService2@12:
|
||||
|
||||
/* Setup the stack */
|
||||
|
@ -53,15 +49,14 @@ _DebugService2@12:
|
|||
mov eax, [ebp+16]
|
||||
mov ecx, [ebp+8]
|
||||
mov edx, [ebp+12]
|
||||
int 0x2D
|
||||
int HEX(2D)
|
||||
int 3
|
||||
|
||||
/* Restore stack */
|
||||
pop ebp
|
||||
ret 12
|
||||
.endfunc
|
||||
|
||||
.func DebugService@20
|
||||
|
||||
_DebugService@20:
|
||||
|
||||
/* Setup the stack */
|
||||
|
@ -78,7 +73,7 @@ _DebugService@20:
|
|||
mov edx, [ebp+16]
|
||||
mov ebx, [ebp+20]
|
||||
mov edi, [ebp+24]
|
||||
int 0x2D
|
||||
int HEX(2D)
|
||||
int 3
|
||||
|
||||
/* Restore registers */
|
||||
|
@ -88,4 +83,5 @@ _DebugService@20:
|
|||
/* Return */
|
||||
pop ebp
|
||||
ret 20
|
||||
.endfunc
|
||||
|
||||
END
|
||||
|
|
|
@ -9,8 +9,13 @@
|
|||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include <ndk/asm.h>
|
||||
.intel_syntax noprefix
|
||||
#include <asm.inc>
|
||||
#include <ks386.inc>
|
||||
|
||||
EXTERN _RtlpCheckForActiveDebugger@0:PROC
|
||||
EXTERN _RtlDispatchException@8:PROC
|
||||
EXTERN _ZwContinue@8:PROC
|
||||
EXTERN _ZwRaiseException@12:PROC
|
||||
|
||||
#define ExceptionContinueSearch 1
|
||||
#define ExceptionNestedException 2
|
||||
|
@ -18,17 +23,17 @@
|
|||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
.func RtlpGetExceptionList@0
|
||||
.globl _RtlpGetExceptionList@0
|
||||
.code
|
||||
|
||||
PUBLIC _RtlpGetExceptionList@0
|
||||
_RtlpGetExceptionList@0:
|
||||
|
||||
/* Return the exception list */
|
||||
mov eax, fs:[TEB_EXCEPTION_LIST]
|
||||
ret
|
||||
.endfunc
|
||||
|
||||
.func RtlpSetExceptionList@4
|
||||
.globl _RtlpSetExceptionList@4
|
||||
|
||||
PUBLIC _RtlpSetExceptionList@4
|
||||
_RtlpSetExceptionList@4:
|
||||
|
||||
/* Get the new list */
|
||||
|
@ -40,10 +45,9 @@ _RtlpSetExceptionList@4:
|
|||
|
||||
/* Return */
|
||||
ret 4
|
||||
.endfunc
|
||||
|
||||
.func RtlCaptureContext@4
|
||||
.globl _RtlCaptureContext@4
|
||||
|
||||
PUBLIC _RtlCaptureContext@4
|
||||
_RtlCaptureContext@4:
|
||||
|
||||
/* Preserve EBX and put the context in it */
|
||||
|
@ -61,10 +65,9 @@ _RtlCaptureContext@4:
|
|||
|
||||
/* Capture the other regs */
|
||||
jmp CaptureRest
|
||||
.endfunc
|
||||
|
||||
.func RtlpCaptureContext@4
|
||||
.globl _RtlpCaptureContext@4
|
||||
|
||||
PUBLIC _RtlpCaptureContext@4
|
||||
_RtlpCaptureContext@4:
|
||||
|
||||
/* Preserve EBX and put the context in it */
|
||||
|
@ -107,10 +110,9 @@ CaptureRest:
|
|||
/* Return to the caller */
|
||||
pop ebx
|
||||
ret 4
|
||||
.endfunc
|
||||
|
||||
.func RtlpExecuteHandlerForException@20
|
||||
.globl _RtlpExecuteHandlerForException@20
|
||||
|
||||
PUBLIC _RtlpExecuteHandlerForException@20
|
||||
_RtlpExecuteHandlerForException@20:
|
||||
|
||||
/* Copy the routine in EDX */
|
||||
|
@ -118,16 +120,14 @@ _RtlpExecuteHandlerForException@20:
|
|||
|
||||
/* Jump to common routine */
|
||||
jmp _RtlpExecuteHandler@20
|
||||
.endfunc
|
||||
|
||||
.func RtlpExecuteHandlerForUnwind@20
|
||||
.globl _RtlpExecuteHandlerForUnwind@20
|
||||
|
||||
PUBLIC _RtlpExecuteHandlerForUnwind@20
|
||||
_RtlpExecuteHandlerForUnwind@20:
|
||||
/* Copy the routine in EDX */
|
||||
mov edx, offset _RtlpUnwindProtector
|
||||
.endfunc
|
||||
|
||||
.func RtlpExecuteHandler@20
|
||||
|
||||
_RtlpExecuteHandler@20:
|
||||
|
||||
/* Save non-volatile */
|
||||
|
@ -142,22 +142,21 @@ _RtlpExecuteHandler@20:
|
|||
xor edi, edi
|
||||
|
||||
/* Call the 2nd-stage executer */
|
||||
push [esp+0x20]
|
||||
push [esp+0x20]
|
||||
push [esp+0x20]
|
||||
push [esp+0x20]
|
||||
push [esp+0x20]
|
||||
push [esp+32]
|
||||
push [esp+32]
|
||||
push [esp+32]
|
||||
push [esp+32]
|
||||
push [esp+32]
|
||||
call _RtlpExecuteHandler2@20
|
||||
|
||||
/* Restore non-volatile */
|
||||
pop edi
|
||||
pop esi
|
||||
pop ebx
|
||||
ret 0x14
|
||||
.endfunc
|
||||
ret 20
|
||||
|
||||
.func RtlpExecuteHandler2@20
|
||||
.globl _RtlpExecuteHandler2@20
|
||||
|
||||
PUBLIC _RtlpExecuteHandler2@20
|
||||
_RtlpExecuteHandler2@20:
|
||||
|
||||
/* Set up stack frame */
|
||||
|
@ -165,7 +164,7 @@ _RtlpExecuteHandler2@20:
|
|||
mov ebp, esp
|
||||
|
||||
/* Save the Frame */
|
||||
push [ebp+0xC]
|
||||
push [ebp+12]
|
||||
|
||||
/* Push handler address */
|
||||
push edx
|
||||
|
@ -177,11 +176,11 @@ _RtlpExecuteHandler2@20:
|
|||
mov [fs:TEB_EXCEPTION_LIST], esp
|
||||
|
||||
/* Call the handler */
|
||||
push [ebp+0x14]
|
||||
push [ebp+0x10]
|
||||
push [ebp+0xC]
|
||||
push [ebp+20]
|
||||
push [ebp+16]
|
||||
push [ebp+12]
|
||||
push [ebp+8]
|
||||
mov ecx, [ebp+0x18]
|
||||
mov ecx, [ebp+24]
|
||||
call ecx
|
||||
|
||||
/* Unlink us */
|
||||
|
@ -193,10 +192,9 @@ _RtlpExecuteHandler2@20:
|
|||
/* Undo stack frame and return */
|
||||
mov esp, ebp
|
||||
pop ebp
|
||||
ret 0x14
|
||||
.endfunc
|
||||
ret 20
|
||||
|
||||
|
||||
.func RtlpExceptionProtector
|
||||
_RtlpExceptionProtector:
|
||||
|
||||
/* Assume we'll continue */
|
||||
|
@ -222,9 +220,8 @@ _RtlpExceptionProtector:
|
|||
|
||||
return:
|
||||
ret 16
|
||||
.endfunc
|
||||
|
||||
.func RtlpUnwindProtector
|
||||
|
||||
_RtlpUnwindProtector:
|
||||
|
||||
/* Assume we'll continue */
|
||||
|
@ -250,10 +247,9 @@ _RtlpUnwindProtector:
|
|||
|
||||
.return:
|
||||
ret 16
|
||||
.endfunc
|
||||
|
||||
.func RtlRaiseException@4
|
||||
.globl _RtlRaiseException@4
|
||||
|
||||
PUBLIC _RtlRaiseException@4
|
||||
_RtlRaiseException@4:
|
||||
|
||||
/* Set up stack frame */
|
||||
|
@ -325,10 +321,9 @@ RaiseStatus1:
|
|||
/* If we returned, raise a status */
|
||||
push eax
|
||||
call _RtlRaiseStatus@4
|
||||
.endfunc
|
||||
|
||||
.func RtlRaiseStatus@4
|
||||
.globl _RtlRaiseStatus@4
|
||||
|
||||
PUBLIC _RtlRaiseStatus@4
|
||||
_RtlRaiseStatus@4:
|
||||
|
||||
/* Set up stack frame */
|
||||
|
@ -398,4 +393,5 @@ RaiseStatus2:
|
|||
/* If we returned, raise a status */
|
||||
push eax
|
||||
call _RtlRaiseStatus@4
|
||||
.endfunc
|
||||
|
||||
END
|
||||
|
|
|
@ -6,20 +6,20 @@
|
|||
* PROGRAMMERS: Timo Kreuzer
|
||||
*/
|
||||
|
||||
.intel_syntax noprefix
|
||||
#include <asm.inc>
|
||||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
.code
|
||||
|
||||
/* PSLIST_ENTRY
|
||||
* NTAPI
|
||||
* RtlInterlockedPopEntrySList(
|
||||
* IN PSLIST_HEADER ListHead);
|
||||
*/
|
||||
.global _ExpInterlockedPopEntrySListResume@0
|
||||
.global _ExpInterlockedPopEntrySListEnd@0
|
||||
.global _ExpInterlockedPopEntrySListFault@0
|
||||
.global _RtlInterlockedPopEntrySList@4
|
||||
PUBLIC _ExpInterlockedPopEntrySListResume@0
|
||||
PUBLIC _ExpInterlockedPopEntrySListEnd@0
|
||||
PUBLIC _ExpInterlockedPopEntrySListFault@0
|
||||
PUBLIC _RtlInterlockedPopEntrySList@4
|
||||
_RtlInterlockedPopEntrySList@4:
|
||||
|
||||
/* Save registers */
|
||||
|
@ -35,10 +35,9 @@ _ExpInterlockedPopEntrySListResume@0:
|
|||
/* Load ListHead->Depth and ListHead->Sequence into edx */
|
||||
mov edx, [ebp + 4]
|
||||
|
||||
1:
|
||||
/* Check if ListHead->Next is NULL */
|
||||
or eax, eax
|
||||
jz 2f
|
||||
jz _ExpInterlockedPopEntrySList2
|
||||
|
||||
/* Copy Depth and Sequence number and adjust Depth */
|
||||
lea ecx, [edx - 1]
|
||||
|
@ -54,7 +53,7 @@ _ExpInterlockedPopEntrySListEnd@0:
|
|||
jnz _ExpInterlockedPopEntrySListResume@0
|
||||
|
||||
/* Restore registers and return */
|
||||
2:
|
||||
_ExpInterlockedPopEntrySList2:
|
||||
pop ebp
|
||||
pop ebx
|
||||
ret 4
|
||||
|
@ -66,7 +65,7 @@ _ExpInterlockedPopEntrySListEnd@0:
|
|||
* IN PSLIST_HEADER ListHead,
|
||||
* IN PSLIST_ENTRY ListEntry);
|
||||
*/
|
||||
.global _RtlInterlockedPushEntrySList@8
|
||||
PUBLIC _RtlInterlockedPushEntrySList@8
|
||||
_RtlInterlockedPushEntrySList@8:
|
||||
|
||||
/* Save registers */
|
||||
|
@ -85,18 +84,18 @@ _RtlInterlockedPushEntrySList@8:
|
|||
/* Load ListHead->Depth and ListHead->Sequence into edx */
|
||||
mov edx, [ebp + 4]
|
||||
|
||||
1:
|
||||
_RtlpInterlockedPushEntrySListResume:
|
||||
/* Set ListEntry->Next to ListHead->Next */
|
||||
mov [ebx], eax
|
||||
|
||||
/* Copy ListHead->Depth and ListHead->Sequence and adjust them */
|
||||
lea ecx, [edx + 0x10001]
|
||||
lea ecx, [edx + HEX(10001)]
|
||||
|
||||
/* If [ebp] equals edx:eax, exchange it with ecx:ebx */
|
||||
LOCK cmpxchg8b qword ptr [ebp]
|
||||
|
||||
/* If not equal, retry with edx:eax, being the content of [ebp] now */
|
||||
jnz 1b
|
||||
jnz _RtlpInterlockedPushEntrySListResume
|
||||
|
||||
/* Restore registers and return */
|
||||
pop ebp
|
||||
|
@ -109,7 +108,7 @@ _RtlInterlockedPushEntrySList@8:
|
|||
* RtlInterlockedFlushSList(
|
||||
* IN PSINGLE_LIST_ENTRY ListHead);
|
||||
*/
|
||||
.global _RtlInterlockedFlushSList@4
|
||||
PUBLIC _RtlInterlockedFlushSList@4
|
||||
_RtlInterlockedFlushSList@4:
|
||||
|
||||
/* Save registers */
|
||||
|
@ -128,10 +127,10 @@ _RtlInterlockedFlushSList@4:
|
|||
/* Load ListHead->Depth and ListHead->Sequence into edx */
|
||||
mov edx, [ebp + 4]
|
||||
|
||||
1:
|
||||
_RtlpInterlockedFlushSListResume:
|
||||
/* Check if ListHead->Next is NULL */
|
||||
or eax, eax
|
||||
jz 2f
|
||||
jz _RtlpInterlockedFlushSListEnd
|
||||
|
||||
/* Copy Depth and Sequence number to ecx */
|
||||
mov ecx, edx
|
||||
|
@ -143,10 +142,12 @@ _RtlInterlockedFlushSList@4:
|
|||
LOCK cmpxchg8b qword ptr [ebp]
|
||||
|
||||
/* If not equal, retry with edx:eax, being the content of [ebp] now */
|
||||
jnz 1b
|
||||
jnz _RtlpInterlockedFlushSListResume
|
||||
|
||||
/* Restore registers and return */
|
||||
2:
|
||||
_RtlpInterlockedFlushSListEnd:
|
||||
pop ebp
|
||||
pop ebx
|
||||
ret 4
|
||||
|
||||
END
|
||||
|
|
|
@ -1,11 +1,22 @@
|
|||
#include <ndk/asm.h>
|
||||
.intel_syntax noprefix
|
||||
/*
|
||||
* COPYRIGHT: GNU GPL - See COPYING in the top level directory
|
||||
* PROJECT: ReactOS Run-Time Library
|
||||
* PURPOSE:
|
||||
* FILE: lib/rtl/i386/res_asm.S
|
||||
* PROGRAMER:
|
||||
*/
|
||||
|
||||
#include <asm.inc>
|
||||
#include <ks386.inc>
|
||||
|
||||
EXTERN _LdrpAccessResource@16:PROC
|
||||
|
||||
/*
|
||||
* On x86, Shrinker, an executable compressor, depends on the
|
||||
* "call access_resource" instruction being there.
|
||||
*/
|
||||
.globl _LdrAccessResource@16
|
||||
.code
|
||||
PUBLIC _LdrAccessResource@16
|
||||
_LdrAccessResource@16:
|
||||
push ebp
|
||||
mov ebp, esp
|
||||
|
@ -18,3 +29,5 @@ _LdrAccessResource@16:
|
|||
call _LdrpAccessResource@16
|
||||
leave
|
||||
ret 16
|
||||
|
||||
END
|
||||
|
|
|
@ -1,26 +1,26 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* COPYRIGHT: GNU GPL - See COPYING in the top level directory
|
||||
* PROJECT: ReactOS Run-Time Library
|
||||
* PURPOSE: Memory functions
|
||||
* FILE: lib/rtl/i386/rtlswap.S
|
||||
* PROGRAMER: Alex Ionescu (alex.ionescu@reactos.org)
|
||||
*/
|
||||
|
||||
.intel_syntax noprefix
|
||||
#include <asm.inc>
|
||||
|
||||
/* GLOBALS *******************************************************************/
|
||||
|
||||
.globl _RtlCompareMemory@12
|
||||
.globl _RtlCompareMemoryUlong@12
|
||||
.globl _RtlFillMemory@12
|
||||
.globl _RtlFillMemoryUlong@12
|
||||
.globl _RtlMoveMemory@12
|
||||
.globl _RtlZeroMemory@8
|
||||
.globl @RtlPrefetchMemoryNonTemporal@8
|
||||
PUBLIC _RtlCompareMemory@12
|
||||
PUBLIC _RtlCompareMemoryUlong@12
|
||||
PUBLIC _RtlFillMemory@12
|
||||
PUBLIC _RtlFillMemoryUlong@12
|
||||
PUBLIC _RtlMoveMemory@12
|
||||
PUBLIC _RtlZeroMemory@8
|
||||
PUBLIC @RtlPrefetchMemoryNonTemporal@8
|
||||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
.code
|
||||
|
||||
.func RtlCompareMemory@12
|
||||
_RtlCompareMemory@12:
|
||||
|
||||
/* Save volatiles */
|
||||
|
@ -74,9 +74,8 @@ NotEqual2:
|
|||
pop edi
|
||||
pop esi
|
||||
ret 12
|
||||
.endfunc
|
||||
|
||||
.func RtlCompareMemoryUlong@12
|
||||
|
||||
_RtlCompareMemoryUlong@12:
|
||||
|
||||
/* Get pointers and size in ULONGs */
|
||||
|
@ -97,9 +96,8 @@ Done:
|
|||
mov eax, edi
|
||||
pop edi
|
||||
ret 12
|
||||
.endfunc
|
||||
|
||||
.func RtlFillMemory@12
|
||||
|
||||
_RtlFillMemory@12:
|
||||
|
||||
/* Get pointers and size */
|
||||
|
@ -134,9 +132,8 @@ ByteFill:
|
|||
rep stosb
|
||||
pop edi
|
||||
ret 12
|
||||
.endfunc
|
||||
|
||||
.func RtlFillMemoryUlong@12
|
||||
|
||||
_RtlFillMemoryUlong@12:
|
||||
|
||||
/* Get pointer, size and pattern */
|
||||
|
@ -150,9 +147,8 @@ _RtlFillMemoryUlong@12:
|
|||
rep stosd
|
||||
pop edi
|
||||
ret 12
|
||||
.endfunc
|
||||
|
||||
.func RtlFillMemoryUlonglong@16
|
||||
|
||||
_RtlFillMemoryUlonglong@16:
|
||||
|
||||
/* Save volatiles */
|
||||
|
@ -179,9 +175,8 @@ _RtlFillMemoryUlonglong@16:
|
|||
pop esi
|
||||
pop edi
|
||||
ret 16
|
||||
.endfunc
|
||||
|
||||
.func RtlZeroMemory@8
|
||||
|
||||
_RtlZeroMemory@8:
|
||||
|
||||
/* Get pointers and size */
|
||||
|
@ -212,9 +207,8 @@ ByteZero:
|
|||
rep stosb
|
||||
pop edi
|
||||
ret 8
|
||||
.endfunc
|
||||
|
||||
.func RtlMoveMemory@12
|
||||
|
||||
_RtlMoveMemory@12:
|
||||
|
||||
/* Save volatiles */
|
||||
|
@ -280,9 +274,8 @@ Overlap:
|
|||
rep movsb
|
||||
cld
|
||||
jmp DoneMove
|
||||
.endfunc
|
||||
|
||||
.func @RtlPrefetchMemoryNonTemporal@8, @RtlPrefetchMemoryNonTemporal@8
|
||||
|
||||
@RtlPrefetchMemoryNonTemporal@8:
|
||||
|
||||
/*
|
||||
|
@ -306,8 +299,10 @@ FetchLine:
|
|||
/* Keep looping for the next line, or return if done */
|
||||
ja FetchLine
|
||||
ret
|
||||
.endfunc
|
||||
|
||||
|
||||
/* FIXME: HACK */
|
||||
_Ke386CacheAlignment:
|
||||
.long 0x40
|
||||
.long 64
|
||||
|
||||
END
|
||||
|
|
|
@ -8,11 +8,10 @@
|
|||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include <reactos/asm.h>
|
||||
#include <asm.inc>
|
||||
|
||||
.intel_syntax noprefix
|
||||
|
||||
.global MsgUnimplemented
|
||||
PUBLIC MsgUnimplemented
|
||||
MsgUnimplemented:
|
||||
.asciz "WARNING: %s at %s:%d is UNIMPLEMENTED!\n"
|
||||
|
||||
|
@ -27,4 +26,5 @@ MsgUnimplemented:
|
|||
ret
|
||||
.endp
|
||||
|
||||
END
|
||||
/* EOF */
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include <ndk/asm.h>
|
||||
.intel_syntax noprefix
|
||||
#include <asm.inc>
|
||||
#include <ksamd64.inc>
|
||||
|
||||
#define DISPOSITION_DISMISS 0
|
||||
#define DISPOSITION_CONTINUE_SEARCH 1
|
||||
|
@ -54,3 +54,5 @@ _except_handler2:
|
|||
_except_handler3:
|
||||
ret
|
||||
.endfunc
|
||||
|
||||
END
|
||||
|
|
|
@ -7,8 +7,43 @@
|
|||
* PROGRAMER: KJK::Hyperion <noog@libero.it>
|
||||
*/
|
||||
|
||||
.globl __chkstk
|
||||
.globl __alloca_probe
|
||||
#include <asm.inc>
|
||||
#include <ks386.inc>
|
||||
|
||||
#define PAGE_SIZE 4096
|
||||
|
||||
PUBLIC __chkstk
|
||||
PUBLIC __alloca_probe
|
||||
PUBLIC __alloca_probe_16
|
||||
.code
|
||||
|
||||
/* 16 byte aligned alloca probe
|
||||
* EAX = size to be allocated */
|
||||
__alloca_probe_16:
|
||||
/* save the ECX register */
|
||||
push ecx
|
||||
|
||||
/* ecx = top of the previous stack frame */
|
||||
lea ecx, [esp + 8]
|
||||
|
||||
/* Calculate end of allocation */
|
||||
sub ecx, eax
|
||||
|
||||
/* Get the misalignment */
|
||||
and ecx, 15
|
||||
|
||||
/* Add the misalignment to the original alloc size */
|
||||
add eax, ecx
|
||||
|
||||
/* Check for overflow */
|
||||
jnc l1
|
||||
|
||||
/* Set maximum value */
|
||||
mov eax, HEX(0ffffffff)
|
||||
l1:
|
||||
/* Restore ecx */
|
||||
pop ecx
|
||||
/* Fall through to __chkstk */
|
||||
|
||||
/*
|
||||
_chkstk() is called by all stack allocations of more than 4 KB. It grows the
|
||||
|
@ -18,49 +53,49 @@
|
|||
__chkstk:
|
||||
__alloca_probe:
|
||||
|
||||
/* EAX = size to be allocated */
|
||||
/* save the ECX register */
|
||||
pushl %ecx
|
||||
/* EAX = size to be allocated */
|
||||
/* save the ECX register */
|
||||
push ecx
|
||||
|
||||
/* ECX = top of the previous stack frame */
|
||||
leal 8(%esp), %ecx
|
||||
/* ECX = top of the previous stack frame */
|
||||
lea ecx, [esp + 8]
|
||||
|
||||
/* probe the desired memory, page by page */
|
||||
cmpl $0x1000, %eax
|
||||
jge .l_MoreThanAPage
|
||||
jmp .l_LessThanAPage
|
||||
/* probe the desired memory, page by page */
|
||||
cmp eax, PAGE_SIZE
|
||||
jl .l_LessThanAPage
|
||||
|
||||
.l_MoreThanAPage:
|
||||
|
||||
/* raise the top of the stack by a page and probe */
|
||||
subl $0x1000, %ecx
|
||||
testl %eax, 0(%ecx)
|
||||
/* raise the top of the stack by a page and probe */
|
||||
sub ecx, PAGE_SIZE
|
||||
test [ecx], eax
|
||||
|
||||
/* loop if still more than a page must be probed */
|
||||
subl $0x1000, %eax
|
||||
cmpl $0x1000, %eax
|
||||
jge .l_MoreThanAPage
|
||||
/* loop if still more than a page must be probed */
|
||||
sub eax, PAGE_SIZE
|
||||
cmp eax, PAGE_SIZE
|
||||
jge .l_MoreThanAPage
|
||||
|
||||
.l_LessThanAPage:
|
||||
|
||||
/* raise the top of the stack by EAX bytes (size % 4096) and probe */
|
||||
subl %eax, %ecx
|
||||
testl %eax, 0(%ecx)
|
||||
/* raise the top of the stack by EAX bytes (size % 4096) and probe */
|
||||
sub ecx, eax
|
||||
test [ecx], eax
|
||||
|
||||
/* EAX = top of the stack */
|
||||
movl %esp, %eax
|
||||
/* EAX = top of the stack */
|
||||
mov eax, esp
|
||||
|
||||
/* allocate the memory */
|
||||
movl %ecx, %esp
|
||||
/* allocate the memory */
|
||||
mov esp, ecx
|
||||
|
||||
/* restore ECX */
|
||||
movl 0(%eax), %ecx
|
||||
/* restore ECX */
|
||||
mov ecx, [eax]
|
||||
|
||||
/* restore the return address */
|
||||
movl 4(%eax), %eax
|
||||
pushl %eax
|
||||
/* restore the return address */
|
||||
mov eax, [eax + 4]
|
||||
push eax
|
||||
|
||||
/* return */
|
||||
ret
|
||||
/* return */
|
||||
ret
|
||||
|
||||
/* EOF */
|
||||
END
|
||||
|
|
|
@ -8,20 +8,23 @@
|
|||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include <ndk/asm.h>
|
||||
#include <asm.inc>
|
||||
#include <ks386.inc>
|
||||
|
||||
/* GLOBALS *******************************************************************/
|
||||
|
||||
.globl __EH_prolog
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
.code
|
||||
|
||||
PUBLIC __EH_prolog
|
||||
// Copied from Wine.
|
||||
__EH_prolog:
|
||||
pushl $-1
|
||||
pushl %eax
|
||||
pushl %fs:0
|
||||
movl %esp, %fs:0
|
||||
movl 12(%esp), %eax
|
||||
movl %ebp, 12(%esp)
|
||||
leal 12(%esp), %ebp
|
||||
pushl %eax
|
||||
push -1
|
||||
push eax
|
||||
push fs:0
|
||||
mov fs:0, esp
|
||||
mov eax, [esp + 12]
|
||||
mov [esp + 12], ebp
|
||||
lea ebp, [esp + 12]
|
||||
push eax
|
||||
ret
|
||||
|
||||
END
|
||||
|
|
|
@ -8,24 +8,29 @@
|
|||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include <ndk/asm.h>
|
||||
.intel_syntax noprefix
|
||||
#include <asm.inc>
|
||||
|
||||
#define DISPOSITION_DISMISS 0
|
||||
#define DISPOSITION_CONTINUE_SEARCH 1
|
||||
#define DISPOSITION_COLLIDED_UNWIND 3
|
||||
|
||||
#define EXCEPTION_EXIT_UNWIND 4
|
||||
#define EXCEPTION_UNWINDING 2
|
||||
|
||||
|
||||
EXTERN _RtlUnwind@16:PROC
|
||||
|
||||
/* GLOBALS *******************************************************************/
|
||||
|
||||
.globl __global_unwind2
|
||||
.globl __local_unwind2
|
||||
.globl __abnormal_termination
|
||||
.globl __except_handler2
|
||||
.globl __except_handler3
|
||||
PUBLIC __global_unwind2
|
||||
PUBLIC __local_unwind2
|
||||
PUBLIC __abnormal_termination
|
||||
PUBLIC __except_handler2
|
||||
PUBLIC __except_handler3
|
||||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
.func unwind_handler
|
||||
.code
|
||||
_unwind_handler:
|
||||
|
||||
/* Check if we were unwinding and continue search if not */
|
||||
|
@ -56,9 +61,8 @@ _unwind_handler:
|
|||
|
||||
unwind_handler_return:
|
||||
ret
|
||||
.endfunc
|
||||
|
||||
.func _global_unwind2
|
||||
|
||||
__global_unwind2:
|
||||
|
||||
/* Create stack and save all registers */
|
||||
|
@ -85,9 +89,8 @@ glu_return:
|
|||
mov esp, ebp
|
||||
pop ebp
|
||||
ret
|
||||
.endfunc
|
||||
|
||||
.func _abnormal_termination
|
||||
|
||||
__abnormal_termination:
|
||||
|
||||
/* Assume false */
|
||||
|
@ -112,9 +115,8 @@ __abnormal_termination:
|
|||
/* Return */
|
||||
ab_return:
|
||||
ret
|
||||
.endfunc
|
||||
|
||||
.func _local_unwind2
|
||||
|
||||
__local_unwind2:
|
||||
|
||||
/* Save volatiles */
|
||||
|
@ -175,9 +177,8 @@ unwind_return:
|
|||
pop esi
|
||||
pop ebx
|
||||
ret
|
||||
.endfunc
|
||||
|
||||
.func _except_handler2
|
||||
|
||||
__except_handler2:
|
||||
|
||||
/* Setup stack and save volatiles */
|
||||
|
@ -256,7 +257,7 @@ except_loop2:
|
|||
mov [ebx+12], eax
|
||||
|
||||
/* Call except handler */
|
||||
call [edi+ecx*4+8]
|
||||
call dword ptr [edi+ecx*4+8]
|
||||
|
||||
except_continue2:
|
||||
/* Reload try level and except again */
|
||||
|
@ -297,9 +298,8 @@ except_return2:
|
|||
mov esp, ebp
|
||||
pop ebp
|
||||
ret
|
||||
.endfunc
|
||||
|
||||
.func _except_handler3
|
||||
|
||||
__except_handler3:
|
||||
|
||||
/* Setup stack and save volatiles */
|
||||
|
@ -437,4 +437,5 @@ except_return3:
|
|||
mov esp, ebp
|
||||
pop ebp
|
||||
ret
|
||||
.endfunc
|
||||
|
||||
END
|
||||
|
|
|
@ -30,7 +30,7 @@ double _logb (double __x)
|
|||
("fxtract\n\t"
|
||||
: "=t" (__junk), "=u" (__val) : "0" (__x));
|
||||
#else
|
||||
#error REVIEW ME
|
||||
#pragma message ("REVIEW ME")
|
||||
__asm fld [__x];
|
||||
__asm fxtract;
|
||||
__asm fstp st(0);
|
||||
|
|
|
@ -8,8 +8,7 @@
|
|||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include <reactos/asm.h>
|
||||
#include <ndk/amd64/asm.h>
|
||||
#include <asm.inc>
|
||||
|
||||
/* DATA *********************************************************************/
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include <reactos/asm.h>
|
||||
#include <ndk/amd64/asm.h>
|
||||
#include <asm.inc>
|
||||
#include <ksamd64.inc>
|
||||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include <reactos/asm.h>
|
||||
#include <ndk/amd64/asm.h>
|
||||
#include <asm.inc>
|
||||
#include <ksamd64.inc>
|
||||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include <reactos/asm.h>
|
||||
#include <ndk/amd64/asm.h>
|
||||
#include <asm.inc>
|
||||
#include <ksamd64.inc>
|
||||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include <reactos/asm.h>
|
||||
#include <ndk/amd64/asm.h>
|
||||
#include <asm.inc>
|
||||
#include <ksamd64.inc>
|
||||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
|
@ -17,24 +17,30 @@
|
|||
|
||||
PUBLIC ceilf
|
||||
ceilf:
|
||||
sub rsp, 16
|
||||
|
||||
/* Put parameter on the stack */
|
||||
movss [rsp - 0x10], xmm0
|
||||
fld dword ptr [rsp]
|
||||
movss [rsp], xmm0
|
||||
fld dword ptr [rsp]
|
||||
|
||||
/* Change fpu control word to round up */
|
||||
fstcw [rsp - 0x10]
|
||||
mov eax, [rsp - 0x10]
|
||||
or eax, 0x00800
|
||||
and eax, 0x0fbff
|
||||
mov [rsp - 0x08], eax
|
||||
fldcw [rsp - 0x08]
|
||||
fstcw [rsp + 8]
|
||||
mov eax, [rsp + 8]
|
||||
or eax, HEX(00800)
|
||||
and eax, HEX(0fbff)
|
||||
mov [rsp + 12], eax
|
||||
fldcw [rsp + 12]
|
||||
|
||||
/* Round to integer */
|
||||
frndint
|
||||
|
||||
/* Restore fpu control word */
|
||||
fldcw [rsp - 0x10]
|
||||
fldcw [rsp + 8]
|
||||
|
||||
fstp dword ptr [rsp - 0x10]
|
||||
movss xmm0, [rsp - 0x10]
|
||||
fstp dword ptr [rsp]
|
||||
movss xmm0, [rsp]
|
||||
|
||||
add rsp, 16
|
||||
ret
|
||||
|
||||
END
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include <reactos/asm.h>
|
||||
#include <ndk/amd64/asm.h>
|
||||
#include <asm.inc>
|
||||
#include <ksamd64.inc>
|
||||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
|
@ -20,3 +20,4 @@ exp:
|
|||
UNIMPLEMENTED exp
|
||||
ret
|
||||
|
||||
END
|
||||
|
|
|
@ -8,8 +8,7 @@
|
|||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include <reactos/asm.h>
|
||||
#include <ndk/amd64/asm.h>
|
||||
#include <asm.inc>
|
||||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include <reactos/asm.h>
|
||||
#include <ndk/amd64/asm.h>
|
||||
#include <asm.inc>
|
||||
#include <ksamd64.inc>
|
||||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
|
@ -19,3 +19,5 @@ PUBLIC floor
|
|||
floor:
|
||||
UNIMPLEMENTED floor
|
||||
ret
|
||||
|
||||
END
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include <reactos/asm.h>
|
||||
#include <ndk/amd64/asm.h>
|
||||
#include <asm.inc>
|
||||
#include <ksamd64.inc>
|
||||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
|
@ -17,24 +17,29 @@
|
|||
|
||||
PUBLIC floorf
|
||||
floorf:
|
||||
sub rsp, 16
|
||||
|
||||
/* Put parameter on the stack */
|
||||
movss [rsp - 0x10], xmm0
|
||||
movss [rsp], xmm0
|
||||
fld dword ptr [rsp]
|
||||
|
||||
/* Change fpu control word to round down */
|
||||
fstcw [rsp - 0x10]
|
||||
mov eax, [rsp - 0x10]
|
||||
fstcw [rsp]
|
||||
mov eax, [rsp]
|
||||
or eax, 0x00400
|
||||
and eax, 0x0f7ff
|
||||
mov [rsp - 0x08], eax
|
||||
fldcw [rsp - 0x08]
|
||||
mov [rsp + 8], eax
|
||||
fldcw [rsp + 8]
|
||||
|
||||
/* Round to integer */
|
||||
frndint
|
||||
|
||||
/* Restore fpu control word */
|
||||
fldcw [rsp - 0x10]
|
||||
fldcw [rsp]
|
||||
|
||||
fstp dword ptr [rsp - 0x10]
|
||||
movss xmm0, [rsp - 0x10]
|
||||
fstp dword ptr [rsp]
|
||||
movss xmm0, [rsp]
|
||||
add rsp, 16
|
||||
ret
|
||||
|
||||
END
|
||||
|
|
|
@ -8,8 +8,7 @@
|
|||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include <reactos/asm.h>
|
||||
#include <ndk/amd64/asm.h>
|
||||
#include <asm.inc>
|
||||
|
||||
/* DATA *********************************************************************/
|
||||
|
||||
|
@ -17,3 +16,5 @@ PUBLIC fmod
|
|||
fmod:
|
||||
UNIMPLEMENTED fmod
|
||||
ret
|
||||
|
||||
END
|
||||
|
|
|
@ -8,8 +8,7 @@
|
|||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include <reactos/asm.h>
|
||||
#include <ndk/amd64/asm.h>
|
||||
#include <asm.inc>
|
||||
|
||||
/* DATA *********************************************************************/
|
||||
|
||||
|
@ -17,3 +16,5 @@ PUBLIC fmodf
|
|||
fmodf:
|
||||
UNIMPLEMENTED fmodf
|
||||
ret
|
||||
|
||||
END
|
||||
|
|
|
@ -8,8 +8,7 @@
|
|||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include <reactos/asm.h>
|
||||
#include <ndk/amd64/asm.h>
|
||||
#include <asm.inc>
|
||||
|
||||
/* DATA *********************************************************************/
|
||||
|
||||
|
@ -17,3 +16,5 @@ PUBLIC ldexp
|
|||
ldexp:
|
||||
UNIMPLEMENTED ldexp
|
||||
ret
|
||||
|
||||
END
|
||||
|
|
|
@ -8,8 +8,7 @@
|
|||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include <reactos/asm.h>
|
||||
#include <ndk/amd64/asm.h>
|
||||
#include <asm.inc>
|
||||
|
||||
/* DATA *********************************************************************/
|
||||
|
||||
|
|
|
@ -8,8 +8,7 @@
|
|||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include <reactos/asm.h>
|
||||
#include <ndk/amd64/asm.h>
|
||||
#include <asm.inc>
|
||||
|
||||
/* DATA *********************************************************************/
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include <reactos/asm.h>
|
||||
#include <ndk/amd64/asm.h>
|
||||
#include <asm.inc>
|
||||
#include <ksamd64.inc>
|
||||
|
||||
/* DATA *********************************************************************/
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include <reactos/asm.h>
|
||||
#include <ndk/amd64/asm.h>
|
||||
#include <asm.inc>
|
||||
#include <ksamd64.inc>
|
||||
|
||||
/* DATA *********************************************************************/
|
||||
|
||||
|
@ -17,3 +17,5 @@ PUBLIC sqrt
|
|||
sqrt:
|
||||
UNIMPLEMENTED sqrt
|
||||
ret
|
||||
|
||||
END
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include <reactos/asm.h>
|
||||
#include <ndk/amd64/asm.h>
|
||||
#include <asm.inc>
|
||||
#include <ksamd64.inc>
|
||||
|
||||
/* DATA *********************************************************************/
|
||||
|
||||
|
@ -17,3 +17,5 @@ PUBLIC sqrtf
|
|||
sqrtf:
|
||||
sqrtss xmm0, xmm0
|
||||
ret
|
||||
|
||||
END
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include <reactos/asm.h>
|
||||
#include <ndk/amd64/asm.h>
|
||||
#include <asm.inc>
|
||||
#include <ksamd64.inc>
|
||||
|
||||
/* DATA *********************************************************************/
|
||||
|
||||
|
@ -17,3 +17,5 @@ PUBLIC tan
|
|||
tan:
|
||||
UNIMPLEMENTED tan
|
||||
ret
|
||||
|
||||
END
|
||||
|
|
|
@ -33,18 +33,22 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
.globl __alldiv
|
||||
.globl __fltused
|
||||
|
||||
|
||||
#include <asm.inc>
|
||||
|
||||
PUBLIC __alldiv
|
||||
PUBLIC __fltused
|
||||
|
||||
/* DATA ********************************************************************/
|
||||
.data
|
||||
ASSUME CS:NOTHING, DS:NOTHING, ES:NOTHING, FS:NOTHING, GS:NOTHING
|
||||
|
||||
__fltused:
|
||||
.long 0x9875
|
||||
.long HEX(9875)
|
||||
|
||||
.intel_syntax noprefix
|
||||
|
||||
/* FUNCTIONS ***************************************************************/
|
||||
.code
|
||||
|
||||
//
|
||||
// lldiv - signed long divide
|
||||
|
@ -222,3 +226,5 @@ L8:
|
|||
pop edi
|
||||
|
||||
ret 16
|
||||
|
||||
END
|
||||
|
|
|
@ -33,12 +33,13 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
.globl __alldvrm
|
||||
|
||||
.intel_syntax noprefix
|
||||
|
||||
#include <asm.inc>
|
||||
|
||||
PUBLIC __alldvrm
|
||||
|
||||
/* FUNCTIONS ***************************************************************/
|
||||
.code
|
||||
|
||||
__alldvrm:
|
||||
push edi
|
||||
|
@ -88,7 +89,7 @@ __alldvrm:
|
|||
|
||||
mov eax,DVNDHI // hi word of a
|
||||
or eax,eax // test to see if signed
|
||||
jge short ....L1 // skip rest if a is already positive
|
||||
jge short .L1 // skip rest if a is already positive
|
||||
inc edi // complement result sign flag
|
||||
inc ebp // complement result sign flag
|
||||
mov edx,DVNDLO // lo word of a
|
||||
|
@ -97,10 +98,10 @@ __alldvrm:
|
|||
sbb eax,0
|
||||
mov DVNDHI,eax // save positive value
|
||||
mov DVNDLO,edx
|
||||
....L1:
|
||||
.L1:
|
||||
mov eax,DVSRHI // hi word of b
|
||||
or eax,eax // test to see if signed
|
||||
jge short ....L2 // skip rest if b is already positive
|
||||
jge short .L2 // skip rest if b is already positive
|
||||
inc edi // complement the result sign flag
|
||||
mov edx,DVSRLO // lo word of a
|
||||
neg eax // make b positive
|
||||
|
@ -108,7 +109,7 @@ __alldvrm:
|
|||
sbb eax,0
|
||||
mov DVSRHI,eax // save positive value
|
||||
mov DVSRLO,edx
|
||||
....L2:
|
||||
.L2:
|
||||
|
||||
//
|
||||
// Now do the divide. First look to see if the divisor is less than 4194304K.
|
||||
|
@ -119,7 +120,7 @@ __alldvrm:
|
|||
//
|
||||
|
||||
or eax,eax // check to see if divisor < 4194304K
|
||||
jnz short ....L3 // nope, gotta do this the hard way
|
||||
jnz short .L3 // nope, gotta do this the hard way
|
||||
mov ecx,DVSRLO // load divisor
|
||||
mov eax,DVNDHI // load high word of dividend
|
||||
xor edx,edx
|
||||
|
@ -137,24 +138,24 @@ __alldvrm:
|
|||
mov eax,esi // set up low word of quotient
|
||||
mul dword ptr DVSRLO // LOWORD(QUOT) * DVSR
|
||||
add edx,ecx // EDX:EAX = QUOT * DVSR
|
||||
jmp short ....L4 // complete remainder calculation
|
||||
jmp short .L4 // complete remainder calculation
|
||||
|
||||
//
|
||||
// Here we do it the hard way. Remember, eax contains the high word of DVSR
|
||||
//
|
||||
|
||||
....L3:
|
||||
.L3:
|
||||
mov ebx,eax // ebx:ecx <- divisor
|
||||
mov ecx,DVSRLO
|
||||
mov edx,DVNDHI // edx:eax <- dividend
|
||||
mov eax,DVNDLO
|
||||
....L5:
|
||||
.L5:
|
||||
shr ebx,1 // shift divisor right one bit
|
||||
rcr ecx,1
|
||||
shr edx,1 // shift dividend right one bit
|
||||
rcr eax,1
|
||||
or ebx,ebx
|
||||
jnz short ....L5 // loop until divisor < 4194304K
|
||||
jnz short .L5 // loop until divisor < 4194304K
|
||||
div ecx // now divide, ignore remainder
|
||||
mov esi,eax // save quotient
|
||||
|
||||
|
@ -170,7 +171,7 @@ __alldvrm:
|
|||
mov eax,DVSRLO
|
||||
mul esi // QUOT * DVSRLO
|
||||
add edx,ecx // EDX:EAX = QUOT * DVSR
|
||||
jc short ....L6 // carry means Quotient is off by 1
|
||||
jc short .L6 // carry means Quotient is off by 1
|
||||
|
||||
//
|
||||
// do long compare here between original dividend and the result of the
|
||||
|
@ -179,18 +180,18 @@ __alldvrm:
|
|||
//
|
||||
|
||||
cmp edx,DVNDHI // compare hi words of result and original
|
||||
ja short ....L6 // if result > original, do subtract
|
||||
jb short ....L7 // if result < original, we are ok
|
||||
ja short .L6 // if result > original, do subtract
|
||||
jb short .L7 // if result < original, we are ok
|
||||
cmp eax,DVNDLO // hi words are equal, compare lo words
|
||||
jbe short ....L7 // if less or equal we are ok, else subtract
|
||||
....L6:
|
||||
jbe short .L7 // if less or equal we are ok, else subtract
|
||||
.L6:
|
||||
dec esi // subtract 1 from quotient
|
||||
sub eax,DVSRLO // subtract divisor from result
|
||||
sbb edx,DVSRHI
|
||||
....L7:
|
||||
.L7:
|
||||
xor ebx,ebx // ebx:esi <- quotient
|
||||
|
||||
....L4:
|
||||
.L4:
|
||||
//
|
||||
// Calculate remainder by subtracting the result from the original dividend.
|
||||
// Since the result is already in a register, we will do the subtract in the
|
||||
|
@ -208,7 +209,7 @@ __alldvrm:
|
|||
//
|
||||
|
||||
dec ebp // check result sign flag
|
||||
jns short ....L9 // result is ok, set up the quotient
|
||||
jns short .L9 // result is ok, set up the quotient
|
||||
neg edx // otherwise, negate the result
|
||||
neg eax
|
||||
sbb edx,0
|
||||
|
@ -216,7 +217,7 @@ __alldvrm:
|
|||
//
|
||||
// Now we need to get the quotient into edx:eax and the remainder into ebx:ecx.
|
||||
//
|
||||
....L9:
|
||||
.L9:
|
||||
mov ecx,edx
|
||||
mov edx,ebx
|
||||
mov ebx,ecx
|
||||
|
@ -229,7 +230,7 @@ __alldvrm:
|
|||
//
|
||||
|
||||
dec edi // check to see if result is negative
|
||||
jnz short ....L8 // if EDI == 0, result should be negative
|
||||
jnz short .L8 // if EDI == 0, result should be negative
|
||||
neg edx // otherwise, negate the result
|
||||
neg eax
|
||||
sbb edx,0
|
||||
|
@ -238,9 +239,11 @@ __alldvrm:
|
|||
// Restore the saved registers and return.
|
||||
//
|
||||
|
||||
....L8:
|
||||
.L8:
|
||||
pop ebp
|
||||
pop esi
|
||||
pop edi
|
||||
|
||||
ret 16
|
||||
|
||||
END
|
||||
|
|
|
@ -33,12 +33,13 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
.globl __allmul
|
||||
|
||||
.intel_syntax noprefix
|
||||
#include <asm.inc>
|
||||
|
||||
PUBLIC __allmul
|
||||
|
||||
/* FUNCTIONS ***************************************************************/
|
||||
.code
|
||||
|
||||
//
|
||||
// llmul - long multiply routine
|
||||
|
@ -113,3 +114,4 @@ hard:
|
|||
|
||||
ret 16 // callee restores the stack
|
||||
|
||||
END
|
||||
|
|
|
@ -33,12 +33,13 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
.globl __allrem
|
||||
|
||||
.intel_syntax noprefix
|
||||
|
||||
#include <asm.inc>
|
||||
|
||||
PUBLIC __allrem
|
||||
|
||||
/* FUNCTIONS ***************************************************************/
|
||||
.code
|
||||
|
||||
//
|
||||
// llrem - signed long remainder
|
||||
|
@ -227,3 +228,5 @@ __allrem :
|
|||
pop ebx
|
||||
|
||||
ret 16
|
||||
|
||||
END
|
||||
|
|
|
@ -33,12 +33,13 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
.globl __allshl
|
||||
|
||||
.intel_syntax noprefix
|
||||
#include <asm.inc>
|
||||
|
||||
PUBLIC __allshl
|
||||
|
||||
/* FUNCTIONS ***************************************************************/
|
||||
.code
|
||||
|
||||
//
|
||||
// llshl - long shift left
|
||||
|
@ -92,3 +93,5 @@ RETZERO:
|
|||
xor eax,eax
|
||||
xor edx,edx
|
||||
ret
|
||||
|
||||
END
|
||||
|
|
|
@ -33,12 +33,13 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
.globl __allshr
|
||||
|
||||
.intel_syntax noprefix
|
||||
|
||||
#include <asm.inc>
|
||||
|
||||
PUBLIC __allshr
|
||||
|
||||
/* FUNCTIONS ***************************************************************/
|
||||
.code
|
||||
|
||||
//
|
||||
// llshr - long shift right
|
||||
|
@ -93,3 +94,5 @@ __allshr:
|
|||
sar edx,31
|
||||
mov eax,edx
|
||||
ret
|
||||
|
||||
END
|
||||
|
|
18
reactos/lib/sdk/crt/math/i386/atan2_asm.s
Normal file
18
reactos/lib/sdk/crt/math/i386/atan2_asm.s
Normal file
|
@ -0,0 +1,18 @@
|
|||
|
||||
#include <asm.inc>
|
||||
|
||||
PUBLIC _atan2
|
||||
|
||||
.code
|
||||
_atan2:
|
||||
push ebp
|
||||
mov ebp, esp
|
||||
|
||||
fld qword ptr [ebp + 8]
|
||||
fld qword ptr [ebp + 16]
|
||||
fpatan
|
||||
|
||||
pop ebp
|
||||
ret
|
||||
|
||||
END
|
|
@ -33,12 +33,13 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
.globl _atan
|
||||
|
||||
.intel_syntax noprefix
|
||||
|
||||
#include <asm.inc>
|
||||
|
||||
PUBLIC _atan
|
||||
|
||||
/* FUNCTIONS ***************************************************************/
|
||||
.code
|
||||
|
||||
_atan:
|
||||
push ebp
|
||||
|
@ -48,3 +49,5 @@ _atan:
|
|||
fpatan // Take the arctangent
|
||||
pop ebp
|
||||
ret
|
||||
|
||||
END
|
||||
|
|
|
@ -33,12 +33,13 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
.globl __aulldiv
|
||||
|
||||
.intel_syntax noprefix
|
||||
#include <asm.inc>
|
||||
|
||||
PUBLIC __aulldiv
|
||||
|
||||
/* FUNCTIONS ***************************************************************/
|
||||
.code
|
||||
|
||||
//
|
||||
// ulldiv - unsigned long divide
|
||||
|
@ -105,7 +106,7 @@ __aulldiv:
|
|||
|
||||
mov eax,DVSRHI // check to see if divisor < 4194304K
|
||||
or eax,eax
|
||||
jnz short ..L1 // nope, gotta do this the hard way
|
||||
jnz short .L1 // nope, gotta do this the hard way
|
||||
mov ecx,DVSRLO // load divisor
|
||||
mov eax,DVNDHI // load high word of dividend
|
||||
xor edx,edx
|
||||
|
@ -114,24 +115,24 @@ __aulldiv:
|
|||
mov eax,DVNDLO // edx:eax <- remainder:lo word of dividend
|
||||
div ecx // get low order bits of quotient
|
||||
mov edx,ebx // edx:eax <- quotient hi:quotient lo
|
||||
jmp short ..L2 // restore stack and return
|
||||
jmp short .L2 // restore stack and return
|
||||
|
||||
//
|
||||
// Here we do it the hard way. Remember, eax contains DVSRHI
|
||||
//
|
||||
|
||||
..L1:
|
||||
.L1:
|
||||
mov ecx,eax // ecx:ebx <- divisor
|
||||
mov ebx,DVSRLO
|
||||
mov edx,DVNDHI // edx:eax <- dividend
|
||||
mov eax,DVNDLO
|
||||
..L3:
|
||||
.L3:
|
||||
shr ecx,1 // shift divisor right one bit// hi bit <- 0
|
||||
rcr ebx,1
|
||||
shr edx,1 // shift dividend right one bit// hi bit <- 0
|
||||
rcr eax,1
|
||||
or ecx,ecx
|
||||
jnz short ..L3 // loop until divisor < 4194304K
|
||||
jnz short .L3 // loop until divisor < 4194304K
|
||||
div ebx // now divide, ignore remainder
|
||||
mov esi,eax // save quotient
|
||||
|
||||
|
@ -147,7 +148,7 @@ __aulldiv:
|
|||
mov eax,DVSRLO
|
||||
mul esi // QUOT * DVSRLO
|
||||
add edx,ecx // EDX:EAX = QUOT * DVSR
|
||||
jc short ..L4 // carry means Quotient is off by 1
|
||||
jc short .L4 // carry means Quotient is off by 1
|
||||
|
||||
//
|
||||
// do long compare here between original dividend and the result of the
|
||||
|
@ -156,13 +157,13 @@ __aulldiv:
|
|||
//
|
||||
|
||||
cmp edx,DVNDHI // compare hi words of result and original
|
||||
ja short ..L4 // if result > original, do subtract
|
||||
jb short ..L5 // if result < original, we are ok
|
||||
ja short .L4 // if result > original, do subtract
|
||||
jb short .L5 // if result < original, we are ok
|
||||
cmp eax,DVNDLO // hi words are equal, compare lo words
|
||||
jbe short ..L5 // if less or equal we are ok, else subtract
|
||||
..L4:
|
||||
jbe short .L5 // if less or equal we are ok, else subtract
|
||||
.L4:
|
||||
dec esi // subtract 1 from quotient
|
||||
..L5:
|
||||
.L5:
|
||||
xor edx,edx // edx:eax <- quotient
|
||||
mov eax,esi
|
||||
|
||||
|
@ -171,9 +172,11 @@ __aulldiv:
|
|||
// Restore the saved registers and return.
|
||||
//
|
||||
|
||||
..L2:
|
||||
.L2:
|
||||
|
||||
pop esi
|
||||
pop ebx
|
||||
|
||||
ret 16
|
||||
|
||||
END
|
||||
|
|
|
@ -33,12 +33,13 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
.globl __aulldvrm
|
||||
|
||||
.intel_syntax noprefix
|
||||
|
||||
#include <asm.inc>
|
||||
|
||||
PUBLIC __aulldvrm
|
||||
|
||||
/* FUNCTIONS ***************************************************************/
|
||||
.code
|
||||
|
||||
__aulldvrm:
|
||||
|
||||
|
@ -101,7 +102,7 @@ __aulldvrm:
|
|||
|
||||
mov eax,DVSRHI // check to see if divisor < 4194304K
|
||||
or eax,eax
|
||||
jnz short .....L1 // nope, gotta do this the hard way
|
||||
jnz short .L1 // nope, gotta do this the hard way
|
||||
mov ecx,DVSRLO // load divisor
|
||||
mov eax,DVNDHI // load high word of dividend
|
||||
xor edx,edx
|
||||
|
@ -120,24 +121,24 @@ __aulldvrm:
|
|||
mov eax,esi // set up low word of quotient
|
||||
mul dword ptr DVSRLO // LOWORD(QUOT) * DVSR
|
||||
add edx,ecx // EDX:EAX = QUOT * DVSR
|
||||
jmp short .....L2 // complete remainder calculation
|
||||
jmp short .L2 // complete remainder calculation
|
||||
|
||||
//
|
||||
// Here we do it the hard way. Remember, eax contains DVSRHI
|
||||
//
|
||||
|
||||
.....L1:
|
||||
.L1:
|
||||
mov ecx,eax // ecx:ebx <- divisor
|
||||
mov ebx,DVSRLO
|
||||
mov edx,DVNDHI // edx:eax <- dividend
|
||||
mov eax,DVNDLO
|
||||
.....L3:
|
||||
.L3:
|
||||
shr ecx,1 // shift divisor right one bit// hi bit <- 0
|
||||
rcr ebx,1
|
||||
shr edx,1 // shift dividend right one bit// hi bit <- 0
|
||||
rcr eax,1
|
||||
or ecx,ecx
|
||||
jnz short .....L3 // loop until divisor < 4194304K
|
||||
jnz short .L3 // loop until divisor < 4194304K
|
||||
div ebx // now divide, ignore remainder
|
||||
mov esi,eax // save quotient
|
||||
|
||||
|
@ -153,7 +154,7 @@ __aulldvrm:
|
|||
mov eax,DVSRLO
|
||||
mul esi // QUOT * DVSRLO
|
||||
add edx,ecx // EDX:EAX = QUOT * DVSR
|
||||
jc short .....L4 // carry means Quotient is off by 1
|
||||
jc short .L4 // carry means Quotient is off by 1
|
||||
|
||||
//
|
||||
// do long compare here between original dividend and the result of the
|
||||
|
@ -162,18 +163,18 @@ __aulldvrm:
|
|||
//
|
||||
|
||||
cmp edx,DVNDHI // compare hi words of result and original
|
||||
ja short .....L4 // if result > original, do subtract
|
||||
jb short .....L5 // if result < original, we are ok
|
||||
ja short .L4 // if result > original, do subtract
|
||||
jb short .L5 // if result < original, we are ok
|
||||
cmp eax,DVNDLO // hi words are equal, compare lo words
|
||||
jbe short .....L5 // if less or equal we are ok, else subtract
|
||||
.....L4:
|
||||
jbe short .L5 // if less or equal we are ok, else subtract
|
||||
.L4:
|
||||
dec esi // subtract 1 from quotient
|
||||
sub eax,DVSRLO // subtract divisor from result
|
||||
sbb edx,DVSRHI
|
||||
.....L5:
|
||||
.L5:
|
||||
xor ebx,ebx // ebx:esi <- quotient
|
||||
|
||||
.....L2:
|
||||
.L2:
|
||||
//
|
||||
// Calculate remainder by subtracting the result from the original dividend.
|
||||
// Since the result is already in a register, we will do the subtract in the
|
||||
|
@ -202,3 +203,5 @@ __aulldvrm:
|
|||
pop esi
|
||||
|
||||
ret 16
|
||||
|
||||
END
|
||||
|
|
|
@ -33,12 +33,13 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
.globl __aullrem
|
||||
|
||||
.intel_syntax noprefix
|
||||
|
||||
#include <asm.inc>
|
||||
|
||||
PUBLIC __aullrem
|
||||
|
||||
/* FUNCTIONS ***************************************************************/
|
||||
.code
|
||||
|
||||
//
|
||||
// ullrem - unsigned long remainder
|
||||
|
@ -101,7 +102,7 @@ __aullrem:
|
|||
|
||||
mov eax,DVSRHI // check to see if divisor < 4194304K
|
||||
or eax,eax
|
||||
jnz short ...L1 // nope, gotta do this the hard way
|
||||
jnz short .L1 // nope, gotta do this the hard way
|
||||
mov ecx,DVSRLO // load divisor
|
||||
mov eax,DVNDHI // load high word of dividend
|
||||
xor edx,edx
|
||||
|
@ -110,24 +111,24 @@ __aullrem:
|
|||
div ecx // edx <- final remainder
|
||||
mov eax,edx // edx:eax <- remainder
|
||||
xor edx,edx
|
||||
jmp short ...L2 // restore stack and return
|
||||
jmp short .L2 // restore stack and return
|
||||
|
||||
//
|
||||
// Here we do it the hard way. Remember, eax contains DVSRHI
|
||||
//
|
||||
|
||||
...L1:
|
||||
.L1:
|
||||
mov ecx,eax // ecx:ebx <- divisor
|
||||
mov ebx,DVSRLO
|
||||
mov edx,DVNDHI // edx:eax <- dividend
|
||||
mov eax,DVNDLO
|
||||
...L3:
|
||||
.L3:
|
||||
shr ecx,1 // shift divisor right one bit// hi bit <- 0
|
||||
rcr ebx,1
|
||||
shr edx,1 // shift dividend right one bit// hi bit <- 0
|
||||
rcr eax,1
|
||||
or ecx,ecx
|
||||
jnz short ...L3 // loop until divisor < 4194304K
|
||||
jnz short .L3 // loop until divisor < 4194304K
|
||||
div ebx // now divide, ignore remainder
|
||||
|
||||
//
|
||||
|
@ -142,7 +143,7 @@ __aullrem:
|
|||
xchg ecx,eax // put partial product in ECX, get quotient in EAX
|
||||
mul dword ptr DVSRLO
|
||||
add edx,ecx // EDX:EAX = QUOT * DVSR
|
||||
jc short ...L4 // carry means Quotient is off by 1
|
||||
jc short .L4 // carry means Quotient is off by 1
|
||||
|
||||
//
|
||||
// do long compare here between original dividend and the result of the
|
||||
|
@ -151,14 +152,14 @@ __aullrem:
|
|||
//
|
||||
|
||||
cmp edx,DVNDHI // compare hi words of result and original
|
||||
ja short ...L4 // if result > original, do subtract
|
||||
jb short ...L5 // if result < original, we're ok
|
||||
ja short .L4 // if result > original, do subtract
|
||||
jb short .L5 // if result < original, we're ok
|
||||
cmp eax,DVNDLO // hi words are equal, compare lo words
|
||||
jbe short ...L5 // if less or equal we're ok, else subtract
|
||||
...L4:
|
||||
jbe short .L5 // if less or equal we're ok, else subtract
|
||||
.L4:
|
||||
sub eax,DVSRLO // subtract divisor from result
|
||||
sbb edx,DVSRHI
|
||||
...L5:
|
||||
.L5:
|
||||
|
||||
//
|
||||
// Calculate remainder by subtracting the result from the original dividend.
|
||||
|
@ -177,8 +178,10 @@ __aullrem:
|
|||
// Restore the saved registers and return.
|
||||
//
|
||||
|
||||
...L2:
|
||||
.L2:
|
||||
|
||||
pop ebx
|
||||
|
||||
ret 16
|
||||
|
||||
END
|
||||
|
|
|
@ -33,12 +33,13 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
.globl __aullshr
|
||||
|
||||
.intel_syntax noprefix
|
||||
|
||||
#include <asm.inc>
|
||||
|
||||
PUBLIC __aullshr
|
||||
|
||||
/* FUNCTIONS ***************************************************************/
|
||||
.code
|
||||
|
||||
//
|
||||
// ullshr - long shift right
|
||||
|
@ -65,13 +66,13 @@ __aullshr:
|
|||
// depends only on the high order bit of edx).
|
||||
//
|
||||
cmp cl,64
|
||||
jae short ..RETZERO
|
||||
jae short .RETZERO
|
||||
|
||||
//
|
||||
// Handle shifts of between 0 and 31 bits
|
||||
//
|
||||
cmp cl, 32
|
||||
jae short ..MORE32
|
||||
jae short .MORE32
|
||||
shrd eax,edx,cl
|
||||
shr edx,cl
|
||||
ret
|
||||
|
@ -79,7 +80,7 @@ __aullshr:
|
|||
//
|
||||
// Handle shifts of between 32 and 63 bits
|
||||
//
|
||||
..MORE32:
|
||||
.MORE32:
|
||||
mov eax,edx
|
||||
xor edx,edx
|
||||
and cl,31
|
||||
|
@ -89,7 +90,9 @@ __aullshr:
|
|||
//
|
||||
// return 0 in edx:eax
|
||||
//
|
||||
..RETZERO:
|
||||
.RETZERO:
|
||||
xor eax,eax
|
||||
xor edx,edx
|
||||
ret
|
||||
|
||||
END
|
||||
|
|
|
@ -33,12 +33,13 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
.globl _ceil
|
||||
|
||||
.intel_syntax noprefix
|
||||
#include <asm.inc>
|
||||
|
||||
PUBLIC _ceil
|
||||
|
||||
/* FUNCTIONS ***************************************************************/
|
||||
.code
|
||||
|
||||
_ceil:
|
||||
push ebp
|
||||
|
@ -47,7 +48,7 @@ _ceil:
|
|||
fld qword ptr [ebp+8] // Load real from stack
|
||||
fstcw [ebp-2] // Save control word
|
||||
fclex // Clear exceptions
|
||||
mov word ptr [ebp-4],0xb63 // Rounding control word
|
||||
mov word ptr [ebp-4], HEX(0b63) // Rounding control word
|
||||
fldcw [ebp-4] // Set new rounding control
|
||||
frndint // Round to integer
|
||||
fclex // Clear exceptions
|
||||
|
@ -55,3 +56,5 @@ _ceil:
|
|||
mov esp,ebp // Deallocate temporary space
|
||||
pop ebp
|
||||
ret
|
||||
|
||||
END
|
||||
|
|
|
@ -3,53 +3,34 @@
|
|||
* This file is part of the w64 mingw-runtime package.
|
||||
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
||||
*/
|
||||
#include <_mingw_mac.h>
|
||||
|
||||
.file "ceilf.S"
|
||||
.text
|
||||
.align 4
|
||||
.globl __MINGW_USYMBOL(ceilf)
|
||||
.def __MINGW_USYMBOL(ceilf); .scl 2; .type 32; .endef
|
||||
__MINGW_USYMBOL(ceilf):
|
||||
#ifdef _WIN64
|
||||
subq $24,%rsp
|
||||
movss %xmm0,8(%rsp)
|
||||
flds 8(%rsp)
|
||||
#include <asm.inc>
|
||||
|
||||
fstcw 4(%rsp) /* store fpu control word */
|
||||
.code
|
||||
.align 4
|
||||
|
||||
movl $0x0800,%edx /* round towards +oo */
|
||||
orl 4(%rsp),%edx
|
||||
andl $0xfbff,%edx
|
||||
movl %edx,(%rsp)
|
||||
fldcw (%rsp) /* load modified control word */
|
||||
PUBLIC _ceilf
|
||||
_ceilf:
|
||||
|
||||
frndint /* round */
|
||||
fld dword ptr [esp + 4]
|
||||
sub esp, 8
|
||||
|
||||
fldcw 4(%rsp) /* restore original control word */
|
||||
fstps 8(%rsp)
|
||||
movss 8(%rsp),%xmm0
|
||||
addq $24,%rsp
|
||||
ret
|
||||
#else
|
||||
flds 4(%esp)
|
||||
subl $8,%esp
|
||||
|
||||
fstcw 4(%esp) /* store fpu control word */
|
||||
fstcw [esp + 4] /* store fpu control word */
|
||||
|
||||
/* We use here %edx although only the low 1 bits are defined.
|
||||
But none of the operations should care and they are faster
|
||||
than the 16 bit operations. */
|
||||
movl $0x0800,%edx /* round towards +oo */
|
||||
orl 4(%esp),%edx
|
||||
andl $0xfbff,%edx
|
||||
movl %edx,(%esp)
|
||||
fldcw (%esp) /* load modified control word */
|
||||
mov edx, [esp + 4]
|
||||
or edx, HEX(0800) /* round towards +oo */
|
||||
and edx, HEX(fbff)
|
||||
mov [esp], edx
|
||||
fldcw [esp] /* load modified control word */
|
||||
|
||||
frndint /* round */
|
||||
|
||||
fldcw 4(%esp) /* restore original control word */
|
||||
fldcw [esp + 4] /* restore original control word */
|
||||
|
||||
addl $8,%esp
|
||||
add esp, 8
|
||||
ret
|
||||
#endif
|
||||
|
||||
END
|
||||
|
|
|
@ -33,12 +33,13 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
.globl _cos
|
||||
|
||||
.intel_syntax noprefix
|
||||
#include <asm.inc>
|
||||
|
||||
PUBLIC _cos
|
||||
|
||||
/* FUNCTIONS ***************************************************************/
|
||||
.code
|
||||
|
||||
_cos:
|
||||
push ebp
|
||||
|
@ -47,3 +48,5 @@ _cos:
|
|||
fcos // Take the cosine
|
||||
pop ebp
|
||||
ret
|
||||
|
||||
END
|
||||
|
|
29
reactos/lib/sdk/crt/math/i386/exp_asm.s
Normal file
29
reactos/lib/sdk/crt/math/i386/exp_asm.s
Normal file
|
@ -0,0 +1,29 @@
|
|||
|
||||
#include <asm.inc>
|
||||
|
||||
PUBLIC _exp
|
||||
|
||||
/* FUNCTIONS ***************************************************************/
|
||||
.code
|
||||
|
||||
_exp:
|
||||
push ebp
|
||||
mov ebp, esp
|
||||
|
||||
fld qword ptr [ebp + 8]
|
||||
fldl2e
|
||||
fmul st, st(1)
|
||||
fst st(1)
|
||||
frndint
|
||||
fxch st(1)
|
||||
fsub st, st(1)
|
||||
f2xm1
|
||||
fld1
|
||||
faddp st(1), st
|
||||
fscale
|
||||
fstp st(1)
|
||||
|
||||
pop ebp
|
||||
ret
|
||||
|
||||
END
|
|
@ -33,12 +33,13 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
.globl _fabs
|
||||
|
||||
.intel_syntax noprefix
|
||||
|
||||
#include <asm.inc>
|
||||
|
||||
PUBLIC _fabs
|
||||
|
||||
/* FUNCTIONS ***************************************************************/
|
||||
.code
|
||||
|
||||
_fabs:
|
||||
push ebp
|
||||
|
@ -47,3 +48,5 @@ _fabs:
|
|||
fabs // Take the absolute value
|
||||
pop ebp
|
||||
ret
|
||||
|
||||
END
|
||||
|
|
|
@ -33,12 +33,13 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
.globl _floor
|
||||
|
||||
.intel_syntax noprefix
|
||||
|
||||
#include <asm.inc>
|
||||
|
||||
PUBLIC _floor
|
||||
|
||||
/* FUNCTIONS ***************************************************************/
|
||||
.code
|
||||
|
||||
_floor:
|
||||
push ebp
|
||||
|
@ -47,7 +48,7 @@ _floor:
|
|||
fld qword ptr [ebp+8] // Load real from stack
|
||||
fstcw [ebp-2] // Save control word
|
||||
fclex // Clear exceptions
|
||||
mov word ptr [ebp-4],0x763 // Rounding control word
|
||||
mov word ptr [ebp-4], HEX(0763) // Rounding control word
|
||||
fldcw [ebp-4] // Set new rounding control
|
||||
frndint // Round to integer
|
||||
fclex // Clear exceptions
|
||||
|
@ -55,3 +56,5 @@ _floor:
|
|||
mov esp,ebp
|
||||
pop ebp
|
||||
ret
|
||||
|
||||
END
|
||||
|
|
|
@ -7,57 +7,34 @@
|
|||
* Removed header file dependency for use in libmingwex.a by
|
||||
* Danny Smith <dannysmith@users.sourceforge.net>
|
||||
*/
|
||||
#include <_mingw_mac.h>
|
||||
|
||||
.file "floorf.S"
|
||||
.text
|
||||
#ifdef _WIN64
|
||||
.align 8
|
||||
#else
|
||||
.align 4
|
||||
#endif
|
||||
.globl __MINGW_USYMBOL(floorf)
|
||||
.def __MINGW_USYMBOL(floorf); .scl 2; .type 32; .endef
|
||||
__MINGW_USYMBOL(floorf):
|
||||
#ifdef _WIN64
|
||||
subq $24,%rsp
|
||||
movss %xmm0,8(%rsp)
|
||||
flds 8(%rsp)
|
||||
#include <asm.inc>
|
||||
|
||||
fstcw 4(%rsp) /* store fpu control word */
|
||||
movl $0x400,%edx /* round towards -oo */
|
||||
orl 4(%rsp),%edx
|
||||
andl $0xf7ff,%edx
|
||||
movl %edx,(%rsp)
|
||||
fldcw (%rsp) /* load modified control word */
|
||||
.code
|
||||
.align 4
|
||||
|
||||
frndint /* round */
|
||||
PUBLIC _floorf
|
||||
_floorf:
|
||||
|
||||
fldcw 4(%rsp) /* restore original control word */
|
||||
fld dword ptr [esp + 4]
|
||||
sub esp, 8
|
||||
|
||||
fstps 8(%rsp)
|
||||
movss 8(%rsp),%xmm0
|
||||
addq $24,%rsp
|
||||
ret
|
||||
#else
|
||||
flds 4(%esp)
|
||||
subl $8,%esp
|
||||
|
||||
fstcw 4(%esp) /* store fpu control word */
|
||||
fstcw [esp + 4] /* store fpu control word */
|
||||
|
||||
/* We use here %edx although only the low 1 bits are defined.
|
||||
But none of the operations should care and they are faster
|
||||
than the 16 bit operations. */
|
||||
movl $0x400,%edx /* round towards -oo */
|
||||
orl 4(%esp),%edx
|
||||
andl $0xf7ff,%edx
|
||||
movl %edx,(%esp)
|
||||
fldcw (%esp) /* load modified control word */
|
||||
mov edx, [esp + 4]
|
||||
or edx, HEX(0400) /* round towards -oo */
|
||||
and edx, HEX(0f7ff)
|
||||
mov [esp], edx
|
||||
fldcw [esp] /* load modified control word */
|
||||
|
||||
frndint /* round */
|
||||
|
||||
fldcw 4(%esp) /* restore original control word */
|
||||
fldcw [esp + 4] /* restore original control word */
|
||||
|
||||
addl $8,%esp
|
||||
add esp, 8
|
||||
ret
|
||||
#endif
|
||||
|
||||
END
|
||||
|
|
26
reactos/lib/sdk/crt/math/i386/fmod_asm.s
Normal file
26
reactos/lib/sdk/crt/math/i386/fmod_asm.s
Normal file
|
@ -0,0 +1,26 @@
|
|||
|
||||
#include <asm.inc>
|
||||
|
||||
PUBLIC _fmod
|
||||
|
||||
/* FUNCTIONS ***************************************************************/
|
||||
.code
|
||||
|
||||
_fmod:
|
||||
push ebp
|
||||
mov ebp, esp
|
||||
|
||||
fld qword ptr [ebp + 8]
|
||||
fld qword ptr [ebp + 16]
|
||||
fxch st(1)
|
||||
l1:
|
||||
fprem
|
||||
fstsw ax
|
||||
sahf
|
||||
jp l1
|
||||
fstp st(1)
|
||||
|
||||
pop ebp
|
||||
ret
|
||||
|
||||
END
|
26
reactos/lib/sdk/crt/math/i386/fmodf_asm.s
Normal file
26
reactos/lib/sdk/crt/math/i386/fmodf_asm.s
Normal file
|
@ -0,0 +1,26 @@
|
|||
|
||||
#include <asm.inc>
|
||||
|
||||
PUBLIC _fmodf
|
||||
|
||||
/* FUNCTIONS ***************************************************************/
|
||||
.code
|
||||
|
||||
_fmodf:
|
||||
push ebp
|
||||
mov ebp, esp
|
||||
|
||||
fld dword ptr [esp + 4]
|
||||
fld dword ptr [esp + 8]
|
||||
fxch st(1)
|
||||
l1:
|
||||
fprem
|
||||
fstsw ax
|
||||
sahf
|
||||
jp l1
|
||||
fstp st(1)
|
||||
|
||||
pop ebp
|
||||
ret
|
||||
|
||||
END
|
28
reactos/lib/sdk/crt/math/i386/ftol2_asm.s
Normal file
28
reactos/lib/sdk/crt/math/i386/ftol2_asm.s
Normal file
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* PURPOSE: Run-Time Library
|
||||
* FILE: lib/rtl/i386/ftol2.S
|
||||
* PROGRAMER:
|
||||
*
|
||||
*/
|
||||
|
||||
#include <asm.inc>
|
||||
|
||||
EXTERN __ftol:PROC
|
||||
PUBLIC __ftol2
|
||||
PUBLIC __ftol2_sse
|
||||
|
||||
/* FUNCTIONS ***************************************************************/
|
||||
.code
|
||||
|
||||
/*
|
||||
* This routine is called by MSVC-generated code to convert from floating point
|
||||
* to integer representation. The floating point number to be converted is
|
||||
* on the top of the floating point stack.
|
||||
*/
|
||||
__ftol2:
|
||||
__ftol2_sse:
|
||||
jmp __ftol
|
||||
|
||||
END
|
|
@ -33,12 +33,13 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
.globl __ftol
|
||||
|
||||
.intel_syntax noprefix
|
||||
|
||||
#include <asm.inc>
|
||||
|
||||
PUBLIC __ftol
|
||||
|
||||
/* FUNCTIONS ***************************************************************/
|
||||
.code
|
||||
|
||||
/*
|
||||
* This routine is called by MSVC-generated code to convert from floating point
|
||||
|
@ -54,7 +55,7 @@ __ftol:
|
|||
fstcw [ebp-2]
|
||||
wait
|
||||
mov ax, [ebp-2]
|
||||
or ah, 0xC
|
||||
or ah, 12
|
||||
mov [ebp-4], ax
|
||||
fldcw [ebp-4]
|
||||
|
||||
|
@ -71,3 +72,5 @@ __ftol:
|
|||
/* Remove stack frame and return*/
|
||||
leave
|
||||
ret
|
||||
|
||||
END
|
||||
|
|
|
@ -7,12 +7,13 @@
|
|||
* PROGRAMER: Magnus Olsen (magnus@greatlord.com)
|
||||
*
|
||||
*/
|
||||
|
||||
.globl _log10
|
||||
|
||||
.intel_syntax noprefix
|
||||
#include <asm.inc>
|
||||
|
||||
PUBLIC _log10
|
||||
|
||||
/* FUNCTIONS ***************************************************************/
|
||||
.code
|
||||
|
||||
_log10:
|
||||
|
||||
|
@ -25,3 +26,4 @@ _log10:
|
|||
pop ebp
|
||||
ret
|
||||
|
||||
END
|
||||
|
|
|
@ -33,12 +33,13 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
.globl _log
|
||||
|
||||
.intel_syntax noprefix
|
||||
|
||||
#include <asm.inc>
|
||||
|
||||
PUBLIC _log
|
||||
|
||||
/* FUNCTIONS ***************************************************************/
|
||||
.code
|
||||
|
||||
_log:
|
||||
push ebp
|
||||
|
@ -49,3 +50,5 @@ _log:
|
|||
fyl2x // Compute the natural log(x)
|
||||
pop ebp
|
||||
ret
|
||||
|
||||
END
|
||||
|
|
|
@ -19,41 +19,53 @@
|
|||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
/* Reacros modifications */
|
||||
/* Reactos modifications */
|
||||
#include <asm.inc>
|
||||
|
||||
#define ALIGNARG(log2) log2
|
||||
#define ASM_TYPE_DIRECTIVE(name,typearg)
|
||||
#define ASM_SIZE_DIRECTIVE(name)
|
||||
#define cfi_adjust_cfa_offset(x)
|
||||
#define ENTRY(x)
|
||||
#define END(x)
|
||||
.global _pow
|
||||
|
||||
.text
|
||||
PUBLIC _pow
|
||||
|
||||
.data
|
||||
ASSUME nothing
|
||||
|
||||
.align ALIGNARG(4)
|
||||
ASM_TYPE_DIRECTIVE(infinity,@object)
|
||||
|
||||
inf_zero:
|
||||
infinity:
|
||||
.byte 0, 0, 0, 0, 0, 0, 0xf0, 0x7f
|
||||
.byte 0, 0, 0, 0, 0, 0, HEX(f0), HEX(7f)
|
||||
ASM_SIZE_DIRECTIVE(infinity)
|
||||
ASM_TYPE_DIRECTIVE(zero,@object)
|
||||
zero: .double 0.0
|
||||
zero:
|
||||
.double 0.0
|
||||
ASM_SIZE_DIRECTIVE(zero)
|
||||
ASM_TYPE_DIRECTIVE(minf_mzero,@object)
|
||||
|
||||
minf_mzero:
|
||||
minfinity:
|
||||
.byte 0, 0, 0, 0, 0, 0, 0xf0, 0xff
|
||||
.byte 0, 0, 0, 0, 0, 0, HEX(f0), HEX(ff)
|
||||
|
||||
mzero:
|
||||
.byte 0, 0, 0, 0, 0, 0, 0, 0x80
|
||||
.byte 0, 0, 0, 0, 0, 0, 0, HEX(80)
|
||||
ASM_SIZE_DIRECTIVE(minf_mzero)
|
||||
ASM_TYPE_DIRECTIVE(one,@object)
|
||||
one: .double 1.0
|
||||
|
||||
one:
|
||||
.double 1.0
|
||||
ASM_SIZE_DIRECTIVE(one)
|
||||
ASM_TYPE_DIRECTIVE(limit,@object)
|
||||
limit: .double 0.29
|
||||
|
||||
limit:
|
||||
.double 0.29
|
||||
ASM_SIZE_DIRECTIVE(limit)
|
||||
ASM_TYPE_DIRECTIVE(p63,@object)
|
||||
p63: .byte 0, 0, 0, 0, 0, 0, 0xe0, 0x43
|
||||
|
||||
p63:
|
||||
.byte 0, 0, 0, 0, 0, 0, HEX(e0), HEX(43)
|
||||
ASM_SIZE_DIRECTIVE(p63)
|
||||
|
||||
#ifdef PIC
|
||||
|
@ -61,308 +73,309 @@ p63: .byte 0, 0, 0, 0, 0, 0, 0xe0, 0x43
|
|||
#define MOX(op,x,f) op##@GOTOFF(%ecx,x,f)
|
||||
#else
|
||||
#define MO(op) op
|
||||
#define MOX(op,x,f) op(,x,f)
|
||||
#define MOX(op,x,f) op[x*f]
|
||||
#endif
|
||||
|
||||
.text
|
||||
.code
|
||||
_pow:
|
||||
ENTRY(__ieee754_pow)
|
||||
fldl 12(%esp) // y
|
||||
fld qword ptr [esp + 12] // y
|
||||
fxam
|
||||
|
||||
#ifdef PIC
|
||||
LOAD_PIC_REG (cx)
|
||||
#endif
|
||||
|
||||
fnstsw
|
||||
movb %ah, %dl
|
||||
andb $0x45, %ah
|
||||
cmpb $0x40, %ah // is y == 0 ?
|
||||
je 11f
|
||||
fnstsw ax
|
||||
mov dl, ah
|
||||
and ah, HEX(045)
|
||||
cmp ah, HEX(040) // is y == 0 ?
|
||||
je L11
|
||||
|
||||
cmpb $0x05, %ah // is y == ±inf ?
|
||||
je 12f
|
||||
cmp ah, 5 // is y == ±inf ?
|
||||
je L12
|
||||
|
||||
cmpb $0x01, %ah // is y == NaN ?
|
||||
je 30f
|
||||
cmp ah, 1 // is y == NaN ?
|
||||
je L30
|
||||
|
||||
fldl 4(%esp) // x : y
|
||||
fld qword ptr [esp + 4] // x : y
|
||||
|
||||
subl $8,%esp
|
||||
sub esp, 8
|
||||
cfi_adjust_cfa_offset (8)
|
||||
|
||||
fxam
|
||||
fnstsw
|
||||
movb %ah, %dh
|
||||
andb $0x45, %ah
|
||||
cmpb $0x40, %ah
|
||||
je 20f // x is ±0
|
||||
fnstsw ax
|
||||
mov dh, ah
|
||||
and ah, HEX(45)
|
||||
cmp ah, HEX(040)
|
||||
je L20 // x is ±0
|
||||
|
||||
cmpb $0x05, %ah
|
||||
je 15f // x is ±inf
|
||||
cmp ah, 5
|
||||
je L15 // x is ±inf
|
||||
|
||||
fxch // y : x
|
||||
fxch st(1) // y : x
|
||||
|
||||
/* fistpll raises invalid exception for |y| >= 1L<<63. */
|
||||
fld %st // y : y : x
|
||||
fld st // y : y : x
|
||||
fabs // |y| : y : x
|
||||
fcompl MO(p63) // y : x
|
||||
fnstsw
|
||||
fcomp qword ptr MO(p63) // y : x
|
||||
fnstsw ax
|
||||
sahf
|
||||
jnc 2f
|
||||
jnc L2
|
||||
|
||||
/* First see whether `y' is a natural number. In this case we
|
||||
can use a more precise algorithm. */
|
||||
fld %st // y : y : x
|
||||
fistpll (%esp) // y : x
|
||||
fildll (%esp) // int(y) : y : x
|
||||
fucomp %st(1) // y : x
|
||||
fnstsw
|
||||
fld st // y : y : x
|
||||
fistp qword ptr [esp] // y : x
|
||||
fild qword ptr [esp] // int(y) : y : x
|
||||
fucomp st(1) // y : x
|
||||
fnstsw ax
|
||||
sahf
|
||||
jne 2f
|
||||
jne L2
|
||||
|
||||
/* OK, we have an integer value for y. */
|
||||
popl %eax
|
||||
pop eax
|
||||
cfi_adjust_cfa_offset (-4)
|
||||
popl %edx
|
||||
pop edx
|
||||
cfi_adjust_cfa_offset (-4)
|
||||
orl $0, %edx
|
||||
fstp %st(0) // x
|
||||
jns 4f // y >= 0, jump
|
||||
fdivrl MO(one) // 1/x (now referred to as x)
|
||||
negl %eax
|
||||
adcl $0, %edx
|
||||
negl %edx
|
||||
4: fldl MO(one) // 1 : x
|
||||
fxch
|
||||
or edx, 0
|
||||
fstp st // x
|
||||
jns L4 // y >= 0, jump
|
||||
fdivr qword ptr MO(one) // 1/x (now referred to as x)
|
||||
neg eax
|
||||
adc edx, 0
|
||||
neg edx
|
||||
L4: fld qword ptr MO(one) // 1 : x
|
||||
fxch st(1)
|
||||
|
||||
6: shrdl $1, %edx, %eax
|
||||
jnc 5f
|
||||
fxch
|
||||
fmul %st(1) // x : ST*x
|
||||
fxch
|
||||
5: fmul %st(0), %st // x*x : ST*x
|
||||
shrl $1, %edx
|
||||
movl %eax, %ecx
|
||||
orl %edx, %ecx
|
||||
jnz 6b
|
||||
fstp %st(0) // ST*x
|
||||
L6: shrd eax, edx, 1
|
||||
jnc L5
|
||||
fxch st(1)
|
||||
fmul st, st(1) // x : ST*x
|
||||
fxch st(1)
|
||||
L5: fmul st, st // x*x : ST*x
|
||||
shr edx, 1
|
||||
mov ecx, eax
|
||||
or ecx, edx
|
||||
jnz L6
|
||||
fstp st // ST*x
|
||||
ret
|
||||
|
||||
/* y is ±NAN */
|
||||
30: fldl 4(%esp) // x : y
|
||||
fldl MO(one) // 1.0 : x : y
|
||||
fucomp %st(1) // x : y
|
||||
fnstsw
|
||||
L30:
|
||||
fld qword ptr [esp + 4] // x : y
|
||||
fld qword ptr MO(one) // 1.0 : x : y
|
||||
fucomp st(1) // x : y
|
||||
fnstsw ax
|
||||
sahf
|
||||
je 31f
|
||||
fxch // y : x
|
||||
31: fstp %st(1)
|
||||
je L31
|
||||
fxch st(1) // y : x
|
||||
L31:fstp st(1)
|
||||
ret
|
||||
|
||||
cfi_adjust_cfa_offset (8)
|
||||
.align ALIGNARG(4)
|
||||
2: /* y is a real number. */
|
||||
fxch // x : y
|
||||
fldl MO(one) // 1.0 : x : y
|
||||
fldl MO(limit) // 0.29 : 1.0 : x : y
|
||||
fld %st(2) // x : 0.29 : 1.0 : x : y
|
||||
fsub %st(2) // x-1 : 0.29 : 1.0 : x : y
|
||||
L2: /* y is a real number. */
|
||||
fxch st(1) // x : y
|
||||
fld qword ptr MO(one) // 1.0 : x : y
|
||||
fld qword ptr MO(limit) // 0.29 : 1.0 : x : y
|
||||
fld st(2) // x : 0.29 : 1.0 : x : y
|
||||
fsub st, st(2) // x-1 : 0.29 : 1.0 : x : y
|
||||
fabs // |x-1| : 0.29 : 1.0 : x : y
|
||||
fucompp // 1.0 : x : y
|
||||
fnstsw
|
||||
fxch // x : 1.0 : y
|
||||
fnstsw ax
|
||||
fxch st(1) // x : 1.0 : y
|
||||
sahf
|
||||
ja 7f
|
||||
fsub %st(1) // x-1 : 1.0 : y
|
||||
ja L7
|
||||
fsub st, st(1) // x-1 : 1.0 : y
|
||||
fyl2xp1 // log2(x) : y
|
||||
jmp 8f
|
||||
jmp L8
|
||||
|
||||
7: fyl2x // log2(x) : y
|
||||
8: fmul %st(1) // y*log2(x) : y
|
||||
fst %st(1) // y*log2(x) : y*log2(x)
|
||||
L7: fyl2x // log2(x) : y
|
||||
L8: fmul st, st(1) // y*log2(x) : y
|
||||
fst st(1) // y*log2(x) : y*log2(x)
|
||||
frndint // int(y*log2(x)) : y*log2(x)
|
||||
fsubr %st, %st(1) // int(y*log2(x)) : fract(y*log2(x))
|
||||
fsubr st(1), st // int(y*log2(x)) : fract(y*log2(x))
|
||||
fxch // fract(y*log2(x)) : int(y*log2(x))
|
||||
f2xm1 // 2^fract(y*log2(x))-1 : int(y*log2(x))
|
||||
faddl MO(one) // 2^fract(y*log2(x)) : int(y*log2(x))
|
||||
fadd qword ptr MO(one) // 2^fract(y*log2(x)) : int(y*log2(x))
|
||||
fscale // 2^fract(y*log2(x))*2^int(y*log2(x)) : int(y*log2(x))
|
||||
addl $8, %esp
|
||||
add esp, 8
|
||||
cfi_adjust_cfa_offset (-8)
|
||||
fstp %st(1) // 2^fract(y*log2(x))*2^int(y*log2(x))
|
||||
fstp st(1) // 2^fract(y*log2(x))*2^int(y*log2(x))
|
||||
ret
|
||||
|
||||
|
||||
// pow(x,±0) = 1
|
||||
.align ALIGNARG(4)
|
||||
11: fstp %st(0) // pop y
|
||||
fldl MO(one)
|
||||
L11:fstp st(0) // pop y
|
||||
fld qword ptr MO(one)
|
||||
ret
|
||||
|
||||
// y == ±inf
|
||||
.align ALIGNARG(4)
|
||||
12: fstp %st(0) // pop y
|
||||
fldl MO(one) // 1
|
||||
fldl 4(%esp) // x : 1
|
||||
L12: fstp st(0) // pop y
|
||||
fld qword ptr MO(one) // 1
|
||||
fld qword ptr [esp + 4] // x : 1
|
||||
fabs // abs(x) : 1
|
||||
fucompp // < 1, == 1, or > 1
|
||||
fnstsw
|
||||
andb $0x45, %ah
|
||||
cmpb $0x45, %ah
|
||||
je 13f // jump if x is NaN
|
||||
fnstsw ax
|
||||
and ah, HEX(45)
|
||||
cmp ah, HEX(45)
|
||||
je L13 // jump if x is NaN
|
||||
|
||||
cmpb $0x40, %ah
|
||||
je 14f // jump if |x| == 1
|
||||
cmp ah, HEX(40)
|
||||
je L14 // jump if |x| == 1
|
||||
|
||||
shlb $1, %ah
|
||||
xorb %ah, %dl
|
||||
andl $2, %edx
|
||||
fldl MOX(inf_zero, %edx, 4)
|
||||
shl ah, 1
|
||||
xor dl, ah
|
||||
and edx, 2
|
||||
fld qword ptr MOX(inf_zero, edx, 4)
|
||||
ret
|
||||
|
||||
.align ALIGNARG(4)
|
||||
14: fldl MO(one)
|
||||
L14:fld qword ptr MO(one)
|
||||
ret
|
||||
|
||||
.align ALIGNARG(4)
|
||||
13: fldl 4(%esp) // load x == NaN
|
||||
L13:fld qword ptr [esp + 4] // load x == NaN
|
||||
ret
|
||||
|
||||
cfi_adjust_cfa_offset (8)
|
||||
.align ALIGNARG(4)
|
||||
// x is ±inf
|
||||
15: fstp %st(0) // y
|
||||
testb $2, %dh
|
||||
jz 16f // jump if x == +inf
|
||||
L15: fstp st(0) // y
|
||||
test dh, 2
|
||||
jz L16 // jump if x == +inf
|
||||
|
||||
// We must find out whether y is an odd integer.
|
||||
fld %st // y : y
|
||||
fistpll (%esp) // y
|
||||
fildll (%esp) // int(y) : y
|
||||
fld st // y : y
|
||||
fistp qword ptr [esp] // y
|
||||
fild qword ptr [esp] // int(y) : y
|
||||
fucompp // <empty>
|
||||
fnstsw
|
||||
fnstsw ax
|
||||
sahf
|
||||
jne 17f
|
||||
jne L17
|
||||
|
||||
// OK, the value is an integer, but is the number of bits small
|
||||
// enough so that all are coming from the mantissa?
|
||||
popl %eax
|
||||
pop eax
|
||||
cfi_adjust_cfa_offset (-4)
|
||||
popl %edx
|
||||
pop edx
|
||||
cfi_adjust_cfa_offset (-4)
|
||||
andb $1, %al
|
||||
jz 18f // jump if not odd
|
||||
movl %edx, %eax
|
||||
orl %edx, %edx
|
||||
jns 155f
|
||||
negl %eax
|
||||
155: cmpl $0x00200000, %eax
|
||||
ja 18f // does not fit in mantissa bits
|
||||
and al, 1
|
||||
jz L18 // jump if not odd
|
||||
mov eax, edx
|
||||
or edx, edx
|
||||
jns L155
|
||||
neg eax
|
||||
L155:
|
||||
cmp eax, HEX(000200000)
|
||||
ja L18 // does not fit in mantissa bits
|
||||
// It's an odd integer.
|
||||
shrl $31, %edx
|
||||
fldl MOX(minf_mzero, %edx, 8)
|
||||
shr edx, 31
|
||||
fld qword ptr MOX(minf_mzero, edx, 8)
|
||||
ret
|
||||
|
||||
cfi_adjust_cfa_offset (8)
|
||||
.align ALIGNARG(4)
|
||||
16: fcompl MO(zero)
|
||||
addl $8, %esp
|
||||
L16:fcomp qword ptr MO(zero)
|
||||
add esp, 8
|
||||
cfi_adjust_cfa_offset (-8)
|
||||
fnstsw
|
||||
shrl $5, %eax
|
||||
andl $8, %eax
|
||||
fldl MOX(inf_zero, %eax, 1)
|
||||
fnstsw ax
|
||||
shr eax, 5
|
||||
and eax, 8
|
||||
fld qword ptr MOX(inf_zero, eax, 1)
|
||||
ret
|
||||
|
||||
cfi_adjust_cfa_offset (8)
|
||||
.align ALIGNARG(4)
|
||||
17: shll $30, %edx // sign bit for y in right position
|
||||
addl $8, %esp
|
||||
L17: shl ecx, 30 // sign bit for y in right position
|
||||
add esp, 8
|
||||
cfi_adjust_cfa_offset (-8)
|
||||
18: shrl $31, %edx
|
||||
fldl MOX(inf_zero, %edx, 8)
|
||||
L18: shr edx, 31
|
||||
fld qword ptr MOX(inf_zero, edx, 8)
|
||||
ret
|
||||
|
||||
cfi_adjust_cfa_offset (8)
|
||||
.align ALIGNARG(4)
|
||||
// x is ±0
|
||||
20: fstp %st(0) // y
|
||||
testb $2, %dl
|
||||
jz 21f // y > 0
|
||||
L20: fstp st(0) // y
|
||||
test dl, 2
|
||||
jz L21 // y > 0
|
||||
|
||||
// x is ±0 and y is < 0. We must find out whether y is an odd integer.
|
||||
testb $2, %dh
|
||||
jz 25f
|
||||
test dh, 2
|
||||
jz L25
|
||||
|
||||
fld %st // y : y
|
||||
fistpll (%esp) // y
|
||||
fildll (%esp) // int(y) : y
|
||||
fld st // y : y
|
||||
fistp qword ptr [esp] // y
|
||||
fild qword ptr [esp] // int(y) : y
|
||||
fucompp // <empty>
|
||||
fnstsw
|
||||
fnstsw ax
|
||||
sahf
|
||||
jne 26f
|
||||
jne L26
|
||||
|
||||
// OK, the value is an integer, but is the number of bits small
|
||||
// enough so that all are coming from the mantissa?
|
||||
popl %eax
|
||||
pop eax
|
||||
cfi_adjust_cfa_offset (-4)
|
||||
popl %edx
|
||||
pop edx
|
||||
cfi_adjust_cfa_offset (-4)
|
||||
andb $1, %al
|
||||
jz 27f // jump if not odd
|
||||
cmpl $0xffe00000, %edx
|
||||
jbe 27f // does not fit in mantissa bits
|
||||
and al, 1
|
||||
jz L27 // jump if not odd
|
||||
cmp edx, HEX(0ffe00000)
|
||||
jbe L27 // does not fit in mantissa bits
|
||||
// It's an odd integer.
|
||||
// Raise divide-by-zero exception and get minus infinity value.
|
||||
fldl MO(one)
|
||||
fdivl MO(zero)
|
||||
fld qword ptr MO(one)
|
||||
fdiv qword ptr MO(zero)
|
||||
fchs
|
||||
ret
|
||||
|
||||
cfi_adjust_cfa_offset (8)
|
||||
25: fstp %st(0)
|
||||
26: addl $8, %esp
|
||||
L25: fstp st(0)
|
||||
L26: add esp, 8
|
||||
cfi_adjust_cfa_offset (-8)
|
||||
27: // Raise divide-by-zero exception and get infinity value.
|
||||
fldl MO(one)
|
||||
fdivl MO(zero)
|
||||
L27: // Raise divide-by-zero exception and get infinity value.
|
||||
fld qword ptr MO(one)
|
||||
fdiv qword ptr MO(zero)
|
||||
ret
|
||||
|
||||
cfi_adjust_cfa_offset (8)
|
||||
.align ALIGNARG(4)
|
||||
// x is ±0 and y is > 0. We must find out whether y is an odd integer.
|
||||
21: testb $2, %dh
|
||||
jz 22f
|
||||
L21:test dh, 2
|
||||
jz L22
|
||||
|
||||
fld %st // y : y
|
||||
fistpll (%esp) // y
|
||||
fildll (%esp) // int(y) : y
|
||||
fld st // y : y
|
||||
fistp qword ptr [esp] // y
|
||||
fild qword ptr [esp] // int(y) : y
|
||||
fucompp // <empty>
|
||||
fnstsw
|
||||
fnstsw ax
|
||||
sahf
|
||||
jne 23f
|
||||
jne L23
|
||||
|
||||
// OK, the value is an integer, but is the number of bits small
|
||||
// enough so that all are coming from the mantissa?
|
||||
popl %eax
|
||||
pop eax
|
||||
cfi_adjust_cfa_offset (-4)
|
||||
popl %edx
|
||||
pop edx
|
||||
cfi_adjust_cfa_offset (-4)
|
||||
andb $1, %al
|
||||
jz 24f // jump if not odd
|
||||
cmpl $0xffe00000, %edx
|
||||
jae 24f // does not fit in mantissa bits
|
||||
and al, 1
|
||||
jz L24 // jump if not odd
|
||||
cmp edx, HEX(0ffe00000)
|
||||
jae L24 // does not fit in mantissa bits
|
||||
// It's an odd integer.
|
||||
fldl MO(mzero)
|
||||
fld qword ptr MO(mzero)
|
||||
ret
|
||||
|
||||
cfi_adjust_cfa_offset (8)
|
||||
22: fstp %st(0)
|
||||
23: addl $8, %esp // Don't use 2 x pop
|
||||
L22: fstp st(0)
|
||||
L23: add esp, 8 // Don't use 2 x pop
|
||||
cfi_adjust_cfa_offset (-8)
|
||||
24: fldl MO(zero)
|
||||
L24: fld qword ptr MO(zero)
|
||||
ret
|
||||
|
||||
END(__ieee754_pow)
|
||||
END
|
||||
|
||||
|
||||
|
|
|
@ -33,12 +33,13 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
.globl _sin
|
||||
|
||||
.intel_syntax noprefix
|
||||
#include <asm.inc>
|
||||
|
||||
PUBLIC _sin
|
||||
|
||||
/* FUNCTIONS ***************************************************************/
|
||||
.code
|
||||
|
||||
_sin:
|
||||
push ebp // Save register bp
|
||||
|
@ -47,3 +48,5 @@ _sin:
|
|||
fsin // Take the sine
|
||||
pop ebp // Restore register bp
|
||||
ret
|
||||
|
||||
END
|
||||
|
|
|
@ -33,12 +33,13 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
.globl _sqrt
|
||||
|
||||
.intel_syntax noprefix
|
||||
|
||||
#include <asm.inc>
|
||||
|
||||
PUBLIC _sqrt
|
||||
|
||||
/* FUNCTIONS ***************************************************************/
|
||||
.code
|
||||
|
||||
_sqrt:
|
||||
push ebp
|
||||
|
@ -47,3 +48,5 @@ _sqrt:
|
|||
fsqrt // Take the square root
|
||||
pop ebp
|
||||
ret
|
||||
|
||||
END
|
||||
|
|
|
@ -33,12 +33,13 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
.globl _tan
|
||||
|
||||
.intel_syntax noprefix
|
||||
|
||||
#include <asm.inc>
|
||||
|
||||
PUBLIC _tan
|
||||
|
||||
/* FUNCTIONS ***************************************************************/
|
||||
.code
|
||||
|
||||
_tan:
|
||||
push ebp
|
||||
|
@ -50,3 +51,5 @@ _tan:
|
|||
mov esp,ebp // Deallocate temporary space
|
||||
pop ebp
|
||||
ret
|
||||
|
||||
END
|
||||
|
|
|
@ -5,28 +5,34 @@
|
|||
* FILE: lib/sdk/crt/mem/i386/memchr.s
|
||||
*/
|
||||
|
||||
#include <asm.inc>
|
||||
#include <ks386.inc>
|
||||
|
||||
/*
|
||||
* void* memchr(const void* s, int c, size_t n)
|
||||
*/
|
||||
|
||||
.globl _memchr
|
||||
PUBLIC _memchr
|
||||
.code
|
||||
|
||||
_memchr:
|
||||
push %ebp
|
||||
mov %esp,%ebp
|
||||
push %edi
|
||||
mov 0x8(%ebp),%edi
|
||||
mov 0xc(%ebp),%eax
|
||||
mov 0x10(%ebp),%ecx
|
||||
push ebp
|
||||
mov ebp, esp
|
||||
push edi
|
||||
mov edi, [ebp + 8]
|
||||
mov eax, [ebp + 12]
|
||||
mov ecx, [ebp + 16]
|
||||
cld
|
||||
jecxz .Lnotfound
|
||||
repne scasb
|
||||
je .Lfound
|
||||
jecxz .Lnotfound
|
||||
repne scasb
|
||||
je .Lfound
|
||||
.Lnotfound:
|
||||
mov $1,%edi
|
||||
mov edi, 1
|
||||
.Lfound:
|
||||
mov %edi,%eax
|
||||
dec %eax
|
||||
pop %edi
|
||||
mov eax, edi
|
||||
dec eax
|
||||
pop edi
|
||||
leave
|
||||
ret
|
||||
|
||||
END
|
||||
|
|
|
@ -1,114 +0,0 @@
|
|||
/*
|
||||
* void *memcpy (void *to, const void *from, size_t count)
|
||||
*
|
||||
* NOTE: This code is a duplicate of memmove function from memmove_asm.s
|
||||
*/
|
||||
|
||||
.globl _memcpy
|
||||
|
||||
_memcpy:
|
||||
push %ebp
|
||||
mov %esp,%ebp
|
||||
|
||||
push %esi
|
||||
push %edi
|
||||
|
||||
mov 8(%ebp),%edi
|
||||
mov 12(%ebp),%esi
|
||||
mov 16(%ebp),%ecx
|
||||
|
||||
cmp %esi,%edi
|
||||
jbe .CopyUp
|
||||
mov %ecx,%eax
|
||||
add %esi,%eax
|
||||
cmp %eax,%edi
|
||||
jb .CopyDown
|
||||
|
||||
.CopyUp:
|
||||
cld
|
||||
|
||||
cmp $16,%ecx
|
||||
jb .L1
|
||||
mov %ecx,%edx
|
||||
test $3,%edi
|
||||
je .L2
|
||||
/*
|
||||
* Make the destination dword aligned
|
||||
*/
|
||||
mov %edi,%ecx
|
||||
and $3,%ecx
|
||||
sub $5,%ecx
|
||||
not %ecx
|
||||
sub %ecx,%edx
|
||||
rep movsb
|
||||
mov %edx,%ecx
|
||||
.L2:
|
||||
shr $2,%ecx
|
||||
rep movsl
|
||||
mov %edx,%ecx
|
||||
and $3,%ecx
|
||||
.L1:
|
||||
test %ecx,%ecx
|
||||
je .L3
|
||||
rep movsb
|
||||
.L3:
|
||||
mov 8(%ebp),%eax
|
||||
pop %edi
|
||||
pop %esi
|
||||
leave
|
||||
ret
|
||||
|
||||
.CopyDown:
|
||||
std
|
||||
|
||||
add %ecx,%edi
|
||||
add %ecx,%esi
|
||||
|
||||
cmp $16,%ecx
|
||||
jb .L4
|
||||
mov %ecx,%edx
|
||||
test $3,%edi
|
||||
je .L5
|
||||
|
||||
/*
|
||||
* Make the destination dword aligned
|
||||
*/
|
||||
mov %edi,%ecx
|
||||
and $3,%ecx
|
||||
sub %ecx,%edx
|
||||
dec %esi
|
||||
dec %edi
|
||||
rep movsb
|
||||
mov %edx,%ecx
|
||||
|
||||
sub $3,%esi
|
||||
sub $3,%edi
|
||||
.L6:
|
||||
shr $2,%ecx
|
||||
rep movsl
|
||||
mov %edx,%ecx
|
||||
and $3,%ecx
|
||||
je .L7
|
||||
add $3,%esi
|
||||
add $3,%edi
|
||||
.L8:
|
||||
rep movsb
|
||||
.L7:
|
||||
cld
|
||||
mov 8(%ebp),%eax
|
||||
pop %edi
|
||||
pop %esi
|
||||
leave
|
||||
ret
|
||||
.L5:
|
||||
sub $4,%edi
|
||||
sub $4,%esi
|
||||
jmp .L6
|
||||
|
||||
.L4:
|
||||
test %ecx,%ecx
|
||||
je .L7
|
||||
dec %esi
|
||||
dec %edi
|
||||
jmp .L8
|
||||
|
|
@ -1,114 +1,120 @@
|
|||
/*
|
||||
* void *memmove (void *to, const void *from, size_t count)
|
||||
* void *memcpy (void *to, const void *from, size_t count)
|
||||
*
|
||||
* NOTE: This code is duplicated in memcpy_asm.s
|
||||
*/
|
||||
|
||||
.globl _memmove
|
||||
#include <asm.inc>
|
||||
#include <ks386.inc>
|
||||
|
||||
PUBLIC _memcpy
|
||||
PUBLIC _memmove
|
||||
.code
|
||||
|
||||
_memcpy:
|
||||
_memmove:
|
||||
push %ebp
|
||||
mov %esp,%ebp
|
||||
push ebp
|
||||
mov ebp, esp
|
||||
|
||||
push %esi
|
||||
push %edi
|
||||
push esi
|
||||
push edi
|
||||
|
||||
mov 8(%ebp),%edi
|
||||
mov 12(%ebp),%esi
|
||||
mov 16(%ebp),%ecx
|
||||
mov edi, [ebp + 8]
|
||||
mov esi, [ebp + 12]
|
||||
mov ecx, [ebp + 16]
|
||||
|
||||
cmp %esi,%edi
|
||||
cmp edi, esi
|
||||
jbe .CopyUp
|
||||
mov %ecx,%eax
|
||||
add %esi,%eax
|
||||
cmp %eax,%edi
|
||||
jb .CopyDown
|
||||
|
||||
mov eax, ecx
|
||||
add eax, esi
|
||||
cmp edi, eax
|
||||
jb .CopyDown
|
||||
|
||||
.CopyUp:
|
||||
cld
|
||||
|
||||
cmp $16,%ecx
|
||||
jb .L1
|
||||
mov %ecx,%edx
|
||||
test $3,%edi
|
||||
je .L2
|
||||
cmp ecx, 16
|
||||
jb .L1
|
||||
mov edx, ecx
|
||||
test edi, 3
|
||||
je .L2
|
||||
/*
|
||||
* Make the destination dword aligned
|
||||
*/
|
||||
mov %edi,%ecx
|
||||
and $3,%ecx
|
||||
sub $5,%ecx
|
||||
not %ecx
|
||||
sub %ecx,%edx
|
||||
rep movsb
|
||||
mov %edx,%ecx
|
||||
mov ecx, edi
|
||||
and ecx, 3
|
||||
sub ecx, 5
|
||||
not ecx
|
||||
sub edx, ecx
|
||||
rep movsb
|
||||
mov ecx, edx
|
||||
.L2:
|
||||
shr $2,%ecx
|
||||
rep movsl
|
||||
mov %edx,%ecx
|
||||
and $3,%ecx
|
||||
shr ecx, 2
|
||||
rep movsd
|
||||
mov ecx, edx
|
||||
and ecx, 3
|
||||
.L1:
|
||||
test %ecx,%ecx
|
||||
je .L3
|
||||
rep movsb
|
||||
test ecx, ecx
|
||||
je .L3
|
||||
rep movsb
|
||||
.L3:
|
||||
mov 8(%ebp),%eax
|
||||
pop %edi
|
||||
pop %esi
|
||||
mov eax, [ebp + 8]
|
||||
pop edi
|
||||
pop esi
|
||||
leave
|
||||
ret
|
||||
|
||||
.CopyDown:
|
||||
std
|
||||
std
|
||||
|
||||
add %ecx,%edi
|
||||
add %ecx,%esi
|
||||
add edi, ecx
|
||||
add esi, ecx
|
||||
|
||||
cmp $16,%ecx
|
||||
jb .L4
|
||||
mov %ecx,%edx
|
||||
test $3,%edi
|
||||
je .L5
|
||||
cmp ecx, 16
|
||||
jb .L4
|
||||
mov edx, ecx
|
||||
test edi, 3
|
||||
je .L5
|
||||
|
||||
/*
|
||||
* Make the destination dword aligned
|
||||
*/
|
||||
mov %edi,%ecx
|
||||
and $3,%ecx
|
||||
sub %ecx,%edx
|
||||
dec %esi
|
||||
dec %edi
|
||||
rep movsb
|
||||
mov %edx,%ecx
|
||||
mov ecx, edi
|
||||
and ecx, 3
|
||||
sub edx, ecx
|
||||
dec esi
|
||||
dec edi
|
||||
rep movsb
|
||||
mov ecx, edx
|
||||
|
||||
sub $3,%esi
|
||||
sub $3,%edi
|
||||
sub esi, 3
|
||||
sub edi, 3
|
||||
.L6:
|
||||
shr $2,%ecx
|
||||
rep movsl
|
||||
mov %edx,%ecx
|
||||
and $3,%ecx
|
||||
je .L7
|
||||
add $3,%esi
|
||||
add $3,%edi
|
||||
shr ecx, 2
|
||||
rep movsd
|
||||
mov ecx, edx
|
||||
and ecx, 3
|
||||
je .L7
|
||||
add esi, 3
|
||||
add edi, 3
|
||||
.L8:
|
||||
rep movsb
|
||||
rep movsb
|
||||
.L7:
|
||||
cld
|
||||
mov 8(%ebp),%eax
|
||||
pop %edi
|
||||
pop %esi
|
||||
mov eax, [ebp + 8]
|
||||
pop edi
|
||||
pop esi
|
||||
leave
|
||||
ret
|
||||
.L5:
|
||||
sub $4,%edi
|
||||
sub $4,%esi
|
||||
jmp .L6
|
||||
|
||||
.L4:
|
||||
test %ecx,%ecx
|
||||
je .L7
|
||||
dec %esi
|
||||
dec %edi
|
||||
jmp .L8
|
||||
sub edi, 4
|
||||
sub esi, 4
|
||||
jmp .L6
|
||||
|
||||
.L4:
|
||||
test ecx, ecx
|
||||
je .L7
|
||||
dec esi
|
||||
dec edi
|
||||
jmp .L8
|
||||
|
||||
END
|
||||
|
|
|
@ -2,46 +2,51 @@
|
|||
* $Id$
|
||||
*/
|
||||
|
||||
#include <asm.inc>
|
||||
#include <ks386.inc>
|
||||
|
||||
/*
|
||||
* void *memset (void *src, int val, size_t count)
|
||||
*/
|
||||
|
||||
.globl _memset
|
||||
PUBLIC _memset
|
||||
.code
|
||||
|
||||
_memset:
|
||||
push %ebp
|
||||
mov %esp,%ebp
|
||||
push %edi
|
||||
mov 0x8(%ebp),%edi
|
||||
movzb 0xc(%ebp),%eax
|
||||
mov 0x10(%ebp),%ecx
|
||||
push ebp
|
||||
mov ebp, esp
|
||||
push edi
|
||||
mov edi, [ebp + 8]
|
||||
movzx eax, byte ptr [ebp + 12]
|
||||
mov ecx, [ebp + 16]
|
||||
cld
|
||||
cmp $16,%ecx
|
||||
jb .L1
|
||||
mov $0x01010101,%edx
|
||||
mul %edx
|
||||
mov %ecx,%edx
|
||||
test $3,%edi
|
||||
je .L2
|
||||
mov %edi,%ecx
|
||||
and $3,%ecx
|
||||
sub $5,%ecx
|
||||
not %ecx
|
||||
sub %ecx,%edx
|
||||
rep stosb
|
||||
mov %edx,%ecx
|
||||
cmp ecx, 16
|
||||
jb .L1
|
||||
mov edx, HEX(01010101)
|
||||
mul edx
|
||||
mov edx, ecx
|
||||
test edi, 3
|
||||
je .L2
|
||||
mov ecx, edi
|
||||
and ecx, 3
|
||||
sub ecx, 5
|
||||
not ecx
|
||||
sub edx, ecx
|
||||
rep stosb
|
||||
mov ecx, edx
|
||||
.L2:
|
||||
shr $2,%ecx
|
||||
rep stosl
|
||||
mov %edx,%ecx
|
||||
and $3,%ecx
|
||||
shr ecx, 2
|
||||
rep stosd
|
||||
mov ecx, edx
|
||||
and ecx, 3
|
||||
.L1:
|
||||
test %ecx,%ecx
|
||||
je .L3
|
||||
rep stosb
|
||||
test ecx, ecx
|
||||
je .L3
|
||||
rep stosb
|
||||
.L3:
|
||||
pop %edi
|
||||
mov 0x8(%ebp),%eax
|
||||
pop edi
|
||||
mov eax, [ebp + 8]
|
||||
leave
|
||||
ret
|
||||
|
||||
END
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include <reactos/asm.h>
|
||||
#include <ndk/amd64/asm.h>
|
||||
#include <asm.inc>
|
||||
#include <ksamd64.inc>
|
||||
|
||||
#define JUMP_BUFFER_Frame 0x00
|
||||
#define JUMP_BUFFER_Rbx 0x08
|
||||
|
@ -156,3 +156,5 @@ PUBLIC longjmp
|
|||
inc rax
|
||||
2: jmp r8
|
||||
.endp longjmp
|
||||
|
||||
END
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
* complete implementation
|
||||
*/
|
||||
|
||||
#include <asm.inc>
|
||||
|
||||
#define JB_BP 0
|
||||
#define JB_BX 1
|
||||
#define JB_DI 2
|
||||
|
@ -20,6 +22,7 @@
|
|||
|
||||
#define JMPBUF 4
|
||||
|
||||
.code
|
||||
/*
|
||||
* int
|
||||
* _setjmp(jmp_buf env);
|
||||
|
@ -33,20 +36,20 @@
|
|||
* Notes:
|
||||
* Sets up the jmp_buf
|
||||
*/
|
||||
.globl __setjmp
|
||||
PUBLIC __setjmp
|
||||
__setjmp:
|
||||
xorl %eax, %eax
|
||||
movl JMPBUF(%esp), %edx
|
||||
xor eax, eax
|
||||
mov edx, JMPBUF[esp]
|
||||
|
||||
/* Save registers. */
|
||||
movl %ebp, (JB_BP*4)(%edx) /* Save caller's frame pointer. */
|
||||
movl %ebx, (JB_BX*4)(%edx)
|
||||
movl %edi, (JB_DI*4)(%edx)
|
||||
movl %esi, (JB_SI*4)(%edx)
|
||||
leal JMPBUF(%esp), %ecx /* Save SP as it will be after we return. */
|
||||
movl %ecx, (JB_SP*4)(%edx)
|
||||
movl PCOFF(%esp), %ecx /* Save PC we are returning to now. */
|
||||
movl %ecx, (JB_IP*4)(%edx)
|
||||
mov [edx + JB_BP*4], ebp /* Save caller's frame pointer. */
|
||||
mov [edx + JB_BX*4], ebx
|
||||
mov [edx + JB_DI*4], edi
|
||||
mov [edx + JB_SI*4], esi
|
||||
lea ecx, JMPBUF[esp] /* Save SP as it will be after we return. */
|
||||
mov [edx + JB_SP*4], ecx
|
||||
mov ecx, PCOFF[esp] /* Save PC we are returning to now. */
|
||||
mov [edx + JB_IP*4], ecx
|
||||
ret
|
||||
|
||||
/*
|
||||
|
@ -62,24 +65,22 @@ __setjmp:
|
|||
* Notes:
|
||||
* Sets up the jmp_buf
|
||||
*/
|
||||
.globl __setjmp3
|
||||
PUBLIC __setjmp3
|
||||
__setjmp3:
|
||||
xorl %eax, %eax
|
||||
movl JMPBUF(%esp), %edx
|
||||
xor eax, eax
|
||||
mov edx, JMPBUF[esp]
|
||||
|
||||
/* Save registers. */
|
||||
movl %ebp, (JB_BP*4)(%edx) /* Save caller's frame pointer. */
|
||||
movl %ebx, (JB_BX*4)(%edx)
|
||||
movl %edi, (JB_DI*4)(%edx)
|
||||
movl %esi, (JB_SI*4)(%edx)
|
||||
leal JMPBUF(%esp), %ecx /* Save SP as it will be after we return. */
|
||||
movl %ecx, (JB_SP*4)(%edx)
|
||||
movl PCOFF(%esp), %ecx /* Save PC we are returning to now. */
|
||||
movl %ecx, (JB_IP*4)(%edx)
|
||||
mov [edx + JB_BP*4], ebp /* Save caller's frame pointer. */
|
||||
mov [edx + JB_BX*4], ebx
|
||||
mov [edx + JB_DI*4], edi
|
||||
mov [edx + JB_SI*4], esi
|
||||
lea ecx, JMPBUF[esp] /* Save SP as it will be after we return. */
|
||||
mov [edx + JB_SP*4], ecx
|
||||
mov ecx, PCOFF[esp] /* Save PC we are returning to now. */
|
||||
mov [edx + JB_IP*4], ecx
|
||||
ret
|
||||
|
||||
#define VAL 8
|
||||
|
||||
/*
|
||||
* void
|
||||
* longjmp(jmp_buf env, int value);
|
||||
|
@ -94,18 +95,20 @@ __setjmp3:
|
|||
* Notes:
|
||||
* Non-local goto
|
||||
*/
|
||||
.globl _longjmp
|
||||
PUBLIC _longjmp
|
||||
_longjmp:
|
||||
movl JMPBUF(%esp), %ecx /* User's jmp_buf in %ecx. */
|
||||
mov ecx, JMPBUF[esp] /* User's jmp_buf in %ecx. */
|
||||
|
||||
movl VAL(%esp), %eax /* Second argument is return value. */
|
||||
mov eax, [esp + 8] /* Second argument is return value. */
|
||||
/* Save the return address now. */
|
||||
movl (JB_IP*4)(%ecx), %edx
|
||||
mov edx, [edx + JB_IP*4]
|
||||
/* Restore registers. */
|
||||
movl (JB_BP*4)(%ecx), %ebp
|
||||
movl (JB_BX*4)(%ecx), %ebx
|
||||
movl (JB_DI*4)(%ecx), %edi
|
||||
movl (JB_SI*4)(%ecx), %esi
|
||||
movl (JB_SP*4)(%ecx), %esp
|
||||
mov ebp, [edx + JB_BP*4]
|
||||
mov ebx, [edx + JB_BX*4]
|
||||
mov edi, [edx + JB_DI*4]
|
||||
mov esi, [edx + JB_SI*4]
|
||||
mov esp, [edx + JB_SP*4]
|
||||
/* Jump to saved PC. */
|
||||
jmp *%edx
|
||||
jmp dword ptr [edx]
|
||||
|
||||
END
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* $Id$
|
||||
*/
|
||||
|
||||
#include "tcscat.h"
|
||||
#include "tcscat.inc"
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* $Id$
|
||||
*/
|
||||
|
||||
#include "tcschr.h"
|
||||
#include "tcschr.inc"
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* $Id$
|
||||
*/
|
||||
|
||||
#include "tcscmp.h"
|
||||
#include "tcscmp.inc"
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* $Id$
|
||||
*/
|
||||
|
||||
#include "tcscpy.h"
|
||||
#include "tcscpy.inc"
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* $Id$
|
||||
*/
|
||||
|
||||
#include "tcslen.h"
|
||||
#include "tcslen.inc"
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* $Id$
|
||||
*/
|
||||
|
||||
#include "tcsncat.h"
|
||||
#include "tcsncat.inc"
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* $Id$
|
||||
*/
|
||||
|
||||
#include "tcsncmp.h"
|
||||
#include "tcsncmp.inc"
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* $Id$
|
||||
*/
|
||||
|
||||
#include "tcsncpy.h"
|
||||
#include "tcsncpy.inc"
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* $Id$
|
||||
*/
|
||||
|
||||
#include "tcsnlen.h"
|
||||
#include "tcsnlen.inc"
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* $Id$
|
||||
*/
|
||||
|
||||
#include "tcsrchr.h"
|
||||
#include "tcsrchr.inc"
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -21,12 +21,12 @@
|
|||
#define _tlods lodsw
|
||||
#define _tstos stosw
|
||||
|
||||
#define _tsize $2
|
||||
#define _tsize 2
|
||||
|
||||
#define _treg(_O_) _O_ ## x
|
||||
|
||||
#define _tdec(_O_) sub $2, _O_
|
||||
#define _tinc(_O_) add $2, _O_
|
||||
#define _tdec(_O_) sub _O_, 2
|
||||
#define _tinc(_O_) add _O_, 2
|
||||
|
||||
#else
|
||||
|
||||
|
@ -45,7 +45,7 @@
|
|||
#define _tlods lodsb
|
||||
#define _tstos stosb
|
||||
|
||||
#define _tsize $1
|
||||
#define _tsize 1
|
||||
|
||||
#define _treg(_O_) _O_ ## l
|
||||
|
||||
|
|
|
@ -1,32 +0,0 @@
|
|||
/* $Id$
|
||||
*/
|
||||
|
||||
#include "tchar.h"
|
||||
|
||||
.globl _tcscat
|
||||
|
||||
_tcscat:
|
||||
push %esi
|
||||
push %edi
|
||||
mov 0x0C(%esp), %edi
|
||||
mov 0x10(%esp), %esi
|
||||
|
||||
xor %eax, %eax
|
||||
mov $-1, %ecx
|
||||
cld
|
||||
|
||||
repne _tscas
|
||||
_tdec(%edi)
|
||||
|
||||
.L1:
|
||||
_tlods
|
||||
_tstos
|
||||
test %_treg(a), %_treg(a)
|
||||
jnz .L1
|
||||
|
||||
mov 0x0C(%esp), %eax
|
||||
pop %edi
|
||||
pop %esi
|
||||
ret
|
||||
|
||||
/* EOF */
|
35
reactos/lib/sdk/crt/string/i386/tcscat.inc
Normal file
35
reactos/lib/sdk/crt/string/i386/tcscat.inc
Normal file
|
@ -0,0 +1,35 @@
|
|||
/* $Id: tcscat.inc 49591 2010-11-15 01:29:12Z tkreuzer $
|
||||
*/
|
||||
|
||||
#include "tchar.h"
|
||||
#include <asm.inc>
|
||||
|
||||
PUBLIC _tcscat
|
||||
.code
|
||||
|
||||
_tcscat:
|
||||
push esi
|
||||
push edi
|
||||
mov edi, [esp + 12]
|
||||
mov esi, [esp + 16]
|
||||
|
||||
xor eax, eax
|
||||
mov ecx, -1
|
||||
cld
|
||||
|
||||
repne _tscas
|
||||
_tdec(edi)
|
||||
|
||||
.L1:
|
||||
_tlods
|
||||
_tstos
|
||||
test _treg(a), _treg(a)
|
||||
jnz .L1
|
||||
|
||||
mov eax, [esp + 12]
|
||||
pop edi
|
||||
pop esi
|
||||
ret
|
||||
|
||||
END
|
||||
/* EOF */
|
|
@ -1,30 +0,0 @@
|
|||
/* $Id$
|
||||
*/
|
||||
|
||||
#include "tchar.h"
|
||||
|
||||
.globl _tcschr
|
||||
|
||||
_tcschr:
|
||||
push %esi
|
||||
mov 0x8(%esp), %esi
|
||||
mov 0xC(%esp), %edx
|
||||
|
||||
cld
|
||||
|
||||
.L1:
|
||||
_tlods
|
||||
cmp %_treg(a), %_treg(d)
|
||||
je .L2
|
||||
test %_treg(a), %_treg(a)
|
||||
jnz .L1
|
||||
mov _tsize, %esi
|
||||
|
||||
.L2:
|
||||
mov %esi, %eax
|
||||
_tdec(%eax)
|
||||
|
||||
pop %esi
|
||||
ret
|
||||
|
||||
/* EOF */
|
32
reactos/lib/sdk/crt/string/i386/tcschr.inc
Normal file
32
reactos/lib/sdk/crt/string/i386/tcschr.inc
Normal file
|
@ -0,0 +1,32 @@
|
|||
/* $Id: tcschr.inc 49591 2010-11-15 01:29:12Z tkreuzer $
|
||||
*/
|
||||
|
||||
#include "tchar.h"
|
||||
#include <asm.inc>
|
||||
|
||||
PUBLIC _tcschr
|
||||
.code
|
||||
|
||||
_tcschr:
|
||||
push esi
|
||||
mov esi, [esp + 8]
|
||||
mov edx, [esp + 12]
|
||||
cld
|
||||
|
||||
.L1:
|
||||
_tlods
|
||||
cmp _treg(d), _treg(a)
|
||||
je .L2
|
||||
test _treg(a), _treg(a)
|
||||
jnz .L1
|
||||
mov esi, _tsize
|
||||
|
||||
.L2:
|
||||
mov eax, esi
|
||||
_tdec(eax)
|
||||
|
||||
pop esi
|
||||
ret
|
||||
|
||||
END
|
||||
/* EOF */
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue