Switch from underscore prefixed symbols to unprefixed symbols. (MSVC compatibility)

svn path=/branches/ros-amd64-bringup/; revision=45410
This commit is contained in:
Timo Kreuzer 2010-02-04 04:58:09 +00:00
parent cb076d0fef
commit 28c8b7fbec
45 changed files with 523 additions and 546 deletions

View file

@ -34,6 +34,7 @@
<!-- compilerflag compiler="as">-gstabs+</compilerflag --> <!-- compilerflag compiler="as">-gstabs+</compilerflag -->
<compilerflag>-U_X86_</compilerflag> <compilerflag>-U_X86_</compilerflag>
<compilerflag>-Wno-format</compilerflag> <compilerflag>-Wno-format</compilerflag>
<compilerflag>-fno-leading-underscore</compilerflag>
</group> </group>
<group linkerset="ld"> <group linkerset="ld">
@ -42,6 +43,8 @@
<linkerflag>-section-alignment=0x1000</linkerflag> <linkerflag>-section-alignment=0x1000</linkerflag>
<linkerflag>--unique=.eh_frame</linkerflag> <linkerflag>--unique=.eh_frame</linkerflag>
<linkerflag>-static</linkerflag> <linkerflag>-static</linkerflag>
<linkerflag>-fno-leading-underscore</linkerflag>
<linkerflag>--exclude-all-symbols</linkerflag>
</group> </group>
<if property="USERMODE" value="1"> <if property="USERMODE" value="1">

View file

@ -21,22 +21,22 @@ RealEntryPoint:
mov ss, ax mov ss, ax
/* checkPoint Charlie - where it all began... */ /* checkPoint Charlie - where it all began... */
mov si, offset _CheckPoint0 mov si, offset CheckPoint0
call writestr call writestr
/* Setup a real mode stack */ /* Setup a real mode stack */
mov sp, stack16 mov sp, stack16
/* Zero BootDrive and BootPartition */ /* Zero BootDrive and BootPartition */
xor eax, eax xor eax, eax
mov _BootDrive, eax mov BootDrive, eax
mov _BootPartition, eax mov BootPartition, eax
/* Store the boot drive */ /* Store the boot drive */
mov _BootDrive, dl mov BootDrive, dl
/* Store the boot partition */ /* Store the boot partition */
mov _BootPartition, dh mov BootPartition, dh
/* Load the GDT */ /* Load the GDT */
lgdt gdtptr lgdt gdtptr
@ -46,13 +46,13 @@ RealEntryPoint:
call x86_16_EnableA20 call x86_16_EnableA20
/* checkPoint Charlie - where it all began... */ /* checkPoint Charlie - where it all began... */
mov si, offset _CheckPoint1 mov si, offset CheckPoint1
call writestr call writestr
call x86_16_BuildPageTables call x86_16_BuildPageTables
/* checkPoint Charlie - where it all began... */ /* checkPoint Charlie - where it all began... */
mov si, offset _CheckPoint2 mov si, offset CheckPoint2
call writestr call writestr
/* Check if CPU supports CPUID */ /* Check if CPU supports CPUID */
@ -89,26 +89,26 @@ RealEntryPoint:
/* X64 Processor */ /* X64 Processor */
/* checkPoint Charlie - where it all began... */ /* checkPoint Charlie - where it all began... */
mov si, offset _CheckPoint3 mov si, offset CheckPoint3
call writestr call writestr
jmp _switch64 jmp switch64
NO_X64_SUPPORT_DETECTED: NO_X64_SUPPORT_DETECTED:
mov si, offset _NotAnX64Processor // Loading message mov si, offset NotAnX64Processor // Loading message
call writestr call writestr
jmp _fail jmp fail
NO_CPUID_SUPPORT_DETECTED: NO_CPUID_SUPPORT_DETECTED:
mov si, offset _NoCPUIDSupport // Loading message mov si, offset NoCPUIDSupport // Loading message
call writestr call writestr
_fail: fail:
jmp _fail jmp fail
nop nop
nop nop
_switch64: switch64:
call x86_16_SwitchToLong call x86_16_SwitchToLong
.code64 .code64
@ -119,7 +119,7 @@ _switch64:
/* GO! */ /* GO! */
xor rcx, rcx xor rcx, rcx
call _BootMain call BootMain
/* Checkpoint */ /* Checkpoint */
// mov ax, LMODE_DS // mov ax, LMODE_DS
@ -174,14 +174,14 @@ x86_16_BuildPageTables:
push es push es
/* Get segment of pml4 */ /* Get segment of pml4 */
mov eax, offset _pml4_startup mov eax, offset pml4_startup
shr eax, 4 shr eax, 4
mov es, ax mov es, ax
cld cld
xor di, di xor di, di
/* One entry in the PML4 pointing to PDP */ /* One entry in the PML4 pointing to PDP */
mov eax, offset _pdp_startup mov eax, offset pdp_startup
or eax, 0x00f or eax, 0x00f
stosd stosd
/* clear rest */ /* clear rest */
@ -190,7 +190,7 @@ x86_16_BuildPageTables:
rep stosd rep stosd
/* One entry in the PDP pointing to PD */ /* One entry in the PDP pointing to PD */
mov eax, offset _pd_startup mov eax, offset pd_startup
or eax, 0x00f or eax, 0x00f
stosd stosd
/* clear rest */ /* clear rest */
@ -268,7 +268,7 @@ x86_16_SwitchToLong:
mov eax, 0x00a0 // Set PAE and PGE: 10100000b mov eax, 0x00a0 // Set PAE and PGE: 10100000b
mov cr4, eax mov cr4, eax
mov edx, offset _pml4_startup // Point cr3 at PML4 mov edx, offset pml4_startup // Point cr3 at PML4
mov cr3, edx mov cr3, edx
mov ecx, 0xC0000080 // Specify EFER MSR mov ecx, 0xC0000080 // Specify EFER MSR
@ -405,42 +405,42 @@ gdtptr:
.long gdt /* Base Address */ .long gdt /* Base Address */
.global _BootDrive .global BootDrive
_BootDrive: BootDrive:
.long 0 .long 0
.global _BootPartition .global BootPartition
_BootPartition: BootPartition:
.long 0 .long 0
.global _NotAnX64Processor .global NotAnX64Processor
_NotAnX64Processor: NotAnX64Processor:
.ascii "FreeLoader: No x64-compatible CPU detected! Exiting..." .ascii "FreeLoader: No x64-compatible CPU detected! Exiting..."
.byte 0x0d, 0x0a, 0 .byte 0x0d, 0x0a, 0
.global _NoCPUIDSupport .global NoCPUIDSupport
_NoCPUIDSupport: NoCPUIDSupport:
.ascii "FreeLoader: No CPUID instruction support detected! Exiting..." .ascii "FreeLoader: No CPUID instruction support detected! Exiting..."
.byte 0x0d, 0x0a, 0 .byte 0x0d, 0x0a, 0
/////////////////////////// Checkpoint messages /////////////////////////////// /////////////////////////// Checkpoint messages ///////////////////////////////
.global _CheckPoint0 .global CheckPoint0
_CheckPoint0: CheckPoint0:
.ascii "Starting FreeLoader..." .ascii "Starting FreeLoader..."
.byte 0x0d, 0x0a, 0 .byte 0x0d, 0x0a, 0
.global _CheckPoint1 .global CheckPoint1
_CheckPoint1: CheckPoint1:
.ascii "FreeLoader[16-bit]: building page tables..." .ascii "FreeLoader[16-bit]: building page tables..."
.byte 0x0d, 0x0a, 0 .byte 0x0d, 0x0a, 0
.global _CheckPoint2 .global CheckPoint2
_CheckPoint2: CheckPoint2:
.ascii "FreeLoader[16-bit]: checking CPU for x64 long mode..." .ascii "FreeLoader[16-bit]: checking CPU for x64 long mode..."
.byte 0x0d, 0x0a, 0 .byte 0x0d, 0x0a, 0
.global _CheckPoint3 .global CheckPoint3
_CheckPoint3: CheckPoint3:
.ascii "FreeLoader: Switching to x64 long mode..." .ascii "FreeLoader: Switching to x64 long mode..."
.byte 0x0d, 0x0a, 0 .byte 0x0d, 0x0a, 0

View file

@ -24,14 +24,14 @@
#include <arch.h> #include <arch.h>
EXTERN(_ChainLoadBiosBootSectorCode) EXTERN(ChainLoadBiosBootSectorCode)
.code64 .code64
call x86_64_SwitchToReal call x86_64_SwitchToReal
.code16 .code16
/* Set the boot drive */ /* Set the boot drive */
mov dl, _BootDrive mov dl, BootDrive
/* Load segment registers */ /* Load segment registers */
cli cli
@ -46,7 +46,7 @@ EXTERN(_ChainLoadBiosBootSectorCode)
// ljmpl $0x0000,$0x7C00 // ljmpl $0x0000,$0x7C00
jmp 0x7c00:0x0000 jmp 0x7c00:0x0000
EXTERN(_SoftReboot) EXTERN(SoftReboot)
.code64 .code64
call x86_64_SwitchToReal call x86_64_SwitchToReal

View file

@ -24,7 +24,7 @@
#include <arch.h> #include <arch.h>
EXTERN(_DriveMapInt13HandlerStart) EXTERN(DriveMapInt13HandlerStart)
Int13Handler: Int13Handler:
pushw %bp pushw %bp
@ -82,7 +82,7 @@ CallOldInt13Handler:
/* Call old int 13h handler with new drive number */ /* Call old int 13h handler with new drive number */
.byte 0x9a /* lcall */ .byte 0x9a /* lcall */
EXTERN(_DriveMapOldInt13HandlerAddress) EXTERN(DriveMapOldInt13HandlerAddress)
.word 0 .word 0
.word 0 .word 0
@ -105,7 +105,7 @@ CallersFlags:
PassedInDriveNumber: PassedInDriveNumber:
.byte 0 .byte 0
EXTERN(_DriveMapInt13HandlerMapList) EXTERN(DriveMapInt13HandlerMapList)
Int13HandlerMapCount: Int13HandlerMapCount:
.byte 0 .byte 0
@ -129,4 +129,4 @@ Int13HandlerDrive4:
Int13HandlerDriveNew4: Int13HandlerDriveNew4:
.byte 0 .byte 0
EXTERN(_DriveMapInt13HandlerEnd) EXTERN(DriveMapInt13HandlerEnd)

View file

@ -33,7 +33,7 @@
* 0x00000400: Found 80486 CPU without CPUID support * 0x00000400: Found 80486 CPU without CPUID support
*/ */
EXTERN(_CpuidSupported) EXTERN(CpuidSupported)
.code32 .code32
pushl %ecx /* save ECX */ pushl %ecx /* save ECX */
@ -80,7 +80,7 @@ NoCpuid:
* VOID GetCpuid(U32 Level, U32 *eax, U32 *ebx, U32 *ecx, U32 *edx); * VOID GetCpuid(U32 Level, U32 *eax, U32 *ebx, U32 *ecx, U32 *edx);
*/ */
EXTERN(_GetCpuid) EXTERN(GetCpuid)
.code32 .code32
pushl %ebp pushl %ebp
@ -123,7 +123,7 @@ EXTERN(_GetCpuid)
* U64 RDTSC(VOID); * U64 RDTSC(VOID);
*/ */
EXTERN(_RDTSC) EXTERN(RDTSC)
.code32 .code32
rdtsc rdtsc
ret ret

View file

@ -35,7 +35,7 @@ _pnp_bios_entry_point:
_pnp_bios_data_segment: _pnp_bios_data_segment:
.word 0 .word 0
EXTERN(_PnpBiosSupported) EXTERN(PnpBiosSupported)
.code64 .code64
push rdi push rdi
@ -113,7 +113,7 @@ _pnp_node_size:
_pnp_node_count: _pnp_node_count:
.word 0 .word 0
EXTERN(_PnpBiosGetDeviceNodeCount) EXTERN(PnpBiosGetDeviceNodeCount)
.code64 .code64
push rbp push rbp
@ -182,7 +182,7 @@ _pnp_buffer_offset:
_pnp_node_number: _pnp_node_number:
.byte 0 .byte 0
EXTERN(_PnpBiosGetDeviceNode) EXTERN(PnpBiosGetDeviceNode)
.code64 .code64
push rbp push rbp

View file

