mirror of
https://github.com/reactos/reactos.git
synced 2024-12-26 00:54:40 +00:00
This commit was generated by cvs2svn to compensate for changes in r10,
which included commits to RCS files with non-trunk default branches. svn path=/trunk/; revision=11
This commit is contained in:
parent
9e7d29f65a
commit
b5efc5cfc5
57 changed files with 17069 additions and 14875 deletions
|
@ -1 +1 @@
|
|||
loaders\dos\loadros kernel\kimage.bin %1 %2 %3 %4
|
||||
loaders\dos\loadros ntoskrnl\kimage.bin %1 %2 %3 %4
|
||||
|
|
|
@ -1,140 +1,140 @@
|
|||
This file attempts to document the functions made publically available by
|
||||
the various subsystems.
|
||||
|
||||
* Formatted I/O operations *
|
||||
|
||||
NAME: int vsprintf(char *buf, const char *fmt, va_list args)
|
||||
NAME: int sprintf(char* buf, const char* fmt, ...)
|
||||
WHERE: internal/kernel.h
|
||||
FUNCTION: The same as the standard c library versions
|
||||
|
||||
* PIO operations *
|
||||
|
||||
NAME: in[b/w/l](port)
|
||||
WHERE: internal/io.h
|
||||
FUNCTION: Read an IO port of the specified size (byte/word or long)
|
||||
RETURNS: The value read
|
||||
|
||||
NAME: out[b/w/l](port,val)
|
||||
WHERE: internal/io.h
|
||||
FUNCTION: Write an IO port of the specified size (byte/word or long)
|
||||
|
||||
NAME: in_p[b/w/l](port)
|
||||
WHERE: internal/io.h
|
||||
FUNCTION: Read an IO port of the specified size (byte/word or long) with
|
||||
a pause
|
||||
RETURNS: The value read
|
||||
|
||||
NAME: out_p[b/w/l](port,val)
|
||||
WHERE: internal/io.h
|
||||
FUNCTION: Write an IO port of the specified size (byte/word or long) with
|
||||
a pause
|
||||
|
||||
* Bit operations *
|
||||
|
||||
NAME: int set_bit(int nr, void* addr)
|
||||
NAME: int clear_bit(int nr, void* addr)
|
||||
NAME: int change_bit(int nr, void* addr)
|
||||
WHERE: internal/bitops.h>
|
||||
FUNCTION: Operate on a bit in the word pointed to by addr
|
||||
RETURN: 0 if the bit was cleared before the operations
|
||||
non-zero otherwise
|
||||
|
||||
* Debugging functions *
|
||||
|
||||
NAME: DPRINT(fmt,....)
|
||||
WHERE: internal/debug.h
|
||||
FUNCTION: Outputs a string to the console if NDEBUG isn't defined before
|
||||
including internal/debug.h, a NOP otherwise
|
||||
ARGUMENTS: The same as printf
|
||||
|
||||
NAME: printk
|
||||
WHERE: internal/kernel.h
|
||||
FUNCTION: Outputs a string to the console
|
||||
ARGUMENTS: The same as printf
|
||||
|
||||
* Memory managment functions *
|
||||
|
||||
NAME: unsigned int physical_to_linear(unsigned int paddr)
|
||||
WHERE: hal/page.h
|
||||
FUNCTION: Converts a physical address to a linear one
|
||||
RECEIVES:
|
||||
paddr = the physical address to convert
|
||||
RETURNS: A virtual address where the memory at that physical address can be
|
||||
accessed
|
||||
|
||||
NAME: void* ExAllocatePool(unsigned int size, unsigned int type = 0);
|
||||
WHERE: internal/pool.h
|
||||
FUNCTION: Allocates a block of memory
|
||||
RECEIVES:
|
||||
size = the size of the block to allocate
|
||||
type = will be whether to allocate pagable memory
|
||||
RETURNS: The address of the block
|
||||
NOTE: This isn't interrupt safe
|
||||
|
||||
NAME: void ExFreePool(void* block)
|
||||
WHERE: internal/pool.h
|
||||
FUNCTION: Frees a block of memory
|
||||
|
||||
NAME: void free_page(unsigned int physical_base, unsigned int nr = 1)
|
||||
WHERE: internal/mm.h
|
||||
FUNCTION: Adds a continuous range of physical memory to the free list
|
||||
|
||||
NAME: unsigned int get_free_page(void)
|
||||
WHERE: internal/mm.h
|
||||
FUNCTION: Gets a free page
|
||||
RETURNS: Its physical address
|
||||
|
||||
NAME: unsigned int get_page_physical_address(unsigned int vaddr)
|
||||
WHERE: internal/mm.h
|
||||
FUNCTION: Gets the physical address of a page
|
||||
|
||||
NAME: void mark_page_not_writable(unsigned int vaddr)
|
||||
WHERE: internal/mm.h
|
||||
FUNCTION: Prevent writing the page
|
||||
|
||||
* DMA functions *
|
||||
|
||||
NAME: unsigned int get_dma_page(unsigned int max_address)
|
||||
WHERE: internal/mm.h
|
||||
FUNCTION: Gets a page with a restricted physical address i.e. suitable for
|
||||
dma
|
||||
RETURNS: The physical address of the page
|
||||
|
||||
NAME: void disable_dma(unsigned int dmanr)
|
||||
WHERE: internal/dma.h
|
||||
FUNCTION: Disables the specified dma channel
|
||||
|
||||
NAME: void enable_dma(unsigned int dmanr)
|
||||
WHERE: internal/dma.h
|
||||
FUNCTION: Enables the specified dma channel
|
||||
|
||||
NAME: void clear_dma_ff(unsigned int dmanr)
|
||||
WHERE: internal/dma.h
|
||||
FUNCTION: Clear the dma flip-flop
|
||||
|
||||
NAME: void set_dma_mode(unsigned int dmanr, char mode)
|
||||
WHERE: internal/dma.h
|
||||
FUNCTION: Sets the type of dma transfer
|
||||
|
||||
NAME: void set_dma_page(unsigned int dmanr, char pagenr)
|
||||
WHERE: internal/dma.h
|
||||
FUNCTION: Set only the page register bits of the transfer address
|
||||
|
||||
NAME: void set_dma_addr(unsigned int dmanr, unsigned int a)
|
||||
WHERE: internal/dma.h
|
||||
FUNCTION: Set the transfer address for dma
|
||||
NOTE: Assumes flip-flop is clear
|
||||
|
||||
NAME: void set_dma_count(unsigned int dmanr, unsigned int count)
|
||||
WHERE: internal/dma.h
|
||||
FUNCTION: Sets the size of the transfer
|
||||
ARGUMENTS:
|
||||
count = the number of bytes to transfer
|
||||
NOTE: Count must be even for channels 5-7
|
||||
|
||||
NAME: int get_dma_residue(unsigned int dmanr)
|
||||
WHERE: internal/dma.h
|
||||
FUNCTION: Gets the residue remaining after a dma transfer on the channel
|
||||
|
||||
|
||||
This file attempts to document the functions made publically available by
|
||||
the various subsystems.
|
||||
|
||||
* Formatted I/O operations *
|
||||
|
||||
NAME: int vsprintf(char *buf, const char *fmt, va_list args)
|
||||
NAME: int sprintf(char* buf, const char* fmt, ...)
|
||||
WHERE: internal/kernel.h
|
||||
FUNCTION: The same as the standard c library versions
|
||||
|
||||
* PIO operations *
|
||||
|
||||
NAME: in[b/w/l](port)
|
||||
WHERE: internal/io.h
|
||||
FUNCTION: Read an IO port of the specified size (byte/word or long)
|
||||
RETURNS: The value read
|
||||
|
||||
NAME: out[b/w/l](port,val)
|
||||
WHERE: internal/io.h
|
||||
FUNCTION: Write an IO port of the specified size (byte/word or long)
|
||||
|
||||
NAME: in_p[b/w/l](port)
|
||||
WHERE: internal/io.h
|
||||
FUNCTION: Read an IO port of the specified size (byte/word or long) with
|
||||
a pause
|
||||
RETURNS: The value read
|
||||
|
||||
NAME: out_p[b/w/l](port,val)
|
||||
WHERE: internal/io.h
|
||||
FUNCTION: Write an IO port of the specified size (byte/word or long) with
|
||||
a pause
|
||||
|
||||
* Bit operations *
|
||||
|
||||
NAME: int set_bit(int nr, void* addr)
|
||||
NAME: int clear_bit(int nr, void* addr)
|
||||
NAME: int change_bit(int nr, void* addr)
|
||||
WHERE: internal/bitops.h>
|
||||
FUNCTION: Operate on a bit in the word pointed to by addr
|
||||
RETURN: 0 if the bit was cleared before the operations
|
||||
non-zero otherwise
|
||||
|
||||
* Debugging functions *
|
||||
|
||||
NAME: DPRINT(fmt,....)
|
||||
WHERE: internal/debug.h
|
||||
FUNCTION: Outputs a string to the console if NDEBUG isn't defined before
|
||||
including internal/debug.h, a NOP otherwise
|
||||
ARGUMENTS: The same as printf
|
||||
|
||||
NAME: printk
|
||||
WHERE: internal/kernel.h
|
||||
FUNCTION: Outputs a string to the console
|
||||
ARGUMENTS: The same as printf
|
||||
|
||||
* Memory managment functions *
|
||||
|
||||
NAME: unsigned int physical_to_linear(unsigned int paddr)
|
||||
WHERE: hal/page.h
|
||||
FUNCTION: Converts a physical address to a linear one
|
||||
RECEIVES:
|
||||
paddr = the physical address to convert
|
||||
RETURNS: A virtual address where the memory at that physical address can be
|
||||
accessed
|
||||
|
||||
NAME: void* ExAllocatePool(unsigned int size, unsigned int type = 0);
|
||||
WHERE: internal/pool.h
|
||||
FUNCTION: Allocates a block of memory
|
||||
RECEIVES:
|
||||
size = the size of the block to allocate
|
||||
type = will be whether to allocate pagable memory
|
||||
RETURNS: The address of the block
|
||||
NOTE: This isn't interrupt safe
|
||||
|
||||
NAME: void ExFreePool(void* block)
|
||||
WHERE: internal/pool.h
|
||||
FUNCTION: Frees a block of memory
|
||||
|
||||
NAME: void free_page(unsigned int physical_base, unsigned int nr = 1)
|
||||
WHERE: internal/mm.h
|
||||
FUNCTION: Adds a continuous range of physical memory to the free list
|
||||
|
||||
NAME: unsigned int get_free_page(void)
|
||||
WHERE: internal/mm.h
|
||||
FUNCTION: Gets a free page
|
||||
RETURNS: Its physical address
|
||||
|
||||
NAME: unsigned int get_page_physical_address(unsigned int vaddr)
|
||||
WHERE: internal/mm.h
|
||||
FUNCTION: Gets the physical address of a page
|
||||
|
||||
NAME: void mark_page_not_writable(unsigned int vaddr)
|
||||
WHERE: internal/mm.h
|
||||
FUNCTION: Prevent writing the page
|
||||
|
||||
* DMA functions *
|
||||
|
||||
NAME: unsigned int get_dma_page(unsigned int max_address)
|
||||
WHERE: internal/mm.h
|
||||
FUNCTION: Gets a page with a restricted physical address i.e. suitable for
|
||||
dma
|
||||
RETURNS: The physical address of the page
|
||||
|
||||
NAME: void disable_dma(unsigned int dmanr)
|
||||
WHERE: internal/dma.h
|
||||
FUNCTION: Disables the specified dma channel
|
||||
|
||||
NAME: void enable_dma(unsigned int dmanr)
|
||||
WHERE: internal/dma.h
|
||||
FUNCTION: Enables the specified dma channel
|
||||
|
||||
NAME: void clear_dma_ff(unsigned int dmanr)
|
||||
WHERE: internal/dma.h
|
||||
FUNCTION: Clear the dma flip-flop
|
||||
|
||||
NAME: void set_dma_mode(unsigned int dmanr, char mode)
|
||||
WHERE: internal/dma.h
|
||||
FUNCTION: Sets the type of dma transfer
|
||||
|
||||
NAME: void set_dma_page(unsigned int dmanr, char pagenr)
|
||||
WHERE: internal/dma.h
|
||||
FUNCTION: Set only the page register bits of the transfer address
|
||||
|
||||
NAME: void set_dma_addr(unsigned int dmanr, unsigned int a)
|
||||
WHERE: internal/dma.h
|
||||
FUNCTION: Set the transfer address for dma
|
||||
NOTE: Assumes flip-flop is clear
|
||||
|
||||
NAME: void set_dma_count(unsigned int dmanr, unsigned int count)
|
||||
WHERE: internal/dma.h
|
||||
FUNCTION: Sets the size of the transfer
|
||||
ARGUMENTS:
|
||||
count = the number of bytes to transfer
|
||||
NOTE: Count must be even for channels 5-7
|
||||
|
||||
NAME: int get_dma_residue(unsigned int dmanr)
|
||||
WHERE: internal/dma.h
|
||||
FUNCTION: Gets the residue remaining after a dma transfer on the channel
|
||||
|
||||
|
||||
|
|
|
@ -1,114 +1,114 @@
|
|||
Kernel Development FAQ (for v0.0.7)
|
||||
|
||||
This attempts to answer some of the common questions people developing for
|
||||
the kernel might want to ask (or at least what I think they should ask).
|
||||
Obviously I can only detail those parts which I have written so other
|
||||
developers please fill in the gaps.
|
||||
|
||||
Q: What is this, what are you people, what's going on
|
||||
A: This is the ReactOS, an operating system intended as a clone of windows
|
||||
NT. See the project website (http://www.sid-dis.com/reactos/) for more details.
|
||||
|
||||
Q: Why ReactOS
|
||||
A: To condemn Bill Gates to penury.
|
||||
|
||||
Q: What do I need to compile the kernel
|
||||
A: DJGPP, get it from http://www.delorie.com/djgpp
|
||||
|
||||
Q: How do I compile the kernel
|
||||
A: Unpack the zip. It is important not to install the kernel in the same
|
||||
directory as a previous version, this has caused a bit of confusion in the
|
||||
past. Edit the makefile in the top level directory, in particular select the
|
||||
correct host to build from. Then run make in the top directory
|
||||
|
||||
Q: What files are created when I make the kernel
|
||||
A: The following files are created in the kernel directory
|
||||
kimage = the kernel as a coff executable
|
||||
kimage.bin = the kernel as a raw binary image
|
||||
kernel.sym = a list of the kernel symbols
|
||||
|
||||
Q: How do I load the kernel
|
||||
A: Run the boot.bat batch file.
|
||||
|
||||
Q: Does it boot from disk
|
||||
A: Not at the moment.
|
||||
|
||||
Q: When I run the kernel it crashes
|
||||
A: The kernel (at the moment) can only be loaded from a clean system. That
|
||||
is one without EMM386 or any version of windows loaded. A quick way to
|
||||
ensure this (if you have windows 95) is to set the program to run in msdos
|
||||
mode and specify an empty config.sys and autoexec.bat. See the windows help
|
||||
for more information.
|
||||
|
||||
If you do that and the problem persists then contact the kernel team
|
||||
(ros-kernel@sid-dis.com) as it is probably a bug in the kernel
|
||||
|
||||
Q6: How do I load a module with the kernel
|
||||
A: Add the names of any modules to be loaded to the command line of boot.bat.
|
||||
|
||||
Q7: I want to add code to the kernel, how do I get it to be compiled
|
||||
A: You will need to edit the Makefile in kernel directory. There should be
|
||||
a statement like this
|
||||
|
||||
OBJECTS = hal/head.o hal/exp.o kernel/vsprintf.o \
|
||||
....
|
||||
kernel/irqhand.o hal/page.o mm/virtual.o kernel/error.o \
|
||||
kernel/exports.o kernel/module.o
|
||||
|
||||
Add the name of the object file (the file produced when your code is
|
||||
compiled) to the end of the statement (in this case after kernel/module.o).
|
||||
If you need to go onto a new line then add a slash to the end of the
|
||||
previous line. It is also very important to use an editor which preserves
|
||||
tabs.
|
||||
|
||||
Q8: I want to add code to the kernel, how do I make it official
|
||||
A: Contact the kernel mailing list ros-kernel@sid-dis.com or our coordinator
|
||||
dwinkley@whitworth.edu. If it is for a specific section then the kernel
|
||||
website (http://www.geocities.com/SiliconValley/Peaks/1957) has a list of
|
||||
those working on individual areas, you might what to contact one of them
|
||||
instead.
|
||||
|
||||
Q9: What header files should I use
|
||||
A: Don't include the usual DJGPP headers like stdio.h unless you are using
|
||||
something compiler based like stdargs.h. To use the DJGPP headers requires
|
||||
linking with libc which is useless in kernel mode.
|
||||
|
||||
All the header files are in the top-level include directory which is laid
|
||||
out like this
|
||||
include = general win32 api declarations
|
||||
include/internal = private kernel headers
|
||||
include/internal/hal = HAL headers
|
||||
include/ddk = header files with declarations for modules
|
||||
|
||||
There should be a file called api.txt which documents all of the functions
|
||||
(and which header files they need).
|
||||
|
||||
Q11: I want to export my function for modules to use, how do I do that
|
||||
A: Add the function to the list in kernel/exports.lst, then remake the
|
||||
kernel. Note the function must be declared as extern "C".
|
||||
|
||||
Q12: I want to make my functions part of the kernel interface to user mode,
|
||||
A: That section isn't finished yet, though it will probably mean adding a
|
||||
pointer to the function and the size of its parameters to a internal table
|
||||
somewhere.
|
||||
|
||||
Q14: I want to write a module, what are the guidelines
|
||||
A: See modules.txt in this directory
|
||||
|
||||
Q15: I want to write an ISR (interrupt service routine)
|
||||
A: See irq.txt in this directory
|
||||
|
||||
Q16: I want to use DMA
|
||||
A: Firstly this answer covers only DMA via the dma chips *not*
|
||||
busmaster DMA.
|
||||
|
||||
To program the dma chip use the functions in internal/dma.h (look in api.txt
|
||||
for details). PC DMA can only go to memory with a physical address below
|
||||
1mb (or 16mb on some systems), use the get_dma_page to allocate this kind
|
||||
of memory.
|
||||
|
||||
Q17: You haven't answered my question
|
||||
A: Send your questions to ros-kernel@sid-dis.com
|
||||
|
||||
|
||||
- David Welch (welch@mcmail.com)
|
||||
Kernel Development FAQ (for v0.0.7)
|
||||
|
||||
This attempts to answer some of the common questions people developing for
|
||||
the kernel might want to ask (or at least what I think they should ask).
|
||||
Obviously I can only detail those parts which I have written so other
|
||||
developers please fill in the gaps.
|
||||
|
||||
Q: What is this, what are you people, what's going on
|
||||
A: This is the ReactOS, an operating system intended as a clone of windows
|
||||
NT. See the project website (http://www.sid-dis.com/reactos/) for more details.
|
||||
|
||||
Q: Why ReactOS
|
||||
A: To condemn Bill Gates to penury.
|
||||
|
||||
Q: What do I need to compile the kernel
|
||||
A: DJGPP, get it from http://www.delorie.com/djgpp
|
||||
|
||||
Q: How do I compile the kernel
|
||||
A: Unpack the zip. It is important not to install the kernel in the same
|
||||
directory as a previous version, this has caused a bit of confusion in the
|
||||
past. Edit the makefile in the top level directory, in particular select the
|
||||
correct host to build from. Then run make in the top directory
|
||||
|
||||
Q: What files are created when I make the kernel
|
||||
A: The following files are created in the kernel directory
|
||||
kimage = the kernel as a coff executable
|
||||
kimage.bin = the kernel as a raw binary image
|
||||
kernel.sym = a list of the kernel symbols
|
||||
|
||||
Q: How do I load the kernel
|
||||
A: Run the boot.bat batch file.
|
||||
|
||||
Q: Does it boot from disk
|
||||
A: Not at the moment.
|
||||
|
||||
Q: When I run the kernel it crashes
|
||||
A: The kernel (at the moment) can only be loaded from a clean system. That
|
||||
is one without EMM386 or any version of windows loaded. A quick way to
|
||||
ensure this (if you have windows 95) is to set the program to run in msdos
|
||||
mode and specify an empty config.sys and autoexec.bat. See the windows help
|
||||
for more information.
|
||||
|
||||
If you do that and the problem persists then contact the kernel team
|
||||
(ros-kernel@sid-dis.com) as it is probably a bug in the kernel
|
||||
|
||||
Q6: How do I load a module with the kernel
|
||||
A: Add the names of any modules to be loaded to the command line of boot.bat.
|
||||
|
||||
Q7: I want to add code to the kernel, how do I get it to be compiled
|
||||
A: You will need to edit the Makefile in kernel directory. There should be
|
||||
a statement like this
|
||||
|
||||
OBJECTS = hal/head.o hal/exp.o kernel/vsprintf.o \
|
||||
....
|
||||
kernel/irqhand.o hal/page.o mm/virtual.o kernel/error.o \
|
||||
kernel/exports.o kernel/module.o
|
||||
|
||||
Add the name of the object file (the file produced when your code is
|
||||
compiled) to the end of the statement (in this case after kernel/module.o).
|
||||
If you need to go onto a new line then add a slash to the end of the
|
||||
previous line. It is also very important to use an editor which preserves
|
||||
tabs.
|
||||
|
||||
Q8: I want to add code to the kernel, how do I make it official
|
||||
A: Contact the kernel mailing list ros-kernel@sid-dis.com or our coordinator
|
||||
dwinkley@whitworth.edu. If it is for a specific section then the kernel
|
||||
website (http://www.geocities.com/SiliconValley/Peaks/1957) has a list of
|
||||
those working on individual areas, you might what to contact one of them
|
||||
instead.
|
||||
|
||||
Q9: What header files should I use
|
||||
A: Don't include the usual DJGPP headers like stdio.h unless you are using
|
||||
something compiler based like stdargs.h. To use the DJGPP headers requires
|
||||
linking with libc which is useless in kernel mode.
|
||||
|
||||
All the header files are in the top-level include directory which is laid
|
||||
out like this
|
||||
include = general win32 api declarations
|
||||
include/internal = private kernel headers
|
||||
include/internal/hal = HAL headers
|
||||
include/ddk = header files with declarations for modules
|
||||
|
||||
There should be a file called api.txt which documents all of the functions
|
||||
(and which header files they need).
|
||||
|
||||
Q11: I want to export my function for modules to use, how do I do that
|
||||
A: Add the function to the list in kernel/exports.lst, then remake the
|
||||
kernel. Note the function must be declared as extern "C".
|
||||
|
||||
Q12: I want to make my functions part of the kernel interface to user mode,
|
||||
A: That section isn't finished yet, though it will probably mean adding a
|
||||
pointer to the function and the size of its parameters to a internal table
|
||||
somewhere.
|
||||
|
||||
Q14: I want to write a module, what are the guidelines
|
||||
A: See modules.txt in this directory
|
||||
|
||||
Q15: I want to write an ISR (interrupt service routine)
|
||||
A: See irq.txt in this directory
|
||||
|
||||
Q16: I want to use DMA
|
||||
A: Firstly this answer covers only DMA via the dma chips *not*
|
||||
busmaster DMA.
|
||||
|
||||
To program the dma chip use the functions in internal/dma.h (look in api.txt
|
||||
for details). PC DMA can only go to memory with a physical address below
|
||||
1mb (or 16mb on some systems), use the get_dma_page to allocate this kind
|
||||
of memory.
|
||||
|
||||
Q17: You haven't answered my question
|
||||
A: Send your questions to ros-kernel@sid-dis.com
|
||||
|
||||
|
||||
- David Welch (welch@mcmail.com)
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,339 +1,339 @@
|
|||
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
|
||||
#ifndef __dj_include_coff_h_
|
||||
#define __dj_include_coff_h_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
//#ifndef __dj_ENFORCE_ANSI_FREESTANDING
|
||||
|
||||
//#ifndef __STRICT_ANSI__
|
||||
|
||||
//#ifndef _POSIX_SOURCE
|
||||
|
||||
/*** coff information for Intel 386/486. */
|
||||
|
||||
/********************** FILE HEADER **********************/
|
||||
|
||||
struct external_filehdr {
|
||||
unsigned short f_magic; /* magic number */
|
||||
unsigned short f_nscns; /* number of sections */
|
||||
unsigned long f_timdat; /* time & date stamp */
|
||||
unsigned long f_symptr; /* file pointer to symtab */
|
||||
unsigned long f_nsyms; /* number of symtab entries */
|
||||
unsigned short f_opthdr; /* sizeof(optional hdr) */
|
||||
unsigned short f_flags; /* flags */
|
||||
};
|
||||
|
||||
|
||||
/* Bits for f_flags:
|
||||
* F_RELFLG relocation info stripped from file
|
||||
* F_EXEC file is executable (no unresolved external references)
|
||||
* F_LNNO line numbers stripped from file
|
||||
* F_LSYMS local symbols stripped from file
|
||||
* F_AR32WR file has byte ordering of an AR32WR machine (e.g. vax)
|
||||
*/
|
||||
|
||||
#define F_RELFLG (0x0001)
|
||||
#define F_EXEC (0x0002)
|
||||
#define F_LNNO (0x0004)
|
||||
#define F_LSYMS (0x0008)
|
||||
|
||||
|
||||
|
||||
#define I386MAGIC 0x14c
|
||||
#define I386AIXMAGIC 0x175
|
||||
#define I386BADMAG(x) (((x).f_magic!=I386MAGIC) && (x).f_magic!=I386AIXMAGIC)
|
||||
|
||||
|
||||
#define FILHDR struct external_filehdr
|
||||
#define FILHSZ sizeof(FILHDR)
|
||||
|
||||
|
||||
/********************** AOUT "OPTIONAL HEADER" **********************/
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned short magic; /* type of file */
|
||||
unsigned short vstamp; /* version stamp */
|
||||
unsigned long tsize; /* text size in bytes, padded to FW bdry*/
|
||||
unsigned long dsize; /* initialized data " " */
|
||||
unsigned long bsize; /* uninitialized data " " */
|
||||
unsigned long entry; /* entry pt. */
|
||||
unsigned long text_start; /* base of text used for this file */
|
||||
unsigned long data_start; /* base of data used for this file */
|
||||
}
|
||||
AOUTHDR;
|
||||
|
||||
|
||||
typedef struct gnu_aout {
|
||||
unsigned long info;
|
||||
unsigned long tsize;
|
||||
unsigned long dsize;
|
||||
unsigned long bsize;
|
||||
unsigned long symsize;
|
||||
unsigned long entry;
|
||||
unsigned long txrel;
|
||||
unsigned long dtrel;
|
||||
} GNU_AOUT;
|
||||
|
||||
#define AOUTSZ (sizeof(AOUTHDR))
|
||||
|
||||
#define OMAGIC 0404 /* object files, eg as output */
|
||||
#define ZMAGIC 0413 /* demand load format, eg normal ld output */
|
||||
#define STMAGIC 0401 /* target shlib */
|
||||
#define SHMAGIC 0443 /* host shlib */
|
||||
|
||||
|
||||
/********************** SECTION HEADER **********************/
|
||||
|
||||
|
||||
struct external_scnhdr {
|
||||
char s_name[8]; /* section name */
|
||||
unsigned long s_paddr; /* physical address, aliased s_nlib */
|
||||
unsigned long s_vaddr; /* virtual address */
|
||||
unsigned long s_size; /* section size */
|
||||
unsigned long s_scnptr; /* file ptr to raw data for section */
|
||||
unsigned long s_relptr; /* file ptr to relocation */
|
||||
unsigned long s_lnnoptr; /* file ptr to line numbers */
|
||||
unsigned short s_nreloc; /* number of relocation entries */
|
||||
unsigned short s_nlnno; /* number of line number entries*/
|
||||
unsigned long s_flags; /* flags */
|
||||
};
|
||||
|
||||
#define SCNHDR struct external_scnhdr
|
||||
#define SCNHSZ sizeof(SCNHDR)
|
||||
|
||||
/*
|
||||
* names of "special" sections
|
||||
*/
|
||||
#define _TEXT ".text"
|
||||
#define _DATA ".data"
|
||||
#define _BSS ".bss"
|
||||
#define _COMMENT ".comment"
|
||||
#define _LIB ".lib"
|
||||
|
||||
/*
|
||||
* s_flags "type"
|
||||
*/
|
||||
#define STYP_TEXT (0x0020) /* section contains text only */
|
||||
#define STYP_DATA (0x0040) /* section contains data only */
|
||||
#define STYP_BSS (0x0080) /* section contains bss only */
|
||||
|
||||
/********************** LINE NUMBERS **********************/
|
||||
|
||||
/* 1 line number entry for every "breakpointable" source line in a section.
|
||||
* Line numbers are grouped on a per function basis; first entry in a function
|
||||
* grouping will have l_lnno = 0 and in place of physical address will be the
|
||||
* symbol table index of the function name.
|
||||
*/
|
||||
struct external_lineno {
|
||||
union {
|
||||
unsigned long l_symndx __attribute__((packed)); /* function name symbol index, iff l_lnno == 0 */
|
||||
unsigned long l_paddr __attribute__((packed)); /* (physical) address of line number */
|
||||
} l_addr;
|
||||
unsigned short l_lnno; /* line number */
|
||||
};
|
||||
|
||||
|
||||
#define LINENO struct external_lineno
|
||||
#define LINESZ sizeof(LINENO)
|
||||
|
||||
|
||||
/********************** SYMBOLS **********************/
|
||||
|
||||
#define E_SYMNMLEN 8 /* # characters in a symbol name */
|
||||
#define E_FILNMLEN 14 /* # characters in a file name */
|
||||
#define E_DIMNUM 4 /* # array dimensions in auxiliary entry */
|
||||
|
||||
struct external_syment
|
||||
{
|
||||
union {
|
||||
char e_name[E_SYMNMLEN];
|
||||
struct {
|
||||
unsigned long e_zeroes __attribute__((packed));
|
||||
unsigned long e_offset __attribute__((packed));
|
||||
} e;
|
||||
} e;
|
||||
unsigned long e_value __attribute__((packed));
|
||||
short e_scnum;
|
||||
unsigned short e_type;
|
||||
unsigned char e_sclass;
|
||||
unsigned char e_numaux;
|
||||
};
|
||||
|
||||
#define N_BTMASK (0xf)
|
||||
#define N_TMASK (0x30)
|
||||
#define N_BTSHFT (4)
|
||||
#define N_TSHIFT (2)
|
||||
|
||||
union external_auxent {
|
||||
struct {
|
||||
unsigned long x_tagndx __attribute__((packed)); /* str, un, or enum tag indx */
|
||||
union {
|
||||
struct {
|
||||
unsigned short x_lnno; /* declaration line number */
|
||||
unsigned short x_size; /* str/union/array size */
|
||||
} x_lnsz;
|
||||
unsigned long x_fsize __attribute__((packed)); /* size of function */
|
||||
} x_misc;
|
||||
union {
|
||||
struct { /* if ISFCN, tag, or .bb */
|
||||
unsigned long x_lnnoptr __attribute__((packed)); /* ptr to fcn line # */
|
||||
unsigned long x_endndx __attribute__((packed)); /* entry ndx past block end */
|
||||
} x_fcn;
|
||||
struct { /* if ISARY, up to 4 dimen. */
|
||||
unsigned short x_dimen[E_DIMNUM];
|
||||
} x_ary;
|
||||
} x_fcnary;
|
||||
unsigned short x_tvndx; /* tv index */
|
||||
} x_sym;
|
||||
|
||||
union {
|
||||
char x_fname[E_FILNMLEN];
|
||||
struct {
|
||||
unsigned long x_zeroes __attribute__((packed));
|
||||
unsigned long x_offset __attribute__((packed));
|
||||
} x_n;
|
||||
} x_file;
|
||||
|
||||
struct {
|
||||
unsigned long x_scnlen __attribute__((packed)); /* section length */
|
||||
unsigned short x_nreloc; /* # relocation entries */
|
||||
unsigned short x_nlinno; /* # line numbers */
|
||||
} x_scn;
|
||||
|
||||
struct {
|
||||
unsigned long x_tvfill __attribute__((packed)); /* tv fill value */
|
||||
unsigned short x_tvlen; /* length of .tv */
|
||||
unsigned short x_tvran[2]; /* tv range */
|
||||
} x_tv; /* info about .tv section (in auxent of symbol .tv)) */
|
||||
|
||||
|
||||
};
|
||||
|
||||
#define SYMENT struct external_syment
|
||||
#define SYMESZ sizeof(SYMENT)
|
||||
#define AUXENT union external_auxent
|
||||
#define AUXESZ sizeof(AUXENT)
|
||||
|
||||
|
||||
# define _ETEXT "etext"
|
||||
|
||||
|
||||
/* Relocatable symbols have number of the section in which they are defined,
|
||||
or one of the following: */
|
||||
|
||||
#define N_UNDEF ((short)0) /* undefined symbol */
|
||||
#define N_ABS ((short)-1) /* value of symbol is absolute */
|
||||
#define N_DEBUG ((short)-2) /* debugging symbol -- value is meaningless */
|
||||
#define N_TV ((short)-3) /* indicates symbol needs preload transfer vector */
|
||||
#define P_TV ((short)-4) /* indicates symbol needs postload transfer vector*/
|
||||
|
||||
/*
|
||||
* Type of a symbol, in low N bits of the word
|
||||
*/
|
||||
#define T_NULL 0
|
||||
#define T_VOID 1 /* function argument (only used by compiler) */
|
||||
#define T_CHAR 2 /* character */
|
||||
#define T_SHORT 3 /* short integer */
|
||||
#define T_INT 4 /* integer */
|
||||
#define T_LONG 5 /* long integer */
|
||||
#define T_FLOAT 6 /* floating point */
|
||||
#define T_DOUBLE 7 /* double word */
|
||||
#define T_STRUCT 8 /* structure */
|
||||
#define T_UNION 9 /* union */
|
||||
#define T_ENUM 10 /* enumeration */
|
||||
#define T_MOE 11 /* member of enumeration*/
|
||||
#define T_UCHAR 12 /* unsigned character */
|
||||
#define T_USHORT 13 /* unsigned short */
|
||||
#define T_UINT 14 /* unsigned integer */
|
||||
#define T_ULONG 15 /* unsigned long */
|
||||
#define T_LNGDBL 16 /* long double */
|
||||
|
||||
/*
|
||||
* derived types, in n_type
|
||||
*/
|
||||
#define DT_NON (0) /* no derived type */
|
||||
#define DT_PTR (1) /* pointer */
|
||||
#define DT_FCN (2) /* function */
|
||||
#define DT_ARY (3) /* array */
|
||||
|
||||
#define BTYPE(x) ((x) & N_BTMASK)
|
||||
|
||||
#define ISPTR(x) (((x) & N_TMASK) == (DT_PTR << N_BTSHFT))
|
||||
#define ISFCN(x) (((x) & N_TMASK) == (DT_FCN << N_BTSHFT))
|
||||
#define ISARY(x) (((x) & N_TMASK) == (DT_ARY << N_BTSHFT))
|
||||
#define ISTAG(x) ((x)==C_STRTAG||(x)==C_UNTAG||(x)==C_ENTAG)
|
||||
#define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK))
|
||||
|
||||
/********************** STORAGE CLASSES **********************/
|
||||
|
||||
/* This used to be defined as -1, but now n_sclass is unsigned. */
|
||||
#define C_EFCN 0xff /* physical end of function */
|
||||
#define C_NULL 0
|
||||
#define C_AUTO 1 /* automatic variable */
|
||||
#define C_EXT 2 /* external symbol */
|
||||
#define C_STAT 3 /* static */
|
||||
#define C_REG 4 /* register variable */
|
||||
#define C_EXTDEF 5 /* external definition */
|
||||
#define C_LABEL 6 /* label */
|
||||
#define C_ULABEL 7 /* undefined label */
|
||||
#define C_MOS 8 /* member of structure */
|
||||
#define C_ARG 9 /* function argument */
|
||||
#define C_STRTAG 10 /* structure tag */
|
||||
#define C_MOU 11 /* member of union */
|
||||
#define C_UNTAG 12 /* union tag */
|
||||
#define C_TPDEF 13 /* type definition */
|
||||
#define C_USTATIC 14 /* undefined static */
|
||||
#define C_ENTAG 15 /* enumeration tag */
|
||||
#define C_MOE 16 /* member of enumeration */
|
||||
#define C_REGPARM 17 /* register parameter */
|
||||
#define C_FIELD 18 /* bit field */
|
||||
#define C_AUTOARG 19 /* auto argument */
|
||||
#define C_LASTENT 20 /* dummy entry (end of block) */
|
||||
#define C_BLOCK 100 /* ".bb" or ".eb" */
|
||||
#define C_FCN 101 /* ".bf" or ".ef" */
|
||||
#define C_EOS 102 /* end of structure */
|
||||
#define C_FILE 103 /* file name */
|
||||
#define C_LINE 104 /* line # reformatted as symbol table entry */
|
||||
#define C_ALIAS 105 /* duplicate tag */
|
||||
#define C_HIDDEN 106 /* ext symbol in dmert public lib */
|
||||
|
||||
/********************** RELOCATION DIRECTIVES **********************/
|
||||
|
||||
|
||||
|
||||
struct external_reloc {
|
||||
unsigned long r_vaddr __attribute__((packed));
|
||||
unsigned long r_symndx __attribute__((packed));
|
||||
unsigned short r_type;
|
||||
};
|
||||
|
||||
|
||||
#define RELOC struct external_reloc
|
||||
#define RELSZ sizeof(RELOC)
|
||||
|
||||
#define RELOC_REL32 20 /* 32-bit PC-relative address */
|
||||
#define RELOC_ADDR32 6 /* 32-bit absolute address */
|
||||
|
||||
#define DEFAULT_DATA_SECTION_ALIGNMENT 4
|
||||
#define DEFAULT_BSS_SECTION_ALIGNMENT 4
|
||||
#define DEFAULT_TEXT_SECTION_ALIGNMENT 4
|
||||
/* For new sections we havn't heard of before */
|
||||
#define DEFAULT_SECTION_ALIGNMENT 4
|
||||
|
||||
//#endif /* !_POSIX_SOURCE */
|
||||
//#endif /* !__STRICT_ANSI__ */
|
||||
//#endif /* !__dj_ENFORCE_ANSI_FREESTANDING */
|
||||
|
||||
#ifndef __dj_ENFORCE_FUNCTION_CALLS
|
||||
#endif /* !__dj_ENFORCE_FUNCTION_CALLS */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !__dj_include_coff_h_ */
|
||||
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
|
||||
#ifndef __dj_include_coff_h_
|
||||
#define __dj_include_coff_h_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
//#ifndef __dj_ENFORCE_ANSI_FREESTANDING
|
||||
|
||||
//#ifndef __STRICT_ANSI__
|
||||
|
||||
//#ifndef _POSIX_SOURCE
|
||||
|
||||
/*** coff information for Intel 386/486. */
|
||||
|
||||
/********************** FILE HEADER **********************/
|
||||
|
||||
struct external_filehdr {
|
||||
unsigned short f_magic; /* magic number */
|
||||
unsigned short f_nscns; /* number of sections */
|
||||
unsigned long f_timdat; /* time & date stamp */
|
||||
unsigned long f_symptr; /* file pointer to symtab */
|
||||
unsigned long f_nsyms; /* number of symtab entries */
|
||||
unsigned short f_opthdr; /* sizeof(optional hdr) */
|
||||
unsigned short f_flags; /* flags */
|
||||
};
|
||||
|
||||
|
||||
/* Bits for f_flags:
|
||||
* F_RELFLG relocation info stripped from file
|
||||
* F_EXEC file is executable (no unresolved external references)
|
||||
* F_LNNO line numbers stripped from file
|
||||
* F_LSYMS local symbols stripped from file
|
||||
* F_AR32WR file has byte ordering of an AR32WR machine (e.g. vax)
|
||||
*/
|
||||
|
||||
#define F_RELFLG (0x0001)
|
||||
#define F_EXEC (0x0002)
|
||||
#define F_LNNO (0x0004)
|
||||
#define F_LSYMS (0x0008)
|
||||
|
||||
|
||||
|
||||
#define I386MAGIC 0x14c
|
||||
#define I386AIXMAGIC 0x175
|
||||
#define I386BADMAG(x) (((x).f_magic!=I386MAGIC) && (x).f_magic!=I386AIXMAGIC)
|
||||
|
||||
|
||||
#define FILHDR struct external_filehdr
|
||||
#define FILHSZ sizeof(FILHDR)
|
||||
|
||||
|
||||
/********************** AOUT "OPTIONAL HEADER" **********************/
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned short magic; /* type of file */
|
||||
unsigned short vstamp; /* version stamp */
|
||||
unsigned long tsize; /* text size in bytes, padded to FW bdry*/
|
||||
unsigned long dsize; /* initialized data " " */
|
||||
unsigned long bsize; /* uninitialized data " " */
|
||||
unsigned long entry; /* entry pt. */
|
||||
unsigned long text_start; /* base of text used for this file */
|
||||
unsigned long data_start; /* base of data used for this file */
|
||||
}
|
||||
AOUTHDR;
|
||||
|
||||
|
||||
typedef struct gnu_aout {
|
||||
unsigned long info;
|
||||
unsigned long tsize;
|
||||
unsigned long dsize;
|
||||
unsigned long bsize;
|
||||
unsigned long symsize;
|
||||
unsigned long entry;
|
||||
unsigned long txrel;
|
||||
unsigned long dtrel;
|
||||
} GNU_AOUT;
|
||||
|
||||
#define AOUTSZ (sizeof(AOUTHDR))
|
||||
|
||||
#define OMAGIC 0404 /* object files, eg as output */
|
||||
#define ZMAGIC 0413 /* demand load format, eg normal ld output */
|
||||
#define STMAGIC 0401 /* target shlib */
|
||||
#define SHMAGIC 0443 /* host shlib */
|
||||
|
||||
|
||||
/********************** SECTION HEADER **********************/
|
||||
|
||||
|
||||
struct external_scnhdr {
|
||||
char s_name[8]; /* section name */
|
||||
unsigned long s_paddr; /* physical address, aliased s_nlib */
|
||||
unsigned long s_vaddr; /* virtual address */
|
||||
unsigned long s_size; /* section size */
|
||||
unsigned long s_scnptr; /* file ptr to raw data for section */
|
||||
unsigned long s_relptr; /* file ptr to relocation */
|
||||
unsigned long s_lnnoptr; /* file ptr to line numbers */
|
||||
unsigned short s_nreloc; /* number of relocation entries */
|
||||
unsigned short s_nlnno; /* number of line number entries*/
|
||||
unsigned long s_flags; /* flags */
|
||||
};
|
||||
|
||||
#define SCNHDR struct external_scnhdr
|
||||
#define SCNHSZ sizeof(SCNHDR)
|
||||
|
||||
/*
|
||||
* names of "special" sections
|
||||
*/
|
||||
#define _TEXT ".text"
|
||||
#define _DATA ".data"
|
||||
#define _BSS ".bss"
|
||||
#define _COMMENT ".comment"
|
||||
#define _LIB ".lib"
|
||||
|
||||
/*
|
||||
* s_flags "type"
|
||||
*/
|
||||
#define STYP_TEXT (0x0020) /* section contains text only */
|
||||
#define STYP_DATA (0x0040) /* section contains data only */
|
||||
#define STYP_BSS (0x0080) /* section contains bss only */
|
||||
|
||||
/********************** LINE NUMBERS **********************/
|
||||
|
||||
/* 1 line number entry for every "breakpointable" source line in a section.
|
||||
* Line numbers are grouped on a per function basis; first entry in a function
|
||||
* grouping will have l_lnno = 0 and in place of physical address will be the
|
||||
* symbol table index of the function name.
|
||||
*/
|
||||
struct external_lineno {
|
||||
union {
|
||||
unsigned long l_symndx __attribute__((packed)); /* function name symbol index, iff l_lnno == 0 */
|
||||
unsigned long l_paddr __attribute__((packed)); /* (physical) address of line number */
|
||||
} l_addr;
|
||||
unsigned short l_lnno; /* line number */
|
||||
};
|
||||
|
||||
|
||||
#define LINENO struct external_lineno
|
||||
#define LINESZ sizeof(LINENO)
|
||||
|
||||
|
||||
/********************** SYMBOLS **********************/
|
||||
|
||||
#define E_SYMNMLEN 8 /* # characters in a symbol name */
|
||||
#define E_FILNMLEN 14 /* # characters in a file name */
|
||||
#define E_DIMNUM 4 /* # array dimensions in auxiliary entry */
|
||||
|
||||
struct external_syment
|
||||
{
|
||||
union {
|
||||
char e_name[E_SYMNMLEN];
|
||||
struct {
|
||||
unsigned long e_zeroes __attribute__((packed));
|
||||
unsigned long e_offset __attribute__((packed));
|
||||
} e;
|
||||
} e;
|
||||
unsigned long e_value __attribute__((packed));
|
||||
short e_scnum;
|
||||
unsigned short e_type;
|
||||
unsigned char e_sclass;
|
||||
unsigned char e_numaux;
|
||||
};
|
||||
|
||||
#define N_BTMASK (0xf)
|
||||
#define N_TMASK (0x30)
|
||||
#define N_BTSHFT (4)
|
||||
#define N_TSHIFT (2)
|
||||
|
||||
union external_auxent {
|
||||
struct {
|
||||
unsigned long x_tagndx __attribute__((packed)); /* str, un, or enum tag indx */
|
||||
union {
|
||||
struct {
|
||||
unsigned short x_lnno; /* declaration line number */
|
||||
unsigned short x_size; /* str/union/array size */
|
||||
} x_lnsz;
|
||||
unsigned long x_fsize __attribute__((packed)); /* size of function */
|
||||
} x_misc;
|
||||
union {
|
||||
struct { /* if ISFCN, tag, or .bb */
|
||||
unsigned long x_lnnoptr __attribute__((packed)); /* ptr to fcn line # */
|
||||
unsigned long x_endndx __attribute__((packed)); /* entry ndx past block end */
|
||||
} x_fcn;
|
||||
struct { /* if ISARY, up to 4 dimen. */
|
||||
unsigned short x_dimen[E_DIMNUM];
|
||||
} x_ary;
|
||||
} x_fcnary;
|
||||
unsigned short x_tvndx; /* tv index */
|
||||
} x_sym;
|
||||
|
||||
union {
|
||||
char x_fname[E_FILNMLEN];
|
||||
struct {
|
||||
unsigned long x_zeroes __attribute__((packed));
|
||||
unsigned long x_offset __attribute__((packed));
|
||||
} x_n;
|
||||
} x_file;
|
||||
|
||||
struct {
|
||||
unsigned long x_scnlen __attribute__((packed)); /* section length */
|
||||
unsigned short x_nreloc; /* # relocation entries */
|
||||
unsigned short x_nlinno; /* # line numbers */
|
||||
} x_scn;
|
||||
|
||||
struct {
|
||||
unsigned long x_tvfill __attribute__((packed)); /* tv fill value */
|
||||
unsigned short x_tvlen; /* length of .tv */
|
||||
unsigned short x_tvran[2]; /* tv range */
|
||||
} x_tv; /* info about .tv section (in auxent of symbol .tv)) */
|
||||
|
||||
|
||||
};
|
||||
|
||||
#define SYMENT struct external_syment
|
||||
#define SYMESZ sizeof(SYMENT)
|
||||
#define AUXENT union external_auxent
|
||||
#define AUXESZ sizeof(AUXENT)
|
||||
|
||||
|
||||
# define _ETEXT "etext"
|
||||
|
||||
|
||||
/* Relocatable symbols have number of the section in which they are defined,
|
||||
or one of the following: */
|
||||
|
||||
#define N_UNDEF ((short)0) /* undefined symbol */
|
||||
#define N_ABS ((short)-1) /* value of symbol is absolute */
|
||||
#define N_DEBUG ((short)-2) /* debugging symbol -- value is meaningless */
|
||||
#define N_TV ((short)-3) /* indicates symbol needs preload transfer vector */
|
||||
#define P_TV ((short)-4) /* indicates symbol needs postload transfer vector*/
|
||||
|
||||
/*
|
||||
* Type of a symbol, in low N bits of the word
|
||||
*/
|
||||
#define T_NULL 0
|
||||
#define T_VOID 1 /* function argument (only used by compiler) */
|
||||
#define T_CHAR 2 /* character */
|
||||
#define T_SHORT 3 /* short integer */
|
||||
#define T_INT 4 /* integer */
|
||||
#define T_LONG 5 /* long integer */
|
||||
#define T_FLOAT 6 /* floating point */
|
||||
#define T_DOUBLE 7 /* double word */
|
||||
#define T_STRUCT 8 /* structure */
|
||||
#define T_UNION 9 /* union */
|
||||
#define T_ENUM 10 /* enumeration */
|
||||
#define T_MOE 11 /* member of enumeration*/
|
||||
#define T_UCHAR 12 /* unsigned character */
|
||||
#define T_USHORT 13 /* unsigned short */
|
||||
#define T_UINT 14 /* unsigned integer */
|
||||
#define T_ULONG 15 /* unsigned long */
|
||||
#define T_LNGDBL 16 /* long double */
|
||||
|
||||
/*
|
||||
* derived types, in n_type
|
||||
*/
|
||||
#define DT_NON (0) /* no derived type */
|
||||
#define DT_PTR (1) /* pointer */
|
||||
#define DT_FCN (2) /* function */
|
||||
#define DT_ARY (3) /* array */
|
||||
|
||||
#define BTYPE(x) ((x) & N_BTMASK)
|
||||
|
||||
#define ISPTR(x) (((x) & N_TMASK) == (DT_PTR << N_BTSHFT))
|
||||
#define ISFCN(x) (((x) & N_TMASK) == (DT_FCN << N_BTSHFT))
|
||||
#define ISARY(x) (((x) & N_TMASK) == (DT_ARY << N_BTSHFT))
|
||||
#define ISTAG(x) ((x)==C_STRTAG||(x)==C_UNTAG||(x)==C_ENTAG)
|
||||
#define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK))
|
||||
|
||||
/********************** STORAGE CLASSES **********************/
|
||||
|
||||
/* This used to be defined as -1, but now n_sclass is unsigned. */
|
||||
#define C_EFCN 0xff /* physical end of function */
|
||||
#define C_NULL 0
|
||||
#define C_AUTO 1 /* automatic variable */
|
||||
#define C_EXT 2 /* external symbol */
|
||||
#define C_STAT 3 /* static */
|
||||
#define C_REG 4 /* register variable */
|
||||
#define C_EXTDEF 5 /* external definition */
|
||||
#define C_LABEL 6 /* label */
|
||||
#define C_ULABEL 7 /* undefined label */
|
||||
#define C_MOS 8 /* member of structure */
|
||||
#define C_ARG 9 /* function argument */
|
||||
#define C_STRTAG 10 /* structure tag */
|
||||
#define C_MOU 11 /* member of union */
|
||||
#define C_UNTAG 12 /* union tag */
|
||||
#define C_TPDEF 13 /* type definition */
|
||||
#define C_USTATIC 14 /* undefined static */
|
||||
#define C_ENTAG 15 /* enumeration tag */
|
||||
#define C_MOE 16 /* member of enumeration */
|
||||
#define C_REGPARM 17 /* register parameter */
|
||||
#define C_FIELD 18 /* bit field */
|
||||
#define C_AUTOARG 19 /* auto argument */
|
||||
#define C_LASTENT 20 /* dummy entry (end of block) */
|
||||
#define C_BLOCK 100 /* ".bb" or ".eb" */
|
||||
#define C_FCN 101 /* ".bf" or ".ef" */
|
||||
#define C_EOS 102 /* end of structure */
|
||||
#define C_FILE 103 /* file name */
|
||||
#define C_LINE 104 /* line # reformatted as symbol table entry */
|
||||
#define C_ALIAS 105 /* duplicate tag */
|
||||
#define C_HIDDEN 106 /* ext symbol in dmert public lib */
|
||||
|
||||
/********************** RELOCATION DIRECTIVES **********************/
|
||||
|
||||
|
||||
|
||||
struct external_reloc {
|
||||
unsigned long r_vaddr __attribute__((packed));
|
||||
unsigned long r_symndx __attribute__((packed));
|
||||
unsigned short r_type;
|
||||
};
|
||||
|
||||
|
||||
#define RELOC struct external_reloc
|
||||
#define RELSZ sizeof(RELOC)
|
||||
|
||||
#define RELOC_REL32 20 /* 32-bit PC-relative address */
|
||||
#define RELOC_ADDR32 6 /* 32-bit absolute address */
|
||||
|
||||
#define DEFAULT_DATA_SECTION_ALIGNMENT 4
|
||||
#define DEFAULT_BSS_SECTION_ALIGNMENT 4
|
||||
#define DEFAULT_TEXT_SECTION_ALIGNMENT 4
|
||||
/* For new sections we havn't heard of before */
|
||||
#define DEFAULT_SECTION_ALIGNMENT 4
|
||||
|
||||
//#endif /* !_POSIX_SOURCE */
|
||||
//#endif /* !__STRICT_ANSI__ */
|
||||
//#endif /* !__dj_ENFORCE_ANSI_FREESTANDING */
|
||||
|
||||
#ifndef __dj_ENFORCE_FUNCTION_CALLS
|
||||
#endif /* !__dj_ENFORCE_FUNCTION_CALLS */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !__dj_include_coff_h_ */
|
||||
|
|
|
@ -1,521 +1,399 @@
|
|||
/* GENERAL DEFINITIONS ****************************************************/
|
||||
|
||||
#include <internal/hal/irq.h>
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* PURPOSE: Number of a thread priority levels
|
||||
*/
|
||||
#define NR_PRIORITY_LEVELS (32)
|
||||
|
||||
/*
|
||||
* PURPOSE: Type of queue to insert a work item in
|
||||
*/
|
||||
enum
|
||||
{
|
||||
CriticalWorkQueue,
|
||||
DelayedWorkQueue,
|
||||
HyperCriticalWorkQueue,
|
||||
};
|
||||
|
||||
/*
|
||||
* Types of memory to allocate
|
||||
*/
|
||||
enum
|
||||
{
|
||||
NonPagedPool,
|
||||
NonPagedPoolMustSucceed,
|
||||
NonPagedPoolCacheAligned,
|
||||
NonPagedPoolCacheAlignedMustS,
|
||||
PagedPool,
|
||||
PagedPoolCacheAligned,
|
||||
};
|
||||
|
||||
/*
|
||||
* PURPOSE: Irp flags
|
||||
*/
|
||||
enum
|
||||
{
|
||||
/*
|
||||
* Read any data from the actual backing media
|
||||
*/
|
||||
IRP_NOCACHE,
|
||||
|
||||
/*
|
||||
* The I/O operation is performing paging
|
||||
*/
|
||||
IRP_PAGING_IO,
|
||||
|
||||
/*
|
||||
* The IRP is for a mount operation
|
||||
*/
|
||||
IRP_MOUNT_COMPLETION,
|
||||
|
||||
/*
|
||||
* The API expects synchronous behaviour
|
||||
*/
|
||||
IRP_SYNCHRONOUS_API,
|
||||
|
||||
/*
|
||||
* The IRP is associated with a larger operation
|
||||
*/
|
||||
IRP_ASSOCIATED_IRP,
|
||||
|
||||
/*
|
||||
* The AssociatedIrp.SystemBuffer field is valid
|
||||
*/
|
||||
IRP_BUFFERED_IO,
|
||||
|
||||
/*
|
||||
* The system buffer was allocated from pool and should be deallocated
|
||||
* by the I/O manager
|
||||
*/
|
||||
IRP_DEALLOCATE_BUFFER,
|
||||
|
||||
/*
|
||||
* The IRP is for an input operation
|
||||
*/
|
||||
IRP_INPUT_OPERATION,
|
||||
|
||||
/*
|
||||
* The paging operation should complete synchronously
|
||||
*/
|
||||
IRP_SYNCHRONOUS_PAGING_IO,
|
||||
|
||||
/*
|
||||
* The IRP represents a filesystem create operation
|
||||
*/
|
||||
IRP_CREATE_OPERATION,
|
||||
|
||||
/*
|
||||
* The IRP represents a filesystem read operation
|
||||
*/
|
||||
IRP_READ_OPERATION,
|
||||
|
||||
/*
|
||||
* The IRP represents a filesystem write operation
|
||||
*/
|
||||
IRP_WRITE_OPERATION,
|
||||
|
||||
/*
|
||||
* The IRP represents a filesystem close operation
|
||||
*/
|
||||
IRP_CLOSE_OPERATION,
|
||||
|
||||
/*
|
||||
* Asynchronous behavior is advised but not required
|
||||
*/
|
||||
IRP_DEFER_IO_COMPLETION,
|
||||
};
|
||||
|
||||
/*
|
||||
* I/O operation flags
|
||||
*/
|
||||
enum
|
||||
{
|
||||
/*
|
||||
* Force an access check even if opened in kernel mode
|
||||
*/
|
||||
SL_FORCE_ACCESS_CHECK,
|
||||
|
||||
/*
|
||||
* The file being opened is a paging file
|
||||
*/
|
||||
SL_OPEN_PAGING_FILE,
|
||||
|
||||
SL_OPEN_TARGET_DIRECTORY,
|
||||
|
||||
SL_CASE_SENSITIVE,
|
||||
|
||||
SL_KEY_SPECIFIED,
|
||||
|
||||
SL_OVERRIDE_VERIFY_VOLUME,
|
||||
|
||||
SL_WRITE_THROUGH,
|
||||
|
||||
SL_FT_SEQUENTIAL_WRITE,
|
||||
|
||||
SL_FAIL_IMMEDIATELY,
|
||||
|
||||
SL_EXCLUSIVE_LOCK,
|
||||
|
||||
SL_RESTART_SCAN,
|
||||
|
||||
SL_RETURN_SINGLE_ENTRY,
|
||||
|
||||
SL_INDEX_SPECIFIED,
|
||||
|
||||
SL_WATCH_TREE,
|
||||
|
||||
SL_ALLOW_RAW_MOUNT,
|
||||
};
|
||||
|
||||
/*
|
||||
* Possible flags for the device object flags
|
||||
*/
|
||||
enum
|
||||
{
|
||||
DO_BUFFERED_IO = 0x1,
|
||||
DO_DIRECT_IO = 0x2,
|
||||
};
|
||||
|
||||
/*
|
||||
* Possible status codes
|
||||
* FIXME: These may not be the actual values used by NT
|
||||
*/
|
||||
enum
|
||||
{
|
||||
STATUS_SUCCESS,
|
||||
STATUS_INSUFFICIENT_RESOURCES,
|
||||
STATUS_OBJECT_NAME_EXISTS,
|
||||
STATUS_OBJECT_NAME_COLLISION,
|
||||
// STATUS_DATATYPE_MISALIGNMENT,
|
||||
STATUS_CTL_FILE_NOT_SUPPORTED,
|
||||
// STATUS_ACCESS_VIOLATION,
|
||||
STATUS_PORT_ALREADY_SET,
|
||||
STATUS_SECTION_NOT_IMAGE,
|
||||
STATUS_BAD_WORKING_SET_LIMIT,
|
||||
STATUS_INCOMPATIBLE_FILE_MAP,
|
||||
STATUS_HANDLE_NOT_WAITABLE,
|
||||
STATUS_PORT_DISCONNECTED,
|
||||
STATUS_NOT_LOCKED,
|
||||
STATUS_NOT_MAPPED_VIEW,
|
||||
STATUS_UNABLE_TO_FREE_VM,
|
||||
STATUS_UNABLE_TO_DELETE_SECTION,
|
||||
STATUS_MORE_PROCESSING_REQUIRED,
|
||||
STATUS_INVALID_CID,
|
||||
STATUS_BAD_INITIAL_STACK,
|
||||
STATUS_INVALID_VOLUME_LABEL,
|
||||
STATUS_SECTION_NOT_EXTENDED,
|
||||
STATUS_NOT_MAPPED_DATA,
|
||||
STATUS_INFO_LENGTH_MISMATCH,
|
||||
STATUS_INVALID_INFO_CLASS,
|
||||
STATUS_SUSPEND_COUNT_EXCEEDED,
|
||||
STATUS_NOTIFY_ENUM_DIR,
|
||||
STATUS_REGISTRY_RECOVERED,
|
||||
STATUS_REGISTRY_IO_FAILED,
|
||||
STATUS_KEY_DELETED,
|
||||
STATUS_NO_LOG_SPACE,
|
||||
STATUS_KEY_HAS_CHILDREN,
|
||||
STATUS_CHILD_MUST_BE_VOLATILE,
|
||||
STATUS_REGISTRY_CORRUPT,
|
||||
STATUS_DLL_NOT_FOUND,
|
||||
STATUS_DLL_INIT_FAILED,
|
||||
STATUS_ORDINAL_NOT_FOUND,
|
||||
STATUS_ENTRYPOINT_NOT_FOUND,
|
||||
// STATUS_PENDING,
|
||||
STATUS_MORE_ENTRIES,
|
||||
// STATUS_INTEGER_OVERFLOW,
|
||||
STATUS_BUFFER_OVERFLOW,
|
||||
STATUS_NO_MORE_FILES,
|
||||
STATUS_NO_INHERITANCE,
|
||||
STATUS_NO_MORE_EAS,
|
||||
STATUS_NO_MORE_ENTRIES,
|
||||
STATUS_GUIDS_EXHAUSTED,
|
||||
STATUS_AGENTS_EXHAUSTED,
|
||||
STATUS_UNSUCCESSFUL,
|
||||
STATUS_NOT_IMPLEMENTED,
|
||||
STATUS_ILLEGAL_FUNCTION,
|
||||
// STATUS_IN_PAGE_ERROR,
|
||||
STATUS_PAGEFILE_QUOTA,
|
||||
STATUS_COMMITMENT_LIMIT,
|
||||
STATUS_SECTION_TOO_BIG,
|
||||
RPC_NT_SS_IN_NULL_CONTEXT,
|
||||
RPC_NT_INVALID_BINDING,
|
||||
// STATUS_INVALID_HANDLE,
|
||||
STATUS_OBJECT_FILE_MISMATCH,
|
||||
STATUS_FILE_CLOSED,
|
||||
STATUS_INVALID_PORT_HANDLE,
|
||||
STATUS_NOT_COMMITTED,
|
||||
STATUS_INVALID_PARAMETER,
|
||||
STATUS_INVALID_PARAMETER_1,
|
||||
STATUS_INVALID_PARAMETER_2,
|
||||
STATUS_INVALID_PARAMETER_3,
|
||||
STATUS_INVALID_PARAMETER_4,
|
||||
STATUS_INVALID_PARAMETER_5,
|
||||
STATUS_INVALID_PARAMETER_6,
|
||||
STATUS_INVALID_PARAMETER_7,
|
||||
STATUS_INVALID_PARAMETER_8,
|
||||
STATUS_INVALID_PARAMETER_9,
|
||||
STATUS_INVALID_PARAMETER_10,
|
||||
STATUS_INVALID_PARAMETER_11,
|
||||
STATUS_INVALID_PARAMETER_12,
|
||||
STATUS_INVALID_PARAMETER_MAX,
|
||||
STATUS_INVALID_PAGE_PROTECTION,
|
||||
STATUS_RESOURCE_DATA_NOT_FOUND,
|
||||
STATUS_RESOURCE_TYPE_NOT_FOUND,
|
||||
STATUS_RESOURCE_NAME_NOT_FOUND,
|
||||
STATUS_RESOURCE_LANG_NOT_FOUND,
|
||||
STATUS_NO_SUCH_DEVICE,
|
||||
STATUS_NO_SUCH_FILE,
|
||||
STATUS_INVALID_DEVICE_REQUEST,
|
||||
STATUS_END_OF_FILE,
|
||||
STATUS_FILE_FORCED_CLOSED,
|
||||
STATUS_WRONG_VOLUME,
|
||||
STATUS_NO_MEDIA,
|
||||
STATUS_NO_MEDIA_IN_DEVICE,
|
||||
STATUS_NONEXISTENT_SECTOR,
|
||||
STATUS_WORKING_SET_QUOTA,
|
||||
// STATUS_NO_MEMORY,
|
||||
STATUS_CONFLICTING_ADDRESS,
|
||||
STATUS_INVALID_SYSTEM_SERVICE,
|
||||
STATUS_THREAD_IS_TERMINATING,
|
||||
STATUS_PROCESS_IS_TERMINATING,
|
||||
STATUS_INVALID_LOCK_SEQUENCE,
|
||||
STATUS_INVALID_VIEW_SIZE,
|
||||
STATUS_ALREADY_COMMITTED,
|
||||
STATUS_ACCESS_DENIED,
|
||||
STATUS_FILE_IS_A_DIRECTORY,
|
||||
STATUS_CANNOT_DELETE,
|
||||
STATUS_INVALID_COMPUTER_NAME,
|
||||
STATUS_FILE_DELETED,
|
||||
STATUS_DELETE_PENDING,
|
||||
STATUS_PORT_CONNECTION_REFUSED,
|
||||
STATUS_NO_SUCH_PRIVILEGE,
|
||||
STATUS_PRIVILEGE_NOT_HELD,
|
||||
STATUS_CANNOT_IMPERSONATE,
|
||||
STATUS_LOGON_FAILURE,
|
||||
STATUS_ACCOUNT_RESTRICTION,
|
||||
STATUS_INVALID_LOGON_HOURS,
|
||||
STATUS_INVALID_WORKSTATION,
|
||||
STATUS_BUFFER_TOO_SMALL,
|
||||
STATUS_UNABLE_TO_DECOMMIT_VM,
|
||||
STATUS_DISK_CORRUPT_ERROR,
|
||||
STATUS_OBJECT_NAME_INVALID,
|
||||
STATUS_OBJECT_NAME_NOT_FOUND,
|
||||
// STATUS_OBJECT_NAME_COLLISION,
|
||||
STATUS_OBJECT_PATH_INVALID,
|
||||
STATUS_OBJECT_PATH_NOT_FOUND,
|
||||
STATUS_DFS_EXIT_PATH_FOUND,
|
||||
STATUS_OBJECT_PATH_SYNTAX_BAD,
|
||||
STATUS_DATA_OVERRUN,
|
||||
STATUS_DATA_LATE_ERROR,
|
||||
STATUS_DATA_ERROR,
|
||||
STATUS_CRC_ERROR,
|
||||
STATUS_SHARING_VIOLATION,
|
||||
STATUS_QUOTA_EXCEEDED,
|
||||
STATUS_MUTANT_NOT_OWNED,
|
||||
STATUS_SEMAPHORE_LIMIT_EXCEEDED,
|
||||
STATUS_DISK_FULL,
|
||||
STATUS_LOCK_NOT_GRANTED,
|
||||
};
|
||||
|
||||
/*
|
||||
* Possible device types
|
||||
*/
|
||||
enum
|
||||
{
|
||||
/*
|
||||
* Standard define types
|
||||
*/
|
||||
FILE_DEVICE_BEEP,
|
||||
FILE_DEVICE_CDROM,
|
||||
FILE_DEVICE_CONTROLLER,
|
||||
FILE_DEVICE_DISK,
|
||||
FILE_DEVICE_INPORT_PORT,
|
||||
FILE_DEVICE_KEYBOARD,
|
||||
FILE_DEVICE_MIDI_IN,
|
||||
FILE_DEVICE_MIDI_OUT,
|
||||
FILE_DEVICE_MOUSE,
|
||||
FILE_DEVICE_NULL,
|
||||
FILE_DEVICE_PARALLEL_PORT,
|
||||
FILE_DEVICE_PRINTER,
|
||||
FILE_DEVICE_SCANNER,
|
||||
FILE_DEVICE_SERIAL_MOUSE_PORT,
|
||||
FILE_DEVICE_SERIAL_PORT,
|
||||
FILE_DEVICE_SCREEN,
|
||||
FILE_DEVICE_TAPE,
|
||||
FILE_DEVICE_UNKNOWN,
|
||||
FILE_DEVICE_VIDEO,
|
||||
FILE_DEVICE_VIRTUAL_DISK,
|
||||
FILE_DEVICE_WAVE_IN,
|
||||
FILE_DEVICE_WAVE_OUT,
|
||||
FILE_DEVICE_8042_PORT,
|
||||
|
||||
/*
|
||||
* Values beyond this are reserved for ISVs
|
||||
*/
|
||||
FILE_DEVICE_FIRST_FREE = 32768
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Possible device characteristics
|
||||
*/
|
||||
enum
|
||||
{
|
||||
FILE_REMOVABLE_MEDIA = 0x1,
|
||||
FILE_READ_ONLY_DEVICE = 0x2,
|
||||
FILE_FLOPPY_DISKETTE = 0x4,
|
||||
FILE_WRITE_ONCE_MEDIA = 0x8,
|
||||
FILE_REMOTE_DEVICE = 0x10,
|
||||
};
|
||||
|
||||
/*
|
||||
* PURPOSE: Bus types
|
||||
*/
|
||||
enum
|
||||
{
|
||||
Internal,
|
||||
Isa,
|
||||
MicroChannel,
|
||||
TurboChannel,
|
||||
PCIBus,
|
||||
MaximumInterfaceType,
|
||||
};
|
||||
|
||||
/*
|
||||
* This is a list of bug check types (not MS's)
|
||||
*/
|
||||
enum
|
||||
{
|
||||
KBUG_NONE,
|
||||
KBUG_ORPHANED_IRP,
|
||||
KBUG_IO_STACK_OVERFLOW,
|
||||
KBUG_OUT_OF_MEMORY,
|
||||
KBUG_POOL_FREE_LIST_CORRUPT,
|
||||
|
||||
/*
|
||||
* These are well known but the actual value is unknown
|
||||
*/
|
||||
NO_PAGES_AVAILABLE,
|
||||
|
||||
/*
|
||||
* These are well known (MS) bug types
|
||||
* (Reference: NT Insider 1997 - http://www.osr.com)
|
||||
*/
|
||||
IRQL_NOT_LESS_OR_EQUAL = 0xa,
|
||||
KMODE_EXCEPTION_NOT_HANDLED = 0x1e,
|
||||
UNEXPECTED_KERNEL_MODE_TRAP = 0x7f,
|
||||
PAGE_FAULT_IN_NON_PAGED_AREA = 0x50,
|
||||
};
|
||||
|
||||
/*
|
||||
* PURPOSE: Object attributes
|
||||
*/
|
||||
enum
|
||||
{
|
||||
OBJ_INHERIT = 0x1,
|
||||
OBJ_PERMANENT = 0x2,
|
||||
OBJ_EXCLUSIVE = 0x4,
|
||||
OBJ_CASE_INSENSITIVE = 0x8,
|
||||
OBJ_OPENIF = 0x10,
|
||||
};
|
||||
|
||||
/*
|
||||
* PURPOSE: DPC priorities
|
||||
*/
|
||||
enum
|
||||
{
|
||||
High,
|
||||
Medium,
|
||||
Low,
|
||||
};
|
||||
|
||||
/*
|
||||
* PURPOSE: Timer types
|
||||
*/
|
||||
enum
|
||||
{
|
||||
NotificationTimer,
|
||||
SynchronizationTimer,
|
||||
};
|
||||
|
||||
/*
|
||||
* PURPOSE: Some drivers use these
|
||||
*/
|
||||
#define IN
|
||||
#define OUT
|
||||
#define OPTIONAL
|
||||
|
||||
/*
|
||||
* PURPOSE: Power IRP minor function numbers
|
||||
*/
|
||||
enum
|
||||
{
|
||||
IRP_MN_QUERY_POWER,
|
||||
IRP_MN_SET_POWER,
|
||||
IRP_MN_WAIT_WAKE,
|
||||
IRP_MN_QUERY_CAPABILITIES,
|
||||
IRP_MN_POWER_SEQUENCE,
|
||||
};
|
||||
|
||||
/*
|
||||
* FIXME: These are not in the correct order
|
||||
*/
|
||||
enum
|
||||
{
|
||||
IRP_MJ_CREATE,
|
||||
IRP_MJ_CREATE_NAMED_PIPE,
|
||||
IRP_MJ_CLOSE,
|
||||
IRP_MJ_READ,
|
||||
IRP_MJ_WRITE,
|
||||
IRP_MJ_QUERY_INFORMATION,
|
||||
IRP_MJ_SET_INFORMATION,
|
||||
IRP_MJ_QUERY_EA,
|
||||
IRP_MJ_SET_EA,
|
||||
IRP_MJ_FLUSH_BUFFERS,
|
||||
IRP_MJ_QUERY_VOLUME_INFORMATION,
|
||||
IRP_MJ_SET_VOLUME_INFORMATION,
|
||||
IRP_MJ_DIRECTORY_CONTROL,
|
||||
IRP_MJ_FILE_SYSTEM_CONTROL,
|
||||
IRP_MJ_DEVICE_CONTROL,
|
||||
IRP_MJ_INTERNAL_DEVICE_CONTROL,
|
||||
IRP_MJ_SHUTDOWN,
|
||||
IRP_MJ_LOCK_CONTROL,
|
||||
IRP_MJ_CLEANUP,
|
||||
IRP_MJ_CREATE_MAILSLOT,
|
||||
IRP_MJ_QUERY_SECURITY,
|
||||
IRP_MJ_SET_SECURITY,
|
||||
IRP_MJ_QUERY_POWER,
|
||||
IRP_MJ_SET_POWER,
|
||||
IRP_MJ_DEVICE_CHANGE,
|
||||
IRP_MJ_QUERY_QUOTA,
|
||||
IRP_MJ_SET_QUOTA,
|
||||
IRP_MJ_PNP_POWER,
|
||||
IRP_MJ_MAXIMUM_FUNCTION,
|
||||
};
|
||||
|
||||
/*
|
||||
* PURPOSE: Used all over
|
||||
*/
|
||||
enum
|
||||
{
|
||||
KernelMode,
|
||||
UserMode,
|
||||
};
|
||||
|
||||
/*
|
||||
* PURPOSE: Arguments to MmProbeAndLockPages
|
||||
*/
|
||||
enum
|
||||
{
|
||||
IoReadAccess,
|
||||
IoWriteAccess,
|
||||
IoModifyAccess,
|
||||
};
|
||||
|
||||
#define MAXIMUM_VOLUME_LABEL_LENGTH (32)
|
||||
|
||||
/*
|
||||
* IRQ levels
|
||||
*/
|
||||
enum
|
||||
{
|
||||
PASSIVE_LEVEL,
|
||||
|
||||
/*
|
||||
* Which order for these (only DISPATCH_LEVEL is important for now)
|
||||
*/
|
||||
APC_LEVEL,
|
||||
DISPATCH_LEVEL,
|
||||
|
||||
/*
|
||||
* Above here are device specific IRQ levels
|
||||
*/
|
||||
FIRST_DEVICE_SPECIFIC_LEVEL,
|
||||
HIGH_LEVEL = FIRST_DEVICE_SPECIFIC_LEVEL + NR_DEVICE_SPECIFIC_LEVELS,
|
||||
};
|
||||
|
||||
/* GENERAL DEFINITIONS ****************************************************/
|
||||
|
||||
#include <internal/hal/irq.h>
|
||||
|
||||
#include <ddk/kedef.h>
|
||||
#include <ddk/iodef.h>
|
||||
|
||||
/*
|
||||
* PURPOSE: Number of a thread priority levels
|
||||
*/
|
||||
#define NR_PRIORITY_LEVELS (32)
|
||||
|
||||
/*
|
||||
* PURPOSE: Type of queue to insert a work item in
|
||||
*/
|
||||
enum
|
||||
{
|
||||
CriticalWorkQueue,
|
||||
DelayedWorkQueue,
|
||||
HyperCriticalWorkQueue,
|
||||
};
|
||||
|
||||
/*
|
||||
* Types of memory to allocate
|
||||
*/
|
||||
enum
|
||||
{
|
||||
NonPagedPool,
|
||||
NonPagedPoolMustSucceed,
|
||||
NonPagedPoolCacheAligned,
|
||||
NonPagedPoolCacheAlignedMustS,
|
||||
PagedPool,
|
||||
PagedPoolCacheAligned,
|
||||
};
|
||||
|
||||
/*
|
||||
* Possible status codes
|
||||
* FIXME: These may not be the actual values used by NT
|
||||
*/
|
||||
enum
|
||||
{
|
||||
STATUS_SUCCESS,
|
||||
STATUS_INSUFFICIENT_RESOURCES,
|
||||
STATUS_OBJECT_NAME_EXISTS,
|
||||
STATUS_OBJECT_NAME_COLLISION,
|
||||
// STATUS_DATATYPE_MISALIGNMENT,
|
||||
STATUS_CTL_FILE_NOT_SUPPORTED,
|
||||
// STATUS_ACCESS_VIOLATION,
|
||||
STATUS_PORT_ALREADY_SET,
|
||||
STATUS_SECTION_NOT_IMAGE,
|
||||
STATUS_BAD_WORKING_SET_LIMIT,
|
||||
STATUS_INCOMPATIBLE_FILE_MAP,
|
||||
STATUS_HANDLE_NOT_WAITABLE,
|
||||
STATUS_PORT_DISCONNECTED,
|
||||
STATUS_NOT_LOCKED,
|
||||
STATUS_NOT_MAPPED_VIEW,
|
||||
STATUS_UNABLE_TO_FREE_VM,
|
||||
STATUS_UNABLE_TO_DELETE_SECTION,
|
||||
STATUS_MORE_PROCESSING_REQUIRED,
|
||||
STATUS_INVALID_CID,
|
||||
STATUS_BAD_INITIAL_STACK,
|
||||
STATUS_INVALID_VOLUME_LABEL,
|
||||
STATUS_SECTION_NOT_EXTENDED,
|
||||
STATUS_NOT_MAPPED_DATA,
|
||||
STATUS_INFO_LENGTH_MISMATCH,
|
||||
STATUS_INVALID_INFO_CLASS,
|
||||
STATUS_SUSPEND_COUNT_EXCEEDED,
|
||||
STATUS_NOTIFY_ENUM_DIR,
|
||||
STATUS_REGISTRY_RECOVERED,
|
||||
STATUS_REGISTRY_IO_FAILED,
|
||||
STATUS_KEY_DELETED,
|
||||
STATUS_NO_LOG_SPACE,
|
||||
STATUS_KEY_HAS_CHILDREN,
|
||||
STATUS_CHILD_MUST_BE_VOLATILE,
|
||||
STATUS_REGISTRY_CORRUPT,
|
||||
STATUS_DLL_NOT_FOUND,
|
||||
STATUS_DLL_INIT_FAILED,
|
||||
STATUS_ORDINAL_NOT_FOUND,
|
||||
STATUS_ENTRYPOINT_NOT_FOUND,
|
||||
// STATUS_PENDING,
|
||||
STATUS_MORE_ENTRIES,
|
||||
// STATUS_INTEGER_OVERFLOW,
|
||||
STATUS_BUFFER_OVERFLOW,
|
||||
STATUS_NO_MORE_FILES,
|
||||
STATUS_NO_INHERITANCE,
|
||||
STATUS_NO_MORE_EAS,
|
||||
STATUS_NO_MORE_ENTRIES,
|
||||
STATUS_GUIDS_EXHAUSTED,
|
||||
STATUS_AGENTS_EXHAUSTED,
|
||||
STATUS_UNSUCCESSFUL,
|
||||
STATUS_NOT_IMPLEMENTED,
|
||||
STATUS_ILLEGAL_FUNCTION,
|
||||
// STATUS_IN_PAGE_ERROR,
|
||||
STATUS_PAGEFILE_QUOTA,
|
||||
STATUS_COMMITMENT_LIMIT,
|
||||
STATUS_SECTION_TOO_BIG,
|
||||
RPC_NT_SS_IN_NULL_CONTEXT,
|
||||
RPC_NT_INVALID_BINDING,
|
||||
// STATUS_INVALID_HANDLE,
|
||||
STATUS_OBJECT_FILE_MISMATCH,
|
||||
STATUS_FILE_CLOSED,
|
||||
STATUS_INVALID_PORT_HANDLE,
|
||||
STATUS_NOT_COMMITTED,
|
||||
STATUS_INVALID_PARAMETER,
|
||||
STATUS_INVALID_PARAMETER_1,
|
||||
STATUS_INVALID_PARAMETER_2,
|
||||
STATUS_INVALID_PARAMETER_3,
|
||||
STATUS_INVALID_PARAMETER_4,
|
||||
STATUS_INVALID_PARAMETER_5,
|
||||
STATUS_INVALID_PARAMETER_6,
|
||||
STATUS_INVALID_PARAMETER_7,
|
||||
STATUS_INVALID_PARAMETER_8,
|
||||
STATUS_INVALID_PARAMETER_9,
|
||||
STATUS_INVALID_PARAMETER_10,
|
||||
STATUS_INVALID_PARAMETER_11,
|
||||
STATUS_INVALID_PARAMETER_12,
|
||||
STATUS_INVALID_PARAMETER_MAX,
|
||||
STATUS_INVALID_PAGE_PROTECTION,
|
||||
STATUS_RESOURCE_DATA_NOT_FOUND,
|
||||
STATUS_RESOURCE_TYPE_NOT_FOUND,
|
||||
STATUS_RESOURCE_NAME_NOT_FOUND,
|
||||
STATUS_RESOURCE_LANG_NOT_FOUND,
|
||||
STATUS_NO_SUCH_DEVICE,
|
||||
STATUS_NO_SUCH_FILE,
|
||||
STATUS_INVALID_DEVICE_REQUEST,
|
||||
STATUS_END_OF_FILE,
|
||||
STATUS_FILE_FORCED_CLOSED,
|
||||
STATUS_WRONG_VOLUME,
|
||||
STATUS_NO_MEDIA,
|
||||
STATUS_NO_MEDIA_IN_DEVICE,
|
||||
STATUS_NONEXISTENT_SECTOR,
|
||||
STATUS_WORKING_SET_QUOTA,
|
||||
// STATUS_NO_MEMORY,
|
||||
STATUS_CONFLICTING_ADDRESS,
|
||||
STATUS_INVALID_SYSTEM_SERVICE,
|
||||
STATUS_THREAD_IS_TERMINATING,
|
||||
STATUS_PROCESS_IS_TERMINATING,
|
||||
STATUS_INVALID_LOCK_SEQUENCE,
|
||||
STATUS_INVALID_VIEW_SIZE,
|
||||
STATUS_ALREADY_COMMITTED,
|
||||
STATUS_ACCESS_DENIED,
|
||||
STATUS_FILE_IS_A_DIRECTORY,
|
||||
STATUS_CANNOT_DELETE,
|
||||
STATUS_INVALID_COMPUTER_NAME,
|
||||
STATUS_FILE_DELETED,
|
||||
STATUS_DELETE_PENDING,
|
||||
STATUS_PORT_CONNECTION_REFUSED,
|
||||
STATUS_NO_SUCH_PRIVILEGE,
|
||||
STATUS_PRIVILEGE_NOT_HELD,
|
||||
STATUS_CANNOT_IMPERSONATE,
|
||||
STATUS_LOGON_FAILURE,
|
||||
STATUS_ACCOUNT_RESTRICTION,
|
||||
STATUS_INVALID_LOGON_HOURS,
|
||||
STATUS_INVALID_WORKSTATION,
|
||||
STATUS_BUFFER_TOO_SMALL,
|
||||
STATUS_UNABLE_TO_DECOMMIT_VM,
|
||||
STATUS_DISK_CORRUPT_ERROR,
|
||||
STATUS_OBJECT_NAME_INVALID,
|
||||
STATUS_OBJECT_NAME_NOT_FOUND,
|
||||
// STATUS_OBJECT_NAME_COLLISION,
|
||||
STATUS_OBJECT_PATH_INVALID,
|
||||
STATUS_OBJECT_PATH_NOT_FOUND,
|
||||
STATUS_DFS_EXIT_PATH_FOUND,
|
||||
STATUS_OBJECT_PATH_SYNTAX_BAD,
|
||||
STATUS_DATA_OVERRUN,
|
||||
STATUS_DATA_LATE_ERROR,
|
||||
STATUS_DATA_ERROR,
|
||||
STATUS_CRC_ERROR,
|
||||
STATUS_SHARING_VIOLATION,
|
||||
STATUS_QUOTA_EXCEEDED,
|
||||
STATUS_MUTANT_NOT_OWNED,
|
||||
STATUS_SEMAPHORE_LIMIT_EXCEEDED,
|
||||
STATUS_DISK_FULL,
|
||||
STATUS_LOCK_NOT_GRANTED,
|
||||
|
||||
STATUS_DEVICE_NOT_READY,
|
||||
STATUS_IO_TIMEOUT,
|
||||
STATUS_MEDIA_WRITE_PROTECTED,
|
||||
STATUS_NO_MEDIA_IN_DRIVE,
|
||||
STATUS_VERIFY_REQUIRED,
|
||||
STATUS_UNRECOGNIZED_MEDIA,
|
||||
// STATUS_WRONG_VOLUME,
|
||||
};
|
||||
|
||||
/*
|
||||
* This is a list of bug check types (not MS's)
|
||||
*/
|
||||
enum
|
||||
{
|
||||
APC_INDEX_MISMATCH = 1,
|
||||
DEVICE_QUEUE_NOT_BUSY,
|
||||
INVALID_AFFINITY_SET,
|
||||
INVALID_DATA_ACCESS_TRAP,
|
||||
INVALID_PROCESS_ATTACH_ATTEMPT,
|
||||
INVALID_PROCESS_DEATTACH_ATTEMPT,
|
||||
INVALID_SOFTWARE_INTERRUPT,
|
||||
IRQL_NOT_DISPATCH_LEVEL,
|
||||
IRQL_NOT_GREATER_OR_EQUAL,
|
||||
NO_EXCEPTION_HANDLING_SUPPORT,
|
||||
MAXIMUM_WAIT_OBJECTS_EXCEEDED,
|
||||
MUTEX_LEVEL_NUMBER_VIOLATION,
|
||||
NO_USER_MODE_CONTEXT,
|
||||
SPIN_LOCK_ALREADY_OWNED,
|
||||
SPIN_LOCK_NOT_OWNED,
|
||||
THREAD_NOT_MUTEX_OWNER,
|
||||
TRAP_CAUSE_UNKNOWN,
|
||||
EMPTY_THREAD_REAPER_LIST,
|
||||
CREATE_DELETE_LOCK_NOT_LOCKED,
|
||||
LAST_CHANCE_CALLED_FROM_KMODE,
|
||||
CID_HANDLE_CREATION,
|
||||
CID_HANDLE_DELETION,
|
||||
REFERENCE_BY_POINTER,
|
||||
BAD_POOL_HEADER,
|
||||
MEMORY_MANAGMENT,
|
||||
PFN_SHARE_COUNT,
|
||||
PFN_REFERENCE_COUNT,
|
||||
NO_SPIN_LOCK_AVAILABLE,
|
||||
KMODE_EXCEPTION_NOT_HANDLED,
|
||||
SHARED_RESOURCE_CONV_ERROR,
|
||||
KERNEL_APC_PENDING_DURING_EXIT,
|
||||
QUOTA_UNDERFLOW,
|
||||
FILE_SYSTEM,
|
||||
FAT_FILE_SYSTEM,
|
||||
NTFS_FILE_SYSTEM,
|
||||
NPFS_FILE_SYSTEM,
|
||||
CDFS_FILE_SYSTEM,
|
||||
RDR_FILE_SYSTEM,
|
||||
CORRUPT_ACCESS_TOKEN,
|
||||
SECURITY_SYSTEM,
|
||||
INCONSISTENT_IRP,
|
||||
PANIC_STACK_SWITCH,
|
||||
PORT_DRIVER_INTERNAL,
|
||||
SCSI_DISK_DRIVER_INTERNAL,
|
||||
INSTRUCTION_BUS_ERROR,
|
||||
SET_OF_INVALID_CONTEXT,
|
||||
PHASE0_INITIALIZATION_FAILED,
|
||||
PHASE1_INITIALIZATION_FAILED,
|
||||
UNEXPECTED_INITIALIZATION_CALL,
|
||||
CACHE_MANAGER,
|
||||
NO_MORE_IRP_STACK_LOCATIONS,
|
||||
DEVICE_REFERENCE_COUNT_NOT_ZERO,
|
||||
FLOPPY_INTERNAL_ERROR,
|
||||
SERIAL_DRIVER_INTERNAL,
|
||||
SYSTEM_EXIT_OWNED_MUTEX,
|
||||
SYSTEM_UNWIND_PREVIOUS_USER,
|
||||
SYSTEN_SERVICE_EXCEPTION,
|
||||
INTERRUPT_UNWIND_ATTEMPTED,
|
||||
INTERRUPT_EXCEPTION_NOT_HANDLED,
|
||||
MULTIPROCESSOR_CONFIGURATION_NOT_SUPPORTED,
|
||||
NO_MORE_SYSTEM_PTES,
|
||||
TARGET_MDL_TOO_SMALL,
|
||||
MUST_SUCCEED_POOL_EMPTY,
|
||||
ATDISK_DRIVER_INTERNAL,
|
||||
NO_SUCH_PARTITION,
|
||||
MULTIPLE_IRP_COMPLETE_REQUESTS,
|
||||
INSUFFICENT_SYSTEM_MAP_PAGES,
|
||||
DEREF_UNKNOWN_LOGON_SERVICE,
|
||||
REF_UNKNOWN_LOGON_SERVICE,
|
||||
CANCEL_STATE_IN_COMPLETED_IRP,
|
||||
PAGE_FAULT_WITH_INTERRUPTS_OFF,
|
||||
IRQL_GT_ZERO_AT_SYSTEM_SERVICE,
|
||||
STREAMS_INTERNAL_ERROR,
|
||||
FATAL_UNHANDLED_HARD_ERROR,
|
||||
NO_PAGES_AVAILABLE,
|
||||
PFN_LIST_CORRUPT,
|
||||
NDIS_INTERNAL_ERROR,
|
||||
PAGE_FAULT_IN_NONPAGED_AREA,
|
||||
REGISTRY_ERROR,
|
||||
MAILSLOT_FILE_SYSTEM,
|
||||
NO_BOOT_DEVICE,
|
||||
LM_SERVER_INTERNAL_ERROR,
|
||||
DATA_COHERENCY_EXCEPTION,
|
||||
INSTRUCTION_COHERENCY_EXCEPTION,
|
||||
XNS_INTERNAL_ERROR,
|
||||
FTDISK_INTERNAL_ERROR,
|
||||
PINBALL_FILE_SYSTEM,
|
||||
CRITICAL_SERVICE_FAILED,
|
||||
SET_ENV_VAR_FAILED,
|
||||
HAL_INITIALIZED_FAILED,
|
||||
UNSUPPORTED_PROCESSOR,
|
||||
OBJECT_INITIALIZATION_FAILED,
|
||||
SECURITY_INITIALIZATION_FAILED,
|
||||
PROCESS_INITIALIZATION_FAILED,
|
||||
HAL1_INITIALIZATION_FAILED,
|
||||
};
|
||||
enum
|
||||
{
|
||||
KBUG_NONE,
|
||||
KBUG_ORPHANED_IRP,
|
||||
KBUG_IO_STACK_OVERFLOW,
|
||||
KBUG_OUT_OF_MEMORY,
|
||||
KBUG_POOL_FREE_LIST_CORRUPT,
|
||||
|
||||
/*
|
||||
* These are well known but the actual value is unknown
|
||||
*/
|
||||
// NO_PAGES_AVAILABLE,
|
||||
|
||||
/*
|
||||
* These are well known (MS) bug types
|
||||
* (Reference: NT Insider 1997 - http://www.osr.com)
|
||||
*/
|
||||
IRQL_NOT_LESS_OR_EQUAL = 0xa,
|
||||
// KMODE_EXCEPTION_NOT_HANDLED = 0x1e,
|
||||
UNEXPECTED_KERNEL_MODE_TRAP = 0x7f,
|
||||
PAGE_FAULT_IN_NON_PAGED_AREA = 0x50,
|
||||
};
|
||||
|
||||
/*
|
||||
* PURPOSE: Object attributes
|
||||
*/
|
||||
enum
|
||||
{
|
||||
OBJ_INHERIT = 0x1,
|
||||
OBJ_PERMANENT = 0x2,
|
||||
OBJ_EXCLUSIVE = 0x4,
|
||||
OBJ_CASE_INSENSITIVE = 0x8,
|
||||
OBJ_OPENIF = 0x10,
|
||||
};
|
||||
|
||||
/*
|
||||
* PURPOSE: DPC priorities
|
||||
*/
|
||||
enum
|
||||
{
|
||||
High,
|
||||
Medium,
|
||||
Low,
|
||||
};
|
||||
|
||||
/*
|
||||
* PURPOSE: Timer types
|
||||
*/
|
||||
enum
|
||||
{
|
||||
NotificationTimer,
|
||||
SynchronizationTimer,
|
||||
};
|
||||
|
||||
/*
|
||||
* PURPOSE: Some drivers use these
|
||||
*/
|
||||
#define IN
|
||||
#define OUT
|
||||
#define OPTIONAL
|
||||
|
||||
/*
|
||||
* PURPOSE: Power IRP minor function numbers
|
||||
*/
|
||||
enum
|
||||
{
|
||||
IRP_MN_QUERY_POWER,
|
||||
IRP_MN_SET_POWER,
|
||||
IRP_MN_WAIT_WAKE,
|
||||
IRP_MN_QUERY_CAPABILITIES,
|
||||
IRP_MN_POWER_SEQUENCE,
|
||||
};
|
||||
|
||||
/*
|
||||
* PURPOSE: Used all over
|
||||
*/
|
||||
enum
|
||||
{
|
||||
KernelMode,
|
||||
UserMode,
|
||||
};
|
||||
|
||||
/*
|
||||
* PURPOSE: Arguments to MmProbeAndLockPages
|
||||
*/
|
||||
enum
|
||||
{
|
||||
IoReadAccess,
|
||||
IoWriteAccess,
|
||||
IoModifyAccess,
|
||||
};
|
||||
|
||||
#define MAXIMUM_VOLUME_LABEL_LENGTH (32)
|
||||
|
||||
/*
|
||||
* IRQ levels
|
||||
*/
|
||||
enum
|
||||
{
|
||||
PASSIVE_LEVEL,
|
||||
|
||||
/*
|
||||
* Which order for these (only DISPATCH_LEVEL is important for now)
|
||||
*/
|
||||
APC_LEVEL,
|
||||
DISPATCH_LEVEL,
|
||||
|
||||
/*
|
||||
* Above here are device specific IRQ levels
|
||||
*/
|
||||
FIRST_DEVICE_SPECIFIC_LEVEL,
|
||||
HIGH_LEVEL = FIRST_DEVICE_SPECIFIC_LEVEL + NR_DEVICE_SPECIFIC_LEVELS,
|
||||
};
|
||||
|
||||
|
|
|
@ -1,15 +1,17 @@
|
|||
/* EXECUTIVE ROUTINES ******************************************************/
|
||||
|
||||
//VOID ExAcquireFastMutex(PFAST_MUTEX FastMutex);
|
||||
VOID ExAcquireFastMutex(PFAST_MUTEX FastMutex);
|
||||
VOID ExAcquireFastMutexUnsafe(PFAST_MUTEX FastMutex);
|
||||
|
||||
BOOLEAN ExAcquireResourceExclusive(PERESOURCE Resource, BOOLEAN Wait);
|
||||
BOOLEAN ExAcquireResourceExclusiveLite(PERESOURCE Resource, BOOLEAN Wait);
|
||||
BOOLEAN ExAcquireResourceSharedLite(PERESOURCE Resource, BOOLEAN Wait);
|
||||
BOOLEAN ExAcquireSharedStarveExclusive(PERESOURCE Resource, BOOLEAN Wait);
|
||||
BOOLEAN ExAcquireSharedWaitForExclusive(PERESOURCE Resource, BOOLEAN Wait);
|
||||
PVOID ExAllocateFromNPagedLookasideList(PNPAGED_LOOKASIDE_LIST LookSide);
|
||||
PVOID ExAllocateFromPagedLookasideList(PPAGED_LOOKASIDE_LIST LookSide);
|
||||
PVOID ExAllocateFromZone(PZONE_HEADER Zone);
|
||||
|
||||
/*
|
||||
* FUNCTION: Releases previously allocated memory
|
||||
* ARGUMENTS:
|
||||
* block = block to free
|
||||
*/
|
||||
VOID ExFreePool(PVOID block);
|
||||
|
||||
/*
|
||||
* FUNCTION: Allocates memory from the nonpaged pool
|
||||
* ARGUMENTS:
|
||||
|
@ -20,6 +22,63 @@ VOID ExFreePool(PVOID block);
|
|||
*/
|
||||
PVOID ExAllocatePool(POOL_TYPE PoolType, ULONG size);
|
||||
|
||||
PVOID ExAllocatePoolWithQuota(POOL_TYPE PoolType, ULONG NumberOfBytes);
|
||||
PVOID ExAllocatePoolWithQuotaTag(POOL_TYPE PoolType, ULONG NumberOfBytes,
|
||||
ULONG Tag);
|
||||
PVOID ExAllocatePoolWithTag(POOL_TYPE PoolType, ULONG NumberOfBytes,
|
||||
ULONG Tag);
|
||||
VOID ExConvertExclusiveToSharedLite(PERESOURCE Resource);
|
||||
VOID ExDeleteNPagedLookasideList(PNPAGED_LOOKASIDE_LIST Lookaside);
|
||||
VOID ExDeletePagedLookasideList(PPAGED_LOOKASIDE_LIST Lookaside);
|
||||
NTSTATUS ExDeleteResource(PERESOURCE Resource);
|
||||
NTSTATUS ExDeleteResourceLite(PERESOURCE Resource);
|
||||
NTSTATUS ExExtendZone(PZONE_HEADER Zone, PVOID Segment, ULONG SegmentSize);
|
||||
|
||||
/*
|
||||
* FUNCTION: Releases previously allocated memory
|
||||
* ARGUMENTS:
|
||||
* block = block to free
|
||||
*/
|
||||
VOID ExFreePool(PVOID block);
|
||||
|
||||
VOID ExFreeToNPagedLookasideList(PNPAGED_LOOKASIDE_LIST Lookaside,
|
||||
PVOID Entry);
|
||||
VOID ExFreeToPagedLookasideList(PPAGED_LOOKASIDE_LIST Lookaside,
|
||||
PVOID Entry);
|
||||
PVOID ExFreeToZone(PZONE_HEADER Zone, PVOID Block);
|
||||
ERESOURCE_THREAD ExGetCurrentResourceThread(VOID);
|
||||
ULONG ExGetExclusiveWaiterCount(PERESOURCE Resource);
|
||||
ULONG ExGetSharedWaiterCount(PERESOURCE Resource);
|
||||
VOID ExInitializeFastMutex(PFAST_MUTEX FastMutex);
|
||||
VOID ExInitializeNPagedLookasideList(PNPAGED_LOOKASIDE_LIST Lookaside,
|
||||
PALLOCATE_FUNCTION Allocate,
|
||||
PFREE_FUNCTION Free,
|
||||
ULONG Flags,
|
||||
ULONG Size,
|
||||
ULONG Tag,
|
||||
USHORT Depth);
|
||||
VOID ExInitializePagedLookasideList(PPAGED_LOOKASIDE_LIST Lookaside,
|
||||
PALLOCATE_FUNCTION Allocate,
|
||||
PFREE_FUNCTION Free,
|
||||
ULONG Flags,
|
||||
ULONG Size,
|
||||
ULONG Tag,
|
||||
USHORT Depth);
|
||||
NTSTATUS ExInitializeResource(PERESOURCE Resource);
|
||||
NTSTATUS ExInitializeResourceLite(PERESOURCE Resource);
|
||||
VOID ExInitializeSListHead(PSLIST_HEADER SListHead);
|
||||
VOID ExInitializeWorkItem(PWORK_QUEUE_ITEM Item,
|
||||
PWORKER_THREAD_ROUTINE Routine,
|
||||
PVOID Context);
|
||||
NTSTATUS ExInitializeZone(PZONE_HEADER Zone,
|
||||
ULONG BlockSize,
|
||||
PVOID InitialSegment,
|
||||
ULONG InitialSegmentSize);
|
||||
LARGE_INTEGER ExInterlockedAddLargeInteger(PLARGE_INTEGER Addend,
|
||||
LARGE_INTEGER Increment,
|
||||
PKSPIN_LOCK Lock);
|
||||
ULONG ExInterlockedAddUlong(PULONG Addend, ULONG Increment, PKSPIN_LOCK Lock);
|
||||
|
||||
VOID ExInterlockedRemoveEntryList(PLIST_ENTRY ListHead, PLIST_ENTRY Entry,
|
||||
PKSPIN_LOCK Lock);
|
||||
VOID RemoveEntryFromList(PLIST_ENTRY ListHead, PLIST_ENTRY Entry);
|
||||
|
@ -33,3 +92,5 @@ PLIST_ENTRY ExInterlockedInsertHeadList(PLIST_ENTRY ListHead,
|
|||
PLIST_ENTRY ListEntry,
|
||||
PKSPIN_LOCK Lock);
|
||||
|
||||
VOID ExQueueWorkItem(PWORK_QUEUE_ITEM WorkItem,
|
||||
WORK_QUEUE_TYPE QueueType);
|
||||
|
|
|
@ -1,3 +1,50 @@
|
|||
|
||||
|
||||
typedef ULONG INTERLOCKED_RESULT;
|
||||
typedef ULONG WORK_QUEUE_TYPE;
|
||||
|
||||
typedef ULONG ERESOURCE_THREAD, *PERESOURCE_THREAD;
|
||||
|
||||
typedef struct _OWNER_ENTRY
|
||||
{
|
||||
ERESOURCE_THREAD OwnerThread;
|
||||
union
|
||||
{
|
||||
LONG OwnerCount;
|
||||
ULONG TableSize;
|
||||
} a;
|
||||
} OWNER_ENTRY, *POWNER_ENTRY;
|
||||
|
||||
typedef struct _ERESOURCE
|
||||
{
|
||||
LIST_ENTRY SystemResourcesList;
|
||||
POWNER_ENTRY OwnerTable;
|
||||
SHORT ActiveCount;
|
||||
USHORT Flag;
|
||||
PKSEMAPHORE SharedWaiters;
|
||||
PKEVENT ExclusiveWaiters;
|
||||
OWNER_ENTRY OwnerThreads[2];
|
||||
ULONG ContentionCount;
|
||||
USHORT NumberOfSharedWaiters;
|
||||
USHORT NumberOfExclusiveWaiters;
|
||||
union
|
||||
{
|
||||
PVOID Address;
|
||||
ULONG CreatorBackTraceIndex;
|
||||
} a;
|
||||
KSPIN_LOCK SpinLock;
|
||||
} ERESOURCE, *PERESOURCE;
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
LONG Count;
|
||||
PKTHREAD Owner;
|
||||
ULONG Contention;
|
||||
KEVENT Event;
|
||||
ULONG OldIrql;
|
||||
} FAST_MUTEX, *PFAST_MUTEX;
|
||||
|
||||
typedef struct _ZONE_HEADER
|
||||
{
|
||||
SINGLE_LIST_ENTRY FreeList;
|
||||
|
@ -16,3 +63,65 @@ typedef struct _ZONE_ENTRY
|
|||
{
|
||||
SINGLE_LIST_ENTRY Entry;
|
||||
} ZONE_ENTRY, *PZONE_ENTRY;
|
||||
|
||||
|
||||
typedef VOID (*PWORKER_THREAD_ROUTINE)(PVOID Parameter);
|
||||
|
||||
typedef struct _WORK_QUEUE_ITEM
|
||||
{
|
||||
LIST_ENTRY Entry;
|
||||
PWORKER_THREAD_ROUTINE Routine;
|
||||
PVOID Context;
|
||||
} WORK_QUEUE_ITEM, *PWORK_QUEUE_ITEM;
|
||||
|
||||
typedef PVOID (*PALLOCATE_FUNCTION)(POOL_TYPE PoolType,
|
||||
ULONG NumberOfBytes,
|
||||
ULONG Tag);
|
||||
typedef VOID (*PFREE_FUNCTION)(PVOID Buffer);
|
||||
|
||||
typedef union _SLIST_HEADER
|
||||
{
|
||||
ULONGLONG Alignment;
|
||||
struct
|
||||
{
|
||||
SINGLE_LIST_ENTRY Next;
|
||||
USHORT Depth;
|
||||
USHORT Sequence;
|
||||
} s;
|
||||
} SLIST_HEADER, *PSLIST_HEADER;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
SLIST_HEADER ListHead;
|
||||
USHORT Depth;
|
||||
USHORT Pad;
|
||||
ULONG TotalAllocates;
|
||||
ULONG AllocateMisses;
|
||||
ULONG TotalFrees;
|
||||
ULONG TotalMisses;
|
||||
POOL_TYPE Type;
|
||||
ULONG Tag;
|
||||
ULONG Size;
|
||||
PALLOCATE_FUNCTION Allocate;
|
||||
PFREE_FUNCTION Free;
|
||||
LIST_ENTRY ListEntry;
|
||||
KSPIN_LOCK Lock;
|
||||
} NPAGED_LOOKASIDE_LIST, *PNPAGED_LOOKASIDE_LIST;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
SLIST_HEADER ListHead;
|
||||
USHORT Depth;
|
||||
USHORT Pad;
|
||||
ULONG TotalAllocates;
|
||||
ULONG AllocateMisses;
|
||||
ULONG TotalFrees;
|
||||
ULONG TotalMisses;
|
||||
POOL_TYPE Type;
|
||||
ULONG Tag;
|
||||
ULONG Size;
|
||||
PALLOCATE_FUNCTION Allocate;
|
||||
PFREE_FUNCTION Free;
|
||||
LIST_ENTRY ListEntry;
|
||||
FAST_MUTEX Lock;
|
||||
} PAGED_LOOKASIDE_LIST, *PPAGED_LOOKASIDE_LIST;
|
||||
|
|
|
@ -224,7 +224,7 @@ BOOLEAN IoCancelIrp(PIRP Irp);
|
|||
NTSTATUS IoCheckShareAccess(ACCESS_MASK DesiredAccess,
|
||||
ULONG DesiredShareAccess,
|
||||
PFILE_OBJECT FileObject,
|
||||
// PSHARE_ACCESS ShareAccess,
|
||||
PSHARE_ACCESS ShareAccess,
|
||||
BOOLEAN Update);
|
||||
|
||||
/*
|
||||
|
@ -404,7 +404,7 @@ BOOLEAN IoRaiseHardInformationalError(NTSTATUS ErrorStatus,
|
|||
NTSTATUS IoReadPartitionTable(PDEVICE_OBJECT DeviceObject,
|
||||
ULONG SectorSize,
|
||||
BOOLEAN ReturnedRecognizedPartitions,
|
||||
struct _DRIVER_LAYOUT_INFORMATION** PBuffer);
|
||||
struct _DRIVE_LAYOUT_INFORMATION** PBuffer);
|
||||
|
||||
VOID IoRegisterDriverReinitialization(PDRIVER_OBJECT DriverObject,
|
||||
PDRIVER_REINITIALIZE ReinitRoutine,
|
||||
|
@ -502,3 +502,22 @@ NTSTATUS IoWritePartitionTable(PDEVICE_OBJECT DeviceObject,
|
|||
ULONG SectorsPerTrack,
|
||||
ULONG NumberOfHeads,
|
||||
struct _DRIVE_LAYOUT_INFORMATION* PBuffer);
|
||||
|
||||
typedef ULONG FS_INFORMATION_CLASS;
|
||||
|
||||
// Preliminary guess
|
||||
NTKERNELAPI NTSTATUS IoQueryFileVolumeInformation(IN PFILE_OBJECT FileObject,
|
||||
IN FS_INFORMATION_CLASS FsInformationClass,
|
||||
IN ULONG Length,
|
||||
OUT PVOID FsInformation,
|
||||
OUT PULONG ReturnedLength);
|
||||
|
||||
NTKERNELAPI // confirmed - Undocumented because it does not require a valid file handle
|
||||
NTSTATUS
|
||||
IoQueryFileInformation(
|
||||
IN PFILE_OBJECT FileObject,
|
||||
IN FILE_INFORMATION_CLASS FileInformationClass,
|
||||
IN ULONG Length,
|
||||
OUT PVOID FileInformation,
|
||||
OUT PULONG ReturnedLength
|
||||
);
|
||||
|
|
|
@ -16,10 +16,14 @@ struct _IO_STATUS_BLOCK;
|
|||
|
||||
/* SIMPLE TYPES *************************************************************/
|
||||
|
||||
enum
|
||||
{
|
||||
DeallocateObject,
|
||||
KeepObject,
|
||||
};
|
||||
|
||||
typedef ULONG INTERFACE_TYPE;
|
||||
typedef INTERFACE_TYPE* PINTERFACE_TYPE;
|
||||
typedef ULONG CONFIGURATION_TYPE;
|
||||
typedef CONFIGURATION_TYPE* PCONFIGURATION_TYPE;
|
||||
|
||||
/*
|
||||
* FIXME: Definition needed
|
||||
|
@ -62,8 +66,9 @@ typedef VOID (*PIO_APC_ROUTINE) (PVOID ApcContext,
|
|||
*/
|
||||
typedef struct _IO_TIMER
|
||||
{
|
||||
} IO_TIMER, PIO_TIMER;
|
||||
|
||||
KTIMER timer;
|
||||
KDPC dpc;
|
||||
} IO_TIMER, *PIO_TIMER;
|
||||
|
||||
/*
|
||||
* PURPOSE: IRP stack location
|
||||
|
@ -136,9 +141,6 @@ typedef struct _IO_STACK_LOCATION
|
|||
*/
|
||||
PIO_COMPLETION_ROUTINE CompletionRoutine;
|
||||
PVOID CompletionContext;
|
||||
BOOLEAN InvokeOnSuccess;
|
||||
BOOLEAN InvokeOnError;
|
||||
BOOLEAN InvokeOnCancel;
|
||||
|
||||
/*
|
||||
* Driver created device object representing the target device
|
||||
|
@ -176,6 +178,52 @@ typedef NTSTATUS (*PDRIVER_INITIALIZE)(struct _DRIVER_OBJECT* DriverObject,
|
|||
typedef NTSTATUS (*PDRIVER_CANCEL)(struct _DRIVER_OBJECT* DriverObject,
|
||||
PUNICODE_STRING RegistryPath);
|
||||
|
||||
|
||||
typedef struct _SECTION_OBJECT_POINTERS
|
||||
{
|
||||
PVOID DataSectionObject;
|
||||
PVOID SharedCacheMap;
|
||||
PVOID ImageSectionObject;
|
||||
} SECTION_OBJECT_POINTERS, *PSECTION_OBJECT_POINTERS;
|
||||
|
||||
typedef struct _IO_COMPLETION_CONTEXT
|
||||
{
|
||||
PVOID Port;
|
||||
ULONG Key;
|
||||
} IO_COMPLETION_CONTEXT, *PIO_COMPLETION_CONTEXT;
|
||||
|
||||
typedef struct _FILE_OBJECT
|
||||
{
|
||||
CSHORT Type;
|
||||
CSHORT Size;
|
||||
struct _DEVICE_OBJECT* DeviceObject;
|
||||
struct _VPB* Vpb;
|
||||
PVOID FsContext;
|
||||
PVOID FsContext2;
|
||||
PSECTION_OBJECT_POINTERS SectionObjectPointers;
|
||||
PVOID PrivateCacheMap;
|
||||
NTSTATUS FinalStatus;
|
||||
struct _FILE_OBJECT* RelatedFileObject;
|
||||
BOOLEAN LockOperation;
|
||||
BOOLEAN DeletePending;
|
||||
BOOLEAN ReadAccess;
|
||||
BOOLEAN WriteAccess;
|
||||
BOOLEAN DeleteAccess;
|
||||
BOOLEAN SharedRead;
|
||||
BOOLEAN SharedWrite;
|
||||
BOOLEAN SharedDelete;
|
||||
ULONG Flags;
|
||||
UNICODE_STRING FileName;
|
||||
LARGE_INTEGER CurrentByteOffset;
|
||||
ULONG Waiters;
|
||||
ULONG Busy;
|
||||
PVOID LastLock;
|
||||
KEVENT Lock;
|
||||
KEVENT Event;
|
||||
PIO_COMPLETION_CONTEXT CompletionContext;
|
||||
} FILE_OBJECT, *PFILE_OBJECT;
|
||||
|
||||
|
||||
typedef struct _IRP
|
||||
{
|
||||
PMDL MdlAddress;
|
||||
|
@ -212,13 +260,11 @@ typedef struct _IRP
|
|||
struct
|
||||
{
|
||||
KDEVICE_QUEUE_ENTRY DeviceQueueEntry;
|
||||
// PETHREAD Thread;
|
||||
PVOID Thread;
|
||||
PETHREAD Thread;
|
||||
PCHAR AuxiliaryBuffer;
|
||||
LIST_ENTRY ListEntry;
|
||||
struct _IO_STACK_LOCATION* CurrentStackLocation;
|
||||
// PFILE_OBJECT OriginalFileObject;
|
||||
PVOID OriginalFileObject;
|
||||
PFILE_OBJECT OriginalFileObject;
|
||||
} Overlay;
|
||||
KAPC Apc;
|
||||
ULONG CompletionKey;
|
||||
|
@ -288,7 +334,7 @@ typedef NTSTATUS (*PFAST_IO_DISPATCH)(struct _DEVICE_OBJECT*, IRP*);
|
|||
/*
|
||||
* Dispatch routine type declaration
|
||||
*/
|
||||
typedef NTSTATUS (*PDRIVER_STARTIO)(struct _DEVICE_OBJECT*, IRP*);
|
||||
typedef VOID (*PDRIVER_STARTIO)(struct _DEVICE_OBJECT*, IRP*);
|
||||
|
||||
/*
|
||||
* Dispatch routine type declaration
|
||||
|
@ -326,14 +372,6 @@ typedef struct _DRIVER_OBJECT
|
|||
} DRIVER_OBJECT, *PDRIVER_OBJECT;
|
||||
|
||||
|
||||
|
||||
|
||||
typedef struct _FILE_OBJECT
|
||||
{
|
||||
PDEVICE_OBJECT DeviceObject;
|
||||
PVOID FsContext;
|
||||
} FILE_OBJECT, *PFILE_OBJECT;
|
||||
|
||||
typedef struct _CONFIGURATION_INFORMATION
|
||||
{
|
||||
ULONG DiskCount;
|
||||
|
@ -355,20 +393,6 @@ typedef VOID (*PIO_DPC_ROUTINE)(PKDPC Dpc,
|
|||
typedef VOID (*PIO_TIMER_ROUTINE)(PDEVICE_OBJECT DeviceObject,
|
||||
PVOID Context);
|
||||
|
||||
#if PKEY_VALUE_FULL_INFORMATION_DEFINED
|
||||
typedef NTSTATUS (*PIO_QUERY_DEVICE_ROUTINE)(PVOID Context,
|
||||
PUNICODE_STRING PathName,
|
||||
INTERFACE_TYPE BusType,
|
||||
ULONG BusNumber,
|
||||
PKEY_VALUE_FULL_INFORMATION* BusKey,
|
||||
CONFIGURATION_TYPE ControllerType,
|
||||
ULONG ControllerNumber,
|
||||
PKEY_VALUE_FULL_INFORMATION* CtrlKey,
|
||||
CONFIGURATION_TYPE PeripheralType,
|
||||
ULONG PeripheralNumber,
|
||||
PKEY_VALUE_FULL_INFORMATION* PrphKey);
|
||||
#endif
|
||||
|
||||
#if WINDOWS_STRUCTS_DOESNT_ALREADY_DEFINE_THIS
|
||||
typedef struct _PARTITION_INFORMATION
|
||||
{
|
||||
|
@ -390,4 +414,142 @@ typedef struct _DRIVER_LAYOUT_INFORMATION
|
|||
PARTITION_INFORMATION PartitionEntry[1];
|
||||
} DRIVER_LAYOUT_INFORMATION, *PDRIVER_LAYOUT_INFORMATION;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
typedef struct _IO_RESOURCE_DESCRIPTOR
|
||||
{
|
||||
UCHAR Option;
|
||||
UCHAR Type;
|
||||
UCHAR SharedDisposition;
|
||||
|
||||
/*
|
||||
* Reserved for system use
|
||||
*/
|
||||
UCHAR Spare1;
|
||||
|
||||
USHORT Flags;
|
||||
|
||||
/*
|
||||
* Reserved for system use
|
||||
*/
|
||||
UCHAR Spare2;
|
||||
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
ULONG Length;
|
||||
ULONG Alignment;
|
||||
PHYSICAL_ADDRESS MinimumAddress;
|
||||
PHYSICAL_ADDRESS MaximumAddress;
|
||||
} Port;
|
||||
struct
|
||||
{
|
||||
ULONG Length;
|
||||
ULONG Alignment;
|
||||
PHYSICAL_ADDRESS MinimumAddress;
|
||||
PHYSICAL_ADDRESS MaximumAddress;
|
||||
} Memory;
|
||||
struct
|
||||
{
|
||||
ULONG MinimumVector;
|
||||
ULONG MaximumVector;
|
||||
} Interrupt;
|
||||
struct
|
||||
{
|
||||
ULONG MinimumChannel;
|
||||
ULONG MaximumChannel;
|
||||
} Dma;
|
||||
} u;
|
||||
} IO_RESOURCE_DESCRIPTOR, *PIO_RESOURCE_DESCRIPTOR;
|
||||
|
||||
typedef struct _IO_RESOURCE_LIST
|
||||
{
|
||||
USHORT Version;
|
||||
USHORT Revision;
|
||||
ULONG Count;
|
||||
IO_RESOURCE_DESCRIPTOR Descriptors[1];
|
||||
} IO_RESOURCE_LIST, *PIO_RESOURCE_LIST;
|
||||
|
||||
typedef struct _IO_RESOURCES_REQUIREMENTS_LIST
|
||||
{
|
||||
/*
|
||||
* List size in bytes
|
||||
*/
|
||||
ULONG ListSize;
|
||||
|
||||
/*
|
||||
* System defined enum for the bus
|
||||
*/
|
||||
INTERFACE_TYPE InterfaceType;
|
||||
|
||||
ULONG BusNumber;
|
||||
ULONG SlotNumber;
|
||||
ULONG Reserved[3];
|
||||
ULONG AlternativeLists;
|
||||
IO_RESOURCE_LIST List[1];
|
||||
} IO_RESOURCES_REQUIREMENTS_LIST, *PIO_RESOURCE_REQUIREMENTS_LIST;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
UCHAR Type;
|
||||
UCHAR ShareDisposition;
|
||||
USHORT Flags;
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
PHYSICAL_ADDRESS Start;
|
||||
ULONG Length;
|
||||
} Port;
|
||||
struct
|
||||
{
|
||||
ULONG Level;
|
||||
ULONG Vector;
|
||||
ULONG Affinity;
|
||||
} Interrupt;
|
||||
struct
|
||||
{
|
||||
PHYSICAL_ADDRESS Start;
|
||||
ULONG Length;
|
||||
} Memory;
|
||||
struct
|
||||
{
|
||||
ULONG Channel;
|
||||
ULONG Port;
|
||||
ULONG Reserved1;
|
||||
} Dma;
|
||||
struct
|
||||
{
|
||||
ULONG DataSize;
|
||||
ULONG Reserved1;
|
||||
ULONG Reserved2;
|
||||
} DeviceSpecificData;
|
||||
} u;
|
||||
} CM_PARTIAL_RESOURCE_DESCRIPTOR, *PCM_PARTIAL_RESOURCE_DESCRIPTOR;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
USHORT Version;
|
||||
USHORT Revision;
|
||||
ULONG Count;
|
||||
CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1];
|
||||
} CM_PARTIAL_RESOURCE_LIST;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
INTERFACE_TYPE InterfaceType;
|
||||
ULONG BusNumber;
|
||||
CM_PARTIAL_RESOURCE_LIST PartialResourceList;
|
||||
} CM_FULL_RESOURCE_DESCRIPTOR;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ULONG Count;
|
||||
CM_FULL_RESOURCE_DESCRIPTOR List[1];
|
||||
} CM_RESOURCE_LIST, *PCM_RESOURCE_LIST;
|
||||
|
||||
|
||||
#endif __INCLUDE_DDK_IOTYPES_H
|
||||
|
|
|
@ -1,6 +1,17 @@
|
|||
#ifndef __INCLUDE_DDK_KEFUNCS_H
|
||||
#define __INCLUDE_DDK_KEFUNCS_H
|
||||
|
||||
/* KERNEL FUNCTIONS ********************************************************/
|
||||
|
||||
/*
|
||||
* FUNCTION: Acquires a spinlock so the caller can synchronize access to
|
||||
* data
|
||||
* ARGUMENTS:
|
||||
* SpinLock = Initialized spinlock
|
||||
* OldIrql (OUT) = Set the previous irql on return
|
||||
*/
|
||||
VOID KeAcquireSpinLock(PKSPIN_LOCK SpinLock, PKIRQL OldIrql);
|
||||
|
||||
VOID KeAcquireSpinLockAtDpcLevel(PKSPIN_LOCK SpinLock);
|
||||
BOOLEAN KeCancelTimer(PKTIMER Timer);
|
||||
VOID KeClearEvent(PKEVENT Event);
|
||||
|
@ -14,6 +25,7 @@ VOID KeFlushIoBuffers(PMDL Mdl, BOOLEAN ReadOperation, BOOLEAN DmaOperation);
|
|||
KIRQL KeGetCurrentIrql(VOID);
|
||||
ULONG KeGetCurrentProcessorNumber(VOID);
|
||||
ULONG KeGetDcacheFillSize(VOID);
|
||||
PKTHREAD KeGetCurrentThread(VOID);
|
||||
VOID KeInitializeCallbackRecord(PKBUGCHECK_CALLBACK_RECORD CallbackRecord);
|
||||
VOID KeInitializeDeviceQueue(PKDEVICE_QUEUE DeviceQueue);
|
||||
VOID KeInitializeDpc(PKDPC Dpc, PKDEFERRED_ROUTINE DeferredRoutine,
|
||||
|
@ -122,3 +134,5 @@ VOID KeBugCheckEx(ULONG BugCheckCode,
|
|||
* RETURNS: Doesn't
|
||||
*/
|
||||
VOID KeBugCheck(ULONG BugCheckCode);
|
||||
|
||||
#endif /* __INCLUDE_DDK_KEFUNCS_H */
|
||||
|
|
|
@ -1,63 +1,154 @@
|
|||
/* KERNEL TYPES **************************************************************/
|
||||
|
||||
#ifndef __INCLUDE_DDK_KETYPES_H
|
||||
#define __INCLUDE_DDK_KETYPES_H
|
||||
|
||||
typedef LONG KPRIORITY;
|
||||
|
||||
typedef VOID (*PKBUGCHECK_CALLBACK_ROUTINE)(PVOID Buffer, ULONG Length);
|
||||
typedef BOOLEAN (*PKSYNCHRONIZE_ROUTINE)(PVOID SynchronizeContext);
|
||||
|
||||
struct _KAPC;
|
||||
|
||||
typedef VOID (*PKNORMAL_ROUTINE)(PVOID NormalContext,
|
||||
PVOID SystemArgument1,
|
||||
PVOID SystemArgument2);
|
||||
typedef VOID (*PKKERNEL_ROUTINE)(struct _KAPC* Apc,
|
||||
PKNORMAL_ROUTINE* NormalRoutine,
|
||||
PVOID* NormalContext,
|
||||
PVOID* SystemArgument1,
|
||||
PVOID* SystemArgument2);
|
||||
|
||||
typedef VOID (*PKRUNDOWN_ROUTINE)(struct _KAPC* Apc);
|
||||
|
||||
typedef struct
|
||||
/*
|
||||
* PURPOSE: Object describing the wait a thread is currently performing
|
||||
*/
|
||||
{
|
||||
LIST_ENTRY WaitListEntry;
|
||||
struct _KTHREAD* Thread;
|
||||
PVOID Object;
|
||||
struct _KWAIT_BLOCK* NextWaitBlock;
|
||||
USHORT WaitKey;
|
||||
USHORT WaitType;
|
||||
} KWAIT_BLOCK, *PKWAIT_BLOCK;
|
||||
|
||||
|
||||
|
||||
typedef struct _ETHREAD
|
||||
/*
|
||||
* PURPOSE: Describes a thread of execution
|
||||
*/
|
||||
{
|
||||
CSHORT Type;
|
||||
CSHORT Size;
|
||||
|
||||
/*
|
||||
* PURPOSE: Head of the queue of apcs
|
||||
*/
|
||||
LIST_ENTRY apc_queue_head;
|
||||
|
||||
/*
|
||||
* PURPOSE: Entry in the linked list of threads
|
||||
*/
|
||||
LIST_ENTRY Entry;
|
||||
|
||||
/*
|
||||
* PURPOSE: Current state of the thread
|
||||
*/
|
||||
ULONG State;
|
||||
|
||||
/*
|
||||
* PURPOSE: Priority modifier of the thread
|
||||
*/
|
||||
ULONG Priority;
|
||||
|
||||
/*
|
||||
* PURPOSE: Pointer to our process
|
||||
*/
|
||||
struct _EPROCESS* Process;
|
||||
|
||||
/*
|
||||
* PURPOSE: Handle of our process
|
||||
*/
|
||||
HANDLE ProcessHandle;
|
||||
|
||||
/*
|
||||
* PURPOSE: Thread affinity mask
|
||||
*/
|
||||
ULONG AffinityMask;
|
||||
|
||||
/*
|
||||
* PURPOSE: Saved thread context
|
||||
*/
|
||||
hal_thread_state context;
|
||||
|
||||
} KTHREAD, *PKTHREAD, *PETHREAD;
|
||||
|
||||
typedef struct _DISPATCHER_HEADER
|
||||
{
|
||||
UCHAR Type;
|
||||
UCHAR Absolute;
|
||||
UCHAR Size;
|
||||
UCHAR Inserted;
|
||||
LONG SignalState;
|
||||
LIST_ENTRY WaitListHead;
|
||||
} DISPATCHER_HEADER;
|
||||
|
||||
typedef struct _KAPC
|
||||
{
|
||||
CSHORT Type;
|
||||
CSHORT Size;
|
||||
ULONG Spare0;
|
||||
struct _KTHREAD* Thread;
|
||||
LIST_ENTRY ApcListEntry;
|
||||
PKKERNEL_ROUTINE KernelRoutine;
|
||||
PKRUNDOWN_ROUTINE RundownRoutine;
|
||||
PKNORMAL_ROUTINE NormalRoutine;
|
||||
PVOID NormalContext;
|
||||
PVOID SystemArgument1;
|
||||
PVOID SystemArgument2;
|
||||
CCHAR ApcStateIndex;
|
||||
KPROCESSOR_MODE ApcMode;
|
||||
BOOLEAN Inserted;
|
||||
} KAPC, *PKAPC;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
LIST_ENTRY Entry;
|
||||
PKBUGCHECK_CALLBACK_ROUTINE CallbackRoutine;
|
||||
PVOID Buffer;
|
||||
ULONG Length;
|
||||
PUCHAR Component;
|
||||
ULONG Checksum;
|
||||
UCHAR State;
|
||||
} KBUGCHECK_CALLBACK_RECORD, *PKBUGCHECK_CALLBACK_RECORD;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
DISPATCHER_HEADER Header;
|
||||
LIST_ENTRY MutantListEntry;
|
||||
struct _KTHREAD* OwnerThread;
|
||||
BOOLEAN Abandoned;
|
||||
UCHAR ApcDisable;
|
||||
} KMUTEX, *PKMUTEX;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
DISPATCHER_HEADER Header;
|
||||
LONG Limit;
|
||||
} KSEMAPHORE, *PKSEMAPHORE;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
} KTHREAD, *PKTHREAD;
|
||||
|
||||
|
||||
/*
|
||||
* PURPOSE: Included in every object that a thread can wait on
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
/*
|
||||
* PURPOSE: True if the object is signaling a change of state
|
||||
*/
|
||||
BOOLEAN signaled;
|
||||
|
||||
/*
|
||||
* PURPOSE: Head of the queue of threads waiting on this object
|
||||
*/
|
||||
LIST_ENTRY wait_queue_head;
|
||||
|
||||
/*
|
||||
* PURPOSE: True if all the threads waiting should be woken when the
|
||||
* object changes state
|
||||
*/
|
||||
BOOLEAN wake_all;
|
||||
|
||||
} DISPATCHER_HEADER, *PDISPATCHER_HEADER;
|
||||
|
||||
|
||||
typedef struct _KEVENT
|
||||
/*
|
||||
* PURPOSE: Describes an event
|
||||
*/
|
||||
typedef struct _KEVENT
|
||||
{
|
||||
/*
|
||||
* PURPOSE: So we can use the general wait routine
|
||||
*/
|
||||
DISPATCHER_HEADER hdr;
|
||||
|
||||
/*
|
||||
* PURPOSE: Type of event, notification or synchronization
|
||||
*/
|
||||
EVENT_TYPE type;
|
||||
DISPATCHER_HEADER Header;
|
||||
} KEVENT, *PKEVENT;
|
||||
|
||||
|
||||
|
@ -66,14 +157,6 @@ typedef struct _KSPIN_LOCK
|
|||
KIRQL irql;
|
||||
} KSPIN_LOCK, *PKSPIN_LOCK;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
} KAPC;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
} UNICODE_STRING;
|
||||
|
||||
typedef VOID (*PDRIVER_ADD_DEVICE)(VOID);
|
||||
|
||||
struct _KDPC;
|
||||
|
@ -139,3 +222,63 @@ typedef struct _KDEVICE_QUEUE_ENTRY
|
|||
typedef struct _WAIT_CONTEXT_BLOCK
|
||||
{
|
||||
} WAIT_CONTEXT_BLOCK, *PWAIT_CONTEXT_BLOCK;
|
||||
|
||||
|
||||
typedef struct _KTIMER
|
||||
{
|
||||
/*
|
||||
* Pointers to maintain the linked list of activated timers
|
||||
*/
|
||||
LIST_ENTRY entry;
|
||||
|
||||
/*
|
||||
* Absolute expiration time in system time units
|
||||
*/
|
||||
unsigned long long expire_time;
|
||||
|
||||
/*
|
||||
* Optional dpc associated with the timer
|
||||
*/
|
||||
PKDPC dpc;
|
||||
|
||||
/*
|
||||
* True if the timer is signaled
|
||||
*/
|
||||
BOOLEAN signaled;
|
||||
|
||||
/*
|
||||
* True if the timer is in the system timer queue
|
||||
*/
|
||||
BOOLEAN running;
|
||||
|
||||
/*
|
||||
* Type of the timer either Notification or Synchronization
|
||||
*/
|
||||
TIMER_TYPE type;
|
||||
|
||||
/*
|
||||
* Period of the timer in milliseconds (zero if once-only)
|
||||
*/
|
||||
ULONG period;
|
||||
|
||||
} KTIMER, *PKTIMER;
|
||||
|
||||
struct _KINTERRUPT;
|
||||
|
||||
typedef BOOLEAN (*PKSERVICE_ROUTINE)(struct _KINTERRUPT* Interrupt,
|
||||
PVOID ServiceContext);
|
||||
|
||||
typedef struct _KINTERRUPT
|
||||
{
|
||||
ULONG Vector;
|
||||
KAFFINITY ProcessorEnableMask;
|
||||
PKSPIN_LOCK IrqLock;
|
||||
BOOLEAN Shareable;
|
||||
BOOLEAN FloatingSave;
|
||||
PKSERVICE_ROUTINE ServiceRoutine;
|
||||
PVOID ServiceContext;
|
||||
LIST_ENTRY Entry;
|
||||
KIRQL SynchLevel;
|
||||
} KINTERRUPT, *PKINTERRUPT;
|
||||
|
||||
#endif /* __INCLUDE_DDK_KETYPES_H */
|
||||
|
|
|
@ -152,7 +152,7 @@ PVOID MmGetSystemAddressForMdl(PMDL Mdl);
|
|||
* BaseVa = Base virtual address of the buffer
|
||||
* Length = Length in bytes of the buffer
|
||||
*/
|
||||
VOID MmInitalizeMdl(PMDL MemoryDescriptorList, PVOID BaseVa, ULONG Length);
|
||||
VOID MmInitializeMdl(PMDL MemoryDescriptorList, PVOID BaseVa, ULONG Length);
|
||||
|
||||
/*
|
||||
* FUNCTION: Checks whether an address is valid for read/write
|
||||
|
|
|
@ -1,24 +1,14 @@
|
|||
typedef struct _MDL
|
||||
typedef struct _MDL
|
||||
/*
|
||||
* PURPOSE: Describes a user buffer passed to a system API
|
||||
*/
|
||||
{
|
||||
/*
|
||||
* Base address of the buffer in user mode
|
||||
*/
|
||||
PVOID Base;
|
||||
|
||||
/*
|
||||
* Length of the buffer in bytes
|
||||
*/
|
||||
ULONG Length;
|
||||
|
||||
/*
|
||||
* System address of buffer or NULL if not mapped
|
||||
*/
|
||||
PVOID SysBase;
|
||||
|
||||
/*
|
||||
* Below this is a variable length list of page physical address
|
||||
*/
|
||||
struct _MDL* Next;
|
||||
CSHORT Size;
|
||||
CSHORT MdlFlags;
|
||||
struct _EPROCESS* Process;
|
||||
PVOID MappedSystemVa;
|
||||
PVOID StartVa;
|
||||
ULONG ByteCount;
|
||||
ULONG ByteOffset;
|
||||
} MDL, *PMDL;
|
||||
|
|
|
@ -1,41 +1,75 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: include/ddk/ntddk.h
|
||||
* PURPOSE: Interface definitions for drivers
|
||||
* PROGRAMMER: David Welch (welch@mcmail.com)
|
||||
* UPDATE HISTORY:
|
||||
* 15/05/98: Created
|
||||
*/
|
||||
|
||||
#ifndef __NTDDK_H
|
||||
#define __NTDDK_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/* INCLUDES ***************************************************************/
|
||||
|
||||
#include <windows.h>
|
||||
#include <internal/hal/page.h>
|
||||
|
||||
#include <ddk/defines.h>
|
||||
#include <ddk/types.h>
|
||||
#include <ddk/structs.h>
|
||||
#include <internal/hal/ddk.h>
|
||||
#include <ddk/rtl.h>
|
||||
#include <ddk/zw.h>
|
||||
#include <ddk/exfuncs.h>
|
||||
#include <ddk/mmfuncs.h>
|
||||
#include <ddk/kefuncs.h>
|
||||
#include <ddk/iofuncs.h>
|
||||
#include <ddk/psfuncs.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif /* __NTDDK_H */
|
||||
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: include/ddk/ntddk.h
|
||||
* PURPOSE: Interface definitions for drivers
|
||||
* PROGRAMMER: David Welch (welch@mcmail.com)
|
||||
* UPDATE HISTORY:
|
||||
* 15/05/98: Created
|
||||
*/
|
||||
|
||||
#ifndef __NTDDK_H
|
||||
#define __NTDDK_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/* INCLUDES ***************************************************************/
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#define NT_SUCCESS(StatCode) ((NTSTATUS)(StatCode) >= 0)
|
||||
#define NTKERNELAPI
|
||||
|
||||
#define CTL_CODE(Dev, Func, Meth, Acc) ( ((Dev)<<16) | ((Acc)<<14) | ((Func)<<2) | (Meth))
|
||||
|
||||
// IOCTL Parameter buffering methods
|
||||
#define METHOD_BUFFERED 0
|
||||
#define METHOD_IN_DIRECT 1
|
||||
#define METHOD_OUT_DIRECT 2
|
||||
#define METHOD_NEITHER 3
|
||||
|
||||
// IOCTL File access type
|
||||
#define FILE_ANY_ACCESS 0
|
||||
#define FILE_READ_ACCESS 1
|
||||
#define FILE_WRITE_ACCESS 2
|
||||
|
||||
#define QUAD_PART(LI) (*(LONGLONG *)(&LI))
|
||||
|
||||
enum {
|
||||
STATUS_NOT_SUPPORTED = 9999,
|
||||
STATUS_DISK_OPERATION_FAILED
|
||||
};
|
||||
|
||||
#define IO_DISK_INCREMENT 4
|
||||
|
||||
#define FILE_WORD_ALIGNMENT 0x0001
|
||||
|
||||
#define FILE_OPENED 0x0001
|
||||
|
||||
#include <ddk/defines.h>
|
||||
#include <ddk/types.h>
|
||||
#include <ddk/structs.h>
|
||||
#include <ddk/setypes.h>
|
||||
|
||||
#include <internal/hal/ddk.h>
|
||||
|
||||
#include <ddk/rtl.h>
|
||||
#include <ddk/zw.h>
|
||||
#include <ddk/exfuncs.h>
|
||||
#include <ddk/mmfuncs.h>
|
||||
#include <ddk/kefuncs.h>
|
||||
#include <ddk/iofuncs.h>
|
||||
#include <ddk/psfuncs.h>
|
||||
#include <ddk/obfuncs.h>
|
||||
|
||||
ULONG DbgPrint(PCH Format,...);
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif /* __NTDDK_H */
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ typedef struct _OBJECT_TYPE
|
|||
/*
|
||||
* PURPOSE: Name of the type
|
||||
*/
|
||||
LPCSTR TypeName;
|
||||
UNICODE_STRING TypeName;
|
||||
|
||||
/*
|
||||
* PURPOSE: Total number of objects of this type
|
||||
|
@ -96,7 +96,7 @@ typedef struct _OBJECT
|
|||
/*
|
||||
* PURPOSE: Name of this entry
|
||||
*/
|
||||
LPCSTR name;
|
||||
UNICODE_STRING name;
|
||||
|
||||
/*
|
||||
* PURPOSE: Our entry in our parents list of subdirectory
|
||||
|
@ -139,11 +139,11 @@ typedef struct _OBJECT_ATTRIBUTES
|
|||
*/
|
||||
ULONG Attributes;
|
||||
|
||||
//SECURITY_DESCRIPTOR SecurityDescriptor
|
||||
//SecurityQualityOfService
|
||||
SECURITY_DESCRIPTOR SecurityDescriptor;
|
||||
// SecurityQualityOfService
|
||||
|
||||
struct _DIRECTORY_OBJECT* parent;
|
||||
char* name;
|
||||
char* path;
|
||||
UNICODE_STRING name;
|
||||
UNICODE_STRING path;
|
||||
|
||||
} OBJECT_ATTRIBUTES, *POBJECT_ATTRIBUTES;
|
||||
|
|
|
@ -25,3 +25,8 @@ NTSTATUS PsCreateSystemThread(PHANDLE ThreadHandle,
|
|||
PCLIENT_ID ClientId,
|
||||
PKSTART_ROUTINE StartRoutine,
|
||||
PVOID StartContext);
|
||||
NTSTATUS PsTerminateSystemThread(NTSTATUS ExitStatus);
|
||||
NTSTATUS PsSuspendThread(VOID);
|
||||
NTSTATUS PsWakeThread(PETHREAD Thread);
|
||||
PETHREAD PsGetCurrentThread(VOID);
|
||||
PEPROCESS PsGetCurrentProcess(VOID);
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
|
||||
#include <kernel32/heap.h>
|
||||
|
||||
typedef ULONG THREADINFOCLASS;
|
||||
|
||||
typedef struct _CLIENT_ID
|
||||
{
|
||||
HANDLE UniqueProcess;
|
||||
|
@ -60,10 +62,7 @@ typedef struct _NT_PEB
|
|||
WORD wMinorVersion;
|
||||
WORD wBuildNumber;
|
||||
WORD wPlatformId;
|
||||
} NT_PEB;
|
||||
|
||||
typedef NT_PEB *PPEB;
|
||||
|
||||
} NT_PEB, *PPEB;
|
||||
|
||||
|
||||
typedef struct _NT_TIB {
|
||||
|
@ -104,8 +103,58 @@ typedef struct _EPROCESS
|
|||
{
|
||||
} EPROCESS, *PEPROCESS;
|
||||
|
||||
//typedef KTHREAD ETHREAD, *PETHREAD;
|
||||
|
||||
#if ETHREAD_NOT_THE_SAME_AS_KTHREAD
|
||||
typedef struct _ETHREAD
|
||||
{
|
||||
EPROCESS* Process;
|
||||
} ETHREAD, *PETHREAD;
|
||||
|
||||
/*
|
||||
* PURPOSE: Thread object
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
CSHORT Type;
|
||||
CSHORT Size;
|
||||
|
||||
/*
|
||||
* PURPOSE: Entry in the linked list of threads
|
||||
*/
|
||||
LIST_ENTRY Entry;
|
||||
|
||||
/*
|
||||
* PURPOSE: Current state of the thread
|
||||
*/
|
||||
ULONG State;
|
||||
|
||||
/*
|
||||
* PURPOSE: Priority modifier of the thread
|
||||
*/
|
||||
ULONG Priority;
|
||||
|
||||
/*
|
||||
* PURPOSE: Pointer to our parent process
|
||||
*/
|
||||
// PEPROCESS Parent;
|
||||
|
||||
/*
|
||||
* PURPOSE: Handle of our parent process
|
||||
*/
|
||||
HANDLE ParentHandle;
|
||||
|
||||
/*
|
||||
* PURPOSE: Not currently used
|
||||
*/
|
||||
ULONG AffinityMask;
|
||||
|
||||
/*
|
||||
* PURPOSE: Saved thread context
|
||||
*/
|
||||
hal_thread_state context;
|
||||
|
||||
} THREAD_OBJECT, *PTHREAD_OBJECT;
|
||||
#endif
|
||||
|
||||
#endif /* __INCLUDE_DDK_PSTYPES_H */
|
||||
|
|
|
@ -5,6 +5,52 @@
|
|||
#ifndef __DDK_RTL_H
|
||||
#define __DDK_RTL_H
|
||||
|
||||
typedef struct _CONTROLLER_OBJECT
|
||||
{
|
||||
CSHORT Type;
|
||||
CSHORT Size;
|
||||
PVOID ControllerExtension;
|
||||
KDEVICE_QUEUE DeviceWaitQueue;
|
||||
ULONG Spare1;
|
||||
LARGE_INTEGER Spare2;
|
||||
} CONTROLLER_OBJECT, *PCONTROLLER_OBJECT;
|
||||
|
||||
typedef struct _STRING
|
||||
{
|
||||
/*
|
||||
* Length in bytes of the string stored in buffer
|
||||
*/
|
||||
USHORT Length;
|
||||
|
||||
/*
|
||||
* Maximum length of the string
|
||||
*/
|
||||
USHORT MaximumLength;
|
||||
|
||||
/*
|
||||
* String
|
||||
*/
|
||||
PCHAR Buffer;
|
||||
} STRING, *PSTRING;
|
||||
|
||||
typedef struct _ANSI_STRING
|
||||
{
|
||||
/*
|
||||
* Length in bytes of the string stored in buffer
|
||||
*/
|
||||
USHORT Length;
|
||||
|
||||
/*
|
||||
* Maximum length of the string
|
||||
*/
|
||||
USHORT MaximumLength;
|
||||
|
||||
/*
|
||||
* String
|
||||
*/
|
||||
PCHAR Buffer;
|
||||
} ANSI_STRING, *PANSI_STRING;
|
||||
|
||||
typedef struct _TIME_FIELDS
|
||||
{
|
||||
CSHORT Year;
|
||||
|
@ -179,6 +225,43 @@ VOID RtlStoreLong(PULONG Address, ULONG Value);
|
|||
VOID RtlStoreUshort(PUSHORT Address, USHORT Value);
|
||||
BOOLEAN RtlTimeFieldsToTime(PTIME_FIELDS TimeFields, PLARGE_INTEGER Time);
|
||||
VOID RtlTimeToTimeFields(PLARGE_INTEGER Time, PTIME_FIELDS TimeFields);
|
||||
PWSTR RtlStrtok(PUNICODE_STRING _string, PWSTR _sep, PWSTR* temp);
|
||||
|
||||
|
||||
typedef struct {
|
||||
ULONG Length;
|
||||
ULONG Unknown[11];
|
||||
} RTL_HEAP_DEFINITION, *PRTL_HEAP_DEFINITION;
|
||||
|
||||
// Heap creation routine
|
||||
|
||||
HANDLE
|
||||
STDCALL
|
||||
RtlCreateHeap(
|
||||
ULONG Flags,
|
||||
PVOID BaseAddress,
|
||||
ULONG SizeToReserve,
|
||||
ULONG SizeToCommit,
|
||||
PVOID Unknown,
|
||||
PRTL_HEAP_DEFINITION Definition
|
||||
);
|
||||
|
||||
PVOID
|
||||
STDCALL
|
||||
RtlAllocateHeap(
|
||||
HANDLE Heap,
|
||||
ULONG Flags,
|
||||
ULONG Size
|
||||
);
|
||||
|
||||
|
||||
BOOLEAN
|
||||
STDCALL
|
||||
RtlFreeHeap(
|
||||
HANDLE Heap,
|
||||
ULONG Flags,
|
||||
PVOID Address
|
||||
);
|
||||
|
||||
|
||||
#endif /* __DDK_RTL_H */
|
||||
|
|
|
@ -1,318 +1,14 @@
|
|||
/* SYSTEM STRUCTURES ******************************************************/
|
||||
|
||||
#include <internal/hal/hal.h>
|
||||
#include <ddk/cfgtypes.h>
|
||||
#include <ddk/ketypes.h>
|
||||
#include <ddk/obtypes.h>
|
||||
#include <ddk/mmtypes.h>
|
||||
#include <ddk/iotypes.h>
|
||||
#include <ddk/extypes.h>
|
||||
#include <ddk/pstypes.h>
|
||||
|
||||
/*
|
||||
* PURPOSE: Thread object
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
CSHORT Type;
|
||||
CSHORT Size;
|
||||
|
||||
/*
|
||||
* PURPOSE: Entry in the linked list of threads
|
||||
*/
|
||||
LIST_ENTRY Entry;
|
||||
|
||||
/*
|
||||
* PURPOSE: Current state of the thread
|
||||
*/
|
||||
ULONG State;
|
||||
|
||||
/*
|
||||
* PURPOSE: Priority modifier of the thread
|
||||
*/
|
||||
ULONG Priority;
|
||||
|
||||
/*
|
||||
* PURPOSE: Pointer to our parent process
|
||||
*/
|
||||
// PEPROCESS Parent;
|
||||
|
||||
/*
|
||||
* PURPOSE: Handle of our parent process
|
||||
*/
|
||||
HANDLE ParentHandle;
|
||||
|
||||
/*
|
||||
* PURPOSE: Not currently used
|
||||
*/
|
||||
ULONG AffinityMask;
|
||||
|
||||
/*
|
||||
* PURPOSE: Saved thread context
|
||||
*/
|
||||
hal_thread_state context;
|
||||
|
||||
} THREAD_OBJECT, *PTHREAD_OBJECT;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* PURPOSE: Object describing the wait a thread is currently performing
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
/*
|
||||
* PURPOSE: Pointer to the waiting thread
|
||||
*/
|
||||
PTHREAD_OBJECT thread;
|
||||
|
||||
/*
|
||||
* PURPOSE: Entry in the wait queue for the object being waited on
|
||||
*/
|
||||
LIST_ENTRY Entry;
|
||||
|
||||
/*
|
||||
* PURPOSE: Pointer to the object being waited on
|
||||
*/
|
||||
DISPATCHER_HEADER* wait_object;
|
||||
|
||||
} KWAIT_BLOCK, *PKWAIT_BLOCK;
|
||||
|
||||
typedef struct _ADAPTER_OBJECT
|
||||
{
|
||||
} ADAPTER_OBJECT, *PADAPTER_OBJECT;
|
||||
|
||||
typedef struct _CONTROLLER_OBJECT
|
||||
{
|
||||
PVOID ControllerExtension;
|
||||
} CONTROLLER_OBJECT, *PCONTROLLER_OBJECT;
|
||||
|
||||
typedef struct _STRING
|
||||
{
|
||||
/*
|
||||
* Length in bytes of the string stored in buffer
|
||||
*/
|
||||
USHORT Length;
|
||||
|
||||
/*
|
||||
* Maximum length of the string
|
||||
*/
|
||||
USHORT MaximumLength;
|
||||
|
||||
/*
|
||||
* String
|
||||
*/
|
||||
PCHAR Buffer;
|
||||
} STRING, *PSTRING;
|
||||
|
||||
typedef struct _ANSI_STRING
|
||||
{
|
||||
/*
|
||||
* Length in bytes of the string stored in buffer
|
||||
*/
|
||||
USHORT Length;
|
||||
|
||||
/*
|
||||
* Maximum length of the string
|
||||
*/
|
||||
USHORT MaximumLength;
|
||||
|
||||
/*
|
||||
* String
|
||||
*/
|
||||
PCHAR Buffer;
|
||||
} ANSI_STRING, *PANSI_STRING;
|
||||
|
||||
typedef struct _KTIMER
|
||||
{
|
||||
/*
|
||||
* Pointers to maintain the linked list of activated timers
|
||||
*/
|
||||
LIST_ENTRY entry;
|
||||
|
||||
/*
|
||||
* Absolute expiration time in system time units
|
||||
*/
|
||||
unsigned long long expire_time;
|
||||
|
||||
/*
|
||||
* Optional dpc associated with the timer
|
||||
*/
|
||||
PKDPC dpc;
|
||||
|
||||
/*
|
||||
* True if the timer is signaled
|
||||
*/
|
||||
BOOLEAN signaled;
|
||||
|
||||
/*
|
||||
* True if the timer is in the system timer queue
|
||||
*/
|
||||
BOOLEAN running;
|
||||
|
||||
/*
|
||||
* Type of the timer either Notification or Synchronization
|
||||
*/
|
||||
TIMER_TYPE type;
|
||||
|
||||
/*
|
||||
* Period of the timer in milliseconds (zero if once-only)
|
||||
*/
|
||||
ULONG period;
|
||||
|
||||
} KTIMER, *PKTIMER;
|
||||
|
||||
|
||||
|
||||
|
||||
typedef struct _IO_RESOURCE_DESCRIPTOR
|
||||
{
|
||||
UCHAR Option;
|
||||
UCHAR Type;
|
||||
UCHAR SharedDisposition;
|
||||
|
||||
/*
|
||||
* Reserved for system use
|
||||
*/
|
||||
UCHAR Spare1;
|
||||
|
||||
USHORT Flags;
|
||||
|
||||
/*
|
||||
* Reserved for system use
|
||||
*/
|
||||
UCHAR Spare2;
|
||||
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
ULONG Length;
|
||||
ULONG Alignment;
|
||||
PHYSICAL_ADDRESS MinimumAddress;
|
||||
PHYSICAL_ADDRESS MaximumAddress;
|
||||
} Port;
|
||||
struct
|
||||
{
|
||||
ULONG Length;
|
||||
ULONG Alignment;
|
||||
PHYSICAL_ADDRESS MinimumAddress;
|
||||
PHYSICAL_ADDRESS MaximumAddress;
|
||||
} Memory;
|
||||
struct
|
||||
{
|
||||
ULONG MinimumVector;
|
||||
ULONG MaximumVector;
|
||||
} Interrupt;
|
||||
struct
|
||||
{
|
||||
ULONG MinimumChannel;
|
||||
ULONG MaximumChannel;
|
||||
} Dma;
|
||||
} u;
|
||||
} IO_RESOURCE_DESCRIPTOR, *PIO_RESOURCE_DESCRIPTOR;
|
||||
|
||||
typedef struct _IO_RESOURCE_LIST
|
||||
{
|
||||
USHORT Version;
|
||||
USHORT Revision;
|
||||
ULONG Count;
|
||||
IO_RESOURCE_DESCRIPTOR Descriptors[1];
|
||||
} IO_RESOURCE_LIST, *PIO_RESOURCE_LIST;
|
||||
|
||||
typedef struct _IO_RESOURCES_REQUIREMENTS_LIST
|
||||
{
|
||||
/*
|
||||
* List size in bytes
|
||||
*/
|
||||
ULONG ListSize;
|
||||
|
||||
/*
|
||||
* System defined enum for the bus
|
||||
*/
|
||||
INTERFACE_TYPE InterfaceType;
|
||||
|
||||
ULONG BusNumber;
|
||||
ULONG SlotNumber;
|
||||
ULONG Reserved[3];
|
||||
ULONG AlternativeLists;
|
||||
IO_RESOURCE_LIST List[1];
|
||||
} IO_RESOURCES_REQUIREMENTS_LIST, *PIO_RESOURCE_REQUIREMENTS_LIST;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
UCHAR Type;
|
||||
UCHAR ShareDisposition;
|
||||
USHORT Flags;
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
PHYSICAL_ADDRESS Start;
|
||||
ULONG Length;
|
||||
} Port;
|
||||
struct
|
||||
{
|
||||
ULONG Level;
|
||||
ULONG Vector;
|
||||
ULONG Affinity;
|
||||
} Interrupt;
|
||||
struct
|
||||
{
|
||||
PHYSICAL_ADDRESS Start;
|
||||
ULONG Length;
|
||||
} Memory;
|
||||
struct
|
||||
{
|
||||
ULONG Channel;
|
||||
ULONG Port;
|
||||
ULONG Reserved1;
|
||||
} Dma;
|
||||
struct
|
||||
{
|
||||
ULONG DataSize;
|
||||
ULONG Reserved1;
|
||||
ULONG Reserved2;
|
||||
} DeviceSpecificData;
|
||||
} u;
|
||||
} CM_PARTIAL_RESOURCE_DESCRIPTOR, *PCM_PARTIAL_RESOURCE_DESCRIPTOR;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
USHORT Version;
|
||||
USHORT Revision;
|
||||
ULONG Count;
|
||||
CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1];
|
||||
} CM_PARTIAL_RESOURCE_LIST;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
INTERFACE_TYPE InterfaceType;
|
||||
ULONG BusNumber;
|
||||
CM_PARTIAL_RESOURCE_LIST PartialResourceList;
|
||||
} CM_FULL_RESOURCE_DESCRIPTOR;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ULONG Count;
|
||||
CM_FULL_RESOURCE_DESCRIPTOR List[1];
|
||||
} CM_RESOURCE_LIST, *PCM_RESOURCE_LIST;
|
||||
|
||||
struct _KINTERRUPT;
|
||||
|
||||
typedef BOOLEAN (*PKSERVICE_ROUTINE)(struct _KINTERRUPT* Interrupt,
|
||||
PVOID ServiceContext);
|
||||
|
||||
typedef struct _KINTERRUPT
|
||||
{
|
||||
ULONG Vector;
|
||||
KAFFINITY ProcessorEnableMask;
|
||||
PKSPIN_LOCK IrqLock;
|
||||
BOOLEAN Shareable;
|
||||
BOOLEAN FloatingSave;
|
||||
PKSERVICE_ROUTINE ServiceRoutine;
|
||||
PVOID ServiceContext;
|
||||
LIST_ENTRY Entry;
|
||||
KIRQL SynchLevel;
|
||||
} KINTERRUPT, *PKINTERRUPT;
|
||||
|
||||
/* SYSTEM STRUCTURES ******************************************************/
|
||||
|
||||
#include <internal/hal/hal.h>
|
||||
#include <ddk/cfgtypes.h>
|
||||
#include <ddk/ketypes.h>
|
||||
#include <ddk/obtypes.h>
|
||||
#include <ddk/mmtypes.h>
|
||||
#include <ddk/iotypes.h>
|
||||
#include <ddk/extypes.h>
|
||||
#include <ddk/pstypes.h>
|
||||
|
||||
typedef struct _ADAPTER_OBJECT
|
||||
{
|
||||
} ADAPTER_OBJECT, *PADAPTER_OBJECT;
|
||||
|
|
|
@ -6,12 +6,9 @@
|
|||
typedef const int CINT;
|
||||
|
||||
|
||||
typedef ULONG KAFFINITY;
|
||||
typedef KAFFINITY *PKAFFINITY;
|
||||
typedef ULONG KAFFINITY, *PKAFFINITY;
|
||||
|
||||
//typedef LONG KPRIORITY;
|
||||
|
||||
typedef LONG NTSTATUS;
|
||||
typedef LONG NTSTATUS, *PNTSTATUS;
|
||||
|
||||
typedef ULONG DEVICE_TYPE;
|
||||
|
||||
|
@ -35,20 +32,12 @@ typedef unsigned long long ULONGLONG;
|
|||
*/
|
||||
//typedef LONG NTSTATUS;
|
||||
|
||||
/*
|
||||
* Unicode string type
|
||||
* FIXME: Real unicode please
|
||||
*/
|
||||
typedef char* PUNICODE_STRING;
|
||||
|
||||
#if REAL_UNICODE
|
||||
typedef struct _UNICODE_STRING
|
||||
{
|
||||
USHORT Length;
|
||||
USHORT MaximumLength;
|
||||
PWSTR Buffer;
|
||||
} UNICODE_STRING, *PUNICODE_STRING;
|
||||
#endif
|
||||
|
||||
typedef enum _SECTION_INHERIT {
|
||||
ViewShare = 1,
|
||||
|
@ -58,12 +47,10 @@ typedef enum _SECTION_INHERIT {
|
|||
/*
|
||||
* Various other types (all quite pointless)
|
||||
*/
|
||||
//typedef ULONG DEVICE_TYPE;
|
||||
typedef ULONG KPROCESSOR_MODE;
|
||||
typedef ULONG KIRQL;
|
||||
typedef UCHAR KIRQL;
|
||||
typedef KIRQL* PKIRQL;
|
||||
typedef ULONG IO_ALLOCATION_ACTION;
|
||||
//typedef ULONG INTERFACE_TYPE;
|
||||
typedef ULONG POOL_TYPE;
|
||||
typedef ULONG TIMER_TYPE;
|
||||
typedef ULONG MM_SYSTEM_SIZE;
|
||||
|
@ -71,15 +58,10 @@ typedef ULONG LOCK_OPERATION;
|
|||
typedef ULONG KEY_INFORMATION_CLASS;
|
||||
typedef ULONG FILE_INFORMATION_CLASS;
|
||||
typedef ULONG KEY_VALUE_INFORMATION_CLASS;
|
||||
//typedef ULONG SECTION_INHERIT;
|
||||
typedef ULONG EVENT_TYPE;
|
||||
//typedef ULONG KAFFINITY;
|
||||
//typedef KAFFINITY* PKAFFINITY;
|
||||
typedef ULONG PHYSICAL_ADDRESS;
|
||||
typedef PHYSICAL_ADDRESS* PPHYSICAL_ADDRESS;
|
||||
typedef ULONG WAIT_TYPE;
|
||||
typedef ULONG KWAIT_REASON;
|
||||
typedef ULONG KINTERRUPT_MODE;
|
||||
//typedef ULONG KINTERRUPT_MODE;
|
||||
typedef USHORT CSHORT;
|
||||
|
||||
#endif
|
||||
|
|
File diff suppressed because it is too large
Load diff
14968
reactos/include/funcs.h
14968
reactos/include/funcs.h
File diff suppressed because it is too large
Load diff
|
@ -1,6 +1,9 @@
|
|||
#ifndef _LINUX_CTYPE_H
|
||||
#define _LINUX_CTYPE_H
|
||||
|
||||
|
||||
#ifdef USE_OLD_CTYPE_IMPLEMENTATION
|
||||
|
||||
#define _U 0x01 /* upper */
|
||||
#define _L 0x02 /* lower */
|
||||
#define _D 0x04 /* digit */
|
||||
|
@ -31,4 +34,38 @@ extern char _ctmp;
|
|||
#define tolower(c) (_ctmp=c,isupper(_ctmp)?_ctmp-('A'-'a'):_ctmp)
|
||||
#define toupper(c) (_ctmp=c,islower(_ctmp)?_ctmp-('a'-'A'):_ctmp)
|
||||
|
||||
#else
|
||||
|
||||
#define upalpha ('A' - 'a')
|
||||
|
||||
extern inline char toupper(char c)
|
||||
{
|
||||
if ((c>='a') && (c<='z')) return (c+upalpha);
|
||||
return(c);
|
||||
}
|
||||
|
||||
extern inline int islower(char c)
|
||||
{
|
||||
if ((c>='a') && (c<='z')) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern inline int isdigit(char c)
|
||||
{
|
||||
if ((c>='0') && (c<='9')) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern inline int isxdigit(char c)
|
||||
{
|
||||
if (((c>='0') && (c<='9')) || ((toupper(c)>='A') && (toupper(c)<='Z')))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,70 +1,72 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: include/internal/debug.h
|
||||
* PURPOSE: Useful debugging macros
|
||||
* PROGRAMMER: David Welch (welch@mcmail.com)
|
||||
* UPDATE HISTORY:
|
||||
* 28/05/98: Created
|
||||
*/
|
||||
|
||||
/*
|
||||
* NOTE: Define NDEBUG before including this header to disable debugging
|
||||
* macros
|
||||
*/
|
||||
|
||||
#ifndef __INTERNAL_DEBUG
|
||||
#define __INTERNAL_DEBUG
|
||||
|
||||
|
||||
#ifndef NDEBUG
|
||||
#define DPRINT(fmt,args...) do { printk("(%s:%d) ",__FILE__,__LINE__); printk(fmt,args); } while(0);
|
||||
//#define assert(x) if (!(x)) {printk("Assertion "#x" failed at %s:%d\n", __FILE__,__LINE__); (*((unsigned int *)0))=1; for (;;); }
|
||||
#define assert(x) if (!(x)) {printk("Assertion "#x" failed at %s:%d\n", __FILE__,__LINE__); for (;;); }
|
||||
#define CHECKPOINT printk("%s:%d\n",__FILE__,__LINE__)
|
||||
#else
|
||||
#define DPRINT(fmt,args...)
|
||||
#define assert(x)
|
||||
#define CHECKPOINT
|
||||
#endif /* NDEBUG */
|
||||
|
||||
/*
|
||||
* FUNCTION: Assert a maximum value for the current irql
|
||||
* ARGUMENTS:
|
||||
* x = Maximum irql
|
||||
*/
|
||||
#define ASSERT_IRQL(x) assert(KeGetCurrentIrql()<=(x))
|
||||
|
||||
#define HBP_EXECUTE (0)
|
||||
#define HBP_WRITE (1)
|
||||
#define HBP_READWRITE (3)
|
||||
|
||||
#define HBP_BYTE (0)
|
||||
#define HBP_WORD (1)
|
||||
#define HBP_DWORD (3)
|
||||
|
||||
/*
|
||||
* FUNCTION: Sets a hardware breakpoint
|
||||
* ARGUMENTS:
|
||||
* i = breakpoint to set (0 to 3)
|
||||
* addr = linear address to break on
|
||||
* type = Type of access to break on
|
||||
* len = length of the variable to watch
|
||||
* NOTES:
|
||||
* The variable to watch must be aligned to its length (i.e. a dword
|
||||
* breakpoint must be aligned to a dword boundary)
|
||||
*
|
||||
* A fatal exception will be generated on the access to the variable.
|
||||
* It is (at the moment) only really useful for catching undefined
|
||||
* pointers if you know the variable effected but not the buggy
|
||||
* routine.
|
||||
*
|
||||
* FIXME: Extend to call out to kernel debugger on breakpoint
|
||||
* Add support for I/O breakpoints
|
||||
* REFERENCES: See the i386 programmer manual for more details
|
||||
*/
|
||||
void set_breakpoint(unsigned int i, unsigned int addr, unsigned int type,
|
||||
unsigned int len);
|
||||
|
||||
|
||||
#endif /* __INTERNAL_DEBUG */
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: include/internal/debug.h
|
||||
* PURPOSE: Useful debugging macros
|
||||
* PROGRAMMER: David Welch (welch@mcmail.com)
|
||||
* UPDATE HISTORY:
|
||||
* 28/05/98: Created
|
||||
*/
|
||||
|
||||
/*
|
||||
* NOTE: Define NDEBUG before including this header to disable debugging
|
||||
* macros
|
||||
*/
|
||||
|
||||
#ifndef __INTERNAL_DEBUG
|
||||
#define __INTERNAL_DEBUG
|
||||
|
||||
#define UNIMPLEMENTED do {printk("%s at %s:%d is umimplemented, have a nice day\n",__FUNCTION__,__FILE__,__LINE__); for(;;); } while(0);
|
||||
|
||||
#ifndef NDEBUG
|
||||
#define DPRINT(fmt,args...) do { printk("(%s:%d) ",__FILE__,__LINE__); printk(fmt,args); } while(0);
|
||||
//#define assert(x) if (!(x)) {printk("Assertion "#x" failed at %s:%d\n", __FILE__,__LINE__); (*((unsigned int *)0))=1; for (;;); }
|
||||
#define assert(x) if (!(x)) {printk("Assertion "#x" failed at %s:%d\n", __FILE__,__LINE__); for (;;); }
|
||||
#define CHECKPOINT printk("%s:%d\n",__FILE__,__LINE__)
|
||||
#else
|
||||
#define DPRINT(fmt,args...)
|
||||
#define assert(x)
|
||||
#define CHECKPOINT
|
||||
#endif /* NDEBUG */
|
||||
|
||||
/*
|
||||
* FUNCTION: Assert a maximum value for the current irql
|
||||
* ARGUMENTS:
|
||||
* x = Maximum irql
|
||||
*/
|
||||
#define ASSERT_IRQL(x) assert(KeGetCurrentIrql()<=(x))
|
||||
#define assert_irql(x) assert(KeGetCurrentIrql()<=(x))
|
||||
|
||||
#define HBP_EXECUTE (0)
|
||||
#define HBP_WRITE (1)
|
||||
#define HBP_READWRITE (3)
|
||||
|
||||
#define HBP_BYTE (0)
|
||||
#define HBP_WORD (1)
|
||||
#define HBP_DWORD (3)
|
||||
|
||||
/*
|
||||
* FUNCTION: Sets a hardware breakpoint
|
||||
* ARGUMENTS:
|
||||
* i = breakpoint to set (0 to 3)
|
||||
* addr = linear address to break on
|
||||
* type = Type of access to break on
|
||||
* len = length of the variable to watch
|
||||
* NOTES:
|
||||
* The variable to watch must be aligned to its length (i.e. a dword
|
||||
* breakpoint must be aligned to a dword boundary)
|
||||
*
|
||||
* A fatal exception will be generated on the access to the variable.
|
||||
* It is (at the moment) only really useful for catching undefined
|
||||
* pointers if you know the variable effected but not the buggy
|
||||
* routine.
|
||||
*
|
||||
* FIXME: Extend to call out to kernel debugger on breakpoint
|
||||
* Add support for I/O breakpoints
|
||||
* REFERENCES: See the i386 programmer manual for more details
|
||||
*/
|
||||
void set_breakpoint(unsigned int i, unsigned int addr, unsigned int type,
|
||||
unsigned int len);
|
||||
|
||||
|
||||
#endif /* __INTERNAL_DEBUG */
|
||||
|
|
|
@ -114,33 +114,4 @@ BOOLEAN HalTranslateBusAddress(INTERFACE_TYPE InterfaceType,
|
|||
PULONG AddressSpace,
|
||||
PPHYSICAL_ADDRESS TranslatedAddress);
|
||||
|
||||
struct __xchg_dummy { unsigned long a[100]; };
|
||||
#define __xg(x) ((struct __xchg_dummy *)(x))
|
||||
|
||||
extern inline LONG InterlockedDecrement(PLONG Addend)
|
||||
/*
|
||||
* FUNCTION: Decrements a variable as an atomic operations
|
||||
* ARGUMENTS:
|
||||
* Addend = Value to be decremented
|
||||
* RETURNS: The decremented value
|
||||
*/
|
||||
{
|
||||
}
|
||||
|
||||
extern inline LONG InterlockedExchange(PLONG Target, LONG Value)
|
||||
/*
|
||||
* FUNCTION: Sets a variable as an atomic operation
|
||||
* ARGUMENTS:
|
||||
* Target = Variable to be set
|
||||
* Value = Caller specified value to set
|
||||
* RETURNS: The previous value of the target
|
||||
*/
|
||||
{
|
||||
__asm__("xchgl %0,%1"
|
||||
:"=r" (Value)
|
||||
:"m" (*__xg(Target)), "0" (Value)
|
||||
:"memory");
|
||||
return(Value);
|
||||
}
|
||||
|
||||
#endif /* __INCLUDE_INTERNAL_HAL_DDK_H */
|
||||
|
|
|
@ -1,71 +1,71 @@
|
|||
/*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __INTERNAL_HAL_HAL_H
|
||||
#define __INTERNAL_HAL_HAL_H
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned short previous_task;
|
||||
unsigned short reserved1;
|
||||
unsigned long esp0;
|
||||
unsigned short ss0;
|
||||
unsigned short reserved2;
|
||||
unsigned long esp1;
|
||||
unsigned short ss1;
|
||||
unsigned short reserved3;
|
||||
unsigned long esp2;
|
||||
unsigned short ss2;
|
||||
unsigned short reserved4;
|
||||
unsigned long cr3;
|
||||
unsigned long eip;
|
||||
unsigned long eflags;
|
||||
unsigned long eax;
|
||||
unsigned long ecx;
|
||||
unsigned long edx;
|
||||
unsigned long ebx;
|
||||
unsigned long esp;
|
||||
unsigned long ebp;
|
||||
unsigned long esi;
|
||||
unsigned long edi;
|
||||
unsigned short es;
|
||||
unsigned short reserved5;
|
||||
unsigned short cs;
|
||||
unsigned short reserved6;
|
||||
unsigned short ss;
|
||||
unsigned short reserved7;
|
||||
unsigned short ds;
|
||||
unsigned short reserved8;
|
||||
unsigned short fs;
|
||||
unsigned short reserved9;
|
||||
unsigned short gs;
|
||||
unsigned short reserved10;
|
||||
unsigned short ldt;
|
||||
unsigned short reserved11;
|
||||
unsigned short trap;
|
||||
unsigned short iomap_base;
|
||||
|
||||
unsigned short nr;
|
||||
|
||||
unsigned char io_bitmap[1];
|
||||
} hal_thread_state;
|
||||
|
||||
/*
|
||||
* FUNCTION: Probes for a PCI bus
|
||||
* RETURNS: True if found
|
||||
*/
|
||||
BOOL HalPciProbe(void);
|
||||
|
||||
/*
|
||||
* FUNCTION: Probes for a BIOS32 extension
|
||||
*/
|
||||
VOID Hal_bios32_probe(VOID);
|
||||
|
||||
/*
|
||||
* FUNCTION: Determines if a a bios32 service is present
|
||||
*/
|
||||
BOOLEAN Hal_bios32_is_service_present(ULONG service);
|
||||
|
||||
|
||||
#endif /* __INTERNAL_HAL_HAL_H */
|
||||
/*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __INTERNAL_HAL_HAL_H
|
||||
#define __INTERNAL_HAL_HAL_H
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned short previous_task;
|
||||
unsigned short reserved1;
|
||||
unsigned long esp0;
|
||||
unsigned short ss0;
|
||||
unsigned short reserved2;
|
||||
unsigned long esp1;
|
||||
unsigned short ss1;
|
||||
unsigned short reserved3;
|
||||
unsigned long esp2;
|
||||
unsigned short ss2;
|
||||
unsigned short reserved4;
|
||||
unsigned long cr3;
|
||||
unsigned long eip;
|
||||
unsigned long eflags;
|
||||
unsigned long eax;
|
||||
unsigned long ecx;
|
||||
unsigned long edx;
|
||||
unsigned long ebx;
|
||||
unsigned long esp;
|
||||
unsigned long ebp;
|
||||
unsigned long esi;
|
||||
unsigned long edi;
|
||||
unsigned short es;
|
||||
unsigned short reserved5;
|
||||
unsigned short cs;
|
||||
unsigned short reserved6;
|
||||
unsigned short ss;
|
||||
unsigned short reserved7;
|
||||
unsigned short ds;
|
||||
unsigned short reserved8;
|
||||
unsigned short fs;
|
||||
unsigned short reserved9;
|
||||
unsigned short gs;
|
||||
unsigned short reserved10;
|
||||
unsigned short ldt;
|
||||
unsigned short reserved11;
|
||||
unsigned short trap;
|
||||
unsigned short iomap_base;
|
||||
|
||||
unsigned short nr;
|
||||
|
||||
unsigned char io_bitmap[1];
|
||||
} hal_thread_state;
|
||||
|
||||
/*
|
||||
* FUNCTION: Probes for a PCI bus
|
||||
* RETURNS: True if found
|
||||
*/
|
||||
BOOL HalPciProbe(void);
|
||||
|
||||
/*
|
||||
* FUNCTION: Probes for a BIOS32 extension
|
||||
*/
|
||||
VOID Hal_bios32_probe(VOID);
|
||||
|
||||
/*
|
||||
* FUNCTION: Determines if a a bios32 service is present
|
||||
*/
|
||||
BOOLEAN Hal_bios32_is_service_present(ULONG service);
|
||||
|
||||
|
||||
#endif /* __INTERNAL_HAL_HAL_H */
|
||||
|
|
|
@ -48,6 +48,11 @@ extern inline unsigned int physical_to_linear(unsigned int x)
|
|||
return(x+IDMAP_BASE);
|
||||
}
|
||||
|
||||
extern inline unsigned int linear_to_physical(unsigned int x)
|
||||
{
|
||||
return(x-IDMAP_BASE);
|
||||
}
|
||||
|
||||
#define FLUSH_TLB __asm__("movl %cr3,%eax\n\tmovl %eax,%cr3\n\t")
|
||||
|
||||
extern inline unsigned int* get_page_directory(void)
|
||||
|
|
|
@ -8,16 +8,11 @@
|
|||
* 28/05/97: Created
|
||||
*/
|
||||
|
||||
#ifndef __INTERNAL_IOMGR_H
|
||||
#define __INTERNAL_IOMGR_H
|
||||
#ifndef __INCLUDE_INTERNAL_IOMGR_H
|
||||
#define __INCLUDE_INTERNAL_IOMGR_H
|
||||
|
||||
#include <ddk/ntddk.h>
|
||||
|
||||
/*
|
||||
* FUNCTION:
|
||||
*/
|
||||
NTSTATUS IoBeginIrp(PDEVICE_OBJECT DeviceObject, PIRP Irp);
|
||||
|
||||
/*
|
||||
* FUNCTION: Called to initalize a loaded driver
|
||||
* ARGUMENTS:
|
||||
|
@ -26,4 +21,7 @@ NTSTATUS IoBeginIrp(PDEVICE_OBJECT DeviceObject, PIRP Irp);
|
|||
*/
|
||||
NTSTATUS InitalizeLoadedDriver(PDRIVER_INITIALIZE entry);
|
||||
|
||||
VOID IoInitCancelHandling(VOID);
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,93 +1,109 @@
|
|||
/*
|
||||
* Various useful prototypes
|
||||
*/
|
||||
|
||||
#ifndef __KERNEL_H
|
||||
#define __KERNEL_H
|
||||
|
||||
#include <windows.h>
|
||||
#include <ddk/ntddk.h>
|
||||
|
||||
#include <internal/linkage.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
VOID KiInterruptDispatch(unsigned int irq);
|
||||
VOID KiDispatchInterrupt(unsigned int irq);
|
||||
VOID KeTimerInterrupt(VOID);
|
||||
|
||||
/*
|
||||
* Defines a descriptor as it appears in the processor tables
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
unsigned int a;
|
||||
unsigned int b;
|
||||
} descriptor;
|
||||
|
||||
extern descriptor idt[256];
|
||||
extern descriptor gdt[256];
|
||||
|
||||
/*
|
||||
* printf style functions
|
||||
*/
|
||||
asmlinkage void printk(const char* fmt, ...);
|
||||
int vsprintf(char *buf, const char *fmt, va_list args);
|
||||
int sprintf(char* buf, const char* fmt, ...);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/*
|
||||
* Magic value (useless really)
|
||||
*/
|
||||
unsigned int magic;
|
||||
|
||||
/*
|
||||
* Cursor position
|
||||
*/
|
||||
unsigned int cursorx;
|
||||
unsigned int cursory;
|
||||
|
||||
/*
|
||||
* Number of files (including the kernel) loaded
|
||||
*/
|
||||
unsigned int nr_files;
|
||||
|
||||
/*
|
||||
* Range of physical memory being used by the system
|
||||
*/
|
||||
unsigned int start_mem;
|
||||
unsigned int end_mem;
|
||||
|
||||
/*
|
||||
* List of module lengths (terminated by a 0)
|
||||
*/
|
||||
unsigned int module_length[64];
|
||||
} boot_param;
|
||||
|
||||
|
||||
/*
|
||||
* Initalization functions (called once by main())
|
||||
*/
|
||||
void MmInitalize(boot_param* bp);
|
||||
void InitalizeExceptions(void);
|
||||
void InitalizeIRQ(void);
|
||||
void InitializeTimer(void);
|
||||
void InitConsole(boot_param* bp);
|
||||
void KeInitDpc(void);
|
||||
void HalInit(boot_param* bp);
|
||||
void IoInit(void);
|
||||
void ObjNamespcInit(void);
|
||||
void PsMgrInit(void);
|
||||
|
||||
|
||||
/*
|
||||
* FUNCTION: Called to execute queued dpcs
|
||||
*/
|
||||
void KeDrainDpcQueue(void);
|
||||
|
||||
void KeExpireTimers(void);
|
||||
|
||||
typedef unsigned int (exception_hook)(CONTEXT* c, unsigned int exp);
|
||||
asmlinkage unsigned int ExHookException(exception_hook fn, UINT exp);
|
||||
|
||||
#endif
|
||||
/*
|
||||
* Various useful prototypes
|
||||
*/
|
||||
|
||||
#ifndef __KERNEL_H
|
||||
#define __KERNEL_H
|
||||
|
||||
#include <windows.h>
|
||||
#include <ddk/ntddk.h>
|
||||
|
||||
#include <internal/linkage.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
/*
|
||||
* Use these to place a function in a specific section of the executable
|
||||
*/
|
||||
#define PLACE_IN_SECTION(s) __attribute__((section (s)))
|
||||
#define INIT_FUNCTION (PLACE_IN_SECTION("init"))
|
||||
#define PAGE_LOCKED_FUNCTION (PLACE_IN_SECTION("pagelk"))
|
||||
#define PAGE_UNLOCKED_FUNCTION (PLACE_IN_SECTION("pagepo"))
|
||||
|
||||
/*
|
||||
* Maximum size of the kmalloc area (this is totally arbitary)
|
||||
*/
|
||||
#define NONPAGED_POOL_SIZE (4*1024*1024)
|
||||
|
||||
VOID KiInterruptDispatch(unsigned int irq);
|
||||
VOID KiDispatchInterrupt(unsigned int irq);
|
||||
VOID KeTimerInterrupt(VOID);
|
||||
|
||||
/*
|
||||
* Defines a descriptor as it appears in the processor tables
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
unsigned int a;
|
||||
unsigned int b;
|
||||
} descriptor;
|
||||
|
||||
extern descriptor idt[256];
|
||||
extern descriptor gdt[256];
|
||||
|
||||
/*
|
||||
* printf style functions
|
||||
*/
|
||||
asmlinkage void printk(const char* fmt, ...);
|
||||
int vsprintf(char *buf, const char *fmt, va_list args);
|
||||
int sprintf(char* buf, const char* fmt, ...);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/*
|
||||
* Magic value (useless really)
|
||||
*/
|
||||
unsigned int magic;
|
||||
|
||||
/*
|
||||
* Cursor position
|
||||
*/
|
||||
unsigned int cursorx;
|
||||
unsigned int cursory;
|
||||
|
||||
/*
|
||||
* Number of files (including the kernel) loaded
|
||||
*/
|
||||
unsigned int nr_files;
|
||||
|
||||
/*
|
||||
* Range of physical memory being used by the system
|
||||
*/
|
||||
unsigned int start_mem;
|
||||
unsigned int end_mem;
|
||||
|
||||
/*
|
||||
* List of module lengths (terminated by a 0)
|
||||
*/
|
||||
unsigned int module_length[64];
|
||||
} boot_param;
|
||||
|
||||
|
||||
/*
|
||||
* Initalization functions (called once by main())
|
||||
*/
|
||||
void MmInitalize(boot_param* bp);
|
||||
void InitalizeExceptions(void);
|
||||
void InitalizeIRQ(void);
|
||||
void InitializeTimer(void);
|
||||
void InitConsole(boot_param* bp);
|
||||
void KeInitDpc(void);
|
||||
void HalInit(boot_param* bp);
|
||||
void IoInit(void);
|
||||
void ObjNamespcInit(void);
|
||||
void PsMgrInit(void);
|
||||
void KeInitializeBugCheck(void);
|
||||
VOID KeInitializeDispatcher(VOID);
|
||||
void TstBegin(void);
|
||||
void KeCalibrateTimerLoop(void);
|
||||
|
||||
/*
|
||||
* FUNCTION: Called to execute queued dpcs
|
||||
*/
|
||||
void KeDrainDpcQueue(void);
|
||||
|
||||
void KeExpireTimers(void);
|
||||
|
||||
typedef unsigned int (exception_hook)(CONTEXT* c, unsigned int exp);
|
||||
asmlinkage unsigned int ExHookException(exception_hook fn, UINT exp);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,146 +1,146 @@
|
|||
/*
|
||||
* Higher level memory managment definitions
|
||||
*/
|
||||
|
||||
#ifndef __MM_H
|
||||
#define __MM_H
|
||||
|
||||
#define PAGE_SYSTEM (0x80000000)
|
||||
|
||||
#include <internal/linkage.h>
|
||||
#include <internal/kernel.h>
|
||||
#include <windows.h>
|
||||
|
||||
typedef struct _memory_area
|
||||
/*
|
||||
* PURPOSE: Describes an area of virtual memory
|
||||
*/
|
||||
{
|
||||
/*
|
||||
* Access protection
|
||||
*/
|
||||
unsigned int access;
|
||||
|
||||
/*
|
||||
* Memory region base
|
||||
*/
|
||||
unsigned int base;
|
||||
|
||||
/*
|
||||
* Memory region length
|
||||
*/
|
||||
unsigned int length;
|
||||
|
||||
/*
|
||||
* Memory type (Mapped file, mapped from an executable or private)
|
||||
*/
|
||||
unsigned int type;
|
||||
|
||||
/*
|
||||
* Memory region state (committed, reserved or free)
|
||||
*/
|
||||
unsigned int state;
|
||||
|
||||
/*
|
||||
* Original access protection
|
||||
*/
|
||||
unsigned int initial_access;
|
||||
|
||||
/*
|
||||
* Used to maintain the linked list of memory areas
|
||||
*/
|
||||
struct _memory_area* previous;
|
||||
struct _memory_area* next;
|
||||
|
||||
/*
|
||||
* True the region is locked
|
||||
*/
|
||||
BOOL lock;
|
||||
|
||||
/*
|
||||
* FUNCTION: Decommits all the pages in the regions
|
||||
*/
|
||||
void (*free)(struct _memory_area* marea);
|
||||
|
||||
/*
|
||||
* FUNCTION: Handles a page fault by loading the required page
|
||||
* RECEIVES:
|
||||
* marea = the memory area
|
||||
* address = the relative address of the page to load
|
||||
* RETURNS:
|
||||
* TRUE = the access should be restarted
|
||||
* FALSE = the access was illegal and an exception should
|
||||
* be generated
|
||||
* NOTES: This function is guarrented to be called within the context
|
||||
* of the thread which required a page to be loaded
|
||||
*/
|
||||
BOOL (*load_page)(struct _memory_area* marea, unsigned int address);
|
||||
} memory_area;
|
||||
|
||||
|
||||
/*
|
||||
* FUNCTION: Gets a page with a restricted max physical address (i.e.
|
||||
* suitable for dma)
|
||||
* RETURNS:
|
||||
* The physical address of the page if it succeeds
|
||||
* NULL if it fails.
|
||||
* NOTES: This is very inefficent because the list isn't sorted. On the
|
||||
* other hand sorting the list would be quite expensive especially if dma
|
||||
* is only used infrequently. Perhaps a special cache of dma pages should
|
||||
* be maintained?
|
||||
*/
|
||||
unsigned int get_dma_page(unsigned int max_address);
|
||||
|
||||
/*
|
||||
* FUNCTION: Allocate a page and return its physical address
|
||||
* RETURNS: The physical address of the page allocated
|
||||
*/
|
||||
asmlinkage unsigned int get_free_page(void);
|
||||
|
||||
/*
|
||||
* FUNCTION: Adds pages to the free list
|
||||
* ARGUMENTS:
|
||||
* physical_base = Physical address of the base of the region to
|
||||
* be freed
|
||||
* nr = number of continuous pages to free
|
||||
*/
|
||||
asmlinkage void free_page(unsigned int physical_base, unsigned int nr);
|
||||
|
||||
/*
|
||||
* FUNCTION: Returns the physical address mapped by a given virtual address
|
||||
* ARGUMENTS:
|
||||
* vaddr = virtual address to query
|
||||
* RETURNS: The physical address if present in memory
|
||||
* Zero if paged out or invalid
|
||||
* NOTE: This doesn't do any synchronization
|
||||
*/
|
||||
unsigned int get_page_physical_address(unsigned int vaddr);
|
||||
|
||||
void mark_page_not_writable(unsigned int vaddr);
|
||||
|
||||
void VirtualInit(boot_param* bp);
|
||||
|
||||
/*
|
||||
* FUNCTION: Returns the first memory area starting in the region or the last
|
||||
* one before the start of the region
|
||||
* ARGUMENTS:
|
||||
* list_head = Head of the list of memory areas to search
|
||||
* base = base address of the region
|
||||
* length = length of the region
|
||||
* RETURNS: A pointer to the area found or
|
||||
* NULL if the region was before the first region on the list
|
||||
*/
|
||||
memory_area* find_first_marea(memory_area* list_head, unsigned int base,
|
||||
unsigned int length);
|
||||
|
||||
/*
|
||||
* Head of the list of system memory areas
|
||||
*/
|
||||
extern memory_area* system_memory_area_list_head;
|
||||
|
||||
/*
|
||||
* Head of the list of user memory areas (this should be per process)
|
||||
*/
|
||||
extern memory_area* memory_area_list_head;
|
||||
|
||||
#endif
|
||||
/*
|
||||
* Higher level memory managment definitions
|
||||
*/
|
||||
|
||||
#ifndef __MM_H
|
||||
#define __MM_H
|
||||
|
||||
#define PAGE_SYSTEM (0x80000000)
|
||||
|
||||
#include <internal/linkage.h>
|
||||
#include <internal/kernel.h>
|
||||
#include <windows.h>
|
||||
|
||||
typedef struct _memory_area
|
||||
/*
|
||||
* PURPOSE: Describes an area of virtual memory
|
||||
*/
|
||||
{
|
||||
/*
|
||||
* Access protection
|
||||
*/
|
||||
unsigned int access;
|
||||
|
||||
/*
|
||||
* Memory region base
|
||||
*/
|
||||
unsigned int base;
|
||||
|
||||
/*
|
||||
* Memory region length
|
||||
*/
|
||||
unsigned int length;
|
||||
|
||||
/*
|
||||
* Memory type (Mapped file, mapped from an executable or private)
|
||||
*/
|
||||
unsigned int type;
|
||||
|
||||
/*
|
||||
* Memory region state (committed, reserved or free)
|
||||
*/
|
||||
unsigned int state;
|
||||
|
||||
/*
|
||||
* Original access protection
|
||||
*/
|
||||
unsigned int initial_access;
|
||||
|
||||
/*
|
||||
* Used to maintain the linked list of memory areas
|
||||
*/
|
||||
struct _memory_area* previous;
|
||||
struct _memory_area* next;
|
||||
|
||||
/*
|
||||
* True the region is locked
|
||||
*/
|
||||
BOOL lock;
|
||||
|
||||
/*
|
||||
* FUNCTION: Decommits all the pages in the regions
|
||||
*/
|
||||
void (*free)(struct _memory_area* marea);
|
||||
|
||||
/*
|
||||
* FUNCTION: Handles a page fault by loading the required page
|
||||
* RECEIVES:
|
||||
* marea = the memory area
|
||||
* address = the relative address of the page to load
|
||||
* RETURNS:
|
||||
* TRUE = the access should be restarted
|
||||
* FALSE = the access was illegal and an exception should
|
||||
* be generated
|
||||
* NOTES: This function is guarrented to be called within the context
|
||||
* of the thread which required a page to be loaded
|
||||
*/
|
||||
BOOL (*load_page)(struct _memory_area* marea, unsigned int address);
|
||||
} memory_area;
|
||||
|
||||
|
||||
/*
|
||||
* FUNCTION: Gets a page with a restricted max physical address (i.e.
|
||||
* suitable for dma)
|
||||
* RETURNS:
|
||||
* The physical address of the page if it succeeds
|
||||
* NULL if it fails.
|
||||
* NOTES: This is very inefficent because the list isn't sorted. On the
|
||||
* other hand sorting the list would be quite expensive especially if dma
|
||||
* is only used infrequently. Perhaps a special cache of dma pages should
|
||||
* be maintained?
|
||||
*/
|
||||
unsigned int get_dma_page(unsigned int max_address);
|
||||
|
||||
/*
|
||||
* FUNCTION: Allocate a page and return its physical address
|
||||
* RETURNS: The physical address of the page allocated
|
||||
*/
|
||||
asmlinkage unsigned int get_free_page(void);
|
||||
|
||||
/*
|
||||
* FUNCTION: Adds pages to the free list
|
||||
* ARGUMENTS:
|
||||
* physical_base = Physical address of the base of the region to
|
||||
* be freed
|
||||
* nr = number of continuous pages to free
|
||||
*/
|
||||
asmlinkage void free_page(unsigned int physical_base, unsigned int nr);
|
||||
|
||||
/*
|
||||
* FUNCTION: Returns the physical address mapped by a given virtual address
|
||||
* ARGUMENTS:
|
||||
* vaddr = virtual address to query
|
||||
* RETURNS: The physical address if present in memory
|
||||
* Zero if paged out or invalid
|
||||
* NOTE: This doesn't do any synchronization
|
||||
*/
|
||||
unsigned int get_page_physical_address(unsigned int vaddr);
|
||||
|
||||
void mark_page_not_writable(unsigned int vaddr);
|
||||
|
||||
void VirtualInit(boot_param* bp);
|
||||
|
||||
/*
|
||||
* FUNCTION: Returns the first memory area starting in the region or the last
|
||||
* one before the start of the region
|
||||
* ARGUMENTS:
|
||||
* list_head = Head of the list of memory areas to search
|
||||
* base = base address of the region
|
||||
* length = length of the region
|
||||
* RETURNS: A pointer to the area found or
|
||||
* NULL if the region was before the first region on the list
|
||||
*/
|
||||
memory_area* find_first_marea(memory_area* list_head, unsigned int base,
|
||||
unsigned int length);
|
||||
|
||||
/*
|
||||
* Head of the list of system memory areas
|
||||
*/
|
||||
extern memory_area* system_memory_area_list_head;
|
||||
|
||||
/*
|
||||
* Head of the list of user memory areas (this should be per process)
|
||||
*/
|
||||
extern memory_area* memory_area_list_head;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,34 +1,34 @@
|
|||
|
||||
#ifndef __MODULE_H
|
||||
#define __MODULE_H
|
||||
|
||||
#include <coff.h>
|
||||
|
||||
typedef struct
|
||||
/*
|
||||
*
|
||||
*/
|
||||
{
|
||||
unsigned int text_base;
|
||||
unsigned int data_base;
|
||||
unsigned int bss_base;
|
||||
SCNHDR* scn_list;
|
||||
char* str_tab;
|
||||
SYMENT* sym_list;
|
||||
unsigned int size;
|
||||
|
||||
/*
|
||||
* Base address of the module in memory
|
||||
*/
|
||||
unsigned int base;
|
||||
|
||||
/*
|
||||
* Offset of the raw data in memory
|
||||
*/
|
||||
unsigned int raw_data_off;
|
||||
} module;
|
||||
|
||||
int process_boot_module(unsigned int start);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef __MODULE_H
|
||||
#define __MODULE_H
|
||||
|
||||
#include <coff.h>
|
||||
|
||||
typedef struct
|
||||
/*
|
||||
*
|
||||
*/
|
||||
{
|
||||
unsigned int text_base;
|
||||
unsigned int data_base;
|
||||
unsigned int bss_base;
|
||||
SCNHDR* scn_list;
|
||||
char* str_tab;
|
||||
SYMENT* sym_list;
|
||||
unsigned int size;
|
||||
|
||||
/*
|
||||
* Base address of the module in memory
|
||||
*/
|
||||
unsigned int base;
|
||||
|
||||
/*
|
||||
* Offset of the raw data in memory
|
||||
*/
|
||||
unsigned int raw_data_off;
|
||||
} module;
|
||||
|
||||
BOOLEAN process_boot_module(unsigned int start);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -43,11 +43,12 @@ enum
|
|||
OBJTYP_MAX,
|
||||
};
|
||||
|
||||
BOOL ObjAddObjectToNameSpace(const char* path, POBJECT_HEADER Object);
|
||||
BOOL ObAddObjectToNameSpace(PUNICODE_STRING path, POBJECT_HEADER Object);
|
||||
|
||||
VOID ObRegisterType(CSHORT id, OBJECT_TYPE* type);
|
||||
|
||||
VOID ObInitializeObjectHeader(CSHORT id, LPCSTR name, POBJECT_HEADER obj);
|
||||
VOID ObInitializeObjectHeader(CSHORT id, PUNICODE_STRING name,
|
||||
POBJECT_HEADER obj);
|
||||
|
||||
/*
|
||||
* FUNCTION: Get the size of an object
|
||||
|
@ -59,7 +60,7 @@ ULONG ObSizeOf(CSHORT Type);
|
|||
HANDLE ObAddHandle(PVOID obj);
|
||||
|
||||
PVOID ObGetObjectByHandle(HANDLE h);
|
||||
PVOID ObLookupObject(PDIRECTORY_OBJECT root, const char* _string);
|
||||
PVOID ObLookupObject(PDIRECTORY_OBJECT root, PUNICODE_STRING _string);
|
||||
PVOID ObGenericCreateObject(PHANDLE Handle,
|
||||
ACCESS_MASK DesiredAccess,
|
||||
POBJECT_ATTRIBUTES ObjectAttributes,
|
||||
|
|
|
@ -1,19 +1,11 @@
|
|||
#ifndef __INTERNAL_POOL_H
|
||||
#define __INTERNAL_POOL_H
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#include <internal/linkage.h>
|
||||
|
||||
/*
|
||||
* Maximum size of the kmalloc area (this is totally arbitary)
|
||||
*/
|
||||
#define NONPAGED_POOL_SIZE (4*1024*1024)
|
||||
|
||||
/*
|
||||
* Allocates an arbitary sized block at any alignment
|
||||
*/
|
||||
//asmlinkage void* ExAllocatePool(ULONG size);
|
||||
//asmlinkage void ExFreePool(void* block);
|
||||
|
||||
#endif /* __INTERNAL_POOL_H */
|
||||
#ifndef __INTERNAL_POOL_H
|
||||
#define __INTERNAL_POOL_H
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#include <internal/linkage.h>
|
||||
|
||||
static PVOID ExAllocatePagedPool(POOL_TYPE Type, ULONG size);
|
||||
static PVOID ExAllocateNonPagedPool(POOL_TYPE Type, ULONG size);
|
||||
|
||||
#endif /* __INTERNAL_POOL_H */
|
||||
|
|
|
@ -1,50 +1,48 @@
|
|||
#ifndef __INCLUDE_INTERNAL_PSMGR_H
|
||||
#define __INCLUDE_INTERNAL_PSMGR_H
|
||||
|
||||
#include <internal/hal/hal.h>
|
||||
|
||||
void PsInitThreadManagment(void);
|
||||
|
||||
/*
|
||||
* PURPOSE: Thread states
|
||||
*/
|
||||
enum
|
||||
{
|
||||
/*
|
||||
* PURPOSE: Don't touch
|
||||
*/
|
||||
THREAD_STATE_INVALID,
|
||||
|
||||
/*
|
||||
* PURPOSE: Waiting to be dispatched
|
||||
*/
|
||||
THREAD_STATE_RUNNABLE,
|
||||
|
||||
/*
|
||||
* PURPOSE: Currently running
|
||||
*/
|
||||
THREAD_STATE_RUNNING,
|
||||
|
||||
/*
|
||||
* PURPOSE: Doesn't want to run
|
||||
*/
|
||||
THREAD_STATE_SLEEPING,
|
||||
|
||||
/*
|
||||
* Waiting to be freed
|
||||
*/
|
||||
THREAD_STATE_TERMINATED,
|
||||
};
|
||||
|
||||
NTSTATUS PsTerminateSystemThread(NTSTATUS ExitStatus);
|
||||
|
||||
/*
|
||||
* Functions the HAL must provide
|
||||
*/
|
||||
|
||||
void HalInitFirstTask(PTHREAD_OBJECT thread);
|
||||
void HalInitTask(PTHREAD_OBJECT thread, PKSTART_ROUTINE fn,
|
||||
PVOID StartContext);
|
||||
void HalTaskSwitch(PTHREAD_OBJECT thread);
|
||||
|
||||
#endif
|
||||
#ifndef __INCLUDE_INTERNAL_PSMGR_H
|
||||
#define __INCLUDE_INTERNAL_PSMGR_H
|
||||
|
||||
#include <internal/hal/hal.h>
|
||||
|
||||
void PsInitThreadManagment(void);
|
||||
|
||||
/*
|
||||
* PURPOSE: Thread states
|
||||
*/
|
||||
enum
|
||||
{
|
||||
/*
|
||||
* PURPOSE: Don't touch
|
||||
*/
|
||||
THREAD_STATE_INVALID,
|
||||
|
||||
/*
|
||||
* PURPOSE: Waiting to be dispatched
|
||||
*/
|
||||
THREAD_STATE_RUNNABLE,
|
||||
|
||||
/*
|
||||
* PURPOSE: Currently running
|
||||
*/
|
||||
THREAD_STATE_RUNNING,
|
||||
|
||||
/*
|
||||
* PURPOSE: Doesn't want to run
|
||||
*/
|
||||
THREAD_STATE_SUSPENDED,
|
||||
|
||||
/*
|
||||
* Waiting to be freed
|
||||
*/
|
||||
THREAD_STATE_TERMINATED,
|
||||
};
|
||||
|
||||
/*
|
||||
* Functions the HAL must provide
|
||||
*/
|
||||
|
||||
void HalInitFirstTask(PKTHREAD thread);
|
||||
BOOLEAN HalInitTask(PKTHREAD thread, PKSTART_ROUTINE fn,
|
||||
PVOID StartContext);
|
||||
void HalTaskSwitch(PKTHREAD thread);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -9,9 +9,9 @@
|
|||
#ifndef __VERSION_H
|
||||
#define __VERSION_H
|
||||
|
||||
#define KERNEL_VERSION "0.0.7"
|
||||
#define KERNEL_VERSION "0.0.8"
|
||||
#define KERNEL_MAJOR_VERSION 0
|
||||
#define KERNEL_MINOR_VERSION 0
|
||||
#define KERNEL_PATCH_LEVEL 7
|
||||
#define KERNEL_PATCH_LEVEL 8
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef i386
|
||||
#define PAGESIZE (4096)
|
||||
#endif
|
||||
/*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef i386
|
||||
#define PAGESIZE (4096)
|
||||
#endif
|
||||
|
|
|
@ -55,7 +55,7 @@ typedef unsigned long long u64;
|
|||
|
||||
typedef unsigned int size_t;
|
||||
typedef size_t __kernel_size_t;
|
||||
typedef unsigned short wchar_t;
|
||||
//typedef unsigned short wchar_t;
|
||||
|
||||
|
||||
#endif /* _LINUX_TYPES_H */
|
||||
|
|
|
@ -1,86 +1,92 @@
|
|||
/*
|
||||
windows.h
|
||||
|
||||
Include this file if you wish to use the Windows32 API Library
|
||||
|
||||
Copyright (C) 1996 Free Software Foundation
|
||||
|
||||
Author: Scott Christley <scottc@net-community.com>
|
||||
Date: 1996
|
||||
|
||||
This file is part of the Windows32 API Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
If you are interested in a warranty or support for this source code,
|
||||
contact Scott Christley <scottc@net-community.com> for more information.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; see the file COPYING.LIB.
|
||||
If not, write to the Free Software Foundation,
|
||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef _GNU_H_WINDOWS_H
|
||||
#define _GNU_H_WINDOWS_H
|
||||
|
||||
#ifndef RC_INVOKED
|
||||
#include <limits.h>
|
||||
#include <stdarg.h>
|
||||
#endif
|
||||
|
||||
/* Base definitions */
|
||||
#include <base.h>
|
||||
|
||||
/* WIN32 messages */
|
||||
#include <messages.h>
|
||||
|
||||
/* WIN32 definitions */
|
||||
#include <defines.h>
|
||||
|
||||
#ifndef RC_INVOKED
|
||||
|
||||
/* WIN32 structures */
|
||||
#include <structs.h>
|
||||
|
||||
/* WIN32 functions */
|
||||
#include <funcs.h>
|
||||
|
||||
#endif /* ! defined (RC_INVOKED) */
|
||||
|
||||
/* WIN32 error codes */
|
||||
#include <errors.h>
|
||||
|
||||
#ifndef RC_INVOKED
|
||||
|
||||
/* Windows sockets specification version 1.1 */
|
||||
#ifdef Win32_Winsock
|
||||
#include <sockets.h>
|
||||
#endif
|
||||
|
||||
/* There is a conflict with BOOL between Objective-C and Win32,
|
||||
so the Windows32 API Library defines and uses WINBOOL.
|
||||
However, if we are not using Objective-C then define the normal
|
||||
windows BOOL so Win32 programs compile normally. If you are
|
||||
using Objective-C then you must use WINBOOL for Win32 operations.
|
||||
*/
|
||||
#ifndef __OBJC__
|
||||
typedef WINBOOL BOOL;
|
||||
#endif /* !__OBJC__ */
|
||||
|
||||
/* How do we get the VM page size on NT? */
|
||||
#ifndef vm_page_size
|
||||
#define vm_page_size 4096
|
||||
#endif
|
||||
|
||||
#endif /* ! defined (RC_INVOKED) */
|
||||
|
||||
#endif /* _GNU_H_WINDOWS_H */
|
||||
/*
|
||||
windows.h
|
||||
|
||||
Include this file if you wish to use the Windows32 API Library
|
||||
|
||||
Copyright (C) 1996 Free Software Foundation
|
||||
|
||||
Author: Scott Christley <scottc@net-community.com>
|
||||
Date: 1996
|
||||
|
||||
This file is part of the Windows32 API Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
If you are interested in a warranty or support for this source code,
|
||||
contact Scott Christley <scottc@net-community.com> for more information.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; see the file COPYING.LIB.
|
||||
If not, write to the Free Software Foundation,
|
||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef _GNU_H_WINDOWS_H
|
||||
#define _GNU_H_WINDOWS_H
|
||||
|
||||
#ifndef RC_INVOKED
|
||||
#include <limits.h>
|
||||
#include <stdarg.h>
|
||||
#endif
|
||||
|
||||
/* Base definitions */
|
||||
#include <base.h>
|
||||
|
||||
/* WIN32 messages */
|
||||
#ifndef _WIN32_LEAN_AND_MEAN
|
||||
#include <messages.h>
|
||||
#endif
|
||||
|
||||
/* WIN32 definitions */
|
||||
#include <defines.h>
|
||||
|
||||
#ifndef RC_INVOKED
|
||||
|
||||
/* WIN32 structures */
|
||||
#include <structs.h>
|
||||
|
||||
/* WIN32 functions */
|
||||
#ifndef _WIN32_LEAN_AND_MEAN
|
||||
#include <funcs.h>
|
||||
#endif
|
||||
|
||||
#endif /* ! defined (RC_INVOKED) */
|
||||
|
||||
/* WIN32 error codes */
|
||||
#include <errors.h>
|
||||
|
||||
#ifndef RC_INVOKED
|
||||
|
||||
/* Windows sockets specification version 1.1 */
|
||||
#ifdef Win32_Winsock
|
||||
#ifndef _WIN32_LEAN_AND_MEAN
|
||||
#include <sockets.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* There is a conflict with BOOL between Objective-C and Win32,
|
||||
so the Windows32 API Library defines and uses WINBOOL.
|
||||
However, if we are not using Objective-C then define the normal
|
||||
windows BOOL so Win32 programs compile normally. If you are
|
||||
using Objective-C then you must use WINBOOL for Win32 operations.
|
||||
*/
|
||||
#ifndef __OBJC__
|
||||
typedef WINBOOL BOOL;
|
||||
#endif /* !__OBJC__ */
|
||||
|
||||
/* How do we get the VM page size on NT? */
|
||||
#ifndef vm_page_size
|
||||
#define vm_page_size 4096
|
||||
#endif
|
||||
|
||||
#endif /* ! defined (RC_INVOKED) */
|
||||
|
||||
#endif /* _GNU_H_WINDOWS_H */
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
|
||||
#include <types.h> /* for size_t */
|
||||
|
||||
typedef unsigned short wchar_t;
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL ((void *) 0)
|
||||
#endif
|
||||
|
@ -38,8 +40,8 @@ extern int wcsnicmp(const wchar_t* cs,const wchar_t * ct, size_t count);
|
|||
/*
|
||||
* Include machine specific inline routines
|
||||
*/
|
||||
#ifndef _I386_STRING_H_
|
||||
#define _I386_STRING_H_
|
||||
//#ifndef _I386_STRING_H_
|
||||
//#define _I386_STRING_H_
|
||||
|
||||
/*
|
||||
* On a 486 or Pentium, we are better off not using the
|
||||
|
@ -70,7 +72,7 @@ extern int wcsnicmp(const wchar_t* cs,const wchar_t * ct, size_t count);
|
|||
|
||||
|
||||
#define __HAVE_ARCH_WCSCPY
|
||||
inline wchar_t * wcscpy(wchar_t * dest,const wchar_t *src)
|
||||
extern inline wchar_t * wcscpy(wchar_t * dest,const wchar_t *src)
|
||||
{
|
||||
__asm__ __volatile__(
|
||||
"cld\n"
|
||||
|
@ -524,7 +526,7 @@ __asm__ __volatile__(
|
|||
return __res;
|
||||
}
|
||||
|
||||
#endif
|
||||
//#endif
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -1,320 +1,320 @@
|
|||
/*
|
||||
* Win32 Global/Local heap functions (GlobalXXX, LocalXXX).
|
||||
* These functions included in Win32 for compatibility with 16 bit Windows
|
||||
* Especially the moveable blocks and handles are oldish.
|
||||
* But the ability to directly allocate memory with GPTR and LPTR is widely
|
||||
* used.
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#define MAGIC_GLOBAL_USED 0x5342BEEF
|
||||
#define GLOBAL_LOCK_MAX 0xFF
|
||||
|
||||
typedef struct __GLOBAL_LOCAL_HANDLE
|
||||
{
|
||||
ULONG Magic;
|
||||
LPVOID Pointer;
|
||||
BYTE Flags;
|
||||
BYTE LockCount;
|
||||
} GLOBAL_HANDLE, LOCAL_HANDLE, *PGLOBAL_HANDLE, *PLOCAL_HANDLE;
|
||||
|
||||
/*********************************************************************
|
||||
* GlobalAlloc -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
HGLOBAL WINAPI GlobalAlloc(UINT flags, DWORD size)
|
||||
{
|
||||
PGLOBAL_HANDLE phandle;
|
||||
LPVOID palloc;
|
||||
|
||||
aprintf("GlobalAlloc( 0x%X, 0x%lX )\n", flags, size );
|
||||
|
||||
if((flags & GMEM_MOVEABLE)==0) /* POINTER */
|
||||
{
|
||||
palloc=HeapAlloc(__ProcessHeap, 0, size);
|
||||
return (HGLOBAL) palloc;
|
||||
}
|
||||
else /* HANDLE */
|
||||
{
|
||||
HeapLock(__ProcessHeap);
|
||||
|
||||
|
||||
phandle=__HeapAllocFragment(__ProcessHeap, 0, sizeof(GLOBAL_HANDLE));
|
||||
if(size)
|
||||
{
|
||||
palloc=HeapAlloc(__ProcessHeap, 0, size+sizeof(HANDLE));
|
||||
*(PHANDLE)palloc=(HANDLE) &(phandle->Pointer);
|
||||
phandle->Pointer=palloc+sizeof(HANDLE);
|
||||
}
|
||||
else
|
||||
phandle->Pointer=NULL;
|
||||
phandle->Magic=MAGIC_GLOBAL_USED;
|
||||
phandle->Flags=flags>>8;
|
||||
phandle->LockCount=0;
|
||||
HeapUnlock(__ProcessHeap);
|
||||
|
||||
return (HGLOBAL) &(phandle->Pointer);
|
||||
}
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* GlobalLock -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
LPVOID WINAPI GlobalLock(HGLOBAL hmem)
|
||||
{
|
||||
PGLOBAL_HANDLE phandle;
|
||||
LPVOID palloc;
|
||||
|
||||
aprintf("GlobalLock( 0x%lX )\n", (ULONG) hmem );
|
||||
|
||||
if(((ULONG)hmem%8)==0)
|
||||
return (LPVOID) hmem;
|
||||
|
||||
HeapLock(__ProcessHeap);
|
||||
phandle=(PGLOBAL_HANDLE)(((LPVOID) hmem)-4);
|
||||
if(phandle->Magic==MAGIC_GLOBAL_USED)
|
||||
{
|
||||
if(phandle->LockCount<GLOBAL_LOCK_MAX)
|
||||
phandle->LockCount++;
|
||||
palloc=phandle->Pointer;
|
||||
}
|
||||
else
|
||||
{
|
||||
dprintf("GlobalLock: invalid handle\n");
|
||||
palloc=(LPVOID) hmem;
|
||||
}
|
||||
HeapUnlock(__ProcessHeap);
|
||||
return palloc;
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* GlobalUnlock -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
BOOL WINAPI GlobalUnlock(HGLOBAL hmem)
|
||||
{
|
||||
PGLOBAL_HANDLE phandle;
|
||||
BOOL locked;
|
||||
|
||||
aprintf("GlobalUnlock( 0x%lX )\n", (ULONG) hmem );
|
||||
|
||||
if(((ULONG)hmem%8)==0)
|
||||
return FALSE;
|
||||
|
||||
HeapLock(__ProcessHeap);
|
||||
phandle=(PGLOBAL_HANDLE)(((LPVOID) hmem)-4);
|
||||
if(phandle->Magic==MAGIC_GLOBAL_USED)
|
||||
{
|
||||
if((phandle->LockCount<GLOBAL_LOCK_MAX)&&(phandle->LockCount>0))
|
||||
phandle->LockCount--;
|
||||
|
||||
locked=(phandle->LockCount==0) ? TRUE : FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
dprintf("GlobalUnlock: invalid handle\n");
|
||||
locked=FALSE;
|
||||
}
|
||||
HeapUnlock(__ProcessHeap);
|
||||
return locked;
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* GlobalHandle -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
HGLOBAL WINAPI GlobalHandle(LPCVOID pmem)
|
||||
{
|
||||
aprintf("GlobalHandle( 0x%lX )\n", (ULONG) pmem );
|
||||
|
||||
if(((ULONG)pmem%8)==0) /* FIXED */
|
||||
return (HGLOBAL) pmem;
|
||||
else /* MOVEABLE */
|
||||
return (HGLOBAL) *(LPVOID *)(pmem-sizeof(HANDLE));
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* GlobalReAlloc -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
HGLOBAL WINAPI GlobalReAlloc(HGLOBAL hmem, DWORD size, UINT flags)
|
||||
{
|
||||
LPVOID palloc;
|
||||
HGLOBAL hnew;
|
||||
PGLOBAL_HANDLE phandle;
|
||||
|
||||
aprintf("GlobalReAlloc( 0x%lX, 0x%lX, 0x%X )\n", (ULONG) hmem, size, flags );
|
||||
|
||||
hnew=NULL;
|
||||
HeapLock(__ProcessHeap);
|
||||
if(flags & GMEM_MODIFY) /* modify flags */
|
||||
{
|
||||
if( (((ULONG)hmem%8)==0) && (flags & GMEM_MOVEABLE))
|
||||
{
|
||||
/* make a fixed block moveable
|
||||
* actually only NT is able to do this. And it's soo simple
|
||||
*/
|
||||
size=HeapSize(__ProcessHeap, 0, (LPVOID) hmem);
|
||||
hnew=GlobalAlloc( flags, size);
|
||||
palloc=GlobalLock(hnew);
|
||||
memcpy(palloc, (LPVOID) hmem, size);
|
||||
GlobalUnlock(hnew);
|
||||
GlobalFree(hmem);
|
||||
}
|
||||
else if((((ULONG)hmem%8) != 0)&&(flags & GMEM_DISCARDABLE))
|
||||
{
|
||||
/* change the flags to make our block "discardable" */
|
||||
phandle=(PGLOBAL_HANDLE)(((LPVOID) hmem)-4);
|
||||
phandle->Flags = phandle->Flags | (GMEM_DISCARDABLE >> 8);
|
||||
hnew=hmem;
|
||||
}
|
||||
else
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
hnew=NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(((ULONG)hmem%8)!=0)
|
||||
{
|
||||
/* reallocate fixed memory */
|
||||
hnew=(HANDLE)HeapReAlloc(__ProcessHeap, 0, (LPVOID) hmem, size);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* reallocate a moveable block */
|
||||
phandle=(PGLOBAL_HANDLE)(((LPVOID) hmem)-4);
|
||||
if(phandle->LockCount!=0)
|
||||
SetLastError(ERROR_INVALID_HANDLE);
|
||||
else if(size!=0)
|
||||
{
|
||||
hnew=hmem;
|
||||
if(phandle->Pointer)
|
||||
{
|
||||
palloc=HeapReAlloc(__ProcessHeap, 0,
|
||||
phandle->Pointer-sizeof(HANDLE),
|
||||
size+sizeof(HANDLE) );
|
||||
phandle->Pointer=palloc+sizeof(HANDLE);
|
||||
}
|
||||
else
|
||||
{
|
||||
palloc=HeapAlloc(__ProcessHeap, 0, size+sizeof(HANDLE));
|
||||
*(PHANDLE)palloc=hmem;
|
||||
phandle->Pointer=palloc+sizeof(HANDLE);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(phandle->Pointer)
|
||||
{
|
||||
HeapFree(__ProcessHeap, 0, phandle->Pointer-sizeof(HANDLE));
|
||||
phandle->Pointer=NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
HeapUnlock(__ProcessHeap);
|
||||
return hnew;
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* GlobalFree -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
HGLOBAL WINAPI GlobalFree(HGLOBAL hmem)
|
||||
{
|
||||
PGLOBAL_HANDLE phandle;
|
||||
|
||||
aprintf("GlobalFree( 0x%lX )\n", (ULONG) hmem );
|
||||
|
||||
if(((ULONG)hmem%4)==0) /* POINTER */
|
||||
{
|
||||
HeapFree(__ProcessHeap, 0, (LPVOID) hmem);
|
||||
}
|
||||
else /* HANDLE */
|
||||
{
|
||||
HeapLock(__ProcessHeap);
|
||||
phandle=(PGLOBAL_HANDLE)(((LPVOID) hmem)-4);
|
||||
if(phandle->Magic==MAGIC_GLOBAL_USED)
|
||||
{
|
||||
HeapLock(__ProcessHeap);
|
||||
if(phandle->LockCount!=0)
|
||||
SetLastError(ERROR_INVALID_HANDLE);
|
||||
if(phandle->Pointer)
|
||||
HeapFree(__ProcessHeap, 0, phandle->Pointer-sizeof(HANDLE));
|
||||
__HeapFreeFragment(__ProcessHeap, 0, phandle);
|
||||
}
|
||||
HeapUnlock(__ProcessHeap);
|
||||
}
|
||||
return hmem;
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* GlobalSize -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
DWORD WINAPI GlobalSize(HGLOBAL hmem)
|
||||
{
|
||||
DWORD retval;
|
||||
PGLOBAL_HANDLE phandle;
|
||||
|
||||
aprintf("GlobalSize( 0x%lX )\n", (ULONG) hmem );
|
||||
|
||||
if(((ULONG)hmem%8)==0)
|
||||
{
|
||||
retval=HeapSize(__ProcessHeap, 0, hmem);
|
||||
}
|
||||
else
|
||||
{
|
||||
HeapLock(__ProcessHeap);
|
||||
phandle=(PGLOBAL_HANDLE)(((LPVOID) hmem)-4);
|
||||
if(phandle->Magic==MAGIC_GLOBAL_USED)
|
||||
{
|
||||
retval=HeapSize(__ProcessHeap, 0, (phandle->Pointer)-sizeof(HANDLE))-4;
|
||||
}
|
||||
else
|
||||
{
|
||||
dprintf("GlobalSize: invalid handle\n");
|
||||
retval=0;
|
||||
}
|
||||
HeapUnlock(__ProcessHeap);
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* GlobalWire -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
LPVOID WINAPI GlobalWire(HGLOBAL hmem)
|
||||
{
|
||||
return GlobalLock( hmem );
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* GlobalUnWire -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
BOOL WINAPI GlobalUnWire(HGLOBAL hmem)
|
||||
{
|
||||
return GlobalUnlock( hmem);
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* GlobalFix -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
VOID WINAPI GlobalFix(HGLOBAL hmem)
|
||||
{
|
||||
GlobalLock( hmem );
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* GlobalUnfix -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
VOID WINAPI GlobalUnfix(HGLOBAL hmem)
|
||||
{
|
||||
GlobalUnlock( hmem);
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* GlobalFlags -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
UINT WINAPI GlobalFlags(HGLOBAL hmem)
|
||||
{
|
||||
return LocalFlags( (HLOCAL) hmem);
|
||||
}
|
||||
|
||||
/*
|
||||
* Win32 Global/Local heap functions (GlobalXXX, LocalXXX).
|
||||
* These functions included in Win32 for compatibility with 16 bit Windows
|
||||
* Especially the moveable blocks and handles are oldish.
|
||||
* But the ability to directly allocate memory with GPTR and LPTR is widely
|
||||
* used.
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#define MAGIC_GLOBAL_USED 0x5342BEEF
|
||||
#define GLOBAL_LOCK_MAX 0xFF
|
||||
|
||||
typedef struct __GLOBAL_LOCAL_HANDLE
|
||||
{
|
||||
ULONG Magic;
|
||||
LPVOID Pointer;
|
||||
BYTE Flags;
|
||||
BYTE LockCount;
|
||||
} GLOBAL_HANDLE, LOCAL_HANDLE, *PGLOBAL_HANDLE, *PLOCAL_HANDLE;
|
||||
|
||||
/*********************************************************************
|
||||
* GlobalAlloc -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
HGLOBAL WINAPI GlobalAlloc(UINT flags, DWORD size)
|
||||
{
|
||||
PGLOBAL_HANDLE phandle;
|
||||
LPVOID palloc;
|
||||
|
||||
aprintf("GlobalAlloc( 0x%X, 0x%lX )\n", flags, size );
|
||||
|
||||
if((flags & GMEM_MOVEABLE)==0) /* POINTER */
|
||||
{
|
||||
palloc=HeapAlloc(__ProcessHeap, 0, size);
|
||||
return (HGLOBAL) palloc;
|
||||
}
|
||||
else /* HANDLE */
|
||||
{
|
||||
HeapLock(__ProcessHeap);
|
||||
|
||||
|
||||
phandle=__HeapAllocFragment(__ProcessHeap, 0, sizeof(GLOBAL_HANDLE));
|
||||
if(size)
|
||||
{
|
||||
palloc=HeapAlloc(__ProcessHeap, 0, size+sizeof(HANDLE));
|
||||
*(PHANDLE)palloc=(HANDLE) &(phandle->Pointer);
|
||||
phandle->Pointer=palloc+sizeof(HANDLE);
|
||||
}
|
||||
else
|
||||
phandle->Pointer=NULL;
|
||||
phandle->Magic=MAGIC_GLOBAL_USED;
|
||||
phandle->Flags=flags>>8;
|
||||
phandle->LockCount=0;
|
||||
HeapUnlock(__ProcessHeap);
|
||||
|
||||
return (HGLOBAL) &(phandle->Pointer);
|
||||
}
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* GlobalLock -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
LPVOID WINAPI GlobalLock(HGLOBAL hmem)
|
||||
{
|
||||
PGLOBAL_HANDLE phandle;
|
||||
LPVOID palloc;
|
||||
|
||||
aprintf("GlobalLock( 0x%lX )\n", (ULONG) hmem );
|
||||
|
||||
if(((ULONG)hmem%8)==0)
|
||||
return (LPVOID) hmem;
|
||||
|
||||
HeapLock(__ProcessHeap);
|
||||
phandle=(PGLOBAL_HANDLE)(((LPVOID) hmem)-4);
|
||||
if(phandle->Magic==MAGIC_GLOBAL_USED)
|
||||
{
|
||||
if(phandle->LockCount<GLOBAL_LOCK_MAX)
|
||||
phandle->LockCount++;
|
||||
palloc=phandle->Pointer;
|
||||
}
|
||||
else
|
||||
{
|
||||
dprintf("GlobalLock: invalid handle\n");
|
||||
palloc=(LPVOID) hmem;
|
||||
}
|
||||
HeapUnlock(__ProcessHeap);
|
||||
return palloc;
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* GlobalUnlock -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
BOOL WINAPI GlobalUnlock(HGLOBAL hmem)
|
||||
{
|
||||
PGLOBAL_HANDLE phandle;
|
||||
BOOL locked;
|
||||
|
||||
aprintf("GlobalUnlock( 0x%lX )\n", (ULONG) hmem );
|
||||
|
||||
if(((ULONG)hmem%8)==0)
|
||||
return FALSE;
|
||||
|
||||
HeapLock(__ProcessHeap);
|
||||
phandle=(PGLOBAL_HANDLE)(((LPVOID) hmem)-4);
|
||||
if(phandle->Magic==MAGIC_GLOBAL_USED)
|
||||
{
|
||||
if((phandle->LockCount<GLOBAL_LOCK_MAX)&&(phandle->LockCount>0))
|
||||
phandle->LockCount--;
|
||||
|
||||
locked=(phandle->LockCount==0) ? TRUE : FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
dprintf("GlobalUnlock: invalid handle\n");
|
||||
locked=FALSE;
|
||||
}
|
||||
HeapUnlock(__ProcessHeap);
|
||||
return locked;
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* GlobalHandle -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
HGLOBAL WINAPI GlobalHandle(LPCVOID pmem)
|
||||
{
|
||||
aprintf("GlobalHandle( 0x%lX )\n", (ULONG) pmem );
|
||||
|
||||
if(((ULONG)pmem%8)==0) /* FIXED */
|
||||
return (HGLOBAL) pmem;
|
||||
else /* MOVEABLE */
|
||||
return (HGLOBAL) *(LPVOID *)(pmem-sizeof(HANDLE));
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* GlobalReAlloc -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
HGLOBAL WINAPI GlobalReAlloc(HGLOBAL hmem, DWORD size, UINT flags)
|
||||
{
|
||||
LPVOID palloc;
|
||||
HGLOBAL hnew;
|
||||
PGLOBAL_HANDLE phandle;
|
||||
|
||||
aprintf("GlobalReAlloc( 0x%lX, 0x%lX, 0x%X )\n", (ULONG) hmem, size, flags );
|
||||
|
||||
hnew=NULL;
|
||||
HeapLock(__ProcessHeap);
|
||||
if(flags & GMEM_MODIFY) /* modify flags */
|
||||
{
|
||||
if( (((ULONG)hmem%8)==0) && (flags & GMEM_MOVEABLE))
|
||||
{
|
||||
/* make a fixed block moveable
|
||||
* actually only NT is able to do this. And it's soo simple
|
||||
*/
|
||||
size=HeapSize(__ProcessHeap, 0, (LPVOID) hmem);
|
||||
hnew=GlobalAlloc( flags, size);
|
||||
palloc=GlobalLock(hnew);
|
||||
memcpy(palloc, (LPVOID) hmem, size);
|
||||
GlobalUnlock(hnew);
|
||||
GlobalFree(hmem);
|
||||
}
|
||||
else if((((ULONG)hmem%8) != 0)&&(flags & GMEM_DISCARDABLE))
|
||||
{
|
||||
/* change the flags to make our block "discardable" */
|
||||
phandle=(PGLOBAL_HANDLE)(((LPVOID) hmem)-4);
|
||||
phandle->Flags = phandle->Flags | (GMEM_DISCARDABLE >> 8);
|
||||
hnew=hmem;
|
||||
}
|
||||
else
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
hnew=NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(((ULONG)hmem%8)!=0)
|
||||
{
|
||||
/* reallocate fixed memory */
|
||||
hnew=(HANDLE)HeapReAlloc(__ProcessHeap, 0, (LPVOID) hmem, size);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* reallocate a moveable block */
|
||||
phandle=(PGLOBAL_HANDLE)(((LPVOID) hmem)-4);
|
||||
if(phandle->LockCount!=0)
|
||||
SetLastError(ERROR_INVALID_HANDLE);
|
||||
else if(size!=0)
|
||||
{
|
||||
hnew=hmem;
|
||||
if(phandle->Pointer)
|
||||
{
|
||||
palloc=HeapReAlloc(__ProcessHeap, 0,
|
||||
phandle->Pointer-sizeof(HANDLE),
|
||||
size+sizeof(HANDLE) );
|
||||
phandle->Pointer=palloc+sizeof(HANDLE);
|
||||
}
|
||||
else
|
||||
{
|
||||
palloc=HeapAlloc(__ProcessHeap, 0, size+sizeof(HANDLE));
|
||||
*(PHANDLE)palloc=hmem;
|
||||
phandle->Pointer=palloc+sizeof(HANDLE);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(phandle->Pointer)
|
||||
{
|
||||
HeapFree(__ProcessHeap, 0, phandle->Pointer-sizeof(HANDLE));
|
||||
phandle->Pointer=NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
HeapUnlock(__ProcessHeap);
|
||||
return hnew;
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* GlobalFree -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
HGLOBAL WINAPI GlobalFree(HGLOBAL hmem)
|
||||
{
|
||||
PGLOBAL_HANDLE phandle;
|
||||
|
||||
aprintf("GlobalFree( 0x%lX )\n", (ULONG) hmem );
|
||||
|
||||
if(((ULONG)hmem%4)==0) /* POINTER */
|
||||
{
|
||||
HeapFree(__ProcessHeap, 0, (LPVOID) hmem);
|
||||
}
|
||||
else /* HANDLE */
|
||||
{
|
||||
HeapLock(__ProcessHeap);
|
||||
phandle=(PGLOBAL_HANDLE)(((LPVOID) hmem)-4);
|
||||
if(phandle->Magic==MAGIC_GLOBAL_USED)
|
||||
{
|
||||
HeapLock(__ProcessHeap);
|
||||
if(phandle->LockCount!=0)
|
||||
SetLastError(ERROR_INVALID_HANDLE);
|
||||
if(phandle->Pointer)
|
||||
HeapFree(__ProcessHeap, 0, phandle->Pointer-sizeof(HANDLE));
|
||||
__HeapFreeFragment(__ProcessHeap, 0, phandle);
|
||||
}
|
||||
HeapUnlock(__ProcessHeap);
|
||||
}
|
||||
return hmem;
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* GlobalSize -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
DWORD WINAPI GlobalSize(HGLOBAL hmem)
|
||||
{
|
||||
DWORD retval;
|
||||
PGLOBAL_HANDLE phandle;
|
||||
|
||||
aprintf("GlobalSize( 0x%lX )\n", (ULONG) hmem );
|
||||
|
||||
if(((ULONG)hmem%8)==0)
|
||||
{
|
||||
retval=HeapSize(__ProcessHeap, 0, hmem);
|
||||
}
|
||||
else
|
||||
{
|
||||
HeapLock(__ProcessHeap);
|
||||
phandle=(PGLOBAL_HANDLE)(((LPVOID) hmem)-4);
|
||||
if(phandle->Magic==MAGIC_GLOBAL_USED)
|
||||
{
|
||||
retval=HeapSize(__ProcessHeap, 0, (phandle->Pointer)-sizeof(HANDLE))-4;
|
||||
}
|
||||
else
|
||||
{
|
||||
dprintf("GlobalSize: invalid handle\n");
|
||||
retval=0;
|
||||
}
|
||||
HeapUnlock(__ProcessHeap);
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* GlobalWire -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
LPVOID WINAPI GlobalWire(HGLOBAL hmem)
|
||||
{
|
||||
return GlobalLock( hmem );
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* GlobalUnWire -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
BOOL WINAPI GlobalUnWire(HGLOBAL hmem)
|
||||
{
|
||||
return GlobalUnlock( hmem);
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* GlobalFix -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
VOID WINAPI GlobalFix(HGLOBAL hmem)
|
||||
{
|
||||
GlobalLock( hmem );
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* GlobalUnfix -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
VOID WINAPI GlobalUnfix(HGLOBAL hmem)
|
||||
{
|
||||
GlobalUnlock( hmem);
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* GlobalFlags -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
UINT WINAPI GlobalFlags(HGLOBAL hmem)
|
||||
{
|
||||
return LocalFlags( (HLOCAL) hmem);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,123 +1,123 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* Copyright (C) 1996, Onno Hovers, All rights reserved
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/kernel32/mem/local.cc
|
||||
* PURPOSE: Manages the local heap
|
||||
* PROGRAMER: Onno Hovers (original wfc version)
|
||||
* David Welch (adapted for ReactOS)
|
||||
* UPDATE HISTORY:
|
||||
* 9/4/98: Adapted from the wfc project
|
||||
*/
|
||||
|
||||
|
||||
/* NOTES
|
||||
*
|
||||
* The local heap is the same as the global heap for win32 and both are only
|
||||
* required for legacy apps
|
||||
*
|
||||
*/
|
||||
|
||||
/* INCLUDES ****************************************************************/
|
||||
|
||||
#include <windows.h>
|
||||
#include <kernel32/heap.h>
|
||||
|
||||
/* FUNCTIONS ***************************************************************/
|
||||
|
||||
/*********************************************************************
|
||||
* LocalFlags -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
UINT WINAPI LocalFlags(HLOCAL hmem)
|
||||
{
|
||||
DWORD retval;
|
||||
PGLOBAL_HANDLE phandle;
|
||||
|
||||
if(((ULONG)hmem%8)==0)
|
||||
{
|
||||
retval=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
HeapLock(__ProcessHeap);
|
||||
phandle=(PGLOBAL_HANDLE)(((LPVOID) hmem)-4);
|
||||
if(phandle->Magic==MAGIC_GLOBAL_USED)
|
||||
{
|
||||
retval=phandle->LockCount + (phandle->Flags<<8);
|
||||
if(phandle->Pointer==0)
|
||||
retval|= LMEM_DISCARDED;
|
||||
}
|
||||
else
|
||||
{
|
||||
dprintf("GlobalSize: invalid handle\n");
|
||||
retval=0;
|
||||
}
|
||||
HeapUnlock(__ProcessHeap);
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
/*********************************************************************
|
||||
* LocalAlloc -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
HLOCAL WINAPI LocalAlloc(UINT flags, UINT size)
|
||||
{
|
||||
return (HLOCAL) GlobalAlloc( flags, size );
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* LocalLock -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
LPVOID WINAPI LocalLock(HLOCAL hmem)
|
||||
{
|
||||
return GlobalLock( (HGLOBAL) hmem );
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* LocalUnlock -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
BOOL WINAPI LocalUnlock(HLOCAL hmem)
|
||||
{
|
||||
return GlobalUnlock( (HGLOBAL) hmem);
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* LocalHandle -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
HLOCAL WINAPI LocalHandle(LPCVOID pmem)
|
||||
{
|
||||
return (HLOCAL) GlobalHandle(pmem);
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* LocalReAlloc -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
HLOCAL WINAPI LocalReAlloc(HLOCAL hmem, UINT size, UINT flags)
|
||||
{
|
||||
return (HLOCAL) GlobalReAlloc( (HGLOBAL) hmem, size, flags);
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* LocalFree -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
HLOCAL WINAPI LocalFree(HLOCAL hmem)
|
||||
{
|
||||
return (HLOCAL) GlobalFree( (HGLOBAL) hmem );
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* LocalSize -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
UINT WINAPI LocalSize(HLOCAL hmem)
|
||||
{
|
||||
return GlobalSize( (HGLOBAL) hmem );
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* LocalShrink -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
UINT WINAPI LocalShrink(HLOCAL hmem, UINT newsize)
|
||||
{
|
||||
return (__ProcessHeap->End - (LPVOID) __ProcessHeap);
|
||||
}
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* Copyright (C) 1996, Onno Hovers, All rights reserved
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/kernel32/mem/local.cc
|
||||
* PURPOSE: Manages the local heap
|
||||
* PROGRAMER: Onno Hovers (original wfc version)
|
||||
* David Welch (adapted for ReactOS)
|
||||
* UPDATE HISTORY:
|
||||
* 9/4/98: Adapted from the wfc project
|
||||
*/
|
||||
|
||||
|
||||
/* NOTES
|
||||
*
|
||||
* The local heap is the same as the global heap for win32 and both are only
|
||||
* required for legacy apps
|
||||
*
|
||||
*/
|
||||
|
||||
/* INCLUDES ****************************************************************/
|
||||
|
||||
#include <windows.h>
|
||||
#include <kernel32/heap.h>
|
||||
|
||||
/* FUNCTIONS ***************************************************************/
|
||||
|
||||
/*********************************************************************
|
||||
* LocalFlags -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
UINT WINAPI LocalFlags(HLOCAL hmem)
|
||||
{
|
||||
DWORD retval;
|
||||
PGLOBAL_HANDLE phandle;
|
||||
|
||||
if(((ULONG)hmem%8)==0)
|
||||
{
|
||||
retval=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
HeapLock(__ProcessHeap);
|
||||
phandle=(PGLOBAL_HANDLE)(((LPVOID) hmem)-4);
|
||||
if(phandle->Magic==MAGIC_GLOBAL_USED)
|
||||
{
|
||||
retval=phandle->LockCount + (phandle->Flags<<8);
|
||||
if(phandle->Pointer==0)
|
||||
retval|= LMEM_DISCARDED;
|
||||
}
|
||||
else
|
||||
{
|
||||
dprintf("GlobalSize: invalid handle\n");
|
||||
retval=0;
|
||||
}
|
||||
HeapUnlock(__ProcessHeap);
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
/*********************************************************************
|
||||
* LocalAlloc -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
HLOCAL WINAPI LocalAlloc(UINT flags, UINT size)
|
||||
{
|
||||
return (HLOCAL) GlobalAlloc( flags, size );
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* LocalLock -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
LPVOID WINAPI LocalLock(HLOCAL hmem)
|
||||
{
|
||||
return GlobalLock( (HGLOBAL) hmem );
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* LocalUnlock -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
BOOL WINAPI LocalUnlock(HLOCAL hmem)
|
||||
{
|
||||
return GlobalUnlock( (HGLOBAL) hmem);
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* LocalHandle -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
HLOCAL WINAPI LocalHandle(LPCVOID pmem)
|
||||
{
|
||||
return (HLOCAL) GlobalHandle(pmem);
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* LocalReAlloc -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
HLOCAL WINAPI LocalReAlloc(HLOCAL hmem, UINT size, UINT flags)
|
||||
{
|
||||
return (HLOCAL) GlobalReAlloc( (HGLOBAL) hmem, size, flags);
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* LocalFree -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
HLOCAL WINAPI LocalFree(HLOCAL hmem)
|
||||
{
|
||||
return (HLOCAL) GlobalFree( (HGLOBAL) hmem );
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* LocalSize -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
UINT WINAPI LocalSize(HLOCAL hmem)
|
||||
{
|
||||
return GlobalSize( (HGLOBAL) hmem );
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* LocalShrink -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
UINT WINAPI LocalShrink(HLOCAL hmem, UINT newsize)
|
||||
{
|
||||
return (__ProcessHeap->End - (LPVOID) __ProcessHeap);
|
||||
}
|
||||
|
|
|
@ -8,12 +8,7 @@ todo: improve debug info
|
|||
#include <thread.h>
|
||||
|
||||
|
||||
WINBASEAPI
|
||||
BOOL
|
||||
WINAPI
|
||||
SwitchToThread(
|
||||
VOID
|
||||
)
|
||||
WINBASEAPI BOOL WINAPI SwitchToThread(VOID )
|
||||
{
|
||||
return NtYieldExecution();
|
||||
}
|
||||
|
@ -80,4 +75,4 @@ TlsSetValue(DWORD dwTlsIndex, LPVOID lpTlsValue)
|
|||
return (FALSE);
|
||||
}
|
||||
|
||||
/*************************************************************/
|
||||
/*************************************************************/
|
||||
|
|
Binary file not shown.
|
@ -3,7 +3,7 @@
|
|||
* PROJECT: ReactOS version of ntdll
|
||||
* FILE: lib/ntdll/genntdll.c
|
||||
* PURPOSE: Generates the system call stubs in ntdll
|
||||
* PROGRAMMER: David Welch (welch@welch)
|
||||
* PROGRAMMER: David Welch (welch@mcmail.com)
|
||||
*/
|
||||
|
||||
/* INCLUDE ******************************************************************/
|
||||
|
@ -19,12 +19,11 @@ int process(FILE* in, FILE* out)
|
|||
char* s;
|
||||
char* name;
|
||||
char* value;
|
||||
char* nr_args;
|
||||
|
||||
fprintf(out,"; Machine generated, don't edit\n");
|
||||
fprintf(out,"\n\n");
|
||||
|
||||
fprintf(out,"/*\n");
|
||||
fprintf(out," * Machine generated, don't edit\n");
|
||||
fprintf(out," */\n\n");
|
||||
fprintf(out,"#include <ntdll/napi.h>\n\n");
|
||||
|
||||
while (!feof(in) && fgets(line,255,in)!=NULL)
|
||||
{
|
||||
fgets(line,255,in);
|
||||
|
@ -37,12 +36,15 @@ int process(FILE* in, FILE* out)
|
|||
{
|
||||
name = strtok(s," \t");
|
||||
value = strtok(NULL," \t");
|
||||
printf("name %s value %s\n",name,value);
|
||||
nr_args = strtok(NULL," \t");
|
||||
|
||||
fprintf(out,"NTSTATUS %s(UCHAR first_arg)\n",name);
|
||||
fprintf(out,"{\n");
|
||||
fprintf(out,"\tMAKE_NTAPI_CALL(%s,first_arg);\n",value);
|
||||
fprintf(out,"}\n");
|
||||
// printf("name %s value %s\n",name,value);
|
||||
|
||||
fprintf(out,"%s:\n",name);
|
||||
fprintf(out,"\tmov\teax,%s\n",value);
|
||||
fprintf(out,"\tlea\tedx,[esp+4]\n");
|
||||
fprintf(out,"\tint\t2Eh\n");
|
||||
fprintf(out,"\tret\t%s\n\n",nr_args);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Binary file not shown.
|
@ -1,196 +1,196 @@
|
|||
; To save space, functions that are just called once are
|
||||
; implemented as macros instead. Four bytes are saved by
|
||||
; avoiding the call / ret instructions.
|
||||
|
||||
|
||||
; FINDFILE: Searches for the file in the root directory.
|
||||
;
|
||||
; Returns:
|
||||
;
|
||||
; If file not found: CF set
|
||||
;
|
||||
; If file found: CF clear
|
||||
; AX = first cluster of file
|
||||
|
||||
|
||||
%macro FINDFILE 0
|
||||
; First, read the whole root directory
|
||||
; into the temporary buffer.
|
||||
|
||||
mov ax, word root_dir_start
|
||||
mov dx, word root_dir_start_hi
|
||||
mov di, nRootDir
|
||||
xor bx, bx
|
||||
mov es, tempbuf
|
||||
call readDisk
|
||||
jc ffDone
|
||||
|
||||
xor di, di
|
||||
|
||||
next_entry: mov cx, 11
|
||||
mov si, filename+7c00h
|
||||
push di
|
||||
repe cmpsb
|
||||
pop di
|
||||
mov ax, [es:di+1ah] ; get cluster number from directory entry
|
||||
clc
|
||||
je ffDone
|
||||
|
||||
add di, 20h ; go to next directory entry
|
||||
cmp byte [es:di], 0 ; if the first byte of the name is 0,
|
||||
jnz next_entry ; there is no more files in the directory
|
||||
|
||||
stc
|
||||
ffDone:
|
||||
%endmacro
|
||||
|
||||
; GETDRIVEPARMS: Calculate start of some disk areas.
|
||||
|
||||
%macro GETDRIVEPARMS 0
|
||||
mov si, word nHidden
|
||||
mov di, word nHidden_hi
|
||||
add si, word resSectors
|
||||
adc di, 0 ; DI:SI = first FAT sector
|
||||
|
||||
mov word fat_start, si
|
||||
mov word fat_start_hi, di
|
||||
|
||||
mov al, nFats
|
||||
xor ah, ah
|
||||
mul word sectPerFat ; DX:AX = total number of FAT sectors
|
||||
|
||||
add si, ax
|
||||
adc di, dx ; DI:SI = first root directory sector
|
||||
mov word root_dir_start, si
|
||||
mov word root_dir_start_hi, di
|
||||
|
||||
; Calculate how many sectors the root directory occupies.
|
||||
mov bx, bytesPerSector
|
||||
mov cl, 5 ; divide BX by 32
|
||||
shr bx, cl ; BX = directory entries per sector
|
||||
|
||||
mov ax, nRootDir
|
||||
xor dx, dx
|
||||
div bx
|
||||
|
||||
mov nRootDir, ax ; AX = sectors per root directory
|
||||
|
||||
add si, ax
|
||||
adc di, 0 ; DI:SI = first data sector
|
||||
|
||||
mov data_start, si
|
||||
mov data_start_hi, di
|
||||
%endmacro
|
||||
|
||||
; GETFATCHAIN:
|
||||
;
|
||||
; Reads the FAT chain and stores it in a temporary buffer in the first
|
||||
; 64 kb. The FAT chain is stored an array of 16-bit cluster numbers,
|
||||
; ending with 0.
|
||||
;
|
||||
; The file must fit in conventional memory, so it can't be larger than
|
||||
; 640 kb. The sector size must be at least 512 bytes, so the FAT chain
|
||||
; can't be larger than around 3 kb.
|
||||
;
|
||||
; Call with: AX = first cluster in chain
|
||||
;
|
||||
; Returns: CF clear on success, set on error
|
||||
|
||||
%macro GETFATCHAIN 0
|
||||
push ax ; store first cluster number
|
||||
|
||||
; Load the complete FAT into memory. The FAT can't be larger
|
||||
; than 128 kb, so it should fit in the temporary buffer.
|
||||
|
||||
mov es, tempbuf
|
||||
xor bx, bx
|
||||
mov di, sectPerFat
|
||||
mov ax, word fat_start
|
||||
mov dx, word fat_start_hi
|
||||
call readDisk
|
||||
pop ax ; restore first cluster number
|
||||
jc boot_error
|
||||
|
||||
; Set ES:DI to the temporary storage for the FAT chain.
|
||||
push ds
|
||||
push es
|
||||
pop ds
|
||||
pop es
|
||||
mov di, FATBUF
|
||||
|
||||
next_clust: stosw ; store cluster number
|
||||
mov si, ax ; SI = cluster number
|
||||
cmp byte extBoot, 29h
|
||||
jne fat_12
|
||||
cmp byte [bp+filesys+4], '6' ; check for FAT-16 system
|
||||
je fat_16
|
||||
|
||||
; This is a FAT-12 disk.
|
||||
|
||||
fat_12: add si, si ; multiply cluster number by 3...
|
||||
add si, ax
|
||||
shr si, 1 ; ...and divide by 2
|
||||
lodsw
|
||||
|
||||
; If the cluster number was even, the cluster value is now in
|
||||
; bits 0-11 of AX. If the cluster number was odd, the cluster
|
||||
; value is in bits 4-15, and must be shifted right 4 bits. If
|
||||
; the number was odd, CF was set in the last shift instruction.
|
||||
|
||||
jnc fat_even
|
||||
mov cl, 4
|
||||
shr ax, cl ; shift the cluster number
|
||||
|
||||
fat_even: and ah, 0fh ; mask off the highest 4 bits
|
||||
cmp ax, 0fffh ; check for EOF
|
||||
jmp short next_test
|
||||
|
||||
; This is a FAT-16 disk. The maximal size of a 16-bit FAT
|
||||
; is 128 kb, so it may not fit within a single 64 kb segment.
|
||||
|
||||
fat_16: mov dx, tempbuf
|
||||
add si, si ; multiply cluster number by two
|
||||
jnc first_half ; if overflow...
|
||||
add dh, 10h ; ...add 64 kb to segment value
|
||||
|
||||
first_half: mov ds, dx ; DS:SI = pointer to next cluster
|
||||
lodsw ; AX = next cluster
|
||||
|
||||
cmp ax, 0fff8h ; >= FFF8 = 16-bit EOF
|
||||
next_test: jb next_clust ; continue if not EOF
|
||||
|
||||
finished: ; Mark end of FAT chain with 0, so we have a single
|
||||
; EOF marker for both FAT-12 and FAT-16 systems.
|
||||
|
||||
xor ax, ax
|
||||
stosw
|
||||
fatError:
|
||||
%endmacro
|
||||
|
||||
|
||||
; loadFile: Loads the file into memory, one cluster at a time.
|
||||
|
||||
%macro LOADFILE 0
|
||||
mov es, tempbuf ; set ES:BX to load address
|
||||
xor bx, bx
|
||||
|
||||
mov si, FATBUF ; set DS:SI to the FAT chain
|
||||
push cs
|
||||
pop ds
|
||||
|
||||
next_cluster: lodsw ; AX = next cluster to read
|
||||
or ax, ax ; if EOF...
|
||||
je boot_success ; ...boot was successful
|
||||
|
||||
dec ax ; cluster numbers start with 2
|
||||
dec ax
|
||||
|
||||
mov di, word sectPerCluster
|
||||
and di, 0ffh ; DI = sectors per cluster
|
||||
mul di
|
||||
add ax, data_start
|
||||
adc dx, data_start_hi ; DX:AX = first sector to read
|
||||
call readDisk
|
||||
jnc next_cluster
|
||||
|
||||
%endmacro
|
||||
; To save space, functions that are just called once are
|
||||
; implemented as macros instead. Four bytes are saved by
|
||||
; avoiding the call / ret instructions.
|
||||
|
||||
|
||||
; FINDFILE: Searches for the file in the root directory.
|
||||
;
|
||||
; Returns:
|
||||
;
|
||||
; If file not found: CF set
|
||||
;
|
||||
; If file found: CF clear
|
||||
; AX = first cluster of file
|
||||
|
||||
|
||||
%macro FINDFILE 0
|
||||
; First, read the whole root directory
|
||||
; into the temporary buffer.
|
||||
|
||||
mov ax, word root_dir_start
|
||||
mov dx, word root_dir_start_hi
|
||||
mov di, nRootDir
|
||||
xor bx, bx
|
||||
mov es, tempbuf
|
||||
call readDisk
|
||||
jc ffDone
|
||||
|
||||
xor di, di
|
||||
|
||||
next_entry: mov cx, 11
|
||||
mov si, filename+7c00h
|
||||
push di
|
||||
repe cmpsb
|
||||
pop di
|
||||
mov ax, [es:di+1ah] ; get cluster number from directory entry
|
||||
clc
|
||||
je ffDone
|
||||
|
||||
add di, 20h ; go to next directory entry
|
||||
cmp byte [es:di], 0 ; if the first byte of the name is 0,
|
||||
jnz next_entry ; there is no more files in the directory
|
||||
|
||||
stc
|
||||
ffDone:
|
||||
%endmacro
|
||||
|
||||
; GETDRIVEPARMS: Calculate start of some disk areas.
|
||||
|
||||
%macro GETDRIVEPARMS 0
|
||||
mov si, word nHidden
|
||||
mov di, word nHidden_hi
|
||||
add si, word resSectors
|
||||
adc di, 0 ; DI:SI = first FAT sector
|
||||
|
||||
mov word fat_start, si
|
||||
mov word fat_start_hi, di
|
||||
|
||||
mov al, nFats
|
||||
xor ah, ah
|
||||
mul word sectPerFat ; DX:AX = total number of FAT sectors
|
||||
|
||||
add si, ax
|
||||
adc di, dx ; DI:SI = first root directory sector
|
||||
mov word root_dir_start, si
|
||||
mov word root_dir_start_hi, di
|
||||
|
||||
; Calculate how many sectors the root directory occupies.
|
||||
mov bx, bytesPerSector
|
||||
mov cl, 5 ; divide BX by 32
|
||||
shr bx, cl ; BX = directory entries per sector
|
||||
|
||||
mov ax, nRootDir
|
||||
xor dx, dx
|
||||
div bx
|
||||
|
||||
mov nRootDir, ax ; AX = sectors per root directory
|
||||
|
||||
add si, ax
|
||||
adc di, 0 ; DI:SI = first data sector
|
||||
|
||||
mov data_start, si
|
||||
mov data_start_hi, di
|
||||
%endmacro
|
||||
|
||||
; GETFATCHAIN:
|
||||
;
|
||||
; Reads the FAT chain and stores it in a temporary buffer in the first
|
||||
; 64 kb. The FAT chain is stored an array of 16-bit cluster numbers,
|
||||
; ending with 0.
|
||||
;
|
||||
; The file must fit in conventional memory, so it can't be larger than
|
||||
; 640 kb. The sector size must be at least 512 bytes, so the FAT chain
|
||||
; can't be larger than around 3 kb.
|
||||
;
|
||||
; Call with: AX = first cluster in chain
|
||||
;
|
||||
; Returns: CF clear on success, set on error
|
||||
|
||||
%macro GETFATCHAIN 0
|
||||
push ax ; store first cluster number
|
||||
|
||||
; Load the complete FAT into memory. The FAT can't be larger
|
||||
; than 128 kb, so it should fit in the temporary buffer.
|
||||
|
||||
mov es, tempbuf
|
||||
xor bx, bx
|
||||
mov di, sectPerFat
|
||||
mov ax, word fat_start
|
||||
mov dx, word fat_start_hi
|
||||
call readDisk
|
||||
pop ax ; restore first cluster number
|
||||
jc boot_error
|
||||
|
||||
; Set ES:DI to the temporary storage for the FAT chain.
|
||||
push ds
|
||||
push es
|
||||
pop ds
|
||||
pop es
|
||||
mov di, FATBUF
|
||||
|
||||
next_clust: stosw ; store cluster number
|
||||
mov si, ax ; SI = cluster number
|
||||
cmp byte extBoot, 29h
|
||||
jne fat_12
|
||||
cmp byte [bp+filesys+4], '6' ; check for FAT-16 system
|
||||
je fat_16
|
||||
|
||||
; This is a FAT-12 disk.
|
||||
|
||||
fat_12: add si, si ; multiply cluster number by 3...
|
||||
add si, ax
|
||||
shr si, 1 ; ...and divide by 2
|
||||
lodsw
|
||||
|
||||
; If the cluster number was even, the cluster value is now in
|
||||
; bits 0-11 of AX. If the cluster number was odd, the cluster
|
||||
; value is in bits 4-15, and must be shifted right 4 bits. If
|
||||
; the number was odd, CF was set in the last shift instruction.
|
||||
|
||||
jnc fat_even
|
||||
mov cl, 4
|
||||
shr ax, cl ; shift the cluster number
|
||||
|
||||
fat_even: and ah, 0fh ; mask off the highest 4 bits
|
||||
cmp ax, 0fffh ; check for EOF
|
||||
jmp short next_test
|
||||
|
||||
; This is a FAT-16 disk. The maximal size of a 16-bit FAT
|
||||
; is 128 kb, so it may not fit within a single 64 kb segment.
|
||||
|
||||
fat_16: mov dx, tempbuf
|
||||
add si, si ; multiply cluster number by two
|
||||
jnc first_half ; if overflow...
|
||||
add dh, 10h ; ...add 64 kb to segment value
|
||||
|
||||
first_half: mov ds, dx ; DS:SI = pointer to next cluster
|
||||
lodsw ; AX = next cluster
|
||||
|
||||
cmp ax, 0fff8h ; >= FFF8 = 16-bit EOF
|
||||
next_test: jb next_clust ; continue if not EOF
|
||||
|
||||
finished: ; Mark end of FAT chain with 0, so we have a single
|
||||
; EOF marker for both FAT-12 and FAT-16 systems.
|
||||
|
||||
xor ax, ax
|
||||
stosw
|
||||
fatError:
|
||||
%endmacro
|
||||
|
||||
|
||||
; loadFile: Loads the file into memory, one cluster at a time.
|
||||
|
||||
%macro LOADFILE 0
|
||||
mov es, tempbuf ; set ES:BX to load address
|
||||
xor bx, bx
|
||||
|
||||
mov si, FATBUF ; set DS:SI to the FAT chain
|
||||
push cs
|
||||
pop ds
|
||||
|
||||
next_cluster: lodsw ; AX = next cluster to read
|
||||
or ax, ax ; if EOF...
|
||||
je boot_success ; ...boot was successful
|
||||
|
||||
dec ax ; cluster numbers start with 2
|
||||
dec ax
|
||||
|
||||
mov di, word sectPerCluster
|
||||
and di, 0ffh ; DI = sectors per cluster
|
||||
mul di
|
||||
add ax, data_start
|
||||
adc dx, data_start_hi ; DX:AX = first sector to read
|
||||
call readDisk
|
||||
jnc next_cluster
|
||||
|
||||
%endmacro
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
Start Stop Length Name Class
|
||||
|
||||
00000H 001FFH 00200H TEXT TEXT
|
||||
|
||||
Program entry point at 0000:0000
|
||||
Warning: No stack
|
||||
|
||||
|
||||
Start Stop Length Name Class
|
||||
|
||||
00000H 001FFH 00200H TEXT TEXT
|
||||
|
||||
Program entry point at 0000:0000
|
||||
Warning: No stack
|
||||
|
||||
|
|
|
@ -1,340 +1,340 @@
|
|||
;
|
||||
; Loads the kernel and any required modules
|
||||
;
|
||||
|
||||
org 0
|
||||
|
||||
;
|
||||
; Segment where we are loaded
|
||||
;
|
||||
LOADSEG equ 02000h
|
||||
|
||||
;
|
||||
; Segment used for temporay storage
|
||||
;
|
||||
WORKSEG equ 01000h
|
||||
|
||||
|
||||
KERNELBASE equ 05000h
|
||||
|
||||
;
|
||||
; Offsets of work areas
|
||||
;
|
||||
FAT_CHAIN equ 0h
|
||||
|
||||
DIR_BUFFER equ 4000h
|
||||
END_DIR_BUFFER equ 0ffe0h
|
||||
|
||||
FAT_SEG equ 03000h
|
||||
|
||||
|
||||
;
|
||||
; These are all on the stack
|
||||
;
|
||||
%define oem [bp+3]
|
||||
%define bytesPerSector [bp+0bh]
|
||||
%define sectPerCluster [bp+0dh]
|
||||
%define resSectors [bp+0eh]
|
||||
%define nFats [bp+10h]
|
||||
%define nRootDir [bp+11h]
|
||||
%define nSectors [bp+13h]
|
||||
%define MID [bp+15h]
|
||||
%define sectPerFat [bp+16h]
|
||||
%define sectPerTrack [bp+18h]
|
||||
%define nHeads [bp+1ah]
|
||||
%define nHidden [bp+1ch]
|
||||
%define nHidden_hi [bp+1eh]
|
||||
%define nSectorHuge [bp+20h]
|
||||
%define drive [bp+24h]
|
||||
%define extBoot [bp+26h]
|
||||
%define volid [bp+27h]
|
||||
%define vollabel [bp+2bh]
|
||||
%define filesys 36h
|
||||
|
||||
RETRYCOUNT equ 5
|
||||
|
||||
%define fat_start [bp-4] ; first FAT sector
|
||||
%define fat_start_hi [bp-2]
|
||||
%define root_dir_start [bp-8] ; first root directory sector
|
||||
%define root_dir_start_hi [bp-6]
|
||||
%define data_start [bp-12] ; first data sector
|
||||
%define data_start_hi [bp-10]
|
||||
|
||||
|
||||
entry:
|
||||
mov drive,dl
|
||||
|
||||
mov ax,LOADSEG
|
||||
mov ds,ax
|
||||
|
||||
|
||||
;
|
||||
; Print out a message
|
||||
;
|
||||
mov di,loadmsg
|
||||
call printmsg
|
||||
|
||||
|
||||
;
|
||||
; Check here for shift pressed and if so display boot menu
|
||||
;
|
||||
|
||||
;
|
||||
; Load the entire fat
|
||||
;
|
||||
; mov ax,fat_start
|
||||
; mov dx,fat_start_hi
|
||||
; mov di,sectPerFat
|
||||
; mov ax,FAT_SEG
|
||||
; mov es,ax
|
||||
; mov bx,0
|
||||
; call readDisk
|
||||
|
||||
|
||||
;
|
||||
; Load root directory
|
||||
;
|
||||
mov ax,WORKSEG
|
||||
mov es,ax
|
||||
|
||||
mov dx,root_dir_start_hi
|
||||
mov ax,root_dir_start
|
||||
mov bx,DIR_BUFFER
|
||||
mov di,nRootDir
|
||||
shr di,4
|
||||
mov di,1
|
||||
call readDisk
|
||||
jc disk_error
|
||||
|
||||
;
|
||||
; Look for a directory called boot
|
||||
;
|
||||
mov di,DIR_BUFFER
|
||||
cld
|
||||
mov cx,4
|
||||
l1:
|
||||
mov si,boot_dir_name
|
||||
; cmp byte [di],0
|
||||
; je boot_error
|
||||
repe cmpsb
|
||||
je found_it
|
||||
or di,31
|
||||
inc di
|
||||
cmp di,END_DIR_BUFFER
|
||||
jge boot_error
|
||||
jmp l1
|
||||
|
||||
|
||||
boot_error:
|
||||
mov di,errormsg
|
||||
call printmsg
|
||||
l3:
|
||||
jmp l3
|
||||
|
||||
disk_error:
|
||||
mov di,errormsg1
|
||||
call printmsg
|
||||
jmp l3
|
||||
|
||||
|
||||
|
||||
found_it:
|
||||
mov di,msg1
|
||||
call printmsg
|
||||
|
||||
;
|
||||
; Load the boot directory found above
|
||||
;
|
||||
sub di,4
|
||||
call readFile
|
||||
|
||||
l2:
|
||||
jmp l2
|
||||
|
||||
;
|
||||
; readFile
|
||||
;
|
||||
%define file_length [di+01ch]
|
||||
%define start_cluster [di+01ah]
|
||||
readFile:
|
||||
cmp byte extBoot, 29h
|
||||
jne fat_12
|
||||
cmp byte [bp+filesys+4], '6' ; check for FAT-16 system
|
||||
je fat_16
|
||||
|
||||
fat_12:
|
||||
mov di,msg2
|
||||
call printmsg
|
||||
l4:
|
||||
jmp l4
|
||||
|
||||
fat_16:
|
||||
mov di,msg3
|
||||
call printmsg
|
||||
jmp l4
|
||||
|
||||
|
||||
|
||||
; readDisk: Reads a number of sectors into memory.
|
||||
;
|
||||
; Call with: DX:AX = 32-bit DOS sector number
|
||||
; DI = number of sectors to read
|
||||
; ES:BX = destination buffer
|
||||
; ES must be 64k aligned (1000h, 2000h etc).
|
||||
;
|
||||
; Returns: CF set on error
|
||||
; ES:BX points one byte after the last byte read.
|
||||
|
||||
readDisk:
|
||||
push bp
|
||||
push si
|
||||
read_next: push dx
|
||||
push ax
|
||||
|
||||
;
|
||||
; translate sector number to BIOS parameters
|
||||
;
|
||||
|
||||
;
|
||||
; abs = sector offset in track
|
||||
; + head * sectPerTrack offset in cylinder
|
||||
; + track * sectPerTrack * nHeads offset in platter
|
||||
;
|
||||
; t1 = abs / sectPerTrack (ax has t1)
|
||||
; sector = abs mod sectPerTrack (cx has sector)
|
||||
;
|
||||
div word sectPerTrack
|
||||
mov cx, dx
|
||||
|
||||
;
|
||||
; t1 = head + track * nHeads
|
||||
;
|
||||
; track = t1 / nHeads (ax has track)
|
||||
; head = t1 mod nHeads (dl has head)
|
||||
;
|
||||
xor dx, dx
|
||||
div word nHeads
|
||||
|
||||
; the following manipulations are necessary in order to
|
||||
; properly place parameters into registers.
|
||||
; ch = cylinder number low 8 bits
|
||||
; cl = 7-6: cylinder high two bits
|
||||
; 5-0: sector
|
||||
mov dh, dl ; save head into dh for bios
|
||||
ror ah, 1 ; move track high bits into
|
||||
ror ah, 1 ; bits 7-6 (assumes top = 0)
|
||||
xchg al, ah ; swap for later
|
||||
mov dl, byte sectPerTrack
|
||||
sub dl, cl
|
||||
inc cl ; sector offset from 1
|
||||
or cx, ax ; merge cylinder into sector
|
||||
mov al, dl ; al has # of sectors left
|
||||
|
||||
; Calculate how many sectors can be transfered in this read
|
||||
; due to dma boundary conditions.
|
||||
push dx
|
||||
|
||||
mov si, di ; temp register save
|
||||
; this computes remaining bytes because of modulo 65536
|
||||
; nature of dma boundary condition
|
||||
mov ax, bx ; get offset pointer
|
||||
neg ax ; and convert to bytes
|
||||
jz ax_min_1 ; started at seg:0, skip ahead
|
||||
|
||||
xor dx, dx ; convert to sectors
|
||||
div word bytesPerSector
|
||||
|
||||
cmp ax, di ; check remainder vs. asked
|
||||
jb ax_min_1 ; less, skip ahead
|
||||
mov si, ax ; transfer only what we can
|
||||
|
||||
ax_min_1: pop dx
|
||||
|
||||
; Check that request sectors do not exceed track boundary
|
||||
mov si, sectPerTrack
|
||||
inc si
|
||||
mov ax, cx ; get the sector/cyl byte
|
||||
and ax, 03fh ; and mask out sector
|
||||
sub si, ax ; si has how many we can read
|
||||
mov ax, di
|
||||
cmp si, di ; see if asked <= available
|
||||
jge ax_min_2
|
||||
mov ax, si ; get what can be xfered
|
||||
|
||||
ax_min_2: mov si, RETRYCOUNT
|
||||
mov ah, 2
|
||||
mov dl, drive
|
||||
|
||||
retry: push ax
|
||||
int 13h
|
||||
pop ax
|
||||
jnc read_ok
|
||||
push ax
|
||||
xor ax, ax ; reset the drive
|
||||
int 13h
|
||||
pop ax
|
||||
dec si
|
||||
jnz retry
|
||||
stc
|
||||
pop ax
|
||||
pop dx
|
||||
pop si
|
||||
pop bp
|
||||
ret
|
||||
|
||||
read_next_jmp: jmp short read_next
|
||||
read_ok: xor ah, ah
|
||||
mov si, ax ; AX = SI = number of sectors read
|
||||
mul word bytesPerSector ; AX = number of bytes read
|
||||
add bx, ax ; add number of bytes read to BX
|
||||
jnc no_incr_es ; if overflow...
|
||||
|
||||
mov ax, es
|
||||
add ah, 10h ; ...add 1000h to ES
|
||||
mov es, ax
|
||||
|
||||
no_incr_es: pop ax
|
||||
pop dx ; DX:AX = last sector number
|
||||
|
||||
add ax, si
|
||||
adc dx, 0 ; DX:AX = next sector to read
|
||||
sub di, si ; if there is anything left to read,
|
||||
jg read_next_jmp ; continue
|
||||
|
||||
clc
|
||||
pop si
|
||||
pop bp
|
||||
ret
|
||||
|
||||
;
|
||||
; Print string (DI = start)
|
||||
;
|
||||
printmsg:
|
||||
push ax
|
||||
push bx
|
||||
push di
|
||||
mov ah,0eh
|
||||
mov bh,0
|
||||
mov bl,07h
|
||||
.l1
|
||||
mov al,[di]
|
||||
cmp al,0
|
||||
je .l2
|
||||
inc di
|
||||
int 10h
|
||||
jmp .l1
|
||||
.l2
|
||||
pop di
|
||||
pop bx
|
||||
pop ax
|
||||
ret
|
||||
|
||||
|
||||
|
||||
loadmsg db "Starting ReactOS...",0xd,0xa,0
|
||||
boot_dir_name db 'BOOT'
|
||||
errormsg db "Files missing on boot disk",0
|
||||
errormsg1 db "Disk read error",0
|
||||
msg1 db "Found boot directory",0xd,0xa,0
|
||||
msg2 db 'FAT12',0
|
||||
msg3 db 'FAT16',0
|
||||
;
|
||||
; Loads the kernel and any required modules
|
||||
;
|
||||
|
||||
org 0
|
||||
|
||||
;
|
||||
; Segment where we are loaded
|
||||
;
|
||||
LOADSEG equ 02000h
|
||||
|
||||
;
|
||||
; Segment used for temporay storage
|
||||
;
|
||||
WORKSEG equ 01000h
|
||||
|
||||
|
||||
KERNELBASE equ 05000h
|
||||
|
||||
;
|
||||
; Offsets of work areas
|
||||
;
|
||||
FAT_CHAIN equ 0h
|
||||
|
||||
DIR_BUFFER equ 4000h
|
||||
END_DIR_BUFFER equ 0ffe0h
|
||||
|
||||
FAT_SEG equ 03000h
|
||||
|
||||
|
||||
;
|
||||
; These are all on the stack
|
||||
;
|
||||
%define oem [bp+3]
|
||||
%define bytesPerSector [bp+0bh]
|
||||
%define sectPerCluster [bp+0dh]
|
||||
%define resSectors [bp+0eh]
|
||||
%define nFats [bp+10h]
|
||||
%define nRootDir [bp+11h]
|
||||
%define nSectors [bp+13h]
|
||||
%define MID [bp+15h]
|
||||
%define sectPerFat [bp+16h]
|
||||
%define sectPerTrack [bp+18h]
|
||||
%define nHeads [bp+1ah]
|
||||
%define nHidden [bp+1ch]
|
||||
%define nHidden_hi [bp+1eh]
|
||||
%define nSectorHuge [bp+20h]
|
||||
%define drive [bp+24h]
|
||||
%define extBoot [bp+26h]
|
||||
%define volid [bp+27h]
|
||||
%define vollabel [bp+2bh]
|
||||
%define filesys 36h
|
||||
|
||||
RETRYCOUNT equ 5
|
||||
|
||||
%define fat_start [bp-4] ; first FAT sector
|
||||
%define fat_start_hi [bp-2]
|
||||
%define root_dir_start [bp-8] ; first root directory sector
|
||||
%define root_dir_start_hi [bp-6]
|
||||
%define data_start [bp-12] ; first data sector
|
||||
%define data_start_hi [bp-10]
|
||||
|
||||
|
||||
entry:
|
||||
mov drive,dl
|
||||
|
||||
mov ax,LOADSEG
|
||||
mov ds,ax
|
||||
|
||||
|
||||
;
|
||||
; Print out a message
|
||||
;
|
||||
mov di,loadmsg
|
||||
call printmsg
|
||||
|
||||
|
||||
;
|
||||
; Check here for shift pressed and if so display boot menu
|
||||
;
|
||||
|
||||
;
|
||||
; Load the entire fat
|
||||
;
|
||||
; mov ax,fat_start
|
||||
; mov dx,fat_start_hi
|
||||
; mov di,sectPerFat
|
||||
; mov ax,FAT_SEG
|
||||
; mov es,ax
|
||||
; mov bx,0
|
||||
; call readDisk
|
||||
|
||||
|
||||
;
|
||||
; Load root directory
|
||||
;
|
||||
mov ax,WORKSEG
|
||||
mov es,ax
|
||||
|
||||
mov dx,root_dir_start_hi
|
||||
mov ax,root_dir_start
|
||||
mov bx,DIR_BUFFER
|
||||
mov di,nRootDir
|
||||
shr di,4
|
||||
mov di,1
|
||||
call readDisk
|
||||
jc disk_error
|
||||
|
||||
;
|
||||
; Look for a directory called boot
|
||||
;
|
||||
mov di,DIR_BUFFER
|
||||
cld
|
||||
mov cx,4
|
||||
l1:
|
||||
mov si,boot_dir_name
|
||||
; cmp byte [di],0
|
||||
; je boot_error
|
||||
repe cmpsb
|
||||
je found_it
|
||||
or di,31
|
||||
inc di
|
||||
cmp di,END_DIR_BUFFER
|
||||
jge boot_error
|
||||
jmp l1
|
||||
|
||||
|
||||
boot_error:
|
||||
mov di,errormsg
|
||||
call printmsg
|
||||
l3:
|
||||
jmp l3
|
||||
|
||||
disk_error:
|
||||
mov di,errormsg1
|
||||
call printmsg
|
||||
jmp l3
|
||||
|
||||
|
||||
|
||||
found_it:
|
||||
mov di,msg1
|
||||
call printmsg
|
||||
|
||||
;
|
||||
; Load the boot directory found above
|
||||
;
|
||||
sub di,4
|
||||
call readFile
|
||||
|
||||
l2:
|
||||
jmp l2
|
||||
|
||||
;
|
||||
; readFile
|
||||
;
|
||||
%define file_length [di+01ch]
|
||||
%define start_cluster [di+01ah]
|
||||
readFile:
|
||||
cmp byte extBoot, 29h
|
||||
jne fat_12
|
||||
cmp byte [bp+filesys+4], '6' ; check for FAT-16 system
|
||||
je fat_16
|
||||
|
||||
fat_12:
|
||||
mov di,msg2
|
||||
call printmsg
|
||||
l4:
|
||||
jmp l4
|
||||
|
||||
fat_16:
|
||||
mov di,msg3
|
||||
call printmsg
|
||||
jmp l4
|
||||
|
||||
|
||||
|
||||
; readDisk: Reads a number of sectors into memory.
|
||||
;
|
||||
; Call with: DX:AX = 32-bit DOS sector number
|
||||
; DI = number of sectors to read
|
||||
; ES:BX = destination buffer
|
||||
; ES must be 64k aligned (1000h, 2000h etc).
|
||||
;
|
||||
; Returns: CF set on error
|
||||
; ES:BX points one byte after the last byte read.
|
||||
|
||||
readDisk:
|
||||
push bp
|
||||
push si
|
||||
read_next: push dx
|
||||
push ax
|
||||
|
||||
;
|
||||
; translate sector number to BIOS parameters
|
||||
;
|
||||
|
||||
;
|
||||
; abs = sector offset in track
|
||||
; + head * sectPerTrack offset in cylinder
|
||||
; + track * sectPerTrack * nHeads offset in platter
|
||||
;
|
||||
; t1 = abs / sectPerTrack (ax has t1)
|
||||
; sector = abs mod sectPerTrack (cx has sector)
|
||||
;
|
||||
div word sectPerTrack
|
||||
mov cx, dx
|
||||
|
||||
;
|
||||
; t1 = head + track * nHeads
|
||||
;
|
||||
; track = t1 / nHeads (ax has track)
|
||||
; head = t1 mod nHeads (dl has head)
|
||||
;
|
||||
xor dx, dx
|
||||
div word nHeads
|
||||
|
||||
; the following manipulations are necessary in order to
|
||||
; properly place parameters into registers.
|
||||
; ch = cylinder number low 8 bits
|
||||
; cl = 7-6: cylinder high two bits
|
||||
; 5-0: sector
|
||||
mov dh, dl ; save head into dh for bios
|
||||
ror ah, 1 ; move track high bits into
|
||||
ror ah, 1 ; bits 7-6 (assumes top = 0)
|
||||
xchg al, ah ; swap for later
|
||||
mov dl, byte sectPerTrack
|
||||
sub dl, cl
|
||||
inc cl ; sector offset from 1
|
||||
or cx, ax ; merge cylinder into sector
|
||||
mov al, dl ; al has # of sectors left
|
||||
|
||||
; Calculate how many sectors can be transfered in this read
|
||||
; due to dma boundary conditions.
|
||||
push dx
|
||||
|
||||
mov si, di ; temp register save
|
||||
; this computes remaining bytes because of modulo 65536
|
||||
; nature of dma boundary condition
|
||||
mov ax, bx ; get offset pointer
|
||||
neg ax ; and convert to bytes
|
||||
jz ax_min_1 ; started at seg:0, skip ahead
|
||||
|
||||
xor dx, dx ; convert to sectors
|
||||
div word bytesPerSector
|
||||
|
||||
cmp ax, di ; check remainder vs. asked
|
||||
jb ax_min_1 ; less, skip ahead
|
||||
mov si, ax ; transfer only what we can
|
||||
|
||||
ax_min_1: pop dx
|
||||
|
||||
; Check that request sectors do not exceed track boundary
|
||||
mov si, sectPerTrack
|
||||
inc si
|
||||
mov ax, cx ; get the sector/cyl byte
|
||||
and ax, 03fh ; and mask out sector
|
||||
sub si, ax ; si has how many we can read
|
||||
mov ax, di
|
||||
cmp si, di ; see if asked <= available
|
||||
jge ax_min_2
|
||||
mov ax, si ; get what can be xfered
|
||||
|
||||
ax_min_2: mov si, RETRYCOUNT
|
||||
mov ah, 2
|
||||
mov dl, drive
|
||||
|
||||
retry: push ax
|
||||
int 13h
|
||||
pop ax
|
||||
jnc read_ok
|
||||
push ax
|
||||
xor ax, ax ; reset the drive
|
||||
int 13h
|
||||
pop ax
|
||||
dec si
|
||||
jnz retry
|
||||
stc
|
||||
pop ax
|
||||
pop dx
|
||||
pop si
|
||||
pop bp
|
||||
ret
|
||||
|
||||
read_next_jmp: jmp short read_next
|
||||
read_ok: xor ah, ah
|
||||
mov si, ax ; AX = SI = number of sectors read
|
||||
mul word bytesPerSector ; AX = number of bytes read
|
||||
add bx, ax ; add number of bytes read to BX
|
||||
jnc no_incr_es ; if overflow...
|
||||
|
||||
mov ax, es
|
||||
add ah, 10h ; ...add 1000h to ES
|
||||
mov es, ax
|
||||
|
||||
no_incr_es: pop ax
|
||||
pop dx ; DX:AX = last sector number
|
||||
|
||||
add ax, si
|
||||
adc dx, 0 ; DX:AX = next sector to read
|
||||
sub di, si ; if there is anything left to read,
|
||||
jg read_next_jmp ; continue
|
||||
|
||||
clc
|
||||
pop si
|
||||
pop bp
|
||||
ret
|
||||
|
||||
;
|
||||
; Print string (DI = start)
|
||||
;
|
||||
printmsg:
|
||||
push ax
|
||||
push bx
|
||||
push di
|
||||
mov ah,0eh
|
||||
mov bh,0
|
||||
mov bl,07h
|
||||
.l1
|
||||
mov al,[di]
|
||||
cmp al,0
|
||||
je .l2
|
||||
inc di
|
||||
int 10h
|
||||
jmp .l1
|
||||
.l2
|
||||
pop di
|
||||
pop bx
|
||||
pop ax
|
||||
ret
|
||||
|
||||
|
||||
|
||||
loadmsg db "Starting ReactOS...",0xd,0xa,0
|
||||
boot_dir_name db 'BOOT'
|
||||
errormsg db "Files missing on boot disk",0
|
||||
errormsg1 db "Disk read error",0
|
||||
msg1 db "Found boot directory",0xd,0xa,0
|
||||
msg2 db 'FAT12',0
|
||||
msg3 db 'FAT16',0
|
||||
|
|
Binary file not shown.
|
@ -1,12 +1,12 @@
|
|||
Mem layout for osldr
|
||||
|
||||
0000 - 07C0 = BIOS data and stack
|
||||
07C0 - 1000 = Boot sector
|
||||
1000 - 1400 = Tempory storage for fat chains
|
||||
1400 - 2000 = Tempory storage for directory entries
|
||||
2000 - 3000 = OSLDR
|
||||
3000 - 5000 = FAT
|
||||
5000 - a000 = Kernel and modules load area
|
||||
|
||||
|
||||
|
||||
Mem layout for osldr
|
||||
|
||||
0000 - 07C0 = BIOS data and stack
|
||||
07C0 - 1000 = Boot sector
|
||||
1000 - 1400 = Tempory storage for fat chains
|
||||
1400 - 2000 = Tempory storage for directory entries
|
||||
2000 - 3000 = OSLDR
|
||||
3000 - 5000 = FAT
|
||||
5000 - a000 = Kernel and modules load area
|
||||
|
||||
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
Binary file not shown.
|
@ -1,62 +1,62 @@
|
|||
#
|
||||
# Global makefile
|
||||
#
|
||||
|
||||
#
|
||||
# Select your host
|
||||
#
|
||||
#HOST = djgpp-linux
|
||||
#HOST = mingw32-linux
|
||||
HOST = djgpp-msdos
|
||||
#HOST = mingw32-windows
|
||||
|
||||
include rules.mak
|
||||
|
||||
#
|
||||
# Required to run the system
|
||||
#
|
||||
COMPONENTS = kernel lib
|
||||
|
||||
#
|
||||
# Select the loader(s) you want to build
|
||||
#
|
||||
LOADERS = dos
|
||||
|
||||
#
|
||||
# Select the modules you want
|
||||
#
|
||||
MODULES = parallel keyboard
|
||||
|
||||
all: $(COMPONENTS) $(LOADERS) $(MODULES)
|
||||
|
||||
#
|
||||
# Device driver rules
|
||||
#
|
||||
|
||||
parallel: dummy
|
||||
make -C modules/parallel
|
||||
|
||||
keyboard: dummy
|
||||
make -C modules/keyboard
|
||||
|
||||
mouse: dummy
|
||||
make -C modules/mouse
|
||||
|
||||
#
|
||||
# Kernel loaders
|
||||
#
|
||||
|
||||
dos: dummy
|
||||
make -C loaders/dos
|
||||
|
||||
#
|
||||
# Required system components
|
||||
#
|
||||
|
||||
kernel: dummy
|
||||
make -C kernel
|
||||
|
||||
lib: dummy
|
||||
make -C lib
|
||||
|
||||
dummy:
|
||||
#
|
||||
# Global makefile
|
||||
#
|
||||
|
||||
#
|
||||
# Select your host
|
||||
#
|
||||
#HOST = djgpp-linux
|
||||
#HOST = mingw32-linux
|
||||
HOST = djgpp-msdos
|
||||
#HOST = mingw32-windows
|
||||
|
||||
include rules.mak
|
||||
|
||||
#
|
||||
# Required to run the system
|
||||
#
|
||||
COMPONENTS = kernel lib
|
||||
|
||||
#
|
||||
# Select the loader(s) you want to build
|
||||
#
|
||||
LOADERS = dos
|
||||
|
||||
#
|
||||
# Select the modules you want
|
||||
#
|
||||
MODULES = parallel keyboard
|
||||
|
||||
all: $(COMPONENTS) $(LOADERS) $(MODULES)
|
||||
|
||||
#
|
||||
# Device driver rules
|
||||
#
|
||||
|
||||
parallel: dummy
|
||||
make -C services/parallel
|
||||
|
||||
keyboard: dummy
|
||||
make -C services/keyboard
|
||||
|
||||
mouse: dummy
|
||||
make -C services/mouse
|
||||
|
||||
#
|
||||
# Kernel loaders
|
||||
#
|
||||
|
||||
dos: dummy
|
||||
make -C loaders/dos
|
||||
|
||||
#
|
||||
# Required system components
|
||||
#
|
||||
|
||||
kernel: dummy
|
||||
make -C ntoskrnl
|
||||
|
||||
lib: dummy
|
||||
make -C lib
|
||||
|
||||
dummy:
|
||||
|
|
|
@ -1,20 +1,21 @@
|
|||
DIRECTORIES
|
||||
|
||||
system : compiled versions of the various system components and
|
||||
libraries
|
||||
mkernel : microkernel source
|
||||
mkernel/hal : hardware abstraction layer source
|
||||
mkernel/mm : memory managment subsystem source
|
||||
mkernel/iomgr : IO manager subsystem source
|
||||
include : win32 headers
|
||||
include/internal : kernel private header files
|
||||
include/ntdll : system library private header files
|
||||
include/kernel32 : system library private header files
|
||||
include/user32 : user interface private header files
|
||||
include/gdi32 : graphics interface private header files
|
||||
include/ddk : header files for modules
|
||||
lib/ntdll : NT dll source
|
||||
lib/kernel32 : kernel32 source
|
||||
doc : documentation
|
||||
loaders/dos : DOS based loader
|
||||
loaders/boot : boot loader
|
||||
DIRECTORIES
|
||||
|
||||
system : compiled versions of the various system components and
|
||||
libraries
|
||||
ntoskrnl : microkernel source
|
||||
ntoskrnl/hal : hardware abstraction layer source
|
||||
ntoskrnl/mm : memory managment subsystem source
|
||||
ntoskrnl/io : IO manager subsystem source
|
||||
include : win32 headers
|
||||
include/internal : kernel private header files
|
||||
include/ntdll : system library private header files
|
||||
include/kernel32 : system library private header files
|
||||
include/user32 : user interface private header files
|
||||
include/gdi32 : graphics interface private header files
|
||||
include/ddk : header files for modules
|
||||
lib/ntdll : NT dll source
|
||||
lib/kernel32 : kernel32 source
|
||||
doc : documentation
|
||||
loaders/dos : DOS based loader
|
||||
loaders/boot : boot loader
|
||||
services : various services (device drivers, filesystems etc)
|
||||
|
|
|
@ -42,9 +42,10 @@ endif
|
|||
#
|
||||
# Create variables for all the compiler tools
|
||||
#
|
||||
DEFINES = -DCHECKED_BUILD -DWIN32_LEAN_AND_MEAN -DDBG
|
||||
CC = $(PREFIX)gcc
|
||||
NATIVE_CC = gcc
|
||||
CFLAGS = -O2 -I../../include -I../include -fno-builtin -DCHECKED_BUILD $(DEFINES) -Wall -Wstrict-prototypes
|
||||
CFLAGS = -O2 -I../../include -I../include -fno-builtin $(DEFINES) -Wall -Wstrict-prototypes
|
||||
CXXFLAGS = $(CFLAGS)
|
||||
NASM = nasm
|
||||
NFLAGS = -i../include/ -f$(NASM_FORMAT)
|
||||
|
|
Loading…
Reference in a new issue