@ -273,7 +273,7 @@ i386CommonExceptionHandler:
SAVE_CPU_REGS SAVE_CPU_REGS
pushl $SCREEN_ATTR pushl $SCREEN_ATTR
call _MachVideoClearScreen call MachVideoClearScreen
add $4,%esp add $4,%esp
movl $i386ExceptionHandlerText,%esi movl $i386ExceptionHandlerText,%esi
@ -485,7 +485,7 @@ i386PrintChar:
pushl $SCREEN_ATTR pushl $SCREEN_ATTR
andl $0xff,%eax andl $0xff,%eax
pushl %eax pushl %eax
call _MachVideoPutChar call MachVideoPutChar
addl $16,%esp addl $16,%esp
ret ret

View file

@ -63,7 +63,7 @@ Int386_regsout:
/* /*
* int Int386(int ivec, REGS* in, REGS* out); * int Int386(int ivec, REGS* in, REGS* out);
*/ */
EXTERN(_Int386) EXTERN(Int386)
.code64 .code64
/* Get the function parameters */ /* Get the function parameters */

View file

@ -29,35 +29,35 @@
* This boots the kernel * This boots the kernel
*/ */
.code64 .code64
.globl _PageDirectoryStart .globl PageDirectoryStart
.globl _pml4_startup .globl pml4_startup
.globl _pdp_startup .globl pdp_startup
.globl _pd_startup .globl pd_startup
.globl _PageDirectoryEnd .globl PageDirectoryEnd
// //
// Boot information structure // Boot information structure
// //
EXTERN(_reactos_memory_map_descriptor_size) EXTERN(reactos_memory_map_descriptor_size)
.long 0 .long 0
EXTERN(_reactos_memory_map) EXTERN(reactos_memory_map)
.rept (32 * /*sizeof(memory_map_t)*/24) .rept (32 * /*sizeof(memory_map_t)*/24)
.byte 0 .byte 0
.endr .endr
.bss .bss
_PageDirectoryStart: PageDirectoryStart:
_pml4_startup: pml4_startup:
.fill 4096, 1, 0 .fill 4096, 1, 0
_pdp_startup: pdp_startup:
.fill 4096, 1, 0 .fill 4096, 1, 0
_pd_startup: pd_startup:
.fill 4096, 1, 0 .fill 4096, 1, 0
_PageDirectoryEnd: PageDirectoryEnd:

View file

@ -7,65 +7,40 @@
/* INCLUDES ******************************************************************/ /* INCLUDES ******************************************************************/
#include <asm.h> #include <reactos/asm.h>
#include <internal/i386/asmmacro.S> #include <ndk/amd64/asm.h>
.intel_syntax noprefix
.macro UNIMPLEMENTED func
jmp 2f
1:
.ascii "Sorry, asm function "
.ascii func
.ascii " is unimplemented!\n\0"
2:
movabs rcx, offset 1b
call _DbgPrint
ret
.endm
/* GLOBALS *******************************************************************/
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
.global _HalEnableInterrupt PUBLIC HalEnableInterrupt
.func _HalEnableInterrupt HalEnableInterrupt:
_HalEnableInterrupt: UNIMPLEMENTED HalEnableInterrupt
UNIMPLEMENTED "HalEnableInterrupt" ret
.endfunc
.global _HalDisableInterrupt PUBLIC HalDisableInterrupt
.func _HalDisableInterrupt HalDisableInterrupt:
_HalDisableInterrupt: UNIMPLEMENTED HalDisableInterrupt
UNIMPLEMENTED "HalDisableInterrupt" ret
.endfunc
.global _HalRequestSoftwareInterrupt PUBLIC HalRequestSoftwareInterrupt
.func _HalRequestSoftwareInterrupt HalRequestSoftwareInterrupt:
_HalRequestSoftwareInterrupt: UNIMPLEMENTED HalRequestSoftwareInterrupt
UNIMPLEMENTED "HalRequestSoftwareInterrupt" ret
.endfunc
.global _HalSendSoftwareInterrupt PUBLIC HalSendSoftwareInterrupt
.func _HalSendSoftwareInterrupt HalSendSoftwareInterrupt:
_HalSendSoftwareInterrupt: UNIMPLEMENTED HalSendSoftwareInterrupt
UNIMPLEMENTED "HalSendSoftwareInterrupt" ret
.endfunc
.global _HalEndSystemInterrupt PUBLIC HalEndSystemInterrupt
.func _HalEndSystemInterrupt HalEndSystemInterrupt:
_HalEndSystemInterrupt: UNIMPLEMENTED HalEndSystemInterrupt
UNIMPLEMENTED "HalEndSystemInterrupt" ret
.endfunc
PUBLIC HalClearSoftwareInterrupt
.globl _HalClearSoftwareInterrupt HalClearSoftwareInterrupt:
.func _HalClearSoftwareInterrupt UNIMPLEMENTED HalClearSoftwareInterrupt
_HalClearSoftwareInterrupt:
UNIMPLEMENTED "HalClearSoftwareInterrupt"
/* Get IRR mask */ /* Get IRR mask */
mov eax, 1 mov eax, 1
@ -75,11 +50,8 @@ _HalClearSoftwareInterrupt:
/* Set IRR */ /* Set IRR */
// and gs:[KPCR_IRR], eax // and gs:[KPCR_IRR], eax
ret ret
.endfunc
.globl _HalBeginSystemInterrupt
.func _HalBeginSystemInterrupt
_HalBeginSystemInterrupt:
UNIMPLEMENTED "HalBeginSystemInterrupt"
.endfunc
PUBLIC HalBeginSystemInterrupt
HalBeginSystemInterrupt:
UNIMPLEMENTED HalBeginSystemInterrupt
ret

View file

@ -7,8 +7,8 @@
/* INCLUDES ******************************************************************/ /* INCLUDES ******************************************************************/
#include <asm.h> #include <reactos/asm.h>
#include <ndk/amd64/asmmacro.S> #include <ndk/amd64/asm.h>
/* GLOBALS *******************************************************************/ /* GLOBALS *******************************************************************/
@ -24,22 +24,16 @@ _MsgUnimplemented:
.text .text
.code64 .code64
.global _HalpCalibrateStallExecution@0 PUBLIC HalpCalibrateStallExecution@0
.func HalpCalibrateStallExecution@0 HalpCalibrateStallExecution@0:
_HalpCalibrateStallExecution@0:
.endfunc
.globl _HalpProfileInterrupt
.func HalpProfileInterrupt
_HalpProfileInterrupt:
.endfunc
.globl _KeStallExecutionProcessor PUBLIC HalpProfileInterrupt
.func KeStallExecutionProcessor HalpProfileInterrupt:
_KeStallExecutionProcessor:
PUBLIC KeStallExecutionProcessor
KeStallExecutionProcessor:
/* Get the number of microseconds required */ /* Get the number of microseconds required */
jecxz Done jecxz Done
@ -65,12 +59,10 @@ SubtractLoop:
Done: Done:
/* Return */ /* Return */
ret 4 ret 4
.endfunc
.globl _HalpQuery8254Counter PUBLIC HalpQuery8254Counter
.func HalpQuery8254Counter HalpQuery8254Counter:
_HalpQuery8254Counter:
/* Save EFLAGS and disable interrupts */ /* Save EFLAGS and disable interrupts */
pushfq pushfq
@ -92,12 +84,9 @@ _HalpQuery8254Counter:
mov eax, ecx mov eax, ecx
popfq popfq
ret ret
.endfunc
.globl _HalpClockInterrupt PUBLIC HalpClockInterrupt
.func HalpClockInterrupt HalpClockInterrupt:
_HalpClockInterrupt:
UNIMPLEMENTED _HalpClockInterrupt UNIMPLEMENTED _HalpClockInterrupt
iret iret
.endfunc

View file

@ -8,84 +8,85 @@
/* INCLUDES ******************************************************************/ /* INCLUDES ******************************************************************/
#include <ndk/asm.h> #include <reactos/asm.h>
#include <ndk/amd64/asm.h>
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
#define BEFORE \ #define BEFORE \
cld; \ cld; \
pushq %rax; \ push rax; \
pushq %rbx; \ push rbx; \
pushq %rcx; \ push rcx; \
pushq %rdx; \ push rdx; \
pushq %rsi; \ push rsi; \
pushq %rdi; \ push rdi; \
pushq %fs; \ push fs; \
pushq %gs; \ push gs; \
#define AFTER \ #define AFTER \
popq %gs; \ pop gs; \
popq %fs; \ pop fs; \
popq %rdi; \ pop rdi; \
popq %rsi; \ pop rsi; \
popq %rdx; \ pop rdx; \
popq %rcx; \ pop rcx; \
popq %rbx; \ pop rbx; \
popq %rax; \ pop rax; \
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
.global _MpsIpiInterrupt PUBLIC MpsIpiInterrupt
_MpsIpiInterrupt: MpsIpiInterrupt:
/* Save registers */ /* Save registers */
BEFORE BEFORE
/* Call the C handler */ /* Call the C handler */
call _MpsIpiHandler call MpsIpiHandler
/* Return to the caller */ /* Return to the caller */
AFTER AFTER
iret iret
#endif #endif
.globl _MpsErrorInterrupt PUBLIC MpsErrorInterrupt
_MpsErrorInterrupt: MpsErrorInterrupt:
/* Save registers */ /* Save registers */
BEFORE BEFORE
/* Call the C handler */ /* Call the C handler */
call _MpsErrorHandler call MpsErrorHandler
/* Return to the caller */ /* Return to the caller */
AFTER AFTER
iret iret
.globl _MpsSpuriousInterrupt PUBLIC MpsSpuriousInterrupt
_MpsSpuriousInterrupt: MpsSpuriousInterrupt:
/* Save registers */ /* Save registers */
BEFORE BEFORE
/* Call the C handler */ /* Call the C handler */
call _MpsSpuriousHandler call MpsSpuriousHandler
/* Return to the caller */ /* Return to the caller */
AFTER AFTER
iret iret
.global _MpsTimerInterrupt PUBLIC MpsTimerInterrupt
_MpsTimerInterrupt: MpsTimerInterrupt:
/* Save registers */ /* Save registers */
BEFORE BEFORE
movl $0xef,%ebx mov ebx, 0xef
movl $0xceafbeef,%eax mov eax, 0xceafbeef
pushq %rax push rax
pushq %rsp push rsp
pushq %rbx push rbx
call _MpsTimerHandler call MpsTimerHandler
popq %rax pop rax
popq %rax pop rax
popq %rax pop rax
/* Return to the caller */ /* Return to the caller */
AFTER AFTER

View file

@ -24,8 +24,9 @@ rip = 0
#define MACRO(name, ...) name MACRO __VA_ARGS__ #define MACRO(name, ...) name MACRO __VA_ARGS__
/* To avoid reverse syntax we provide a new macro .PROC, replacing PROC... */ /* To avoid reverse syntax we provide a new macro .PROC, replacing PROC... */
.PROC MACRO namex .PROC MACRO name
namex PROC FRAME name PROC FRAME
_name:
ENDM ENDM
/* ... and .ENDP, replacing ENDP */ /* ... and .ENDP, replacing ENDP */
@ -43,6 +44,16 @@ ENDM
DB text, 0 DB text, 0
ENDM ENDM
.text MACRO
ENDM
.code64 MACRO
.code
ENDM
UNIMPLEMENTED MACRO name
ENDM
/* We need this to distinguish repeat from macros */ /* We need this to distinguish repeat from macros */
#define ENDR ENDM #define ENDR ENDM
@ -79,7 +90,9 @@ ENDM
.endm .endm
/* MASM compatible PUBLIC */ /* MASM compatible PUBLIC */
#define PUBLIC .global .macro PUBLIC symbol
.global \symbol
.endm
/* MASM compatible ALIGN */ /* MASM compatible ALIGN */
#define ALIGN .align #define ALIGN .align
@ -148,7 +161,7 @@ code = 1
lea rdx, 1b[rip] lea rdx, 1b[rip]
lea r8, 2b[rip] lea r8, 2b[rip]
mov r9, \line mov r9, \line
call _DbgPrint call DbgPrint
add rsp, 0x20 add rsp, 0x20
.endm .endm
#define UNIMPLEMENTED UNIMPLEMENTED2 __FILE__, __LINE__, #define UNIMPLEMENTED UNIMPLEMENTED2 __FILE__, __LINE__,

View file

@ -83,9 +83,14 @@ extern long timedelta;
#ifdef _MSC_VER #ifdef _MSC_VER
#define MAKE_SET(set, sym, type) #define MAKE_SET(set, sym, type)
#else #else
#if defined(_M_AMD64)
#define MAKE_SET(set, sym, type) \
asm(".stabs \"" #set "\", " #type ", 0, 0, " #sym)
#else
#define MAKE_SET(set, sym, type) \ #define MAKE_SET(set, sym, type) \
asm(".stabs \"_" #set "\", " #type ", 0, 0, _" #sym) asm(".stabs \"_" #set "\", " #type ", 0, 0, _" #sym)
#endif #endif
#endif
#define TEXT_SET(set, sym) MAKE_SET(set, sym, 23) #define TEXT_SET(set, sym) MAKE_SET(set, sym, 23)
#define DATA_SET(set, sym) MAKE_SET(set, sym, 25) #define DATA_SET(set, sym) MAKE_SET(set, sym, 25)
#define BSS_SET(set, sym) MAKE_SET(set, sym, 27) #define BSS_SET(set, sym) MAKE_SET(set, sym, 27)

View file

@ -3,54 +3,47 @@
* PROJECT: ReactOS Run-Time Library * PROJECT: ReactOS Run-Time Library
* PURPOSE: Debug Routines * PURPOSE: Debug Routines
* FILE: lib/rtl/i386/debug.S * FILE: lib/rtl/i386/debug.S
* PROGRAMER: Alex Ionescu (alex@relsoft.net) * PROGRAMER: Timo Kreuzer (timo.kreuzer@reactos.org)
*/ */
.intel_syntax noprefix #include <reactos/asm.h>
/* GLOBALS ****************************************************************/ /* GLOBALS ****************************************************************/
.globl _DbgBreakPoint PUBLIC DbgBreakPoint
.globl _DbgBreakPointWithStatus PUBLIC DbgBreakPointWithStatus
.globl _DbgUserBreakPoint PUBLIC DbgUserBreakPoint
.globl _DebugService PUBLIC DebugService
.globl _DebugService2 PUBLIC DebugService2
.globl _DbgBreakPointNoBugCheck PUBLIC DbgBreakPointNoBugCheck
.globl _RtlpBreakWithStatusInstruction PUBLIC RtlpBreakWithStatusInstruction
/* FUNCTIONS ***************************************************************/ /* FUNCTIONS ***************************************************************/
.func DbgBreakPointNoBugCheck .code64
_DbgBreakPointNoBugCheck:
DbgBreakPointNoBugCheck:
int 3 int 3
ret ret
.endfunc
.func DbgBreakPoint DbgBreakPoint:
_DbgBreakPoint: DbgUserBreakPoint:
_DbgUserBreakPoint:
int 3 int 3
ret ret
.endfunc
.func DbgBreakPointWithStatus DbgBreakPointWithStatus:
_DbgBreakPointWithStatus:
mov eax, ecx mov eax, ecx
RtlpBreakWithStatusInstruction:
_RtlpBreakWithStatusInstruction:
int 3 int 3
ret ret
.endfunc
.func DebugService2 DebugService2:
_DebugService2:
ret ret
/* Call the interrupt */ /* Call the interrupt */
// mov eax, [rbp+8] // mov eax, [rbp+8]
// int 0x2D // int 0x2D
// int 3 // int 3
.endfunc
/****************************************************************************** /******************************************************************************
* NTSTATUS NTAPI DebugService( * NTSTATUS NTAPI DebugService(
@ -60,8 +53,7 @@ _DebugService2:
* IN PVOID Argument1, // <r9> = [rsp + 32] * IN PVOID Argument1, // <r9> = [rsp + 32]
* IN PVOID Argument2); // [rsp + 40] * IN PVOID Argument2); // [rsp + 40]
*/ */
.func DebugService DebugService:
_DebugService:
/* Prepare registers for interrupt */ /* Prepare registers for interrupt */
mov eax, ecx // Service mov eax, ecx // Service
@ -71,9 +63,10 @@ _DebugService:
mov r9, [rsp + 40] // Argument2 mov r9, [rsp + 40] // Argument2
/* Call the Interrupt */ /* Call the Interrupt */
int 0x2D int HEX(2D)
int 3 int 3
/* Return */ /* Return */
ret ret
.endfunc
END

View file

@ -8,24 +8,25 @@
/* INCLUDES ******************************************************************/ /* INCLUDES ******************************************************************/
#include <ndk/asm.h> #include <reactos/asm.h>
.intel_syntax noprefix #include <ndk/amd64/asm.h>
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
.code64
/* /*
* VOID NTAPI * VOID NTAPI
* RtlCaptureContext( * RtlCaptureContext(
* PCONTEXT ContextRecord); <rcx> * PCONTEXT ContextRecord); <rcx>
*/ */
.func RtlCaptureContext PUBLIC RtlCaptureContext
.global _RtlCaptureContext .PROC RtlCaptureContext
_RtlCaptureContext:
.cfi_startproc
/* Push rflags */ /* Push rflags */
pushfq pushfq
.cfi_adjust_cfa_offset 8 .ALLOCSTACK 8
.ENDPROLOG
/* Save the basic register context */ /* Save the basic register context */
mov [rcx + CONTEXT_Rax], rax mov [rcx + CONTEXT_Rax], rax
@ -47,7 +48,7 @@ _RtlCaptureContext:
mov [rcx + CONTEXT_R9], r9 mov [rcx + CONTEXT_R9], r9
/* Load former stack pointer in rax */ /* Load former stack pointer in rax */
lea rax, [rsp + 0x10] lea rax, [rsp + 16]
mov [rcx + CONTEXT_R10], r10 mov [rcx + CONTEXT_R10], r10
mov [rcx + CONTEXT_R11], r11 mov [rcx + CONTEXT_R11], r11
@ -95,6 +96,8 @@ _RtlCaptureContext:
/* Cleanup stack and return */ /* Cleanup stack and return */
add rsp, 8 add rsp, 8
ret ret
.cfi_endproc .ENDP RtlCaptureContext
.endfunc
END

View file

@ -8,10 +8,12 @@
/* INCLUDES ******************************************************************/ /* INCLUDES ******************************************************************/
#include <ndk/amd64/asmmacro.S> #include <reactos/asm.h>
#include <ndk/amd64/asm.h>
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
.intel_syntax noprefix
.code64
/* SIZE_T /* SIZE_T
* RtlCompareMemory( * RtlCompareMemory(
@ -27,6 +29,7 @@
.pushreg rsi .pushreg rsi
push rdi push rdi
.pushreg rdi .pushreg rdi
.ENDPROLOG
/* Setup registers for compare */ /* Setup registers for compare */
mov rsi, rcx mov rsi, rcx
@ -38,41 +41,48 @@
/* Get number of qwords */ /* Get number of qwords */
mov rcx, r8 mov rcx, r8
shr rcx, 3 shr rcx, 3
jz 2f jz RtlCompareMemory2
/* Compare qwords */ /* Compare qwords */
repe cmpsq repe cmpsq
jnz 4f jnz RtlCompareMemory4
2: /* Compare rest */ RtlCompareMemory2:
/* Compare rest */
mov rcx, r8 mov rcx, r8
and rcx, 7 and rcx, 7
jz 3f jz RtlCompareMemory3
repe cmpsb repe cmpsb
jnz 5f jnz RtlCompareMemory5
3: /* All equal */ RtlCompareMemory3:
/* All equal */
/* Return the full count */ /* Return the full count */
mov rax, rcx mov rax, rcx
jmp 6f jmp RtlCompareMemory6
4: /* Not equal after comparing qwords */ RtlCompareMemory4:
/* Not equal after comparing qwords */
/* Compare the last qword */ /* Compare the last qword */
sub rsi, 8 sub rsi, 8
sub rdi, 8 sub rdi, 8
mov rcx, 8 mov rcx, 8
repe cmpsb repe cmpsb
5: /* Not equal after comparing bytes */ RtlCompareMemory5:
/* Not equal after comparing bytes */
/* Return difference */ /* Return difference */
sub rdi, rdx sub rdi, rdx
dec rdi dec rdi
mov rax, rdi mov rax, rdi
6: /* Cleanup and return */ RtlCompareMemory6:
/* Cleanup and return */
pop rdi pop rdi
pop rsi pop rsi
ret ret
.endproc .endp RtlCompareMemory
END

View file

@ -6,9 +6,8 @@
* PROGRAMMERS: Timo Kreuzer * PROGRAMMERS: Timo Kreuzer
*/ */
#include <ndk/asm.h> #include <reactos/asm.h>
#include <ndk/amd64/asmmacro.S> #include <ndk/amd64/asm.h>
.intel_syntax noprefix
#define SLIST8A_DEPTH_MASK 0x000000000000FFFF #define SLIST8A_DEPTH_MASK 0x000000000000FFFF
#define SLIST8A_DEPTH_INC 0x0000000000000001 #define SLIST8A_DEPTH_INC 0x0000000000000001
@ -32,15 +31,15 @@
/* FUNCTIONS ****************************************************************/ /* FUNCTIONS ****************************************************************/
.global _ExpInterlockedPopEntrySList .global ExpInterlockedPopEntrySList
.global _ExpInterlockedPopEntrySListResume .global ExpInterlockedPopEntrySListResume
.global _ExpInterlockedPopEntrySListFault .global ExpInterlockedPopEntrySListFault
.global _ExpInterlockedPopEntrySListEnd .global ExpInterlockedPopEntrySListEnd
.global _ExpInterlockedPopEntrySListResume16 .global ExpInterlockedPopEntrySListResume16
.global _ExpInterlockedPopEntrySListFault16 .global ExpInterlockedPopEntrySListFault16
.global _ExpInterlockedPopEntrySListEnd16 .global ExpInterlockedPopEntrySListEnd16
.global _ExpInterlockedPushEntrySList .global ExpInterlockedPushEntrySList
.global _ExpInterlockedFlushSList .global ExpInterlockedFlushSList
/* PSLIST_ENTRY /* PSLIST_ENTRY
* NTAPI * NTAPI
@ -48,7 +47,7 @@
* IN PSLIST_HEADER ListHead); * IN PSLIST_HEADER ListHead);
*/ */
.proc RtlInterlockedPopEntrySList .proc RtlInterlockedPopEntrySList
_ExpInterlockedPopEntrySList: ExpInterlockedPopEntrySList:
/* Load ListHead->Region into rdx */ /* Load ListHead->Region into rdx */
mov rdx, [rcx + 8] mov rdx, [rcx + 8]
@ -58,16 +57,16 @@ _ExpInterlockedPopEntrySList:
/* Check what kind of header this is */ /* Check what kind of header this is */
test rdx, SLIST8B_HEADERTYPE_MASK test rdx, SLIST8B_HEADERTYPE_MASK
jnz _RtlInterlockedPopEntrySList16 jnz RtlInterlockedPopEntrySList16
/* We have an 8 byte header */ /* We have an 8 byte header */
_ExpInterlockedPopEntrySListResume: ExpInterlockedPopEntrySListResume:
/* Check if ListHead->NextEntry is NULL */ /* Check if ListHead->NextEntry is NULL */
mov r9, rax mov r9, rax
and r9, SLIST8A_NEXTENTRY_MASK and r9, SLIST8A_NEXTENTRY_MASK
jz _RtlInterlockedPopEntrySListEmpty jz RtlInterlockedPopEntrySListEmpty
/* Copy Depth and Sequence number and adjust Depth */ /* Copy Depth and Sequence number and adjust Depth */
lea r8, [rax - SLIST8A_DEPTH_INC] lea r8, [rax - SLIST8A_DEPTH_INC]
@ -83,7 +82,7 @@ _ExpInterlockedPopEntrySListResume:
/* Combine to new pointer in rdx */ /* Combine to new pointer in rdx */
or rdx, r9 or rdx, r9
_ExpInterlockedPopEntrySListFault: ExpInterlockedPopEntrySListFault:
/* Load the next NextEntry pointer to r9 */ /* Load the next NextEntry pointer to r9 */
mov r9, [rdx] mov r9, [rdx]
@ -94,13 +93,13 @@ _ExpInterlockedPopEntrySListFault:
/* Combine into r8 */ /* Combine into r8 */
or r8, r9 or r8, r9
_ExpInterlockedPopEntrySListEnd: ExpInterlockedPopEntrySListEnd:
/* If [rcx] equals rax, exchange it with r8 */ /* If [rcx] equals rax, exchange it with r8 */
lock cmpxchg [rcx], r8 lock cmpxchg [rcx], r8
/* If not equal, retry with rax, being the content of [rcx] now */ /* If not equal, retry with rax, being the content of [rcx] now */
jnz _ExpInterlockedPopEntrySListResume jnz ExpInterlockedPopEntrySListResume
/* Shift the pointer bits in place */ /* Shift the pointer bits in place */
and rax, SLIST8A_NEXTENTRY_MASK and rax, SLIST8A_NEXTENTRY_MASK
@ -114,11 +113,11 @@ _ExpInterlockedPopEntrySListEnd:
or rax, rdx or rax, rdx
ret ret
_RtlInterlockedPopEntrySListEmpty: RtlInterlockedPopEntrySListEmpty:
xor rax, rax xor rax, rax
ret ret
_RtlInterlockedPopEntrySList16: RtlInterlockedPopEntrySList16:
/* This is a 16 byte header */ /* This is a 16 byte header */
/* Save rbx */ /* Save rbx */
@ -127,14 +126,14 @@ _RtlInterlockedPopEntrySList16:
/* Copy rcx to r8, as we need rcx for the exchange */ /* Copy rcx to r8, as we need rcx for the exchange */
mov r8, rcx mov r8, rcx
_ExpInterlockedPopEntrySListResume16: ExpInterlockedPopEntrySListResume16:
/* Check if ListHead->NextEntry is NULL */ /* Check if ListHead->NextEntry is NULL */
mov r9, rdx mov r9, rdx
and r9, SLIST16B_NEXTENTY_MASK and r9, SLIST16B_NEXTENTY_MASK
jz _RtlInterlockedPopEntrySListEmpty16 jz RtlInterlockedPopEntrySListEmpty16
_ExpInterlockedPopEntrySListFault16: ExpInterlockedPopEntrySListFault16:
/* Get next pointer */ /* Get next pointer */
mov rcx, [r9] mov rcx, [r9]
@ -145,13 +144,13 @@ _ExpInterlockedPopEntrySListFault16:
/* Copy Depth and Sequence number and adjust Depth */ /* Copy Depth and Sequence number and adjust Depth */
lea rbx, [rax - SLIST16A_DEPTH_INC] lea rbx, [rax - SLIST16A_DEPTH_INC]
_ExpInterlockedPopEntrySListEnd16: ExpInterlockedPopEntrySListEnd16:
/* If [r8] equals rdx:rax, exchange it with rcx:rbx */ /* If [r8] equals rdx:rax, exchange it with rcx:rbx */
lock cmpxchg16b [r8] lock cmpxchg16b [r8]
/* If not equal, retry with rdx:rax, being the content of [r8] now */ /* If not equal, retry with rdx:rax, being the content of [r8] now */
jnz _ExpInterlockedPopEntrySListResume16 jnz ExpInterlockedPopEntrySListResume16
/* Copy the old NextEntry pointer to rax */ /* Copy the old NextEntry pointer to rax */
mov rax, rdx mov rax, rdx
@ -161,12 +160,12 @@ _ExpInterlockedPopEntrySListEnd16:
pop rbx pop rbx
ret ret
_RtlInterlockedPopEntrySListEmpty16: RtlInterlockedPopEntrySListEmpty16:
xor rax, rax xor rax, rax
pop rbx pop rbx
ret ret
.endproc .endp RtlInterlockedPopEntrySList
/* PSLIST_ENTRY /* PSLIST_ENTRY
@ -176,7 +175,7 @@ _RtlInterlockedPopEntrySListEmpty16:
* IN PSLIST_ENTRY ListEntry); * IN PSLIST_ENTRY ListEntry);
*/ */
.proc RtlInterlockedPushEntrySList .proc RtlInterlockedPushEntrySList
_ExpInterlockedPushEntrySList: ExpInterlockedPushEntrySList:
/* Load ListHead->Alignment into rax */ /* Load ListHead->Alignment into rax */
mov rax, [rcx] mov rax, [rcx]
@ -186,16 +185,16 @@ _ExpInterlockedPushEntrySList:
/* Check what kind of header this is */ /* Check what kind of header this is */
test r9, SLIST8B_HEADERTYPE_MASK test r9, SLIST8B_HEADERTYPE_MASK
jnz _RtlInterlockedPushEntrySList16 jnz RtlInterlockedPushEntrySList16
/* We have an 8 byte header */ /* We have an 8 byte header */
_RtlInterlockedPushEntrySListLoop: RtlInterlockedPushEntrySListLoop:
/* Get ListHead->NextEntry */ /* Get ListHead->NextEntry */
mov r8, rax mov r8, rax
and r8, SLIST8A_NEXTENTRY_MASK and r8, SLIST8A_NEXTENTRY_MASK
jz _RtlInterlockedPushEntrySListEmpty jz RtlInterlockedPushEntrySListEmpty
/* Shift the NextEntry pointer */ /* Shift the NextEntry pointer */
shr r8, SLIST8A_NEXTENTRY_SHIFT shr r8, SLIST8A_NEXTENTRY_SHIFT
@ -207,7 +206,7 @@ _RtlInterlockedPushEntrySListLoop:
/* Combine to new pointer and save as ListEntry->NextEntry */ /* Combine to new pointer and save as ListEntry->NextEntry */
or r8, r9 or r8, r9
_RtlInterlockedPushEntrySListEmpty: RtlInterlockedPushEntrySListEmpty:
/* Store the NextEntry pointer in the new ListEntry */ /* Store the NextEntry pointer in the new ListEntry */
mov [rdx], r8 mov [rdx], r8
@ -230,13 +229,13 @@ _RtlInterlockedPushEntrySListEmpty:
lock cmpxchg [rcx], r8 lock cmpxchg [rcx], r8
/* If not equal, retry with rax, being the content of [rcx] now */ /* If not equal, retry with rax, being the content of [rcx] now */
jnz _RtlInterlockedPushEntrySListLoop jnz RtlInterlockedPushEntrySListLoop
/* Return the old NextEntry pointer */ /* Return the old NextEntry pointer */
mov rax, r9 mov rax, r9
ret ret
_RtlInterlockedPushEntrySList16: RtlInterlockedPushEntrySList16:
/* This is a 16 byte header */ /* This is a 16 byte header */
/* Save rbx */ /* Save rbx */
@ -252,7 +251,7 @@ _RtlInterlockedPushEntrySList16:
mov rdx, [r8 + 8] mov rdx, [r8 + 8]
_RtlInterlockedPushEntrySListLoop16: RtlInterlockedPushEntrySListLoop16:
/* Move ListHead->NextEntry to rbx */ /* Move ListHead->NextEntry to rbx */
mov rbx, rdx mov rbx, rdx
@ -268,7 +267,7 @@ _RtlInterlockedPushEntrySListLoop16:
lock cmpxchg16b [r8] lock cmpxchg16b [r8]
/* If not equal, retry with rdx:rax, being the content of [r8] now */ /* If not equal, retry with rdx:rax, being the content of [r8] now */
jnz _RtlInterlockedPushEntrySListLoop16 jnz RtlInterlockedPushEntrySListLoop16
/* Copy the old NextEntry pointer to rax */ /* Copy the old NextEntry pointer to rax */
mov rax, rdx mov rax, rdx
@ -278,7 +277,7 @@ _RtlInterlockedPushEntrySListLoop16:
pop rbx pop rbx
ret ret
.endproc .endp RtlInterlockedPushEntrySList
/* PSLIST_ENTRY /* PSLIST_ENTRY
* NTAPI * NTAPI
@ -286,18 +285,18 @@ _RtlInterlockedPushEntrySListLoop16:
* IN PSINGLE_LIST_ENTRY ListHead); * IN PSINGLE_LIST_ENTRY ListHead);
*/ */
.proc RtlInterlockedFlushSList .proc RtlInterlockedFlushSList
_ExpInterlockedFlushSList: ExpInterlockedFlushSList:
/* Load ListHead->Region into rdx */ /* Load ListHead->Region into rdx */
mov rax, [rcx + 8] mov rax, [rcx + 8]
/* Check what kind of header this is */ /* Check what kind of header this is */
test rax, SLIST8B_HEADERTYPE_MASK test rax, SLIST8B_HEADERTYPE_MASK
jnz _RtlInterlockedFlushSList16 jnz RtlInterlockedFlushSList16
/* We have an 8 byte header */ /* We have an 8 byte header */
_RtlInterlockedFlushSListLoop: RtlInterlockedFlushSListLoop:
/* Zero ListHead->Alignment */ /* Zero ListHead->Alignment */
xor r8, r8 xor r8, r8
@ -306,7 +305,7 @@ _RtlInterlockedFlushSListLoop:
lock cmpxchg [rcx], r8 lock cmpxchg [rcx], r8
/* If not equal, retry with rax, being the content of [rcx] now */ /* If not equal, retry with rax, being the content of [rcx] now */
jnz _RtlInterlockedFlushSListLoop jnz RtlInterlockedFlushSListLoop
/* Use rcx as pointer template */ /* Use rcx as pointer template */
mov rdx, ~SLIST8_POINTER_MASK mov rdx, ~SLIST8_POINTER_MASK
@ -316,7 +315,7 @@ _RtlInterlockedFlushSListLoop:
or rax, rdx or rax, rdx
ret ret
_RtlInterlockedFlushSList16: RtlInterlockedFlushSList16:
/* We have a 16 byte header */ /* We have a 16 byte header */
push rbx push rbx
@ -324,13 +323,13 @@ _RtlInterlockedFlushSList16:
xor rbx, rbx xor rbx, rbx
mov rcx, 0x3 mov rcx, 0x3
_RtlInterlockedFlushSListLoop16: RtlInterlockedFlushSListLoop16:
/* If [r8] equals rdx:rax, exchange it with rcx:rbx */ /* If [r8] equals rdx:rax, exchange it with rcx:rbx */
lock cmpxchg16b [r8] lock cmpxchg16b [r8]
/* If not equal, retry with rdx:rax, being the content of [r8] now */ /* If not equal, retry with rdx:rax, being the content of [r8] now */
jnz _RtlInterlockedFlushSListLoop16 jnz RtlInterlockedFlushSListLoop16
/* Copy the old NextEntry pointer to rax */ /* Copy the old NextEntry pointer to rax */
mov rax, rdx mov rax, rdx
@ -340,4 +339,4 @@ _RtlInterlockedFlushSListLoop16:
pop rbx pop rbx
ret ret
.endproc .endp RtlInterlockedFlushSList

View file

@ -8,8 +8,7 @@
/* INCLUDES ******************************************************************/ /* INCLUDES ******************************************************************/
#include <ndk/amd64/asm.h> #include <reactos/asm.h>
#include <ndk/amd64/asmmacro.S>
.intel_syntax noprefix .intel_syntax noprefix
@ -21,11 +20,11 @@ _MsgUnimplemented:
.proc _chkstk .proc _chkstk
UNIMPLEMENTED chkstk UNIMPLEMENTED chkstk
ret ret
.endproc .endp
.proc _alloca_probe .proc _alloca_probe
UNIMPLEMENTED alloca_probe UNIMPLEMENTED alloca_probe
ret ret
.endproc .endp
/* EOF */ /* EOF */

View file

@ -8,21 +8,21 @@
/* INCLUDES ******************************************************************/ /* INCLUDES ******************************************************************/
#include <reactos/asm.h>
#include <ndk/amd64/asm.h> #include <ndk/amd64/asm.h>
#include <ndk/amd64/asmmacro.S>
.intel_syntax noprefix
/* DATA *********************************************************************/ /* DATA *********************************************************************/
.globl __fltused PUBLIC _fltused
__fltused: _fltused:
.long 0x9875 .long 0x9875
/* FUNCTIONS ****************************************************************/ /* FUNCTIONS ****************************************************************/
.code64
.proc alldiv .proc alldiv
UNIMPLEMENTED alldiv UNIMPLEMENTED alldiv
ret ret
.endproc .endp alldiv

View file

@ -8,14 +8,14 @@
/* INCLUDES ******************************************************************/ /* INCLUDES ******************************************************************/
#include <reactos/asm.h>
#include <ndk/amd64/asm.h> #include <ndk/amd64/asm.h>
#include <ndk/amd64/asmmacro.S>
.intel_syntax noprefix /* FUNCTIONS ****************************************************************/
.code64
.proc atan PUBLIC atan
atan:
UNIMPLEMENTED atan UNIMPLEMENTED atan
ret ret
.endproc

View file

@ -8,14 +8,14 @@
/* INCLUDES ******************************************************************/ /* INCLUDES ******************************************************************/
#include <reactos/asm.h>
#include <ndk/amd64/asm.h> #include <ndk/amd64/asm.h>
#include <ndk/amd64/asmmacro.S>
.intel_syntax noprefix /* FUNCTIONS ****************************************************************/
.code64
.proc atan2 PUBLIC atan2
atan2:
UNIMPLEMENTED atan2 UNIMPLEMENTED atan2
ret ret
.endproc

View file

@ -8,14 +8,15 @@
/* INCLUDES ******************************************************************/ /* INCLUDES ******************************************************************/
#include <reactos/asm.h>
#include <ndk/amd64/asm.h> #include <ndk/amd64/asm.h>
#include <ndk/amd64/asmmacro.S>
.intel_syntax noprefix /* FUNCTIONS ****************************************************************/
.code64
.proc ceil PUBLIC ceil
ceil:
UNIMPLEMENTED ceil UNIMPLEMENTED ceil
ret ret
.endproc

View file

@ -8,13 +8,15 @@
/* INCLUDES ******************************************************************/ /* INCLUDES ******************************************************************/
#include <reactos/asm.h>
#include <ndk/amd64/asm.h> #include <ndk/amd64/asm.h>
#include <ndk/amd64/asmmacro.S>
.intel_syntax noprefix /* FUNCTIONS ****************************************************************/
.code64
.proc ceilf PUBLIC ceilf
ceilf:
/* Put parameter on the stack */ /* Put parameter on the stack */
movss [rsp - 0x10], xmm0 movss [rsp - 0x10], xmm0
fld dword ptr [rsp] fld dword ptr [rsp]
@ -36,5 +38,3 @@
fstp dword ptr [rsp - 0x10] fstp dword ptr [rsp - 0x10]
movss xmm0, [rsp - 0x10] movss xmm0, [rsp - 0x10]
ret ret
.endproc

View file

@ -8,14 +8,15 @@
/* INCLUDES ******************************************************************/ /* INCLUDES ******************************************************************/
#include <reactos/asm.h>
#include <ndk/amd64/asm.h> #include <ndk/amd64/asm.h>
#include <ndk/amd64/asmmacro.S>
.intel_syntax noprefix /* FUNCTIONS ****************************************************************/
.code64
.proc exp PUBLIC exp
exp:
UNIMPLEMENTED exp UNIMPLEMENTED exp
ret ret
.endproc

View file

@ -8,14 +8,15 @@
/* INCLUDES ******************************************************************/ /* INCLUDES ******************************************************************/
#include <reactos/asm.h>
#include <ndk/amd64/asm.h> #include <ndk/amd64/asm.h>
#include <ndk/amd64/asmmacro.S>
.intel_syntax noprefix /* FUNCTIONS ****************************************************************/
.code64
.proc fabs PUBLIC fabs
fabs:
UNIMPLEMENTED fabs UNIMPLEMENTED fabs
ret ret
.endproc

View file

@ -8,14 +8,14 @@
/* INCLUDES ******************************************************************/ /* INCLUDES ******************************************************************/
#include <reactos/asm.h>
#include <ndk/amd64/asm.h> #include <ndk/amd64/asm.h>
#include <ndk/amd64/asmmacro.S>
.intel_syntax noprefix /* FUNCTIONS ****************************************************************/
.code64
.proc floor PUBLIC floor
floor:
UNIMPLEMENTED floor UNIMPLEMENTED floor
ret ret
.endproc

View file

@ -8,13 +8,15 @@
/* INCLUDES ******************************************************************/ /* INCLUDES ******************************************************************/
#include <reactos/asm.h>
#include <ndk/amd64/asm.h> #include <ndk/amd64/asm.h>
#include <ndk/amd64/asmmacro.S>
.intel_syntax noprefix /* FUNCTIONS ****************************************************************/
.code64
.proc floorf PUBLIC floorf
floorf:
/* Put parameter on the stack */ /* Put parameter on the stack */
movss [rsp - 0x10], xmm0 movss [rsp - 0x10], xmm0
fld dword ptr [rsp] fld dword ptr [rsp]
@ -36,5 +38,3 @@
fstp dword ptr [rsp - 0x10] fstp dword ptr [rsp - 0x10]
movss xmm0, [rsp - 0x10] movss xmm0, [rsp - 0x10]
ret ret
.endproc

View file

@ -8,14 +8,12 @@
/* INCLUDES ******************************************************************/ /* INCLUDES ******************************************************************/
#include <reactos/asm.h>
#include <ndk/amd64/asm.h> #include <ndk/amd64/asm.h>
#include <ndk/amd64/asmmacro.S>
.intel_syntax noprefix /* DATA *********************************************************************/
PUBLIC fmod
.proc fmod fmod:
UNIMPLEMENTED fmod UNIMPLEMENTED fmod
ret ret
.endproc

View file

@ -8,14 +8,12 @@
/* INCLUDES ******************************************************************/ /* INCLUDES ******************************************************************/
#include <reactos/asm.h>
#include <ndk/amd64/asm.h> #include <ndk/amd64/asm.h>
#include <ndk/amd64/asmmacro.S>
.intel_syntax noprefix /* DATA *********************************************************************/
PUBLIC fmodf
.proc fmodf fmodf:
UNIMPLEMENTED fmodf UNIMPLEMENTED fmodf
ret ret
.endproc

View file

@ -8,14 +8,12 @@
/* INCLUDES ******************************************************************/ /* INCLUDES ******************************************************************/
#include <reactos/asm.h>
#include <ndk/amd64/asm.h> #include <ndk/amd64/asm.h>
#include <ndk/amd64/asmmacro.S>
.intel_syntax noprefix /* DATA *********************************************************************/
PUBLIC ldexp
.proc ldexp ldexp:
UNIMPLEMENTED ldexp UNIMPLEMENTED ldexp
ret ret
.endproc

View file

@ -8,14 +8,12 @@
/* INCLUDES ******************************************************************/ /* INCLUDES ******************************************************************/
#include <reactos/asm.h>
#include <ndk/amd64/asm.h> #include <ndk/amd64/asm.h>
#include <ndk/amd64/asmmacro.S>
.intel_syntax noprefix /* DATA *********************************************************************/
PUBLIC log
.proc log log:
UNIMPLEMENTED log UNIMPLEMENTED log
ret ret
.endproc

View file

@ -8,14 +8,13 @@
/* INCLUDES ******************************************************************/ /* INCLUDES ******************************************************************/
#include <reactos/asm.h>
#include <ndk/amd64/asm.h> #include <ndk/amd64/asm.h>
#include <ndk/amd64/asmmacro.S>
.intel_syntax noprefix /* DATA *********************************************************************/
PUBLIC log10
.proc log10 log10:
UNIMPLEMENTED log10 UNIMPLEMENTED log10
ret ret
.endproc

View file

@ -8,14 +8,13 @@
/* INCLUDES ******************************************************************/ /* INCLUDES ******************************************************************/
#include <reactos/asm.h>
#include <ndk/amd64/asm.h> #include <ndk/amd64/asm.h>
#include <ndk/amd64/asmmacro.S>
.intel_syntax noprefix /* DATA *********************************************************************/
PUBLIC pow
.proc pow pow:
UNIMPLEMENTED pow UNIMPLEMENTED pow
ret ret
.endproc

View file

@ -8,14 +8,12 @@
/* INCLUDES ******************************************************************/ /* INCLUDES ******************************************************************/
#include <reactos/asm.h>
#include <ndk/amd64/asm.h> #include <ndk/amd64/asm.h>
#include <ndk/amd64/asmmacro.S>
.intel_syntax noprefix /* DATA *********************************************************************/
PUBLIC sqrt
.proc sqrt sqrt:
UNIMPLEMENTED sqrt UNIMPLEMENTED sqrt
ret ret
.endproc

View file

@ -8,13 +8,12 @@
/* INCLUDES ******************************************************************/ /* INCLUDES ******************************************************************/
#include <reactos/asm.h>
#include <ndk/amd64/asm.h> #include <ndk/amd64/asm.h>
#include <ndk/amd64/asmmacro.S>
.intel_syntax noprefix /* DATA *********************************************************************/
PUBLIC sqrtf
.proc sqrtf sqrtf:
sqrtss xmm0, xmm0 sqrtss xmm0, xmm0
ret ret
.endproc

View file

@ -8,14 +8,12 @@
/* INCLUDES ******************************************************************/ /* INCLUDES ******************************************************************/
#include <reactos/asm.h>
#include <ndk/amd64/asm.h> #include <ndk/amd64/asm.h>
#include <ndk/amd64/asmmacro.S>
.intel_syntax noprefix /* DATA *********************************************************************/
PUBLIC tan
.proc tan tan:
UNIMPLEMENTED tan UNIMPLEMENTED tan
ret ret
.endproc

View file

@ -44,8 +44,8 @@
* Returns: 0 * Returns: 0
* Notes: Sets up the jmp_buf * Notes: Sets up the jmp_buf
*/ */
PUBLIC __setjmp PUBLIC _setjmp
.proc __setjmp .proc _setjmp
/* Load rsp as it was before the call into rax */ /* Load rsp as it was before the call into rax */
lea rax, [rsp + 8] lea rax, [rsp + 8]
/* Load return address into r8 */ /* Load return address into r8 */
@ -73,7 +73,7 @@ PUBLIC __setjmp
movdqa [rcx + JUMP_BUFFER_Xmm15], xmm15 movdqa [rcx + JUMP_BUFFER_Xmm15], xmm15
xor rax, rax xor rax, rax
ret ret
.endp .endp _setjmp
/* /*
* int _setjmpex(jmp_buf _Buf,void *_Ctx); * int _setjmpex(jmp_buf _Buf,void *_Ctx);
@ -83,8 +83,8 @@ PUBLIC __setjmp
* Returns: 0 * Returns: 0
* Notes: Sets up the jmp_buf * Notes: Sets up the jmp_buf
*/ */
PUBLIC __setjmpex PUBLIC _setjmpex
.proc __setjmpex .proc _setjmpex
/* Load rsp as it was before the call into rax */ /* Load rsp as it was before the call into rax */
lea rax, [rsp + 8] lea rax, [rsp + 8]
/* Load return address into r8 */ /* Load return address into r8 */
@ -112,7 +112,7 @@ PUBLIC __setjmpex
movdqa [rcx + JUMP_BUFFER_Xmm15], xmm15 movdqa [rcx + JUMP_BUFFER_Xmm15], xmm15
xor rax, rax xor rax, rax
ret ret
.endp .endp _setjmpex
/* /*
@ -123,8 +123,8 @@ PUBLIC __setjmpex
* Returns: Doesn't return * Returns: Doesn't return
* Notes: Non-local goto * Notes: Non-local goto
*/ */
PUBLIC _longjmp PUBLIC longjmp
.proc _longjmp .proc longjmp
// FIXME: handle frame // FIXME: handle frame
@ -155,4 +155,4 @@ PUBLIC _longjmp
jnz 2f jnz 2f
inc rax inc rax
2: jmp r8 2: jmp r8
.endp .endp longjmp

View file

@ -8,15 +8,16 @@
/* INCLUDES ******************************************************************/ /* INCLUDES ******************************************************************/
#include <asm.h> #include <reactos/asm.h>
.intel_syntax noprefix #include <ndk/amd64/asm.h>
.code64
/* GLOBALS *******************************************************************/ /* GLOBALS *******************************************************************/
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
.code64
.text .text
/** /**
@ -29,9 +30,8 @@
* IN CCHAR Number, <rsp + 0x28> * IN CCHAR Number, <rsp + 0x28>
* IN PLOADER_PARAMETER_BLOCK LoaderBlock) <rsp + 0x30> * IN PLOADER_PARAMETER_BLOCK LoaderBlock) <rsp + 0x30>
*/ */
.globl _KiSetupStackAndInitializeKernel PUBLIC KiSetupStackAndInitializeKernel
.func KiSetupStackAndInitializeKernel .PROC KiSetupStackAndInitializeKernel
_KiSetupStackAndInitializeKernel:
/* Save current stack */ /* Save current stack */
mov rsi, rsp mov rsi, rsp
@ -53,6 +53,9 @@ _KiSetupStackAndInitializeKernel:
movsq movsq
movsq movsq
jmp _KiInitializeKernelAndGotoIdleLoop jmp KiInitializeKernelAndGotoIdleLoop
.ENDP KiSetupStackAndInitializeKernel
END
.endfunc

View file

@ -44,8 +44,8 @@
* *
*--*/ *--*/
.func KiThreadStartup .func KiThreadStartup
.globl _KiThreadStartup .globl KiThreadStartup
_KiThreadStartup: KiThreadStartup:
/* /*
* Clear all the non-volatile registers, so the thread won't be tempted to * Clear all the non-volatile registers, so the thread won't be tempted to
@ -85,7 +85,7 @@ _KiThreadStartup:
/* Exit back to user-mode */ /* Exit back to user-mode */
// jmp _KiServiceExit2 // jmp _KiServiceExit2
UNIMPLEMENTED "KiThreadStartup->KiServiceExit2" UNIMPLEMENTED KiThreadStartup->KiServiceExit2
BadThread: BadThread:
@ -112,10 +112,10 @@ BadThread:
* Absolutely all registers except ESP can be trampled here for maximum code flexibility. * Absolutely all registers except ESP can be trampled here for maximum code flexibility.
* *
*--*/ *--*/
.globl _KiSwapContextInternal .globl KiSwapContextInternal
.func _KiSwapContextInternal, _KiSwapContextInternal .func KiSwapContextInternal
_KiSwapContextInternal: KiSwapContextInternal:
UNIMPLEMENTED "KiSwapContextInternal" UNIMPLEMENTED KiSwapContextInternal
ret ret
.endfunc .endfunc
@ -147,9 +147,9 @@ _KiSwapContextInternal:
* another thread switches to IT. * another thread switches to IT.
* *
*--*/ *--*/
.globl _KiSwapContext .globl KiSwapContext
.func _KiSwapContext, _KiSwapContext .func KiSwapContext
_KiSwapContext: KiSwapContext:
/* Save 10 registers */ /* Save 10 registers */
sub rsp, 10 * 8 sub rsp, 10 * 8
@ -180,7 +180,7 @@ _KiSwapContext:
movzx ecx, byte ptr [edi+KTHREAD_WAIT_IRQL] movzx ecx, byte ptr [edi+KTHREAD_WAIT_IRQL]
/* Do the swap with the registers correctly setup */ /* Do the swap with the registers correctly setup */
call _KiSwapContextInternal call KiSwapContextInternal
/* Restore the registers */ /* Restore the registers */
mov rbp, [rsp+0] mov rbp, [rsp+0]

View file

@ -10,20 +10,20 @@
#include <reactos/asm.h> #include <reactos/asm.h>
#include <ndk/amd64/asm.h> #include <ndk/amd64/asm.h>
EXTERN _KiDispatchException:PROC EXTERN KiDispatchException:PROC
EXTERN _FrLdrDbgPrint:DWORD EXTERN FrLdrDbgPrint:DWORD
EXTERN _KeBugCheckWithTf:PROC EXTERN KeBugCheckWithTf:PROC
EXTERN _MmAccessFault:PROC EXTERN MmAccessFault:PROC
EXTERN _KiSystemFatalException:PROC EXTERN KiSystemFatalException:PROC
EXTERN _KiNpxNotAvailableFaultHandler:PROC EXTERN KiNpxNotAvailableFaultHandler:PROC
EXTERN _KiGeneralProtectionFaultHandler:PROC EXTERN KiGeneralProtectionFaultHandler:PROC
EXTERN _KiXmmExceptionHandler:PROC EXTERN KiXmmExceptionHandler:PROC
/* GLOBALS *******************************************************************/ /* GLOBALS *******************************************************************/
.data .data
PUBLIC _MsgUnimplemented PUBLIC MsgUnimplemented
_MsgUnimplemented: _MsgUnimplemented:
.ascii "WARNING: %s at %s:%d is UNIMPLEMENTED!\n" .ascii "WARNING: %s at %s:%d is UNIMPLEMENTED!\n"
@ -58,7 +58,7 @@ label2:
lea rcx, _MsgTrapInfo[rip] lea rcx, _MsgTrapInfo[rip]
lea rdx, 1b[rip] lea rdx, 1b[rip]
mov r8, [rbp + KTRAP_FRAME_Rip] mov r8, [rbp + KTRAP_FRAME_Rip]
call qword ptr _FrLdrDbgPrint[rip] call qword ptr FrLdrDbgPrint[rip]
add rsp, 32 add rsp, 32
#endif #endif
ENDM ENDM
@ -263,18 +263,18 @@ ENDM
ALIGN 8 ALIGN 8
PUBLIC _InterruptDispatchTable PUBLIC InterruptDispatchTable
_InterruptDispatchTable: InterruptDispatchTable:
Vector = 0 Vector = 0
REPEAT 256 REPEAT 256
push Vector push Vector
jmp _KiUnexpectedInterrupt jmp KiUnexpectedInterrupt
ALIGN 8 ALIGN 8
Vector = Vector+1 Vector = Vector+1
ENDR ENDR
// rbp = TrapFrame, eax = ExceptionCode, edx = NumParams, r9,r10,r11 = params // rbp = TrapFrame, eax = ExceptionCode, edx = NumParams, r9,r10,r11 = params
.PROC _InternalDispatchException .PROC InternalDispatchException
/* Allocate stack space for EXCEPTION_RECORD and KEXCEPTION_FRAME */ /* Allocate stack space for EXCEPTION_RECORD and KEXCEPTION_FRAME */
sub rsp, SIZE_EXCEPTION_RECORD + SIZE_KEXCEPTION_FRAME sub rsp, SIZE_EXCEPTION_RECORD + SIZE_KEXCEPTION_FRAME
@ -322,7 +322,7 @@ ENDR
mov r8, rbp // TrapFrame mov r8, rbp // TrapFrame
mov r9b, [r8 + KTRAP_FRAME_PreviousMode] // PreviousMode mov r9b, [r8 + KTRAP_FRAME_PreviousMode] // PreviousMode
mov byte ptr [rsp + KEXCEPTION_FRAME_P5], 1 // FirstChance mov byte ptr [rsp + KEXCEPTION_FRAME_P5], 1 // FirstChance
call _KiDispatchException call KiDispatchException
/* Restore registers */ /* Restore registers */
mov r12, [rsp + KEXCEPTION_FRAME_R12] mov r12, [rsp + KEXCEPTION_FRAME_R12]
@ -342,13 +342,13 @@ ENDR
add rsp, SIZE_EXCEPTION_RECORD + SIZE_KEXCEPTION_FRAME add rsp, SIZE_EXCEPTION_RECORD + SIZE_KEXCEPTION_FRAME
ret ret
.ENDP _InternalDispatchException .ENDP InternalDispatchException
/* SOFTWARE INTERRUPT SERVICES ***********************************************/ /* SOFTWARE INTERRUPT SERVICES ***********************************************/
PUBLIC _KiDivideErrorFault PUBLIC KiDivideErrorFault
.PROC _KiDivideErrorFault .PROC KiDivideErrorFault
/* Push pseudo error code */ /* Push pseudo error code */
ENTER_TRAP_FRAME TRAPFLAG_ALL ENTER_TRAP_FRAME TRAPFLAG_ALL
@ -361,16 +361,16 @@ PUBLIC _KiDivideErrorFault
mov r9, 0 mov r9, 0
mov r10, 0 mov r10, 0
mov r11, 0 mov r11, 0
call _InternalDispatchException call InternalDispatchException
/* Return */ /* Return */
LEAVE_TRAP_FRAME LEAVE_TRAP_FRAME
iretq iretq
.ENDP _KiDivideErrorFault .ENDP KiDivideErrorFault
PUBLIC _KiDebugTrapOrFault PUBLIC KiDebugTrapOrFault
.PROC _KiDebugTrapOrFault .PROC KiDebugTrapOrFault
/* Push pseudo error code */ /* Push pseudo error code */
ENTER_TRAP_FRAME TRAPFLAG_ALL ENTER_TRAP_FRAME TRAPFLAG_ALL
@ -391,16 +391,16 @@ KiDebugTrapOrFaultKMode:
mov r9, 0 mov r9, 0
mov r10, 0 mov r10, 0
mov r11, 0 mov r11, 0
call _InternalDispatchException call InternalDispatchException
/* Return */ /* Return */
LEAVE_TRAP_FRAME LEAVE_TRAP_FRAME
iretq iretq
.ENDP _KiDebugTrapOrFault .ENDP KiDebugTrapOrFault
PUBLIC _KiNmiInterrupt PUBLIC KiNmiInterrupt
.PROC _KiNmiInterrupt .PROC KiNmiInterrupt
/* Push pseudo error code */ /* Push pseudo error code */
ENTER_TRAP_FRAME TRAPFLAG_ALL ENTER_TRAP_FRAME TRAPFLAG_ALL
@ -411,11 +411,11 @@ PUBLIC _KiNmiInterrupt
/* Return */ /* Return */
LEAVE_TRAP_FRAME LEAVE_TRAP_FRAME
iretq iretq
.ENDP _KiNmiInterrupt .ENDP KiNmiInterrupt
PUBLIC _KiBreakpointTrap PUBLIC KiBreakpointTrap
.PROC _KiBreakpointTrap .PROC KiBreakpointTrap
/* Push pseudo error code */ /* Push pseudo error code */
ENTER_TRAP_FRAME TRAPFLAG_ALL ENTER_TRAP_FRAME TRAPFLAG_ALL
@ -423,7 +423,7 @@ PUBLIC _KiBreakpointTrap
// lea rcx, _MsgBreakpointTrap[rip] // lea rcx, _MsgBreakpointTrap[rip]
// mov rdx, rsp // mov rdx, rsp
// call qword ptr _FrLdrDbgPrint[rip] // call qword ptr FrLdrDbgPrint[rip]
/* Dispatch the exception */ /* Dispatch the exception */
mov eax, STATUS_BREAKPOINT mov eax, STATUS_BREAKPOINT
@ -431,16 +431,16 @@ PUBLIC _KiBreakpointTrap
mov r9, 0 mov r9, 0
mov r10, 0 mov r10, 0
mov r11, 0 mov r11, 0
call _InternalDispatchException call InternalDispatchException
/* Return */ /* Return */
LEAVE_TRAP_FRAME LEAVE_TRAP_FRAME
iretq iretq
.ENDP _KiBreakpointTrap .ENDP KiBreakpointTrap
PUBLIC _KiOverflowTrap PUBLIC KiOverflowTrap
.PROC _KiOverflowTrap .PROC KiOverflowTrap
/* Push pseudo error code */ /* Push pseudo error code */
ENTER_TRAP_FRAME TRAPFLAG_ALL ENTER_TRAP_FRAME TRAPFLAG_ALL
@ -453,16 +453,16 @@ PUBLIC _KiOverflowTrap
mov r9, 0 mov r9, 0
mov r10, 0 mov r10, 0
mov r11, 0 mov r11, 0
call _InternalDispatchException call InternalDispatchException
/* Return */ /* Return */
LEAVE_TRAP_FRAME LEAVE_TRAP_FRAME
iretq iretq
.ENDP _KiOverflowTrap .ENDP KiOverflowTrap
PUBLIC _KiBoundFault PUBLIC KiBoundFault
.PROC _KiBoundFault .PROC KiBoundFault
/* Push pseudo error code */ /* Push pseudo error code */
ENTER_TRAP_FRAME TRAPFLAG_ALL ENTER_TRAP_FRAME TRAPFLAG_ALL
@ -473,7 +473,7 @@ PUBLIC _KiBoundFault
/* Bugcheck */ /* Bugcheck */
mov ecx, EXCEPTION_BOUND_CHECK mov ecx, EXCEPTION_BOUND_CHECK
mov rdx, rbp mov rdx, rbp
call _KiSystemFatalException call KiSystemFatalException
KiBoundFaltUserMode: KiBoundFaltUserMode:
/* Enable interrupts for user-mode */ /* Enable interrupts for user-mode */
@ -485,16 +485,16 @@ KiBoundFaltUserMode:
mov r9, 0 mov r9, 0
mov r10, 0 mov r10, 0
mov r11, 0 mov r11, 0
call _InternalDispatchException call InternalDispatchException
/* Return */ /* Return */
LEAVE_TRAP_FRAME LEAVE_TRAP_FRAME
iretq iretq
.ENDP _KiBoundFault .ENDP KiBoundFault
PUBLIC _KiInvalidOpcodeFault PUBLIC KiInvalidOpcodeFault
.PROC _KiInvalidOpcodeFault .PROC KiInvalidOpcodeFault
/* Push pseudo error code */ /* Push pseudo error code */
ENTER_TRAP_FRAME TRAPFLAG_ALL ENTER_TRAP_FRAME TRAPFLAG_ALL
@ -502,7 +502,7 @@ PUBLIC _KiInvalidOpcodeFault
mov rdx, [rbp + KTRAP_FRAME_Rip] mov rdx, [rbp + KTRAP_FRAME_Rip]
lea rcx, _MsgInvalidOpcodeFault[rip] lea rcx, _MsgInvalidOpcodeFault[rip]
call qword ptr _FrLdrDbgPrint[rip] call qword ptr FrLdrDbgPrint[rip]
/* Enable interrupts */ /* Enable interrupts */
sti sti
@ -522,22 +522,22 @@ KiInvalidOpcodeKernel:
mov r9, 0 mov r9, 0
mov r10, 0 mov r10, 0
mov r11, 0 mov r11, 0
call _InternalDispatchException call InternalDispatchException
/* Return */ /* Return */
LEAVE_TRAP_FRAME LEAVE_TRAP_FRAME
iretq iretq
.ENDP _KiInvalidOpcodeFault .ENDP KiInvalidOpcodeFault
PUBLIC _KiNpxNotAvailableFault PUBLIC KiNpxNotAvailableFault
.PROC _KiNpxNotAvailableFault .PROC KiNpxNotAvailableFault
/* Push pseudo error code */ /* Push pseudo error code */
ENTER_TRAP_FRAME TRAPFLAG_ALL ENTER_TRAP_FRAME TRAPFLAG_ALL
/* Call the C handler */ /* Call the C handler */
mov rcx, rbp mov rcx, rbp
call _KiNpxNotAvailableFaultHandler call KiNpxNotAvailableFaultHandler
/* Check the return status code */ /* Check the return status code */
test eax, eax test eax, eax
@ -548,102 +548,102 @@ PUBLIC _KiNpxNotAvailableFault
mov r9, 0 mov r9, 0
mov r10, 0 mov r10, 0
mov r11, 0 mov r11, 0
call _InternalDispatchException call InternalDispatchException
KiNpxNotAvailableFaultExit: KiNpxNotAvailableFaultExit:
/* Return */ /* Return */
LEAVE_TRAP_FRAME LEAVE_TRAP_FRAME
iretq iretq
.ENDP _KiNpxNotAvailableFault .ENDP KiNpxNotAvailableFault
PUBLIC _KiDoubleFaultAbort PUBLIC KiDoubleFaultAbort
.PROC _KiDoubleFaultAbort .PROC KiDoubleFaultAbort
/* Push pseudo error code */ /* Push pseudo error code */
ENTER_TRAP_FRAME TRAPFLAG_ALL ENTER_TRAP_FRAME TRAPFLAG_ALL
lea rcx, _MsgDoubleFault[rip] lea rcx, _MsgDoubleFault[rip]
mov rdx, [rbp + KTRAP_FRAME_FaultAddress] mov rdx, [rbp + KTRAP_FRAME_FaultAddress]
mov r8, rbp mov r8, rbp
call qword ptr _FrLdrDbgPrint[rip] call qword ptr FrLdrDbgPrint[rip]
/* Bugcheck */ /* Bugcheck */
mov ecx, 8 // EXCEPTION_DOUBLE_FAULT mov ecx, 8 // EXCEPTION_DOUBLE_FAULT
mov rdx, rbp mov rdx, rbp
call _KiSystemFatalException call KiSystemFatalException
jmp $ jmp $
.ENDP _KiDoubleFaultAbort .ENDP KiDoubleFaultAbort
PUBLIC _KiNpxSegmentOverrunAbort PUBLIC KiNpxSegmentOverrunAbort
.PROC _KiNpxSegmentOverrunAbort .PROC KiNpxSegmentOverrunAbort
/* Push pseudo error code */ /* Push pseudo error code */
ENTER_TRAP_FRAME TRAPFLAG_ALL ENTER_TRAP_FRAME TRAPFLAG_ALL
/* Bugcheck */ /* Bugcheck */
mov ecx, EXCEPTION_NPX_OVERRUN mov ecx, EXCEPTION_NPX_OVERRUN
mov rdx, rbp mov rdx, rbp
call _KiSystemFatalException call KiSystemFatalException
jmp $ jmp $
.ENDP _KiNpxSegmentOverrunAbort .ENDP KiNpxSegmentOverrunAbort
PUBLIC _KiInvalidTssFault PUBLIC KiInvalidTssFault
.PROC _KiInvalidTssFault .PROC KiInvalidTssFault
/* We have an error code */ /* We have an error code */
ENTER_TRAP_FRAME (TRAPFLAG_HAS_ERRORCODE OR TRAPFLAG_ALL) ENTER_TRAP_FRAME (TRAPFLAG_HAS_ERRORCODE OR TRAPFLAG_ALL)
/* Bugcheck */ /* Bugcheck */
mov ecx, EXCEPTION_INVALID_TSS mov ecx, EXCEPTION_INVALID_TSS
mov rdx, rbp mov rdx, rbp
call _KiSystemFatalException call KiSystemFatalException
jmp $ jmp $
.ENDP _KiInvalidTssFault .ENDP KiInvalidTssFault
PUBLIC _KiSegmentNotPresentFault PUBLIC KiSegmentNotPresentFault
.PROC _KiSegmentNotPresentFault .PROC KiSegmentNotPresentFault
/* We have an error code */ /* We have an error code */
ENTER_TRAP_FRAME (TRAPFLAG_HAS_ERRORCODE OR TRAPFLAG_ALL) ENTER_TRAP_FRAME (TRAPFLAG_HAS_ERRORCODE OR TRAPFLAG_ALL)
/* Bugcheck */ /* Bugcheck */
mov ecx, EXCEPTION_SEGMENT_NOT_PRESENT mov ecx, EXCEPTION_SEGMENT_NOT_PRESENT
mov rdx, rbp mov rdx, rbp
call _KiSystemFatalException call KiSystemFatalException
jmp $ jmp $
.ENDP _KiSegmentNotPresentFault .ENDP KiSegmentNotPresentFault
PUBLIC _KiStackFault PUBLIC KiStackFault
.PROC _KiStackFault .PROC KiStackFault
/* We have an error code */ /* We have an error code */
ENTER_TRAP_FRAME (TRAPFLAG_HAS_ERRORCODE OR TRAPFLAG_ALL) ENTER_TRAP_FRAME (TRAPFLAG_HAS_ERRORCODE OR TRAPFLAG_ALL)
/* Bugcheck */ /* Bugcheck */
mov ecx, EXCEPTION_STACK_FAULT mov ecx, EXCEPTION_STACK_FAULT
mov rdx, rbp mov rdx, rbp
call _KiSystemFatalException call KiSystemFatalException
jmp $ jmp $
.ENDP _KiStackFault .ENDP KiStackFault
PUBLIC _KiGeneralProtectionFault PUBLIC KiGeneralProtectionFault
.PROC _KiGeneralProtectionFault .PROC KiGeneralProtectionFault
/* We have an error code */ /* We have an error code */
ENTER_TRAP_FRAME (TRAPFLAG_HAS_ERRORCODE OR TRAPFLAG_ALL) ENTER_TRAP_FRAME (TRAPFLAG_HAS_ERRORCODE OR TRAPFLAG_ALL)
TRAPINFO KiGeneralProtectionFault TRAPINFO KiGeneralProtectionFault
mov rdx, [rbp + KTRAP_FRAME_Rip] mov rdx, [rbp + KTRAP_FRAME_Rip]
lea rcx, _MsgGeneralProtFault[rip] lea rcx, _MsgGeneralProtFault[rip]
call qword ptr _FrLdrDbgPrint[rip] call qword ptr FrLdrDbgPrint[rip]
/* Call the C handler */ /* Call the C handler */
call _KiGeneralProtectionFaultHandler call KiGeneralProtectionFaultHandler
/* Check for success */ /* Check for success */
test eax, eax test eax, eax
@ -654,7 +654,7 @@ PUBLIC _KiGeneralProtectionFault
mov r9, 0 mov r9, 0
mov r10, 0 mov r10, 0
mov r11, 0 mov r11, 0
call _InternalDispatchException call InternalDispatchException
KiGpfFatal: KiGpfFatal:
@ -665,17 +665,17 @@ KiGpfFatal:
mov r9, [rbp + KTRAP_FRAME_ErrorCode] // error code mov r9, [rbp + KTRAP_FRAME_ErrorCode] // error code
sub rsp, 8 sub rsp, 8
mov [rsp + KTRAP_FRAME_P5+8], rbp // trap frame mov [rsp + KTRAP_FRAME_P5+8], rbp // trap frame
call _KeBugCheckWithTf call KeBugCheckWithTf
KiGpfExit: KiGpfExit:
/* Return */ /* Return */
LEAVE_TRAP_FRAME LEAVE_TRAP_FRAME
iretq iretq
.ENDP _KiGeneralProtectionFault .ENDP KiGeneralProtectionFault
PUBLIC _KiPageFault PUBLIC KiPageFault
.PROC _KiPageFault .PROC KiPageFault
/* We have an error code */ /* We have an error code */
ENTER_TRAP_FRAME (TRAPFLAG_HAS_ERRORCODE OR TRAPFLAG_ALL) ENTER_TRAP_FRAME (TRAPFLAG_HAS_ERRORCODE OR TRAPFLAG_ALL)
@ -686,7 +686,7 @@ PUBLIC _KiPageFault
mov rdx, [rbp + KTRAP_FRAME_ErrorCode] mov rdx, [rbp + KTRAP_FRAME_ErrorCode]
mov r8, [rbp + KTRAP_FRAME_Rip] mov r8, [rbp + KTRAP_FRAME_Rip]
mov r9, [rbp + KTRAP_FRAME_FaultAddress] mov r9, [rbp + KTRAP_FRAME_FaultAddress]
call qword ptr _FrLdrDbgPrint[rip] call qword ptr FrLdrDbgPrint[rip]
#endif #endif
/* Save page fault address */ /* Save page fault address */
@ -700,7 +700,7 @@ PUBLIC _KiPageFault
mov r8b, [rbp + KTRAP_FRAME_SegCs] // Mode mov r8b, [rbp + KTRAP_FRAME_SegCs] // Mode
and r8b, 1 and r8b, 1
mov r9, rbp // TrapInformation mov r9, rbp // TrapInformation
call _MmAccessFault call MmAccessFault
/* Check for success */ /* Check for success */
test eax, eax test eax, eax
@ -724,7 +724,7 @@ InPageException:
mov r11d, eax // Param3 = Status mov r11d, eax // Param3 = Status
mov eax, STATUS_IN_PAGE_ERROR // ExceptionCode mov eax, STATUS_IN_PAGE_ERROR // ExceptionCode
mov edx, 3 // ParamCount mov edx, 3 // ParamCount
call _InternalDispatchException call InternalDispatchException
jmp PageFaultReturn jmp PageFaultReturn
AccessViolation: AccessViolation:
@ -734,27 +734,27 @@ AccessViolation:
SpecialCode: SpecialCode:
/* Setup a normal page fault exception */ /* Setup a normal page fault exception */
mov edx, 2 // ParamCount mov edx, 2 // ParamCount
call _InternalDispatchException call InternalDispatchException
PageFaultReturn: PageFaultReturn:
LEAVE_TRAP_FRAME LEAVE_TRAP_FRAME
iretq iretq
.ENDP _KiPageFault .ENDP KiPageFault
PUBLIC _KiFloatingErrorFault PUBLIC KiFloatingErrorFault
.PROC _KiFloatingErrorFault .PROC KiFloatingErrorFault
/* Push pseudo error code */ /* Push pseudo error code */
ENTER_TRAP_FRAME TRAPFLAG_ALL ENTER_TRAP_FRAME TRAPFLAG_ALL
UNIMPLEMENTED KiFloatingErrorFault UNIMPLEMENTED KiFloatingErrorFault
jmp $ jmp $
.ENDP _KiFloatingErrorFault .ENDP KiFloatingErrorFault
PUBLIC _KiAlignmentFault PUBLIC KiAlignmentFault
.PROC _KiAlignmentFault .PROC KiAlignmentFault
/* We have an error code */ /* We have an error code */
ENTER_TRAP_FRAME (TRAPFLAG_HAS_ERRORCODE OR TRAPFLAG_ALL) ENTER_TRAP_FRAME (TRAPFLAG_HAS_ERRORCODE OR TRAPFLAG_ALL)
@ -764,34 +764,34 @@ PUBLIC _KiAlignmentFault
/* Bugcheck */ /* Bugcheck */
mov ecx, EXCEPTION_ALIGNMENT_CHECK mov ecx, EXCEPTION_ALIGNMENT_CHECK
mov rdx, rbp mov rdx, rbp
call _KiSystemFatalException call KiSystemFatalException
jmp $ jmp $
.ENDP _KiAlignmentFault .ENDP KiAlignmentFault
PUBLIC _KiMcheckAbort PUBLIC KiMcheckAbort
.PROC _KiMcheckAbort .PROC KiMcheckAbort
/* Push pseudo error code */ /* Push pseudo error code */
ENTER_TRAP_FRAME TRAPFLAG_ALL ENTER_TRAP_FRAME TRAPFLAG_ALL
/* Bugcheck */ /* Bugcheck */
mov ecx, HEX(12) mov ecx, HEX(12)
mov rdx, rbp mov rdx, rbp
call _KiSystemFatalException call KiSystemFatalException
jmp $ jmp $
.ENDP _KiMcheckAbort .ENDP KiMcheckAbort
PUBLIC _KiXmmException PUBLIC KiXmmException
.PROC _KiXmmException .PROC KiXmmException
/* Push pseudo error code */ /* Push pseudo error code */
ENTER_TRAP_FRAME TRAPFLAG_ALL ENTER_TRAP_FRAME TRAPFLAG_ALL
/* Call the C handler */ /* Call the C handler */
mov rcx, rbp mov rcx, rbp
call _KiXmmExceptionHandler call KiXmmExceptionHandler
/* Check for success */ /* Check for success */
test eax, eax test eax, eax
@ -802,27 +802,27 @@ PUBLIC _KiXmmException
mov r9, 0 mov r9, 0
mov r10, 0 mov r10, 0
mov r11, 0 mov r11, 0
call _InternalDispatchException call InternalDispatchException
KiXmmExit: KiXmmExit:
LEAVE_TRAP_FRAME LEAVE_TRAP_FRAME
iretq iretq
.ENDP _KiXmmException .ENDP KiXmmException
PUBLIC _KiApcInterrupt PUBLIC KiApcInterrupt
.PROC _KiApcInterrupt .PROC KiApcInterrupt
/* We have an error code */ /* We have an error code */
ENTER_TRAP_FRAME (TRAPFLAG_HAS_ERRORCODE OR TRAPFLAG_ALL) ENTER_TRAP_FRAME (TRAPFLAG_HAS_ERRORCODE OR TRAPFLAG_ALL)
UNIMPLEMENTED KiApcInterrupt UNIMPLEMENTED KiApcInterrupt
jmp $ jmp $
.ENDP _KiApcInterrupt .ENDP KiApcInterrupt
PUBLIC _KiRaiseAssertion PUBLIC KiRaiseAssertion
.PROC _KiRaiseAssertion .PROC KiRaiseAssertion
/* We have an error code */ /* We have an error code */
ENTER_TRAP_FRAME (TRAPFLAG_HAS_ERRORCODE OR TRAPFLAG_ALL) ENTER_TRAP_FRAME (TRAPFLAG_HAS_ERRORCODE OR TRAPFLAG_ALL)
@ -835,15 +835,15 @@ PUBLIC _KiRaiseAssertion
mov r9, 0 mov r9, 0
mov r10, 0 mov r10, 0
mov r11, 0 mov r11, 0
call _InternalDispatchException call InternalDispatchException
LEAVE_TRAP_FRAME LEAVE_TRAP_FRAME
iretq iretq
.ENDP _KiRaiseAssertion .ENDP KiRaiseAssertion
PUBLIC _KiDebugServiceTrap PUBLIC KiDebugServiceTrap
.PROC _KiDebugServiceTrap .PROC KiDebugServiceTrap
/* Push pseudo error code */ /* Push pseudo error code */
ENTER_TRAP_FRAME TRAPFLAG_ALL ENTER_TRAP_FRAME TRAPFLAG_ALL
@ -858,37 +858,37 @@ PUBLIC _KiDebugServiceTrap
mov r9, [rbp+KTRAP_FRAME_Rax] // Service mov r9, [rbp+KTRAP_FRAME_Rax] // Service
mov r10, [rbp+KTRAP_FRAME_Rcx] // Buffer mov r10, [rbp+KTRAP_FRAME_Rcx] // Buffer
mov r11, [rbp+KTRAP_FRAME_Rdx] // Length mov r11, [rbp+KTRAP_FRAME_Rdx] // Length
call _InternalDispatchException call InternalDispatchException
LEAVE_TRAP_FRAME; LEAVE_TRAP_FRAME;
iretq iretq
.ENDP _KiDebugServiceTrap .ENDP KiDebugServiceTrap
PUBLIC _KiDpcInterrupt PUBLIC KiDpcInterrupt
.PROC _KiDpcInterrupt .PROC KiDpcInterrupt
/* We have an error code */ /* We have an error code */
ENTER_TRAP_FRAME (TRAPFLAG_HAS_ERRORCODE OR TRAPFLAG_ALL) ENTER_TRAP_FRAME (TRAPFLAG_HAS_ERRORCODE OR TRAPFLAG_ALL)
UNIMPLEMENTED KiDpcInterrupt UNIMPLEMENTED KiDpcInterrupt
jmp $ jmp $
.ENDP _KiDpcInterrupt .ENDP KiDpcInterrupt
PUBLIC _KiIpiInterrupt PUBLIC KiIpiInterrupt
.PROC _KiIpiInterrupt .PROC KiIpiInterrupt
/* We have an error code */ /* We have an error code */
ENTER_TRAP_FRAME (TRAPFLAG_HAS_ERRORCODE OR TRAPFLAG_ALL) ENTER_TRAP_FRAME (TRAPFLAG_HAS_ERRORCODE OR TRAPFLAG_ALL)
UNIMPLEMENTED KiIpiInterrupt UNIMPLEMENTED KiIpiInterrupt
jmp $ jmp $
.ENDP _KiIpiInterrupt .ENDP KiIpiInterrupt
PUBLIC _KiUnexpectedInterrupt PUBLIC KiUnexpectedInterrupt
.PROC _KiUnexpectedInterrupt .PROC KiUnexpectedInterrupt
/* The error code is the vector */ /* The error code is the vector */
cli cli
ENTER_TRAP_FRAME (TRAPFLAG_HAS_ERRORCODE OR TRAPFLAG_ALL) ENTER_TRAP_FRAME (TRAPFLAG_HAS_ERRORCODE OR TRAPFLAG_ALL)
@ -900,10 +900,10 @@ PUBLIC _KiUnexpectedInterrupt
mov r9, 0 // The enabled and asserted status bits mov r9, 0 // The enabled and asserted status bits
sub rsp, 8 sub rsp, 8
mov [rbp + KTRAP_FRAME_P5 + 8], rbp // trap frame mov [rbp + KTRAP_FRAME_P5 + 8], rbp // trap frame
call _KeBugCheckWithTf call KeBugCheckWithTf
jmp $ jmp $
.ENDP _KiUnexpectedInterrupt .ENDP KiUnexpectedInterrupt

View file

@ -13,11 +13,6 @@
#define NDEBUG #define NDEBUG
#include <debug.h> #include <debug.h>
#if defined (ALLOC_PRAGMA)
#pragma alloc_text(INIT, MmInitGlobalKernelPageDirectory)
#pragma alloc_text(INIT, MiInitPageDirectoryMap)
#endif
#undef InterlockedExchangePte #undef InterlockedExchangePte
#define InterlockedExchangePte(pte1, pte2) \ #define InterlockedExchangePte(pte1, pte2) \
InterlockedExchange64(&pte1->u.Long, pte2.u.Long) InterlockedExchange64(&pte1->u.Long, pte2.u.Long)

View file

@ -103,7 +103,7 @@
" ret $0x%x\n\n" " ret $0x%x\n\n"
#define KernelModeStub_amd64 " movl $0x%x, %%eax\n" \ #define KernelModeStub_amd64 " movl $0x%x, %%eax\n" \
" call _KiSystemService\n" \ " call KiSystemService\n" \
" ret $0x%x\n\n" " ret $0x%x\n\n"
/* For now, use the usermode stub. We'll optimize later */ /* For now, use the usermode stub. We'll optimize later */
@ -143,7 +143,7 @@ struct ncitool_data_t ncitool_data[] = {
{ "i386", 4, KernelModeStub_x86, UserModeStub_x86, { "i386", 4, KernelModeStub_x86, UserModeStub_x86,
".global _%s@%d\n", "_%s@%d:\n" }, ".global _%s@%d\n", "_%s@%d:\n" },
{ "amd64", 4, KernelModeStub_amd64, UserModeStub_amd64, { "amd64", 4, KernelModeStub_amd64, UserModeStub_amd64,
".global _%s\n", "_%s:\n" }, ".global %s\n", "%s:\n" },
{ "powerpc", 4, KernelModeStub_ppc, UserModeStub_ppc, { "powerpc", 4, KernelModeStub_ppc, UserModeStub_ppc,
"\t.globl %s\n", "%s:\n" }, "\t.globl %s\n", "%s:\n" },
{ "mips", 4, KernelModeStub_mips, UserModeStub_mips, { "mips", 4, KernelModeStub_mips, UserModeStub_mips,

View file

@ -6,6 +6,10 @@ LDFLAG_WINDOWS:=--subsystem=windows
LDFLAG_NATIVE:=--subsystem=native LDFLAG_NATIVE:=--subsystem=native
LDFLAG_EXCLUDE_ALL_SYMBOLS=-exclude-all-symbols LDFLAG_EXCLUDE_ALL_SYMBOLS=-exclude-all-symbols
DLLTOOL_FLAGS=--kill-at
ifeq ($(ARCH),amd64)
DLLTOOL_FLAGS= --no-leading-underscore
endif
#~ #(module, objs, deps, ldflags, output, def, libs, entry, base) #~ #(module, objs, deps, ldflags, output, def, libs, entry, base)
#(module, objs, deps, ldflags, output, def, libs, entry, base, extralibs) #(module, objs, deps, ldflags, output, def, libs, entry, base, extralibs)
@ -14,15 +18,15 @@ define RBUILD_LINK
ifneq ($(6),) ifneq ($(6),)
${call RBUILD_intermediate_dir,$(5)}$$(SEP)lib${call RBUILD_name,$(5)}.a: $(6) | ${call RBUILD_intermediate_path,$(5)} ${call RBUILD_intermediate_dir,$(5)}$$(SEP)lib${call RBUILD_name,$(5)}.a: $(6) | ${call RBUILD_intermediate_path,$(5)}
$$(ECHO_IMPLIB) $$(ECHO_IMPLIB)
$${dlltool} --def $(6) --kill-at --output-lib=$$@ $${dlltool} --def $(6) $(DLLTOOL_FLAGS) --output-lib=$$@
${call RBUILD_intermediate_dir,$(5)}$$(SEP)lib${call RBUILD_name,$(5)}.delayimp.a: $(6) | ${call RBUILD_intermediate_path,$(5)} ${call RBUILD_intermediate_dir,$(5)}$$(SEP)lib${call RBUILD_name,$(5)}.delayimp.a: $(6) | ${call RBUILD_intermediate_path,$(5)}
$$(ECHO_IMPLIB) $$(ECHO_IMPLIB)
$${dlltool} --def $(6) --kill-at --output-delaylib=$$@ $${dlltool} --def $(6) $(DLLTOOL_FLAGS) --output-delaylib=$$@
${call RBUILD_intermediate_path_noext,$(5)}.exp: $(6) | ${call RBUILD_intermediate_path,$(5)} ${call RBUILD_intermediate_path_noext,$(5)}.exp: $(6) | ${call RBUILD_intermediate_path,$(5)}
$$(ECHO_IMPLIB) $$(ECHO_IMPLIB)
$${dlltool} --def $(6) --kill-at --output-exp=$$@ $${dlltool} --def $(6) $(DLLTOOL_FLAGS) --output-exp=$$@
$(1)_CLEANFILES+=\ $(1)_CLEANFILES+=\
${call RBUILD_intermediate_dir,$(5)}$$(SEP)lib$(notdir $(5)).a \ ${call RBUILD_intermediate_dir,$(5)}$$(SEP)lib$(notdir $(5)).a \

View file

@ -1364,7 +1364,7 @@ Module::GetEntryPoint() const
if (entrypoint == "0" || entrypoint == "0x0") if (entrypoint == "0" || entrypoint == "0x0")
return "0"; return "0";
if (Environment::GetArch() != "arm") if (Environment::GetArch() != "arm" && Environment::GetArch() != "amd64")
result = "_"; result = "_";
result += entrypoint; result += entrypoint;