repo_id
stringlengths 5
115
| size
int64 590
5.01M
| file_path
stringlengths 4
212
| content
stringlengths 590
5.01M
|
|---|---|---|---|
0xffea/MINIX3
| 7,413
|
sys/arch/i386/stand/mbr/gptmbr.S
|
/* -----------------------------------------------------------------------
*
* Copyright 2007-2009 H. Peter Anvin - All Rights Reserved
* Copyright 2009-2010 Intel Corporation; author: H. Peter Anvin
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom
* the Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall
* be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* ----------------------------------------------------------------------- */
#include <machine/asm.h>
#include <sys/bootblock.h>
#ifdef CTRL_80
.macro ADJUST_DRIVE
testb $0x04, BIOS_kbdflags
jz 1f
movb $0x80, %dl
1:
.endm
#elif defined(FORCE_80)
.macro ADJUST_DRIVE
movb $0x80, %dl
.endm
#else
.macro ADJUST_DRIVE
.endm
#endif
.code16
.text
.globl bootsec
stack = 0x7c00
/* Partition table header here */
phdr = stack /* Above the stack, overwritten by bootsect */
/* Partition table sector here */
/* To handle > 32K we need to play segment tricks... */
psec = _phdr + 512
/* Where we put DS:SI */
dssi_out = start + 0x1be
BIOS_kbdflags = 0x417
BIOS_page = 0x462
/* gas/ld has issues with doing this as absolute addresses... */
.section ".bootsec", "a", @nobits
.globl bootsec
bootsec:
.space 512
.text
.globl start
start:
cli
xorw %ax, %ax
movw %ax, %ds
movw %ax, %ss
movw $stack, %sp
movw %sp, %si
pushw %es /* 4(%bp) es:di -> $PnP header */
pushw %di /* 2(%bp) */
movw %ax, %es
sti
cld
/* Copy down to 0:0x600 */
movw $start, %di
movw $(512/2), %cx
rep; movsw
ljmpw $0, $next
next:
ADJUST_DRIVE
pushw %dx /* 0(%bp) = %dl -> drive number */
/* Check to see if we have EBIOS */
pushw %dx /* drive number */
movb $0x41, %ah /* %al == 0 already */
movw $0x55aa, %bx
xorw %cx, %cx
xorb %dh, %dh
stc
int $0x13
jc 1f
cmpw $0xaa55, %bx
jne 1f
shrw %cx /* Bit 0 = fixed disk subset */
jnc 1f
/* We have EBIOS; patch in the following code at
read_sector_cbios: movb $0x42, %ah ; jmp read_common */
movl $0xeb42b4+((read_common-read_sector_cbios-4) << 24), \
(read_sector_cbios)
1:
popw %dx
/* Get (C)HS geometry */
movb $0x08, %ah
int $0x13
andw $0x3f, %cx /* Sector count */
movw %sp, %bp /* %bp -> frame pointer: LEAVE UNCHANGED */
pushw %cx /* -2(%bp) Save sectors on the stack */
movzbw %dh, %ax /* dh = max head */
incw %ax /* From 0-based max to count */
mulw %cx /* Heads*sectors -> sectors per cylinder */
/* Save sectors/cylinder on the stack */
pushw %dx /* -4(%bp) High word */
pushw %ax /* -6(%bp) Low word */
/* Load partition table header */
xorl %eax,%eax
cltd
incw %ax /* %edx:%eax = 1 */
movw $phdr, %bx
pushw %bx /* -8(%bp) phdr == bootsect */
call read_sector
/* Number of partition sectors */
/* We assume the partition table is 32K or less, and that
the sector size is 512. */
/* Note: phdr == 6(%bp) */
movw (80+6)(%bp),%cx /* NumberOfPartitionEntries */
movw (84+6)(%bp),%ax /* SizeOfPartitionEntry */
pushw %ax
pushw %cx
mulw %cx
shrw $9,%ax
xchgw %ax,%cx
incw %cx
/* Starting LBA of partition array */
movl (72+6)(%bp),%eax
movl (76+6)(%bp),%edx
pushw %bx
get_ptab:
call read_sector
call inc64
loopw get_ptab
/* Find the boot partition */
xorw %si,%si /* Nothing found yet */
popw %di /* Partition table in memory */
popw %cx /* NumberOfPartitionEntries */
popw %ax /* SizeOfPartitionEntry */
find_part:
/* If the PartitionTypeGUID is all zero, it's an empty slot */
movl (%di),%edx
orl 4(%di),%edx
orl 8(%di),%edx
orl 12(%di),%edx
jz not_this
testb $0x04,48(%di)
jz not_this
andw %si,%si
jnz found_multiple
movw %di,%si
not_this:
addw %ax,%di
loopw find_part
andw %si,%si
jnz found_part
missing_os:
call error
.ascii "Missing OS\r\n"
found_multiple:
call error
.ascii "Multiple active partitions\r\n"
found_part:
xchgw %ax,%cx /* Set up %cx for rep movsb further down */
movw $dssi_out,%di
pushw %di
/* 80 00 00 00 ee 00 00 00
- bootable partition, type EFI (EE), no CHS information */
xorl %eax,%eax
movb $0x80,%al
stosl
movb $0xed,%al
stosl
movl 32(%si),%eax
movl 36(%si),%edx
call saturate_stosl /* Partition start */
movl 40(%si),%eax
movl 44(%si),%edx
subl 32(%si),%eax
sbbl 36(%si),%edx
call inc64
call saturate_stosl /* Partition length */
movzwl %cx,%eax /* Length of GPT entry */
stosl
rep; movsb /* GPT entry follows MBR entry */
popw %si
/*
* boot: invoke the actual bootstrap. %ds:%si points to the
* partition information in memory. The top word on the stack
* is phdr == 0x7c00 == the address of the boot sector.
*/
boot:
movl (32+20)(%si),%eax
movl (36+20)(%si),%edx
popw %bx
call read_sector
cmpw $0xaa55, -2(%bx)
jne missing_os /* Not a valid boot sector */
movw %bp, %sp /* driveno == bootsec-6 */
popw %dx /* dl -> drive number */
popw %di /* es:di -> $PnP vector */
popw %es
movl $0x54504721,%eax /* !GPT magic number */
cli
jmpw *%sp /* %sp == bootsec */
/*
* Store the value in %eax to %di iff %edx == 0, otherwise store -1.
* Returns the value that was actually written in %eax.
*/
saturate_stosl:
andl %edx,%edx
jz 1f
orl $-1,%eax
1: stosl
ret
/*
* Increment %edx:%eax
*/
inc64:
addl $1,%eax
adcl $0,%edx
ret
/*
* read_sector: read a single sector pointed to by %edx:%eax to
* %es:%bx. CF is set on error. All registers saved.
*/
read_sector:
pushal
pushl %edx /* MSW of LBA */
pushl %eax /* LSW of LBA */
pushw %es /* Buffer segment */
pushw %bx /* Buffer offset */
pushw $1 /* Sector count */
pushw $16 /* Size of packet */
movw %sp, %si
/* This chunk is skipped if we have ebios */
/* Do not clobber %es:%bx or %edx:%eax before this chunk! */
read_sector_cbios:
divl -6(%bp) /* secpercyl */
shlb $6, %ah
movb %ah, %cl
movb %al, %ch
xchgw %dx, %ax
divb -2(%bp) /* sectors */
movb %al, %dh
orb %ah, %cl
incw %cx /* Sectors are 1-based */
movw $0x0201, %ax
read_common:
movb (%bp), %dl /* driveno */
int $0x13
leaw 16(%si), %sp /* Drop DAPA */
popal
jc disk_error
addb $2, %bh /* bx += 512: point to the next buffer */
ret
disk_error:
call error
.ascii "Disk error on boot\r\n"
/*
* Print error messages. This is invoked with "call", with the
* error message at the return address.
*/
error:
popw %si
2:
lodsb
movb $0x0e, %ah
movb (BIOS_page), %bh
movb $0x07, %bl
int $0x10 /* May destroy %bp */
cmpb $10, %al /* Newline? */
jne 2b
int $0x18 /* Boot failure */
die:
hlt
jmp die
mbr_space = end - .
. = MBR_DSN_OFFSET
end:
|
0xffea/MINIX3
| 16,584
|
sys/arch/i386/stand/mbr/mbr.S
|
/* $NetBSD: mbr.S,v 1.23 2010/12/08 21:56:42 jakllsch Exp $ */
/*
* Copyright (c) 1999-2004 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Frank van der Linden, based on an earlier work by Wolfgang Solfrank.
* Major surgery performed by David Laight.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/*
* i386 master boot code
*/
/* Compile options:
* BOOTSEL - bootselector code
* BOOT_EXTENDED - scan extended partition list (LBA reads)
* COM_PORT - do serial io to specified port number
* 0..3 => bios port, otherwise actual io_addr
* COM_BAUD - initialise serial port baud rate
*
* TERSE_ERROR - terse error messages
* NO_CHS - all reads are LBA
* NO_LBA_CHECK - no check if bios supports LBA reads
* NO_BANNER - do not output title line 'banner'
*/
#ifdef BOOT_EXTENDED
#define NO_CHS 1
#define BOOTSEL 1
#endif
#ifdef COM_PORT
#if COM_PORT < 4
/* The first 4 items in the 40:xx segment are the serial port base addresses */
#define COM_PORT_VAL (0x400 + (COM_PORT * 2))
#else
#define COM_PORT_VAL $COM_PORT
#endif
#if !defined(COM_FREQ)
#define COM_FREQ 1843200
#endif
#else
#undef COM_BAUD
#endif
#ifdef BOOTSEL
#define TERSE_ERROR 1
#endif
#include <machine/asm.h>
#include <sys/bootblock.h>
#define BOOTADDR 0x7c00 /* where we get loaded to */
#define TABENTRYSIZE (MBR_BS_PARTNAMESIZE + 1)
#define NAMETABSIZE (MBR_PART_COUNT * TABENTRYSIZE)
#ifdef COM_PORT
/* ASCII values for the keys */
#define KEY_ACTIVE '\r'
#define KEY_DISK1 'a'
#define KEY_PTN1 '1'
#else
/* Scan values for the various keys we use, as returned by the BIOS */
#define SCAN_ENTER 0x1c
#define SCAN_F1 0x3b
#define SCAN_1 0x2
#define KEY_ACTIVE SCAN_ENTER
#define KEY_DISK1 SCAN_F1
#define KEY_PTN1 SCAN_1
#endif
/*
* Minimum and maximum drive number that is considered to be valid.
*/
#define MINDRV 0x80
#define MAXDRV 0x8f
#ifdef TERSE_ERROR
/*
* Error codes. Done this way to save space.
*/
#define ERR_INVPART '1' /* Invalid partition table */
#define ERR_READ '2' /* Read error */
#define ERR_NOOS '3' /* Magic no. check failed for part. */
#define ERR_KEY '?' /* unknown key press */
#define ERR_NO_LBA 'L' /* sector above chs limit */
#define set_err(err) movb $err, %al
#else
#define set_err(err) mov $err, %ax
#endif
.text
.code16
/*
* Move ourselves out of the way first.
* (to the address we are linked at)
* and zero our bss
*/
ENTRY(start)
xor %ax, %ax
mov %ax, %ss
movw $BOOTADDR, %sp
mov %ax, %es
mov %ax, %ds
movw $mbr, %di
mov $BOOTADDR + (mbr - start), %si
push %ax /* zero for %cs of lret */
push %di
movw $(bss_start - mbr), %cx
rep
movsb /* relocate code */
mov $(bss_end - bss_start + 511)/512, %ch
rep
stosw /* zero bss */
lret /* Ensures %cs == 0 */
/*
* Sanity check the drive number passed by the BIOS. Some BIOSs may not
* do this and pass garbage.
*/
mbr:
cmpb $MAXDRV, %dl /* relies on MINDRV being 0x80 */
jle 1f
movb $MINDRV, %dl /* garbage in, boot disk 0 */
1:
push %dx /* save drive number */
push %dx /* twice - for err_msg loop */
#if defined(COM_BAUD)
mov $com_args, %si
mov $num_com_args, %cl /* %ch is zero from above */
mov COM_PORT_VAL, %dx
1: lodsw
add %ah, %dl
outb %dx
loop 1b
#endif
#ifndef NO_BANNER
mov $banner, %si
call message_crlf
#endif
/*
* Walk through the selector (name) table printing used entries.
*
* Register use:
* %ax temp
* %bx nametab[] boot seletor menu
* %ecx base of 'extended' partition
* %edx next extended partition
* %si message ptr (etc)
* %edi sector number of this partition
* %bp parttab[] mbr partition table
*/
bootsel_menu:
movw $nametab, %bx
#ifdef BOOT_EXTENDED
xorl %ecx, %ecx /* base of extended partition */
next_extended:
xorl %edx, %edx /* for next extended partition */
#endif
lea parttab - nametab(%bx), %bp
next_ptn:
movb 4(%bp), %al /* partition type */
#ifdef NO_CHS
movl 8(%bp), %edi /* partition sector number */
#ifdef BOOT_EXTENDED
cmpb $MBR_PTYPE_EXT, %al /* Extended partition */
je 1f
cmpb $MBR_PTYPE_EXT_LBA, %al /* Extended LBA partition */
je 1f
cmpb $MBR_PTYPE_EXT_LNX, %al /* Linux extended partition */
jne 2f
1: movl %edi, %edx /* save next extended ptn */
jmp 4f
2:
#endif
addl lba_sector, %edi /* add in extended ptn base */
#endif
test %al, %al /* undefined partition */
je 4f
cmpb $0x80, (%bp) /* check for active partition */
jne 3f /* jump if not... */
#define ACTIVE (4 * ((KEY_ACTIVE - KEY_DISK1) & 0xff))
#ifdef NO_CHS
movl %edi, ptn_list + ACTIVE /* save location of active ptn */
#else
mov %bp, ptn_list + ACTIVE
#endif
#undef ACTIVE
3:
#ifdef BOOTSEL
cmpb $0, (%bx) /* check for prompt */
jz 4f
/* output menu item */
movw $prefix, %si
incb (%si)
call message /* menu number */
mov (%si), %si /* ':' << 8 | '1' + count */
shl $2, %si /* const + count * 4 */
#define CONST (4 * ((':' << 8) + '1' - ((KEY_PTN1 - KEY_DISK1) & 0xff)))
#ifdef NO_CHS
movl %edi, ptn_list - CONST(%si) /* sector to read */
#else
mov %bp, ptn_list - CONST(%si) /* partition info */
#endif
#undef CONST
mov %bx, %si
call message_crlf /* prompt */
#endif
4:
add $0x10, %bp
add $TABENTRYSIZE, %bx
cmpb $(nametab - start - 0x100) + 4 * TABENTRYSIZE, %bl
jne next_ptn
#ifdef BOOT_EXTENDED
/*
* Now check extended partition chain
*/
testl %edx, %edx
je wait_key
testl %ecx, %ecx
jne 1f
xchg %ecx, %edx /* save base of ext ptn chain */
1: addl %ecx, %edx /* sector to read */
movl %edx, lba_sector
movw $lba_info, %si
movb $0x42, %ah
pop %dx /* recover drive # */
push %dx /* save drive */
int $0x13
movw $BOOTADDR + (nametab - start), %bx
jnc next_extended /* abort menu on read fail */
#endif
/*
* The non-bootsel code traverses this code path, it needs the
* correct keycode to select the active partition.
*/
#ifndef BOOTSEL
mov $(KEY_ACTIVE - KEY_DISK1) & 0xff, %ax
#else
/*
* Get the initial time value for the timeout comparison. It is returned
* by int 1a in cx:dx. We do sums modulo 2^16 so it doesn't matter if
* the counter wraps (which it does every hour) - so we can safely
* ignore 'cx'.
*
* Loop around checking for a keypress until we have one, or timeout is
* reached.
*/
wait_key:
xorb %ah, %ah
int $0x1a
mov %dx, %di /* start time to di */
3:
#ifdef COM_PORT_VAL
mov COM_PORT_VAL, %dx
push %dx
add $5, %dx
inb %dx
pop %dx
test $1, %al
jz 1f
inb %dx
jmp check_key
#else
movb $1, %ah /* looks to see if a */
int $0x16 /* key has been pressed */
jz 1f
get_key:
xorb %ah, %ah
int $0x16 /* 'read key', code ah, ascii al */
shr $8, %ax /* code in %al, %ah zero */
jmp check_key
#endif
1: xorb %ah, %ah
int $0x1a /* current time to cx:dx */
sub %di, %dx
cmpw timeout, %dx /* always wait for 1 tick... */
jbe 3b /* 0xffff means never timeout */
def_key:
mov defkey, %al /* timedout - we need %ah to still be zero! */
/*
* We have a keycode, see what it means.
* If we don't know we generate error '?' and go ask again
*/
check_key:
/*
* F1-F10 -> boot disk 0-9. Check if the requested disk isn't above
* the number of disks actually in the system as stored in 0:0475 by
* the BIOS.
* If we trust loc 475, we needn't check the upper bound on the keystroke
* This is always sector 0, so always read using chs.
*/
subb $KEY_DISK1, %al
cmpb 0x0475, %al
jae boot_ptn
addb $0x80, %al
pop %dx /* dump saved drive # */
push %ax /* replace with new */
#ifdef NO_CHS
xorl %ebp, %ebp /* read sector number 0 */
jmp boot_lba
#else
movw $chs_zero, %si /* chs read sector zero info */
jmp read_chs
#endif
#endif /* BOOTSEL */
/*
* Boot requested partition.
* Use keycode to index the table we generated when we scanned the mbr
* while generating the menu.
*
* We very carfully saved the values in the correct part of the table.
*/
boot_ptn:
shl $2, %ax
movw %ax, %si
#ifdef NO_CHS
movl ptn_list(%si), %ebp
testl %ebp, %ebp
jnz boot_lba
#else
mov ptn_list(%si), %si
test %si, %si
jnz boot_si
#endif
#ifdef BOOTSEL
set_err(ERR_KEY)
#else
set_err(ERR_INVPART)
#endif
/* jmp err_msg */
/* Something went wrong...
* Output error code,
* reset disk subsystem - needed after read failure,
* and wait for user key
*/
err_msg:
#ifdef TERSE_ERROR
movb %al, errcod
movw $errtxt, %si
call message
#else
push %ax
movw $errtxt, %si
call message
pop %si
call message_crlf
#endif
pop %dx /* drive we errored on */
xor %ax,%ax /* only need %ah = 0 */
int $0x13 /* reset disk subsystem */
#ifdef BOOTSEL
pop %dx /* original drive number */
push %dx
push %dx
#ifdef COM_PORT_VAL
jmp wait_key /* Read with timeout (again) */
#else
jmp get_key /* Blocking read */
#endif
#else
int $0x18 /* BIOS might ask for a key */
/* press and retry boot seq. */
1: sti
hlt
jmp 1b
#endif
#ifndef NO_CHS
/*
* Active partition pointed to by si.
* Read the first sector.
*
* We can either do a CHS (Cylinder Head Sector) or an LBA (Logical
* Block Address) read. Always doing the LBA one
* would be nice - unfortunately not all systems support it.
* Also some may contain a separate (eg SCSI) bios that doesn't
* support it even when the main bios does.
*
* There is also the additional problem that the CHS values may be wrong
* (eg if fdisk was run on a different system that used different BIOS
* geometry). We convert the CHS value to a LBA sector number using
* the geometry from the BIOS, if the number matches we do a CHS read.
*/
boot_si:
movl 8(%si), %ebp /* get sector # */
testb $MBR_BS_READ_LBA, flags
jnz boot_lba /* fdisk forced LBA read */
pop %dx /* collect saved drive... */
push %dx /* ...number to dl */
movb $8, %ah
int $0x13 /* chs info */
/*
* Validate geometry, if the CHS sector number doesn't match the LBA one
* we'll do an LBA read.
* calc: (cylinder * number_of_heads + head) * number_of_sectors + sector
* and compare against LBA sector number.
* Take a slight 'flier' and assume we can just check 16bits (very likely
* to be true because the number of sectors per track is 63).
*/
movw 2(%si), %ax /* cylinder + sector */
push %ax /* save for sector */
shr $6, %al
xchgb %al, %ah /* 10 bit cylinder number */
shr $8, %dx /* last head */
inc %dx /* number of heads */
mul %dx
mov 1(%si), %dl /* head we want */
add %dx, %ax
and $0x3f, %cx /* number of sectors */
mul %cx
pop %dx /* recover sector we want */
and $0x3f, %dx
add %dx, %ax
dec %ax
cmp %bp, %ax
je read_chs
#ifndef NO_LBA_CHECK
/*
* Determine whether we have int13-extensions, by calling int 13, function 41.
* Check for the magic number returned, and the disk packet capability.
*/
movw $0x55aa, %bx
movb $0x41, %ah
pop %dx
push %dx
int $0x13
set_err(ERR_NO_LBA)
jc err_msg /* no int13 extensions */
cmpw $0xaa55, %bx
jnz err_msg
testb $1, %cl
jz err_msg
#endif /* NO_LBA_CHECK */
#endif /* NO_CHS */
/*
* Save sector number (passed in %ebp) into lba parameter block,
* read the sector and leap into it.
*/
boot_lba:
movl %ebp, lba_sector /* save sector number */
movw $lba_info, %si
movb $0x42, %ah
pop %dx /* recover drive # */
do_read:
push %dx /* save drive */
int $0x13
set_err(ERR_READ)
jc err_msg
/*
* Check signature for valid bootcode
*/
movb BOOTADDR, %al /* first byte non-zero */
test %al, %al
jz 1f
movw BOOTADDR + MBR_MAGIC_OFFSET, %ax
1: cmp $MBR_MAGIC, %ax
set_err(ERR_NOOS)
jnz err_msg
/* We pass the sector number through to the next stage boot.
* It doesn't have to use it (indeed no other mbr code will generate) it,
* but it does let us have a NetBSD pbr that can identify where it was
* read from! This lets us use this code to select between two
* NetBSD system on the same physical driver.
* (If we've read the mbr of a different disk, it gets a random number
* - but it wasn't expecting anything...)
*/
movl %ebp, %esi
pop %dx /* recover drive # */
#ifdef __minix
/* There some bug in MINIX tools, which causes to
* generate wrong code for "jmp BOOTADDR" (relocation issue).
*/
jmp start - LOADADDR + BOOTADDR
#else
jmp BOOTADDR
#endif
#ifndef NO_CHS
/*
* Sector below CHS limit
* Do a cylinder-head-sector read instead.
*/
read_chs:
pop %dx /* recover drive # */
movb 1(%si), %dh /* head */
movw 2(%si), %cx /* ch=cyl, cl=sect */
movw $BOOTADDR, %bx /* es:bx is buffer */
movw $0x201, %ax /* command 2, 1 sector */
jmp do_read
#endif
/*
* Control block for int-13 LBA read.
* We need a xx, 00, 01, 00 somewhere to load chs for sector zero,
* by a complete fluke there is one here!
*/
chs_zero:
lba_info:
.word 0x10 /* control block length */
.word 1 /* sector count */
.word BOOTADDR /* offset in segment */
.word 0 /* segment */
lba_sector:
.long 0x0000 /* sector # goes here... */
.long 0x0000
errtxt: .ascii "Error " /* runs into crlf if errcod set */
errcod: .byte 0
crlf: .asciz "\r\n"
#ifndef NO_BANNER
#ifdef BOOTSEL
#ifdef COM_PORT_VAL
banner: .asciz "a: disk"
#else
banner: .asciz "Fn: diskn"
#endif
#else
banner: .asciz "NetBSD MBR boot"
#endif
#endif
#ifdef BOOTSEL
prefix: .asciz "0: "
#endif
#ifndef TERSE_ERROR
ERR_INVPART: .asciz "No active partition"
ERR_READ: .asciz "Disk read error"
ERR_NOOS: .asciz "No operating system"
#ifndef NO_LBA_CHECK
ERR_NO_LBA: .asciz "Invalid CHS read"
#endif
#ifdef BOOTSEL
ERR_KEY: .asciz "bad key"
#endif
#endif
#if defined(COM_BAUD)
#define COM_DIVISOR (((COM_FREQ / COM_BAUD) + 8) / 16)
com_args:
.byte 0x80 /* divisor latch enable */
.byte +3 /* io_port + 3 */
.byte COM_DIVISOR & 0xff
.byte -3 /* io_port */
.byte COM_DIVISOR >> 8 /* high baud */
.byte +1 /* io_port + 1 */
.byte 0x03 /* 8 bit no parity */
.byte +2 /* io_port + 3 */
num_com_args = (. - com_args)/2
#endif
/*
* I hate #including source files, but the stuff below has to be at
* the correct absolute address.
* Clearly this could be done with a linker script.
*/
message_crlf:
call message
movw $crlf, %si
#include <message.S>
#if 0
#include <dump_eax.S>
#endif
/*
* Stuff from here on is overwritten by fdisk - the offset must not change...
*
* Get amount of space to makefile can report it.
* (Unfortunately I can't seem to get the value reported when it is -ve)
*/
mbr_space = defkey - .
. = start + MBR_BS_OFFSET
/*
* Default action, as a keyvalue we'd normally read from the BIOS.
*/
defkey:
.byte KEY_ACTIVE /* ps/2 code */
#ifndef BOOTSEL_FLAGS
#define BOOTSEL_FLAGS 0
#endif
flags: .byte MBR_BS_NEWMBR | BOOTSEL_FLAGS
/*
* Timeout value. ~65536 ticks per hour, which is ~18.2 times per second.
* 0xffff means never timeout.
*/
timeout:
.word 182 /* default to 10 seconds */
/*
* mbr_bootsel
*/
nametab:
.fill MBR_PART_COUNT * (MBR_BS_PARTNAMESIZE + 1), 0x01, 0x00
/* space for mbr_dsn */
. = start + MBR_DSN_OFFSET
.long 0
/* mbr_bootsel_magic */
. = start + MBR_BS_MAGIC_OFFSET
.word MBR_BS_MAGIC
/*
* MBR partition table
*/
. = start + MBR_PART_OFFSET
parttab:
.fill 0x40, 0x01, 0x00
. = start + MBR_MAGIC_OFFSET
.word MBR_MAGIC
/* zeroed data space */
bss_off = 0
bss_start = .
#define BSS(name, size) name = bss_start + bss_off; bss_off = bss_off + size
BSS(ptn_list, 256 * 4) /* long[]: boot sector numbers */
BSS(dump_eax_buff, 16)
BSS(bss_end, 0)
|
0xffea/MINIX3
| 3,422
|
sys/arch/i386/stand/lib/biosmca.S
|
/* $NetBSD: biosmca.S,v 1.4 2003/02/01 14:48:18 dsl Exp $ */
/*
* Ported to boot 386BSD by Julian Elischer ([email protected]) Sept 1992
*
* Mach Operating System
* Copyright (c) 1992, 1991 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or [email protected]
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/
/*
Copyright 1988, 1989, 1990, 1991, 1992
by Intel Corporation, Santa Clara, California.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and
its documentation for any purpose and without fee is hereby
granted, provided that the above copyright notice appears in all
copies and that both the copyright notice and this permission notice
appear in supporting documentation, and that the name of Intel
not be used in advertising or publicity pertaining to distribution
of the software without specific, written prior permission.
INTEL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
IN NO EVENT SHALL INTEL BE LIABLE FOR ANY SPECIAL, INDIRECT, OR
CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT,
NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* extracted from netbsd:sys/arch/i386/stand/bios_disk.S */
#include <machine/asm.h>
.data
.globl _C_LABEL(biosmca_ps2model)
_C_LABEL(biosmca_ps2model): .long 0
.text
/*
# BIOS call "INT 0x15 Function 0xc0" to read extended sys config info on PS/2
# Return: no return value
#
# This function initializes biosmca_ps2model with model number as
# identified by BIOS, if the machine is a PS/2 box (i.e. has MCA bus
# instead of ISA).
*/
ENTRY(biosmca)
.code32
pushl %ebp
movl %esp, %ebp
pushl %ebx
push %ecx
push %edx
push %esi
push %edi
push %eax
call _C_LABEL(prot_to_real) # enter real mode
.code16
# zero %ecx
xorl %ecx, %ecx
xor %ax, %ax
movb $0xc0, %ah # subfunction
int $0x15
jc back
# check feature byte 1 if MCA bus present and replaces ISA
movb %es:5(%bx), %al
andb $0x02, %al # bit 1 set means MCA instead of ISA
# see also arch/i386/mca/mca_machdep.c
jnz back
# save model and submodel bytes to %cx
movb %es:2(%bx), %ch # model (1 byte)
movb %es:3(%bx), %cl # submodel (1 byte)
back:
calll _C_LABEL(real_to_prot) # back to protected mode
.code32
# save model
movl %ecx, _C_LABEL(biosmca_ps2model)
pop %eax
pop %edi
pop %esi
pop %edx
pop %ecx
popl %ebx
popl %ebp
ret
|
0xffea/MINIX3
| 2,426
|
sys/arch/i386/stand/lib/message.S
|
/* $NetBSD: message.S,v 1.4 2009/11/19 22:10:03 dsl Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by David Laight.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <machine/asm.h>
.global message, message_1
#if defined(BOOT_MSG_COM0) && !defined(COM_PORT_VAL)
#define COM_PORT_VAL $0x3f8 /* Value for COM1 */
#endif
/*
* message: write the error message in %ds:%esi to the console
*/
message:
/*
* BIOS call "INT 10H Function 0Eh" to write character to console
* Call with %ah = 0x0e
* %al = character
* %bh = page
* %bl = foreground color
*/
.code16
pusha
message_1: /* for dump_eax */
lodsb
1:
#ifdef COM_PORT_VAL
mov COM_PORT_VAL, %dx
outb %al, %dx
add $5, %dl
2: inb %dx
test $0x40, %al
jz 2b
#else
movb $0x0e, %ah
movw $0x0001, %bx
int $0x10
#endif
lodsb
testb %al, %al
jnz 1b
#ifdef MESSAGE_PAUSE
/* Delay for about 1 second to allow message to be read */
movb $0x86, %ah
mov $16, %cx /* about a second */
int $0x15 /* delay cx:dx usecs */
#endif
popa
ret
|
0xffea/MINIX3
| 7,116
|
sys/arch/i386/stand/lib/bios_disk.S
|
/* $NetBSD: bios_disk.S,v 1.21 2011/06/16 13:27:59 joerg Exp $ */
/*
* Ported to boot 386BSD by Julian Elischer ([email protected]) Sept 1992
*
* Mach Operating System
* Copyright (c) 1992, 1991 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or [email protected]
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/
/*
Copyright 1988, 1989, 1990, 1991, 1992
by Intel Corporation, Santa Clara, California.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and
its documentation for any purpose and without fee is hereby
granted, provided that the above copyright notice appears in all
copies and that both the copyright notice and this permission notice
appear in supporting documentation, and that the name of Intel
not be used in advertising or publicity pertaining to distribution
of the software without specific, written prior permission.
INTEL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
IN NO EVENT SHALL INTEL BE LIABLE FOR ANY SPECIAL, INDIRECT, OR
CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT,
NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* extracted from netbsd:sys/arch/i386/boot/bios.S */
#include <machine/asm.h>
/*
* BIOS call "INT 0x13 Function 0x0" to reset the disk subsystem
* Call with %ah = 0x0
* %dl = drive (0x80 for hard disk, 0x0 for floppy disk)
* Return:
* %al = 0x0 on success; err code on failure
*/
ENTRY(biosdisk_reset)
pusha
movb %al, %dl # device
call _C_LABEL(prot_to_real) # enter real mode
.code16
movb $0x0, %ah # subfunction
int $0x13
setc %bl
movb %ah, %bh # save error code
calll _C_LABEL(real_to_prot) # back to protected mode
.code32
movzwl %bx, %eax # return value in %eax
movl %eax, 28(%esp)
popa
ret
/*
* BIOS call "INT 0x13 Function 0x2" to read sectors from disk into memory
* Call with %ah = 0x2
* %al = number of sectors
* %ch = cylinder
* %cl = sector
* %dh = head
* %dl = drive (0x80 for hard disk, 0x0 for floppy disk)
* %es:%bx = segment:offset of buffer
* Return:
* %al = 0x0 on success; err code on failure
*
* biosdisk_read(dev, cyl, head, sect, count, buff_addr);
*
* Note: On failure, you must reset the disk with biosdisk_reset() before
* sending another command.
*/
ENTRY(biosdisk_read)
pusha
movb 44(%esp), %dh
movw 40(%esp), %cx
xchgb %ch, %cl # cylinder; the highest 2 bits of cyl is in %cl
rorb $2, %cl
movb 48(%esp), %al
orb %al, %cl
incb %cl # sector; sec starts from 1, not 0
movb 36(%esp), %dl # device
movl 56(%esp), %ebx # buffer address (may be >64k)
movb 52(%esp), %al # number of sectors
call _C_LABEL(prot_to_real) # enter real mode
.code16
push %bx
shrl $4, %ebx # max segment
mov %ds, %si
add %si, %bx
mov %bx, %es # %es:%bx now valid buffer address
pop %bx
and $0xf, %bx # and min offset - to avoid overrun
movb $0x2, %ah # subfunction
int $0x13
setc %al # error code is in %ah
calll _C_LABEL(real_to_prot) # back to protected mode
.code32
movl %eax, 28(%esp)
popa
ret
/*
* biosdisk_getinfo(int dev): return a word that represents the
* max number of sectors, heads and cylinders for this device
*/
ENTRY(biosdisk_getinfo)
push %es
pusha
movb %al, %dl # diskinfo(drive #)
call _C_LABEL(prot_to_real) # enter real mode
.code16
push %dx # save drive #
movb $0x08, %ah # ask for disk info
int $0x13
pop %bx # restore drive #
jnc ok
testb $0x80, %bl # is it a hard disk?
jnz ok
/*
* Urk. Call failed. It is not supported for floppies by old BIOS's.
* Guess it's a 15-sector floppy. Initialize all the registers for
* documentation, although we only need head and sector counts.
*/
xorw %ax, %ax # set status to success
# movb %ah, %bh # %bh = 0
# movb $2, %bl # %bl bits 0-3 = drive type, 2 = 1.2M
movb $79, %ch # max track
movb $15, %cl # max sector
movb $1, %dh # max head
# movb $1, %dl # # floppy drives installed
# es:di = parameter table
# carry = 0
ok:
calll _C_LABEL(real_to_prot) # back to protected mode
.code32
/* form a longword representing all this gunk */
shrl $8, %eax # clear unnecessary bits
shll $24, %eax
shll $16, %ecx # do the same for %ecx
shrl $8, %ecx
movb %dh, %cl # max head
orl %ecx, %eax # return value in %eax
movl %eax, 28(%esp)
popa
pop %es
ret
/*
* int biosdisk_int13ext(int dev):
* check for availibility of int13 extensions.
*/
ENTRY(biosdisk_int13ext)
pusha
movb %al, %dl # drive #
movw $0x55aa, %bx
call _C_LABEL(prot_to_real) # enter real mode
.code16
movb $0x41, %ah # ask for disk info
int $0x13
setnc %dl
calll _C_LABEL(real_to_prot) # switch back
.code32
movzbl %dl, %eax # return value in %eax
cmpw $0xaa55, %bx
sete %dl
andb %dl, %al
andb %cl, %al
movl %eax, 28(%esp)
popa
ret
/*
* BIOS call "INT 0x13 Function 0x42" to read sectors from disk into memory
* Call with %ah = 0x42
* %ds:%si = parameter block (data buffer address
* must be a real mode physical address).
* %dl = drive (0x80 for hard disk, 0x0 for floppy disk)
* Return:
* %al = 0x0 on success; err code on failure
*/
ENTRY(biosdisk_extread)
pusha
movl %edx, %esi # parameter block
movb %al, %dl # device
call _C_LABEL(prot_to_real) # enter real mode
.code16
push %ds
movl %esi, %eax
shrl $4, %eax
movw %ds, %bx
addw %bx, %ax
movw %ax, %ds
andw $0xf, %si
movb $0x42, %ah # subfunction
int $0x13
setc %bl
movb %ah, %bh # save error code
pop %ds
calll _C_LABEL(real_to_prot) # back to protected mode
.code32
movzwl %bx, %eax # return value in %eax
movl %eax, 28(%esp)
popa
ret
ENTRY(biosdisk_getextinfo)
pusha
movl %edx, %esi # parameter block
movb %al, %dl # device
call _C_LABEL(prot_to_real) # enter real mode
.code16
push %ds
movl %esi, %eax
shrl $4, %eax
andw $0xf, %si
movw %ds, %bx
addw %bx, %ax
movw %ax, %ds
movb $0x48, %ah # subfunction
int $0x13
setc %bl
pop %ds
calll _C_LABEL(real_to_prot) # back to protected mode
.code32
movzbl %bl, %eax # return value in %eax
movl %eax, 28(%esp)
popa
ret
|
0xffea/MINIX3
| 2,511
|
sys/arch/i386/stand/lib/comio.S
|
/* $NetBSD: comio.S,v 1.4 2003/04/16 14:23:11 dsl Exp $ */
/* serial console handling
modelled after code in FreeBSD:sys/i386/boot/netboot/start2.S
*/
#include <machine/asm.h>
.text
/**************************************************************************
INIT - Initialization (com number)
**************************************************************************/
ENTRY(cominit)
push %ebp
mov %esp,%ebp
push %ebx
push %edx
push %esi
push %edi
movl 8(%ebp), %edx
call _C_LABEL(prot_to_real) # enter real mode
.code16
# Initialize the serial port (dl) to 9600 baud, 8N1.
movb $0xe3, %al
movb $0, %ah
int $0x14
mov %ax,%bx
calll _C_LABEL(real_to_prot) # back to protected mode
.code32
xor %eax,%eax
mov %bx,%ax
pop %edi
pop %esi
pop %edx
pop %ebx
pop %ebp
ret
/**************************************************************************
PUTC - Print a character (char, com number)
**************************************************************************/
ENTRY(computc)
push %ebp
mov %esp,%ebp
push %ecx
push %ebx
push %edx
push %esi
push %edi
movb 8(%ebp),%cl
movl 12(%ebp),%edx
call _C_LABEL(prot_to_real) # enter real mode
.code16
movb %cl,%al
movb $0x01, %ah
int $0x14
movb %ah,%bl
calll _C_LABEL(real_to_prot) # back to protected mode
.code32
xor %eax,%eax
movb %bl,%al
pop %edi
pop %esi
pop %edx
pop %ebx
pop %ecx
pop %ebp
ret
/**************************************************************************
GETC - Get a character (com number)
**************************************************************************/
ENTRY(comgetc)
push %ebp
mov %esp,%ebp
push %ebx
push %edx
push %esi
push %edi
movl 8(%ebp),%edx
call _C_LABEL(prot_to_real) # enter real mode
.code16
movb $0x02, %ah
int $0x14
mov %ax, %bx
calll _C_LABEL(real_to_prot) # back to protected mode
.code32
xor %eax,%eax
mov %bx,%ax
pop %edi
pop %esi
pop %edx
pop %ebx
pop %ebp
ret
/**************************************************************************
ISKEY - Check for keyboard interrupt (com number)
**************************************************************************/
ENTRY(comstatus)
push %ebp
mov %esp,%ebp
push %ebx
push %edx
push %esi
push %edi
movl 8(%ebp),%edx
call _C_LABEL(prot_to_real) # enter real mode
.code16
movb $0x03, %ah
int $0x14
mov %ax,%bx
calll _C_LABEL(real_to_prot) # back to protected mode
.code32
xor %eax,%eax
mov %bx,%ax
pop %edi
pop %esi
pop %edx
pop %ebx
pop %ebp
ret
|
0xffea/MINIX3
| 4,466
|
sys/arch/i386/stand/lib/bios_pci.S
|
/* $NetBSD: bios_pci.S,v 1.6 2005/12/11 12:17:48 christos Exp $ */
/*
* Copyright (c) 1996
* Matthias Drochner. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
/* minimal calls to PCI BIOS */
#include <machine/asm.h>
#define addr32 .byte 0x67
#define data32 .byte 0x66
#define PCI_FUNCTION_ID 0xb1
#define PCI_BIOS_PRESENT 0x01
#define FIND_PCI_DEVICE 0x02
#define READ_CONFIG_DWORD 0x0a
#define WRITE_CONFIG_DWORD 0x0d
/* int pcibios_present(int *signature)
return: AX from BIOS call, -1 on error
var param: EDX from BIOS call, must be signature "PCI "
*/
ENTRY(pcibios_present)
pushl %ebp
movl %esp, %ebp
pushl %ebx
pushl %ecx
pushl %edx
call _C_LABEL(prot_to_real) # enter real mode
.code16
movb $PCI_FUNCTION_ID, %ah
movb $PCI_BIOS_PRESENT, %al
int $0x1a
jnc ok1
movl $-1, %ebx
jmp err1
ok1:
xorl %ebx, %ebx
mov %ax, %bx
err1:
calll _C_LABEL(real_to_prot) # back to protected mode
.code32
movl 8(%ebp), %eax
movl %edx, (%eax)
movl %ebx, %eax # return value in %eax
popl %edx
popl %ecx
popl %ebx
popl %ebp
ret
/* int pcibios_finddev(int vendor, int device, int index, int *busdevfcn)
return: AH from BIOS call, -1 on error
var param: BX from BIOS call, contains bus/device/function
*/
ENTRY(pcibios_finddev)
pushl %ebp
movl %esp, %ebp
pushl %ebx
pushl %ecx
pushl %edx
pushl %esi
movl 8(%ebp), %edx
movl 12(%ebp), %ecx
movl 16(%ebp), %esi
call _C_LABEL(prot_to_real) # enter real mode
.code16
movb $PCI_FUNCTION_ID, %ah
movb $FIND_PCI_DEVICE, %al
int $0x1a
jnc ok2
movl $-1, %edx
jmp err2
ok2:
movl $0,%edx
movb %ah, %dl
err2:
calll _C_LABEL(real_to_prot) # back to protected mode
.code32
movl 20(%ebp), %eax
mov %bx, (%eax)
movl %edx, %eax # return value in %eax
popl %esi
popl %edx
popl %ecx
popl %ebx
popl %ebp
ret
/* int pcibios_cfgread(int busdevfcn, int offset, int *value)
return: AH from BIOS call, -1 on error
var param: ECX from BIOS call, contains value read
*/
ENTRY(pcibios_cfgread)
pushl %ebp
movl %esp, %ebp
pushl %ebx
pushl %ecx
pushl %edx
pushl %edi
movl 8(%ebp), %ebx
movl 12(%ebp), %edi
call _C_LABEL(prot_to_real) # enter real mode
.code16
movb $PCI_FUNCTION_ID, %ah
movb $READ_CONFIG_DWORD, %al
int $0x1a
jnc ok3
movl $-1, %edx
jmp err3
ok3:
movl $0,%edx
movb %ah, %dl
err3:
calll _C_LABEL(real_to_prot) # back to protected mode
.code32
movl 16(%ebp), %eax
movl %ecx, (%eax)
movl %edx, %eax # return value in %eax
popl %edi
popl %edx
popl %ecx
popl %ebx
popl %ebp
ret
/* int pcibios_cfgwrite(int busdevfcn, int offset, int value)
return: AH from BIOS call, -1 on error
var param: ECX from BIOS call, contains value read
*/
ENTRY(pcibios_cfgwrite)
pushl %ebp
movl %esp, %ebp
pushl %ebx
pushl %ecx
pushl %edx
pushl %edi
movl 8(%ebp), %ebx
movl 12(%ebp), %edi
movl 16(%ebp), %ecx
call _C_LABEL(prot_to_real) # enter real mode
.code16
movb $PCI_FUNCTION_ID, %ah
movb $WRITE_CONFIG_DWORD, %al
int $0x1a
jnc ok4
movl $-1, %edx
jmp err4
ok4:
movl $0,%edx
movb %ah, %dl
err4:
calll _C_LABEL(real_to_prot) # back to protected mode
.code32
movl %edx, %eax # return value in %eax
popl %edi
popl %edx
popl %ecx
popl %ebx
popl %ebp
ret
|
0xffea/MINIX3
| 7,151
|
sys/arch/i386/stand/lib/realprot.S
|
/* $NetBSD: realprot.S,v 1.10 2010/12/19 17:18:23 jakllsch Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by David Laight.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/*
* Loosely based on code from stand/lib/libcrt/bootsect/start_bootsect.S
*/
#include <machine/asm.h>
#define CR0_PE 1
.text
.align 16
gdt:
.word 0, 0
.byte 0, 0x00, 0x00, 0
/* kernel code segment */
.globl flatcodeseg
flatcodeseg = . - gdt
.word 0xffff, 0
.byte 0, 0x9f, 0xcf, 0
/* kernel data segment */
.globl flatdataseg
flatdataseg = . - gdt
.word 0xffff, 0
.byte 0, 0x93, 0xcf, 0
/* boot code segment, base will be patched */
bootcodeseg = . - gdt
.word 0xffff, 0
.byte 0, 0x9e, 0x4f, 0
/* boot data segment, base will be patched */
bootdataseg = . - gdt
.word 0xffff, 0
.byte 0, 0x92, 0xcf, 0
/* 16 bit real mode, base will be patched */
bootrealseg = . - gdt
.word 0xffff, 0
.byte 0, 0x9e, 0x00, 0
/* limits (etc) for data segment in real mode */
bootrealdata = . - gdt
.word 0xffff, 0
.byte 0, 0x92, 0x00, 0
gdtlen = . - gdt
.align 16
gdtarg:
.word gdtlen-1 /* limit */
.long 0 /* physical addr, will be inserted */
toreal: .word xreal /* off:seg address for indirect jump */
ourseg: .word 0 /* real mode code and data segment */
stkseg: .word 0 /* real mode stack segment */
stkdif: .long 0 /* diff. between real and prot sp */
.global gdt_fixup
gdt_fixup:
.code16
pushl %eax
pushl %edx
xorl %eax, %eax
mov %cs, %ax
mov %ax, ourseg
/* sort out stuff for %ss != %ds */
xorl %edx, %edx
movw %ss, %dx
movw %dx, stkseg
subl %eax, %edx
shll $4, %edx
movl %edx, stkdif
/* fix up GDT entries for bootstrap */
mov %ax, %dx
shll $4, %eax
shr $12, %dx
#define FIXUP(gdt_index) \
movw %ax, gdt+gdt_index+2; \
movb %dl, gdt+gdt_index+4
FIXUP(bootcodeseg)
FIXUP(bootrealseg)
FIXUP(bootdataseg)
/* fix up GDT pointer */
addl $gdt, %eax
movl %eax, gdtarg+2
popl %edx
popl %eax
ret
/*
* real_to_prot()
*
* Switch CPU to 32bit protected mode to execute C.
*
* NB: Call with the 32bit calll instruction so that a 32 bit
* return address is pushed.
*
* All registers are preserved, %ss:%esp will point to the same
* place as %ss:%sp did, although the actual value of %esp might
* be changed.
*
* Interrupts are disabled while we are in 32bit mode to save us
* having to setup a different IDT. This code is only used during
* the boot process and it doesn't use any interrupts.
*/
ENTRY(real_to_prot)
.code16
pushl %eax
cli
lgdt %cs:gdtarg /* Global descriptor table */
movl %cr0, %eax
or $CR0_PE, %ax
movl %eax, %cr0 /* Enter 'protected mode' */
ljmp $bootcodeseg, $1f /* Jump into a 32bit segment */
1:
.code32
/* Set all the segment registers to map the same area as the code */
mov $bootdataseg, %eax
mov %ax, %ds
mov %ax, %es
mov %ax, %ss
addl stkdif, %esp /* Allow for real %ss != %ds */
popl %eax
ret
/*
* prot_to_real()
*
* Switch CPU back to 16bit real mode in order to call system bios functions.
*
* All registers are preserved, except that %sp may be changed so that
* %ss:%sp points to the same memory.
* Note that %ebp is preserved and will not reference the correct part
* of the stack.
*
* Interrupts are enabled while in real mode.
*
* Based on the descripton in section 14.5 of the 80386 Programmer's
* reference book.
*/
/*
* EPIA_HACK
*
* VIA C3 processors (Eden, Samuel 2) don't seem to correctly switch back to
* executing 16 bit code after the switch to real mode and subsequent jump.
*
* It is speculated that the CPU is prefetching and decoding branch
* targets and not invalidating this buffer on the long jump.
* Further investication indicates that the caching of return addresses
* is most likely the problem.
*
* Previous versions just used some extra call/ret and a few NOPs, these
* only helped a bit, but booting compressed kernels would still fail.
*
* Trashing the return address stack (by doing 'call' without matched 'ret')
* Seems to fix things completely. 1 iteration isn't enough, 16 is plenty.
*/
ENTRY(prot_to_real)
.code32
pushl %eax
#ifdef EPIA_HACK
push %ecx
push $0x10
pop %ecx
1: call trash_return_cache
loop 1b
pop %ecx
#endif
/*
* Load the segment registers while still in protected mode.
* Otherwise the control bits don't get changed.
* The correct base addresses are loaded later.
*/
movw $bootrealdata, %ax
movw %ax, %ds
movw %ax, %es
movw %ax, %ss
/*
* Load %cs with a segment that has the correct attributes for
* 16bit operation.
*/
ljmp $bootrealseg, $1f
1:
.code16
movl %cr0, %eax
and $~CR0_PE, %eax
movl %eax, %cr0 /* Disable potected mode */
/* Jump far indirect to load real mode %cs */
ljmp *%cs:toreal
xreal:
/*
* CPU is now in real mode, load the other segment registers
* with their correct base addresses.
*/
mov %cs, %ax
mov %ax, %ds
mov %ax, %es
/*
* If stack was above 64k, 16bit %ss needs to be different from
* 32bit %ss (and the other segment registers).
*/
mov stkseg, %ax
mov %ax, %ss
subl stkdif, %esp
/* Check we are returning to an address below 64k */
push %bp
movw %sp, %bp
movw 2/*bp*/ + 4/*eax*/ + 2(%bp), %ax /* high bits ret addr */
test %ax, %ax
jne 1f
pop %bp
sti
popl %eax
retl
1: movw $3f, %si
call message
movl 2/*bp*/ + 4/*eax*/(%bp), %eax /* return address */
call dump_eax
int $0x18
2: sti
hlt
jmp 2b
3: .asciz "prot_to_real can't return to "
.global dump_eax_buff
dump_eax_buff:
. = . + 16
#ifdef EPIA_HACK
trash_return_cache:
.code32
pop %eax
jmp *%eax
#endif
/* vtophys(void *)
* convert boot time 'linear' address to a physical one
*/
ENTRY(vtophys)
.code32
xorl %eax, %eax
movw ourseg, %ax
shll $4, %eax
addl 4(%esp), %eax
ret
|
0xffea/MINIX3
| 2,902
|
sys/arch/i386/stand/lib/cpufunc.S
|
/* $NetBSD: cpufunc.S,v 1.4 2011/06/08 16:03:42 joerg Exp $ */
/*-
* Copyright (c) 2007 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Andrew Doran.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <machine/asm.h>
NENTRY(x86_read_psl)
pushfl
popl %eax
ret
NENTRY(x86_write_psl)
movl 4(%esp), %eax
pushl %eax
popfl
ret
NENTRY(x86_disable_intr)
cli
ret
NENTRY(x86_enable_intr)
sti
ret
NENTRY(inb)
movl 4(%esp), %edx
xorl %eax, %eax
inb %dx, %al
ret
NENTRY(insb)
pushl %edi
movl 8(%esp), %edx
movl 12(%esp), %edi
movl 16(%esp), %ecx
cld
rep
insb
popl %edi
ret
NENTRY(inw)
movl 4(%esp), %edx
xorl %eax, %eax
inw %dx, %ax
ret
NENTRY(insw)
pushl %edi
movl 8(%esp), %edx
movl 12(%esp), %edi
movl 16(%esp), %ecx
cld
rep
insw
popl %edi
ret
NENTRY(inl)
movl 4(%esp), %edx
inl %dx, %eax
ret
NENTRY(insl)
pushl %edi
movl 8(%esp), %edx
movl 12(%esp), %edi
movl 16(%esp), %ecx
cld
rep
insl
popl %edi
ret
NENTRY(outb)
movl 4(%esp), %edx
movl 8(%esp), %eax
outb %al, %dx
ret
NENTRY(outsb)
pushl %esi
movl 8(%esp), %edx
movl 12(%esp), %esi
movl 16(%esp), %ecx
cld
rep
outsb
popl %esi
ret
NENTRY(outw)
movl 4(%esp), %edx
movl 8(%esp), %eax
outw %ax, %dx
ret
NENTRY(outsw)
pushl %esi
movl 8(%esp), %edx
movl 12(%esp), %esi
movl 16(%esp), %ecx
cld
rep
outsw
popl %esi
ret
NENTRY(outl)
movl 4(%esp), %edx
movl 8(%esp), %eax
outl %eax, %dx
ret
NENTRY(outsl)
pushl %esi
movl 8(%esp), %edx
movl 12(%esp), %esi
movl 16(%esp), %ecx
cld
rep
outsl
popl %esi
ret
|
0xffea/MINIX3
| 2,390
|
sys/arch/i386/stand/lib/biosdelay.S
|
/* $NetBSD: biosdelay.S,v 1.4 2005/12/11 12:17:48 christos Exp $ */
/*
* Copyright (c) 1996, 1997
* Perry E. Metzger. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgements:
* This product includes software developed for the NetBSD Project
* by Perry E. Metzger.
* 4. The names of the authors may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include <machine/asm.h>
.text
/*
* BIOS call "INT 15H Function 86H" to sleep for a set number of microseconds
* Call with %ah = 0x86
* %cx = time interval (high)
* %dx = time interval (low)
* Return:
* If error
* CF = set
* else
* CF = clear
*/
ENTRY(delay)
pushl %ebp
pushl %ebx
pushl %esi
pushl %edi
movw 20(%esp), %dx
movw 22(%esp), %cx
call _C_LABEL(prot_to_real)
.code16
movb $0x86, %ah
int $0x15
setnc %ah
movb %ah, %bl # real_to_prot uses %eax
calll _C_LABEL(real_to_prot)
.code32
xorl %eax, %eax
movb %bl, %al
popl %edi
popl %esi
popl %ebx
popl %ebp
ret
|
0xffea/MINIX3
| 3,005
|
sys/arch/i386/stand/lib/dos_file.S
|
/* $NetBSD: dos_file.S,v 1.6 2009/11/21 11:52:57 dsl Exp $ */
/* extracted from Tor Egge's patches for NetBSD boot */
#include <machine/asm.h>
/*
# MSDOS call "INT 0x21 Function 0x3d" to open a file.
# Call with %ah = 0x3d
# %al = 0x0 (access and sharing modes)
# %ds:%dx = ASCIZ filename
# %cl = attribute mask of files to look for
*/
.globl _C_LABEL(doserrno)
_C_LABEL(doserrno): .long 1
ENTRY(dosopen)
.code32
pushl %ebp
movl %esp, %ebp
pushl %edx
pushl %ebx
pushl %esi
pushl %edi
movl 0x8(%ebp), %edx # File name.
call _C_LABEL(prot_to_real) # enter real mode
.code16
push %ds
movl %edx, %eax
shrl $4, %eax
mov %ds, %si
add %si, %ax
mov %ax, %ds
and $0xf, %dx
movb $0x3d, %ah # Open existing file.
movb $0x0 , %al # ro
sti
int $0x21
cli
pop %ds
jnc ok1
mov %ax, _C_LABEL(doserrno)
movl $-1, %edx
jmp err1
ok1:
movl $0,%edx
mov %ax, %dx
err1:
calll _C_LABEL(real_to_prot) # back to protected mode
.code32
movl %edx, %eax # return value in %eax
popl %edi
popl %esi
popl %ebx
popl %edx
popl %ebp
ret
ENTRY(dosread)
.code32
pushl %ebp
movl %esp, %ebp
pushl %ebx
pushl %ecx
pushl %edx
pushl %esi
pushl %edi
movl 0x8(%ebp), %ebx # File handle
movl 0xc(%ebp), %edx # Buffer.
movl 0x10(%ebp), %ecx # Bytes to read
call _C_LABEL(prot_to_real) # enter real mode
.code16
push %ds
movl %edx, %eax
shrl $4, %eax
mov %ds, %si
add %si, %ax
mov %ax, %ds
and $0xf, %dx
movb $0x3f, %ah # Read from file or device
sti
int $0x21
cli
pop %ds
jnc ok2
mov %ax, _C_LABEL(doserrno)
movl $-1, %edx
jmp err2
ok2:
movl $0,%edx
mov %ax, %dx
err2:
calll _C_LABEL(real_to_prot) # back to protected mode
.code32
movl %edx, %eax # return value in %eax
popl %edi
popl %esi
popl %edx
popl %ecx
popl %ebx
popl %ebp
ret
ENTRY(dosclose)
.code32
pushl %ebp
movl %esp, %ebp
pushl %ebx
pushl %esi
pushl %edi
movl 0x8(%ebp), %ebx # File handle
call _C_LABEL(prot_to_real) # enter real mode
.code16
movb $0x3e, %ah # Close file.
sti
int $0x21
cli
jnc ok3
mov %ax, _C_LABEL(doserrno)
movl $-1, %ebx
jmp err3
ok3:
movl $0, %ebx
err3:
calll _C_LABEL(real_to_prot) # back to protected mode
.code32
movl %ebx, %eax # return value in %eax
popl %edi
popl %esi
popl %ebx
popl %ebp
ret
ENTRY(dosseek)
.code32
pushl %ebp
movl %esp, %ebp
pushl %ebx
pushl %ecx
pushl %edx
pushl %esi
pushl %edi
movl 0x8(%ebp), %ebx # File handle
movl 0xc(%ebp), %ecx # Offset
movl 0x10(%ebp) , %edx # whence
call _C_LABEL(prot_to_real) # enter real mode
.code16
movb $0x42, %ah # Seek
movb %dl, %al # whence
mov %cx, %dx #offs lo
shrl $0x10, %ecx #offs hi
sti
int $0x21
cli
jnc ok4
mov %ax, _C_LABEL(doserrno)
movl $-1, %edx
jmp err4
ok4:
shll $0x10, %edx #new ofs hi
mov %ax, %dx #new ofs lo
err4:
calll _C_LABEL(real_to_prot) # back to protected mode
.code32
movl %edx, %eax # return value in %eax
popl %edi
popl %esi
popl %edx
popl %ecx
popl %ebx
popl %ebp
ret
|
0xffea/MINIX3
| 2,795
|
sys/arch/i386/stand/lib/pvcopy.S
|
/* $NetBSD: pvcopy.S,v 1.2 2008/04/28 20:23:25 martin Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by David Laight.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <machine/asm.h>
/*
* Routines to copy to/from absolute virtual addresses.
* Needed because the boot code runs with %ds having a 64k offset
* whereas Unix runs with a zero offset.
*
* These routines are optimised for code space, not execution speed.
*/
/*
* pbzero(void *dst, int cnt)
* zero absolute virtual memory
*/
ENTRY(pbzero)
.code32
push %edi
push %es
mov 12(%esp),%edi
mov 16(%esp),%ecx
mov $flatdataseg, %ax /* selector with offset == 0 */
mov %ax, %es
xor %eax,%eax
cld
rep
stosb
pop %es
pop %edi
ret
/*
* vpbcopy(const void *src, void *dst, int cnt)
* Copy to absolute virtual address
*/
ENTRY(vpbcopy)
.code32
push %esi
push %edi
push %es
mov 16(%esp),%esi
mov 20(%esp),%edi
mov 24(%esp),%ecx
mov $flatdataseg, %ax /* selector with offset == 0 */
mov %ax, %es
xor %eax,%eax
cld
rep
movsb
popl %es
popl %edi
popl %esi
ret
/*
* pvbcopy(const void *src, void *dst, int cnt)
* Copy from absolute virtual address
*/
ENTRY(pvbcopy)
.code32
push %esi
push %edi
push %ds
mov 16(%esp),%esi
mov 20(%esp),%edi
mov 24(%esp),%ecx
mov $flatdataseg, %ax /* selector with offset == 0 */
mov %ax, %ds
xor %eax,%eax
cld
rep
movsb
popl %ds
popl %edi
popl %esi
ret
|
0xffea/MINIX3
| 2,578
|
sys/arch/i386/stand/lib/biosmemps2.S
|
/* $NetBSD: biosmemps2.S,v 1.6 2011/06/16 13:27:59 joerg Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Jaromir Dolecek.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <machine/asm.h>
.text
/* int getextmemp2(void buffer)
call int 15 function 0xc7 - later PS/2s - RETURN MEMORY-MAP INFORMATION
return: 0=OK, nonzero=error
buffer: filled with memory-map table structure
*/
ENTRY(getextmemps2)
.code32
movl %eax, %edx
xorl %eax, %eax
pusha
call _C_LABEL(prot_to_real)
.code16
# do int15, function 0xc0 call to discover if C7h is supported
movb $0xc0, %ah
int $0x15
setc %cl
jc out # 0xc0 not supported if carry set
# check feature byte 2, bit 4 to see if return memory map is supported
movb %es:6(%bx), %al
andb $0x10, %al
jnz getmem # 0xc7 supported
# set %cl to indicate failure, and exit
movb $2, %cl
jmp out
getmem:
# move the parameter to right register
push %ds
movl %edx, %esi
andl $0xf, %esi
shrl $4, %edx
mov %ds, %ax
add %dx, %ax
mov %ax, %ds
# actually call int15, function 0xc7 now
movb $0xc7, %ah
int $0x15
setc %cl # save carry
pop %ds
out:
calll _C_LABEL(real_to_prot)
.code32
movb %cl, 28(%esp)
popa
ret
|
0xffea/MINIX3
| 2,856
|
sys/arch/i386/stand/lib/conio.S
|
/* $NetBSD: conio.S,v 1.7 2011/06/16 13:27:59 joerg Exp $ */
/* PC console handling
originally from: FreeBSD:sys/i386/boot/netboot/start2.S
*/
#include <machine/asm.h>
.text
/**************************************************************************
CLR - Clear screen
**************************************************************************/
ENTRY(conclr)
pusha
call _C_LABEL(prot_to_real) # enter real mode
.code16
/* Clear screen. */
movw $0x0600, %ax
movw $0x0700, %bx
xorw %cx, %cx
movw $0x184f, %dx /* 80x25 */
int $0x10
/* Home cursor. */
movb $0x02, %ah
xorw %bx, %bx
xorw %dx, %dx
int $0x10
calll _C_LABEL(real_to_prot) # back to protected mode
.code32
popa
ret
/**************************************************************************
PUTC - Print a character
**************************************************************************/
ENTRY(conputc)
pusha
call _C_LABEL(prot_to_real) # enter real mode
.code16
cmp $0x08, %al # backspace?
jne print_char
# Multiline backspace support.
push %ax
movb $0x3, %ah # get cursor position
xorw %bx, %bx
int $0x10
pop %ax
testb %dl, %dl # cursor on first column?
jnz print_char
testb %dh, %dh # cursor not on first row?
jz print_char
decb %dh # move up one row
movb $0x4f, %dl # move to last column
xorw %bx, %bx
movb $0x02, %ah # set cursor position
jmp do_int
print_char:
movw $1,%bx
movb $0x0e,%ah # print character
movb %al, %cl
do_int:
int $0x10
calll _C_LABEL(real_to_prot) # back to protected mode
.code32
popa
ret
/**************************************************************************
GETC - Get a character
**************************************************************************/
ENTRY(congetc)
xorl %eax, %eax
pusha
call _C_LABEL(prot_to_real) # enter real mode
.code16
movb $0x0,%ah
int $0x16
movw %ax,%bx
calll _C_LABEL(real_to_prot) # back to protected mode
.code32
movw %bx, 28(%esp)
popa
ret
/**************************************************************************
ISSHIFT - Check for keyboard interrupt; via shift key
**************************************************************************/
ENTRY(conisshift)
xorl %eax, %eax
pusha
call _C_LABEL(prot_to_real) # enter real mode
.code16
xor %bx,%bx
movb $0x2,%ah
int $0x16
testb $3,%al
setnz %bl
calll _C_LABEL(real_to_prot) # back to protected mode
.code32
movb %bl, 28(%esp)
popa
ret
/**************************************************************************
ISKEY - Check for keyboard input
**************************************************************************/
ENTRY(coniskey)
xorl %eax, %eax
pusha
call _C_LABEL(prot_to_real) # enter real mode
.code16
xor %bx,%bx
movb $0x1,%ah
int $0x16
setnz %bl
calll _C_LABEL(real_to_prot) # back to protected mode
.code32
movb %bl, 28(%esp)
popa
ret
|
0xffea/MINIX3
| 3,425
|
sys/arch/i386/stand/lib/biosmemx.S
|
/* $NetBSD: biosmemx.S,v 1.9 2008/10/14 14:18:11 ad Exp $ */
/*
* Copyright (c) 1997, 1999
* Matthias Drochner. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include <machine/asm.h>
.text
/* int getextmem2(int buffer[2])
return: 0=OK, -1=error
buffer[0]: extmem kBytes below 16M (max 15M/1024)
buffer[1]: extmem above 16M, in 64k units
*/
ENTRY(getextmem2)
pushl %ebp
movl %esp,%ebp
pushl %ebx
pushl %ecx
pushl %edx
push %esi
push %edi
call _C_LABEL(prot_to_real)
.code16
xorl %ebx, %ebx
movl $0xe801, %eax
int $0x15
pushf
movw %si, %ax
orw %si, %bx
jz 1f /* if zero use configured values */
movw %cx, %ax /* k below 16M (max 0x3c00 = 15MB) */
movw %dx, %bx /* 64k above 16M */
1:
popf
setc %bl
calll _C_LABEL(real_to_prot)
.code32
movl 8(%ebp), %edi
xorl %eax, %eax
movw %cx, %ax
stosl
movw %dx, %ax
stosl
movb %bl, %al
cbw
pop %edi
pop %esi
popl %edx
popl %ecx
popl %ebx
popl %ebp
ret
/* int getmementry(int *iterator, buffer[5])
return: 0=ok, else error
buffer[0]: start of memory chunk
buffer[2]: length (bytes)
buffer[4]: type
*/
ENTRY(getmementry)
pushl %ebp
movl %esp,%ebp
pushl %ebx
pushl %ecx
pushl %edx
push %esi
push %edi
movl 8(%ebp), %eax
movl 0(%eax), %ebx /* index */
movl $20, %ecx /* Buffer size */
movl $0x534d4150, %edx /* "SMAP" */
movl 12(%ebp), %edi /* buffer address */
call _C_LABEL(prot_to_real)
.code16
push %di
shrl $4, %edi
mov %ds, %ax
add %di, %ax
mov %ax, %es
pop %di
and $0xf, %di /* buffer addres now in ES:DI */
movl $0xe820, %eax /* Some BIOS check EAX value */
int $0x15
setc %cl
calll _C_LABEL(real_to_prot)
.code32
movl 8(%ebp), %eax
movl %ebx, 0(%eax) /* updated index */
xorl %eax, %eax
movb %cl, %al
pop %edi
pop %esi
popl %edx
popl %ecx
popl %ebx
popl %ebp
ret
/* int biosA20(void)
return: 0=ok, else error
*/
ENTRY(biosA20)
pushl %ebp
movl %esp,%ebp
pushl %ebx
pushl %ecx
pushl %edx
push %esi
push %edi
call _C_LABEL(prot_to_real)
.code16
movl $0x2401, %eax
int $0x15
setc %cl
calll _C_LABEL(real_to_prot)
.code32
movzbl %cl, %eax
pop %edi
pop %esi
popl %edx
popl %ecx
popl %ebx
popl %ebp
ret
|
0xffea/MINIX3
| 2,570
|
sys/arch/i386/stand/lib/message32.S
|
/* $NetBSD: message32.S,v 1.1 2009/11/19 22:13:17 dsl Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by David Laight.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <machine/asm.h>
/*
* Output messages directly to serial port from 32bit mode.
* Useful for debugging when the real-prot is suspect.
*
* %ds:dump_eax_buff must be somewhere it is safe to write 12 bytes.
*/
#ifndef COM_PORT_VAL
#define COM_PORT_VAL $0x3f8 /* Standard address COM1 (dty0) */
#endif
.globl message32
.code32
message32:
pusha
message32_1:
lodsb
2:
mov COM_PORT_VAL, %dx
outb %al, %dx
add $5, %dl
3: inb %dx
test $0x40, %al
jz 3b
lodsb
test %al, %al
jnz 2b
popa
ret
.globl dump_eax32
dump_eax32:
pusha
movl $dump_eax_buff, %esi
mov %esi, %edi
push $8
pop %ecx
1: roll $4, %eax
push %eax
andb $0x0f, %al
addb $0x30, %al /* 30..3f - clear AF */
#if 1 /* 5 bytes to generate real hex... */
daa /* 30..39, 40..45 */
addb $0xc0, %al /* f0..f9, 00..05 */
adcb $0x40, %al /* 30..39, 41..46 */
#endif
movb %al,(%edi)
inc %edi
pop %eax
loop 1b
push $0x20 /* space + 3 NULs */
pop (%edi)
jmp message32_1
|
0xffea/MINIX3
| 4,575
|
sys/arch/i386/stand/lib/multiboot.S
|
/* $NetBSD: multiboot.S,v 1.1 2008/10/11 11:06:20 joerg Exp $ */
/* starts program in protected mode / flat space
with given stackframe
needs global variables flatcodeseg and flatdataseg
(gdt offsets)
derived from: NetBSD:sys/arch/i386/stand/lib/startprog.S
*/
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/*
* Ported to boot 386BSD by Julian Elischer ([email protected]) Sept 1992
*
* Mach Operating System
* Copyright (c) 1992, 1991 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or [email protected]
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/
/*
Copyright 1988, 1989, 1990, 1991, 1992
by Intel Corporation, Santa Clara, California.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and
its documentation for any purpose and without fee is hereby
granted, provided that the above copyright notice appears in all
copies and that both the copyright notice and this permission notice
appear in supporting documentation, and that the name of Intel
not be used in advertising or publicity pertaining to distribution
of the software without specific, written prior permission.
INTEL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
IN NO EVENT SHALL INTEL BE LIABLE FOR ANY SPECIAL, INDIRECT, OR
CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT,
NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <machine/asm.h>
#define MULTIBOOT_INFO_MAGIC 0x2BADB002
/*
* multiboot(phyaddr,header,stack)
* start the program on protected mode where phyaddr is the entry point
*/
ENTRY(multiboot)
pushl %ebp
movl %esp, %ebp
# prepare a new stack
movl $flatdataseg, %eax
movw %ax, %es # for arg copy
movl 16(%ebp), %ebx # stack
subl $4,%ebx
movl %ebx, %edi
movl 12(%ebp), %ebx # header
movl 8(%ebp), %ecx # entry
# set new stackptr (movsl decd sp 1 more -> dummy return address)
movw %ax, %ss
movl %edi, %esp
# push on our entry address
movl $flatcodeseg, %eax # segment
pushl %eax
pushl %ecx #entry
# convert over the other data segs
movl $flatdataseg, %eax
mov %ax, %ds
mov %ax, %es
movl $MULTIBOOT_INFO_MAGIC, %eax
# convert the PC (and code seg)
lret
|
0xffea/MINIX3
| 1,772
|
sys/arch/i386/stand/lib/biosgetrtc.S
|
/* $NetBSD: biosgetrtc.S,v 1.7 2011/06/16 13:27:59 joerg Exp $ */
/*
* Copyright (c) 1996
* Matthias Drochner. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include <machine/asm.h>
ENTRY(biosgetrtc)
pusha
pushl %eax
xorl %ebx, %ebx
call _C_LABEL(prot_to_real) # enter real mode
.code16
movb $2, %ah
int $0x1a
jnc ok
movl $-1, %ebx
ok:
calll _C_LABEL(real_to_prot) # back to protected mode
.code32
popl %eax
movb %ch, (%eax)
movb %cl, 1(%eax)
movb %dh, 2(%eax)
movb $0, 3(%eax)
movl %ebx, 28(%esp)
popa
ret
|
0xffea/MINIX3
| 2,057
|
sys/arch/i386/stand/lib/biosreboot.S
|
/* $NetBSD: biosreboot.S,v 1.5 2011/06/16 13:27:59 joerg Exp $ */
/*
* Copyright (c) 1997
* Perry E. Metzger. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgements:
* This product includes software developed for the NetBSD Project
* by Perry E. Metzger.
* 4. The names of the authors may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include <machine/asm.h>
.text
/* Call INT 19 to do the equivalent of CTL-ALT-DEL */
ENTRY(reboot)
pusha
call _C_LABEL(prot_to_real)
.code16
int $0x19
/* NOTE: We should never even get past this point. */
calll _C_LABEL(real_to_prot)
.code32
movl %ebx, 28(%esp)
popa
ret
|
0xffea/MINIX3
| 2,300
|
sys/arch/i386/stand/lib/biosmem.S
|
/* $NetBSD: biosmem.S,v 1.9 2011/06/16 13:27:59 joerg Exp $ */
/*
* Copyright (c) 1996
* Perry E. Metzger. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgements:
* This product includes software developed for the NetBSD Project
* by Perry E. Metzger.
* 4. The names of the authors may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include <machine/asm.h>
.text
/* get mem below 1M, in kByte */
ENTRY(getbasemem)
pusha
call _C_LABEL(prot_to_real)
.code16
int $0x12
# zero-extend 16-bit result to 32 bits.
movzwl %ax, %eax
calll _C_LABEL(real_to_prot)
.code32
movl %eax, 28(%esp)
popa
ret
/* get mem above 1M, in kByte */
ENTRY(getextmem1)
pusha
call _C_LABEL(prot_to_real)
.code16
movb $0x88,%ah
int $0x15
# zero-extend 16-bit result to 32 bits.
movzwl %ax, %eax
calll _C_LABEL(real_to_prot)
.code32
movl %eax, 28(%esp)
popa
ret
|
0xffea/MINIX3
| 2,080
|
sys/arch/i386/stand/lib/putstr32.S
|
/* $NetBSD: putstr32.S,v 1.1 2011/06/02 18:53:00 dsl Exp $ */
/*-
* Copyright (c) 20011 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by David Laight.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <machine/asm.h>
/*
* Diagnostic print routines callable from 32bit C code during early
* parts of the boot process.
*/
/*
* void putstr(const char *)
*
* display message on serial port
*/
.globl _C_LABEL(putstr32)
_C_LABEL(putstr32):
.code32
push %esi
movl 8(%esp), %esi
call message32
pop %esi
ret
/*
* void putint(int)
*
* display value on serial port as 8 hex digits followed by a space
*/
.globl _C_LABEL(putint32)
_C_LABEL(putint32):
.code32
movl 4(%esp), %eax
call dump_eax32
ret
|
0xffea/MINIX3
| 3,303
|
sys/arch/i386/stand/lib/startprog.S
|
/* $NetBSD: startprog.S,v 1.3 2003/02/01 14:48:18 dsl Exp $ */
/* starts program in protected mode / flat space
with given stackframe
needs global variables flatcodeseg and flatdataseg
(gdt offsets)
derived from: NetBSD:sys/arch/i386/boot/asm.S
*/
/*
* Ported to boot 386BSD by Julian Elischer ([email protected]) Sept 1992
*
* Mach Operating System
* Copyright (c) 1992, 1991 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or [email protected]
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/
/*
Copyright 1988, 1989, 1990, 1991, 1992
by Intel Corporation, Santa Clara, California.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and
its documentation for any purpose and without fee is hereby
granted, provided that the above copyright notice appears in all
copies and that both the copyright notice and this permission notice
appear in supporting documentation, and that the name of Intel
not be used in advertising or publicity pertaining to distribution
of the software without specific, written prior permission.
INTEL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
IN NO EVENT SHALL INTEL BE LIABLE FOR ANY SPECIAL, INDIRECT, OR
CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT,
NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <machine/asm.h>
/*
* startprog(phyaddr,argc,argv,stack)
* start the program on protected mode where phyaddr is the entry point
*/
ENTRY(startprog)
pushl %ebp
movl %esp, %ebp
# prepare a new stack
movl $flatdataseg, %ebx
movw %bx, %es # for arg copy
movl 20(%ebp), %eax # stack
subl $4,%eax
movl %eax, %edi
# push some number of args onto the stack
movl 12(%ebp), %ecx # argc
movl %ecx, %eax
decl %eax
shl $2, %eax
addl 16(%ebp), %eax # ptr to last arg
movl %eax, %esi
std # backwards
rep
movsl
cld # LynxOS depends on it
movl 8(%ebp), %ecx # entry
# set new stackptr (movsl decd sp 1 more -> dummy return address)
movw %bx, %ss
movl %edi, %esp
# push on our entry address
movl $flatcodeseg, %ebx # segment
pushl %ebx
pushl %ecx #entry
# convert over the other data segs
movl $flatdataseg, %ebx
mov %bx, %ds
mov %bx, %es
# convert the PC (and code seg)
lret
|
0xffea/MINIX3
| 1,900
|
sys/arch/i386/stand/lib/biosgetsystime.S
|
/* $NetBSD: biosgetsystime.S,v 1.3 2011/06/16 13:27:59 joerg Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by David Laight.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <machine/asm.h>
/* Return system time (~18.2Hz ticks since midnight) */
ENTRY(biosgetsystime)
pusha
call _C_LABEL(prot_to_real) # enter real mode
.code16
movb $0, %ah
int $0x1a
calll _C_LABEL(real_to_prot) # back to protected mode
.code32
mov %ecx, %eax
shl $16, %eax
movw %dx, %ax
movl %eax, 28(%esp)
popa
ret
|
0xffea/MINIX3
| 2,139
|
sys/arch/i386/stand/lib/biosvideomode.S
|
/* $NetBSD: biosvideomode.S,v 1.3 2003/04/16 13:49:21 dsl Exp $ */
/*
* Copyright (c) 1996
* Perry E. Metzger. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgements:
* This product includes software developed for the NetBSD Project
* by Perry E. Metzger.
* 4. The names of the authors may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include <machine/asm.h>
.text
ENTRY(biosvideomode)
pushl %ebp
movl %esp,%ebp
pushl %ebx
push %esi
push %edi
call _C_LABEL(prot_to_real)
.code16
movb $0, %ah
movb $2, %al
int $0x10
# zero-extend 16-bit result to 32 bits.
movl $0, %ebx
movw %ax,%bx
calll _C_LABEL(real_to_prot)
.code32
movl %ebx, %eax
pop %edi
pop %esi
popl %ebx
popl %ebp
ret
|
0xffea/MINIX3
| 2,302
|
sys/arch/i386/stand/lib/putstr.S
|
/* $NetBSD: putstr.S,v 1.2 2008/04/28 20:23:25 martin Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by David Laight.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <machine/asm.h>
/*
* Diagnostic print routines callable from 32bit C code during early
* parts of the boot process.
*/
/*
* void putstr(const char *)
*
* display message on console
* bugs: message address must be less than 64k
*/
.globl _C_LABEL(putstr)
_C_LABEL(putstr):
.code32
movl 4(%esp), %eax
pusha
movl %eax, %esi
call _C_LABEL(prot_to_real)
.code16
movl %esi, %eax
call message
calll _C_LABEL(real_to_prot)
.code32
popa
ret
/*
* void putint(int)
*
* display value on console as 8 hex digits followed by a space
*/
.globl _C_LABEL(putint)
_C_LABEL(putint):
.code32
movl 4(%esp), %eax
pusha
call _C_LABEL(prot_to_real)
.code16
call dump_eax
calll _C_LABEL(real_to_prot)
.code32
popa
ret
|
0xffea/MINIX3
| 2,211
|
sys/arch/i386/stand/lib/dump_eax.S
|
/* $NetBSD: dump_eax.S,v 1.4 2009/11/19 22:08:14 dsl Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by David Laight.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <machine/asm.h>
/* This is useful for debugging - although you may need to
* delete some code to fit it in.
* %ds:dump_eax_buff must be somewhere it is safe to write 10 bytes.
*/
ENTRY(dump_eax)
.code16
pusha /* saves bottom 16 bits only! */
movw $dump_eax_buff, %si
mov %si, %di
movw $8, %cx
1: roll $4, %eax
push %ax
andb $0x0f, %al
addb $0x30, %al /* 30..3f - clear AF */
#if 1 /* 5 bytes to generate real hex... */
daa /* 30..39, 40..45 */
addb $0xc0, %al /* f0..f9, 00..05 */
adcb $0x40, %al /* 30..39, 41..46 */
#endif
mov %al,(%di)
inc %di
pop %ax
loop 1b
movw $0x20,(%di) /* space + NIL */
jmp message_1
|
0xffea/MINIX3
| 6,334
|
sys/arch/i386/stand/lib/biosvbe.S
|
/* $NetBSD: biosvbe.S,v 1.3 2011/02/20 22:03:13 jakllsch Exp $ */
/*-
* Copyright (c) 2009 Jared D. McNeill <[email protected]>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <machine/asm.h>
.text
/*
* VESA BIOS Extensions routines
*/
/*
* Function 00h - Return VBE Controller Information
*
* int biosvbe_info(struct vbeinfoblock *)
* return: VBE call status
*/
ENTRY(biosvbe_info)
pushl %ebp
movl %esp,%ebp
pushl %ebx
pushl %ecx
pushl %edx
push %esi
push %edi
movl 8(%ebp), %edi /* vbe info block address*/
call _C_LABEL(prot_to_real)
.code16
push %es
push %di
shrl $4, %edi
mov %ds, %ax
add %di, %ax
mov %ax, %es
pop %di
and $0xf, %di /* mode info block address now in es:di */
movw $0x4f00, %ax /* get vbe info block */
int $0x10
pop %es
calll _C_LABEL(real_to_prot)
.code32
andl $0xffff,%eax
pop %edi
pop %esi
popl %edx
popl %ecx
popl %ebx
popl %ebp
ret
/*
* Function 01h - Return VBE Mode Information
*
* int biosvbe_get_mode_info(int mode, struct modeinfoblock *mi)
* return: VBE call status
*/
ENTRY(biosvbe_get_mode_info)
pushl %ebp
movl %esp,%ebp
pushl %ebx
pushl %ecx
pushl %edx
push %esi
push %edi
movl 8(%ebp), %ecx /* mode number */
movl 12(%ebp), %edi /* mode info block address */
call _C_LABEL(prot_to_real)
.code16
push %es
push %di
shrl $4, %edi
mov %ds, %ax
add %di, %ax
mov %ax, %es
pop %di
and $0xf, %di /* mode info block address now in es:di */
movw $0x4f01, %ax /* get mode info block */
int $0x10
pop %es
calll _C_LABEL(real_to_prot)
.code32
andl $0xffff,%eax
pop %edi
pop %esi
popl %edx
popl %ecx
popl %ebx
popl %ebp
ret
/*
* Function 02h - Set VBE Mode
*
* int biosvbe_set_mode(int mode)
* return: VBE call status
*/
ENTRY(biosvbe_set_mode)
pushl %ebp
movl %esp,%ebp
pushl %ebx
pushl %ecx
pushl %edx
push %esi
push %edi
movl 8(%ebp), %ebx /* mode number */
orl $0x4000, %ebx
call _C_LABEL(prot_to_real)
.code16
movw $0x4f02, %ax /* set mode */
int $0x10
calll _C_LABEL(real_to_prot)
.code32
andl $0xffff,%eax
pop %edi
pop %esi
popl %edx
popl %ecx
popl %ebx
popl %ebp
ret
/*
* Function 08h - Set/Get DAC Palette Format
*
* int biosvbe_palette_format(int format)
* return: VBE call status
*/
ENTRY(biosvbe_palette_format)
pushl %ebp
movl %esp,%ebp
pushl %ebx
pushl %ecx
pushl %edx
push %esi
push %edi
movl 8(%ebp), %ebx /* mode number */
call _C_LABEL(prot_to_real)
.code16
movw $0x4f08, %ax /* get/set palette format */
int $0x10
calll _C_LABEL(real_to_prot)
.code32
andl $0xffff,%eax
pop %edi
pop %esi
popl %edx
popl %ecx
popl %ebx
popl %ebp
ret
/*
* Function 09h - Set/Get Palette Data
*
* int biosvbe_palette_data(int mode, int reg, struct paletteentry *)
* return: VBE call status
*/
ENTRY(biosvbe_palette_data)
pushl %ebp
movl %esp,%ebp
pushl %ebx
pushl %ecx
pushl %edx
push %esi
push %edi
movl 8(%ebp), %ebx /* mode number */
movl 12(%ebp), %edx /* register */
movl 16(%ebp), %edi /* palette entry address */
movl $1, %ecx /* # palette entries to update */
call _C_LABEL(prot_to_real)
.code16
push %es
push %di
shrl $4, %edi
mov %ds, %ax
add %di, %ax
mov %ax, %es
pop %di
and $0xf, %di /* palette entry address now in es:di */
movw $0x4f09, %ax /* get/set palette entry */
int $0x10
pop %es
calll _C_LABEL(real_to_prot)
.code32
andl $0xffff,%eax
pop %edi
pop %esi
popl %edx
popl %ecx
popl %ebx
popl %ebp
ret
/*
* Function 15h BL=00h - Report VBE/DDC Capabilities
*
* int biosvbe_ddc_caps(void)
* return: VBE/DDC capabilities
*/
ENTRY(biosvbe_ddc_caps)
pushl %ebp
movl %esp,%ebp
pushl %ebx
pushl %ecx
pushl %edx
push %esi
push %edi
call _C_LABEL(prot_to_real)
.code16
pushw %es
xorw %di, %di
movw %di, %es /* es:di == 0:0 */
movw $0x4f15, %ax /* display identification extensions */
mov $0x00, %bx /* report DDC capabilities */
mov $0x00, %cx /* controller unit number (00h = primary) */
int $0x10
popw %es
calll _C_LABEL(real_to_prot)
.code32
movl %eax,%ecx
movl $0x0000,%eax
andl $0xffff,%ecx
cmpl $0x004f,%ecx
jne 1f
andl $0xffff,%ebx
movl %ebx,%eax
1:
pop %edi
pop %esi
popl %edx
popl %ecx
popl %ebx
popl %ebp
ret
/*
* Function 15h BL=01h - Read EDID
*
* int biosvbe_ddc_read_edid(int blockno, void *buf)
* return: VBE call status
*/
ENTRY(biosvbe_ddc_read_edid)
pushl %ebp
movl %esp,%ebp
pushl %ebx
pushl %ecx
pushl %edx
push %esi
push %edi
movl 8(%ebp), %edx /* EDID block number */
movl 12(%ebp), %edi /* EDID block address */
call _C_LABEL(prot_to_real)
.code16
push %es
push %di
shrl $4, %edi
mov %ds, %ax
add %di, %ax
mov %ax, %es
pop %di
and $0xf, %di /* EDID block address now in es:di */
movw $0x4f15, %ax /* display identification extensions */
mov $0x01, %bx /* read EDID */
mov $0x00, %cx /* controller unit number (00h = primary) */
int $0x10
pop %es
calll _C_LABEL(real_to_prot)
.code32
andl $0xffff,%eax
pop %edi
pop %esi
popl %edx
popl %ecx
popl %ebx
popl %ebp
ret
|
0xffea/MINIX3
| 3,915
|
sys/arch/i386/stand/boot/biosboot.S
|
/* $NetBSD: biosboot.S,v 1.8 2011/01/05 23:13:01 jakllsch Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by David Laight.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <machine/asm.h>
#include <sys/bootblock.h>
/*
* Code linked to 0x1000:0 and (usually) read from /boot by bootxx code
*
* On entry:
* %dl BIOS drive number
* %ecx:%ebx Sector number of NetBSD partition
* %ds:%si Boot parameter block (patched by installboot)
* %cs 0x1000
* %ds, %es, %ss All zero
* %sp near 0xfffc
*/
.text
.code16
ENTRY(boot_start)
jmp boot_start_1
.balign 4
ENTRY(boot_magic)
.long X86_BOOT_MAGIC_2 /* checked for by bootxx code */
ENTRY(boot_params)
.long boot_start_1 - boot_params
#include <boot_params.S>
. = boot_start + 0x80 /* space for patchable variables */
boot_start_1:
#if 0
/* Allow for boot_start not being %cs:0 */
call 2f
2: pop %cx
sub $2b, %cx /* %ax is offset */
test $0xf, %cx /* check code seg aligned */
jz 3f
lret /* not playing if not */
3: mov %cs, %ax
shr $4, %cx
add %cx, %ax /* segment staring at boot_start */
push %ax
push $4f
lret
4:
#endif
mov %cs, %ax
mov %ax, %es
movl %ecx, %ebp /* move LBA out of the way */
/* Grab boot_params patched into bootxx by installboot */
cmpl $X86_BOOT_MAGIC_1,-4(%si) /* sanity check ptr */
jne 2f
mov $boot_params, %di
movl (%si),%ecx
cmp $boot_start_1 - boot_params, %cx
jbe 1f
mov $boot_start_1 - boot_params, %cx
1: cld
rep
movsb
2:
mov %ax, %ds
movl $_end, %eax /* top of bss */
shr $4, %eax /* as a segment */
add $0x1001, %ax /* and + 64k */
mov %ax, %ss /* for stack */
mov $0xfffc, %sp /* %sp at top of it */
call gdt_fixup
calll real_to_prot
.code32
movl $_end, %ecx /* zero bss */
movl $__bss_start, %edi
subl %edi, %ecx
shr $2, %ecx /* _end and __bss_start are aligned */
xor %eax, %eax
rep
stosl
testb $X86_BP_FLAGS_LBA64VALID, boot_params+4
jnz 1f
xorl %ebp, %ebp /* high part of LBA is not valid */
1:
movzbl %dl, %edx
push %ebp /* high 32 bits of first sector */
push %ebx /* first sector of bios partition */
push %edx /* bios disk */
call _C_LABEL(boot2) /* C bootstrap code */
addl $12, %esp
call prot_to_real
.code16
boot_fail:
push %ax
movw $1f, %si
call message
pop %si
call message
jmp loopstop
1: .asciz "Boot2 failed: "
ENTRY(_rtt)
.code32
call prot_to_real
.code16
loopstop:
movb $0x86, %ah /* delay for about a second */
movw $16, %cx
int $0x15
int $0x18 /* might be a boot fail entry */
1: sti
hlt
jmp 1b
|
0xffea/MINIX3
| 9,400
|
sys/arch/i386/stand/cdboot/cdboot.S
|
/* $NetBSD: cdboot.S,v 1.12 2011/01/04 16:53:05 jakllsch Exp $ */
/*-
* Copyright (c) 2005 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Bang Jun-Young.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/*
* This is a primary boot loader that loads a secondary boot loader
* directly from CD without performing floppy/hard disk emulation as
* described by the El Torito specification.
*/
#include <machine/asm.h>
#include <sys/bootblock.h>
#define BOOT_ADDR 0x7c00
#define BLOCK_SIZE 2048 /* Default for ISO 9660 */
#define VD_LBA 16 /* LBA of Volume Descriptor (VD) */
#define PVD_ADDR end /* Where Primary VD is loaded */
#define ROOTDIR_ADDR end+BLOCK_SIZE /* Where Root Directory is loaded */
#define LOADER_ADDR SECONDARY_LOAD_ADDRESS
#ifdef BOOT_FROM_FAT
#define MBR_AFTERBPB 90 /* BPB size in FAT32 partition BR */
#else
#define MBR_AFTERBPB 62 /* BPB size in floppy master BR */
#endif
/*
* See src/sys/sys/bootblock.h for details.
*/
#define MBR_PART_COUNT 4
#define MBR_PART_OFFSET 446
#define MBR_PART_SIZE 16 /* sizeof(struct mbr_partition) */
/*
* Disk error codes
*/
#define ERROR_TIMEOUT 0x80
/*
* Volume Descriptor types.
*/
#define VD_PRIMARY 1
#define VD_SUPPLEMENTARY 2
#define VD_TERMINATOR 255
/* Only actually used entries are listed below */
/*
* Format of Primary Volume Descriptor (8.4)
*/
#define PVD_ROOT_DR 156 /* Offset of Root Directory Record */
/*
* Format of Directory Record (9.1)
*/
#define DR_LEN 0
#define DR_EXTENT 2
#define DR_DATA_LEN 10
#define DR_NAME_LEN 32
#define DR_NAME 33
.text
.code16
ENTRY(start)
jmp start1
. = start + MBR_AFTERBPB /* skip BPB */
. = start + MBR_DSN_OFFSET
.long 0
/* mbr_bootsel_magic (not used here) */
. = start + MBR_BS_MAGIC_OFFSET
.word 0
. = start + MBR_PART_OFFSET
. = start + MBR_MAGIC_OFFSET
pbr_magic:
.word MBR_MAGIC
.fill 512 /* reserve space for disklabel */
start1:
jmp 1f
.balign 4
.long X86_BOOT_MAGIC_1 /* checked by installboot & pbr code */
boot_params: /* space for patchable variables */
.long 1f - boot_params /* length of this data area */
#include <boot_params.S>
. = start1 + 0x80 /* Space for patching unknown params */
1: xorw %ax, %ax
movw %ax, %ds
movw %ax, %es
movw %ax, %ss
movw $BOOT_ADDR, %sp
movw %sp, %si
movw $start, %di
movw $BLOCK_SIZE/2, %cx
rep
movsw
ljmp $0, $real_start
real_start:
movb %dl, boot_drive /* Save boot drive number */
#ifndef DISABLE_KEYPRESS
/*
* We can skip boot wait when:
* - there's no hard disk present.
* - there's no active partition in the MBR of the 1st hard disk.
*/
/*
* Check presence of hard disks.
*/
movw $0x475, %si
movb (%si), %al
testb %al, %al
jz boot_cdrom
/*
* Find the active partition from the MBR.
*/
movw $0x0201, %ax /* %al = number of sectors to read */
movw $BOOT_ADDR, %bx /* %es:%bx = data buffer */
movw $0x0001, %cx /* %ch = low 8 bits of cylinder no */
/* %cl = high 2 bits of cyl no & */
/* sector number */
movw $0x0080, %dx /* %dh = head number */
/* %dl = disk number */
int $0x13 /* Read MBR into memory */
jc boot_cdrom /* CF set on error */
movb $1, mbr_loaded
movb $MBR_PART_COUNT, %cl
movw $BOOT_ADDR+MBR_PART_OFFSET, %si
1:
movb (%si), %al
testb $0x80, %al
jnz found_active
addw $MBR_PART_SIZE, %si
decb %cl
testb %cl, %cl
jnz 1b /* If 0, no active partition found */
jmp boot_cdrom
found_active:
movw $str_press_key, %si
call message
next_second:
movw $str_dot, %si
call message
decb wait_count
jz boot_hard_disk
xorb %ah, %ah /* Get system time */
int $0x1a
movw %dx, %di /* %cx:%dx = number of clock ticks */
addw $19, %di /* 19 ~= 18.2 Hz */
wait_key:
movb $1, %ah /* Check for keystroke */
int $0x16
jz not_avail /* ZF clear if keystroke available */
xorb %ah, %ah /* Read key to flush keyboard buf */
int $0x16
jmp boot_cdrom
not_avail:
xorb %ah, %ah /* Get system time */
int $0x1a
cmpw %dx, %di /* Compare with saved time */
jnz wait_key
jmp next_second
boot_hard_disk:
movw $str_crlf, %si
call message
cmpb $1, mbr_loaded
jz 1f
movw $0x0201, %ax /* %al = number of sectors to read */
movw $BOOT_ADDR, %bx /* %es:%bx = data buffer */
movw $0x0001, %cx /* %ch = low 8 bits of cylinder no */
/* %cl = high 2 bits of cyl no & */
/* sector number */
movw $0x0080, %dx /* %dh = head number */
/* %dl = disk number */
int $0x13 /* Read MBR into memory */
jc panic /* CF set on error */
1:
movw %cs, %ax /* Restore initial state */
movw %ax, %ds
movw %ax, %es
movw $0x0080, %dx /* %dl = boot drive number */
jmp $0, $BOOT_ADDR /* Jump to MBR! */
jmp panic /* This should be never executed */
#endif /* !DISABLE_KEYPRESS */
boot_cdrom:
movw $str_banner, %si
call message
/* Read volume descriptor sectors until Primary decriptor found */
movl $VD_LBA, %eax
next_block:
movb $1, %dh /* Number of sectors to read */
movl $PVD_ADDR, %ebx
call read_sectors
cmpb $VD_PRIMARY, (%bx) /* Is it Primary Volume Descriptor? */
jz pvd_found
incl %eax
cmpb $VD_TERMINATOR, (%bx)
jnz next_block
movw $str_no_pvd, %si
call message
jmp panic
/* Read all of root directory */
pvd_found:
movw $PVD_ADDR+PVD_ROOT_DR, %bx
movl DR_EXTENT(%bx), %eax /* LBA of the root directory */
movl DR_DATA_LEN(%bx), %edx
shrl $11, %edx /* Convert to number of sectors */
movb %dl, %dh /* ... and load it to %dh */
movl $ROOTDIR_ADDR, %ebx
call read_sectors
/* Scan directory entries searching for /boot */
next_entry:
cmpb $0, DR_LEN(%bx)
jz last_entry
movw %bx, %si
addw $DR_NAME, %si
movb DR_NAME_LEN(%bx), %cl
movw $str_loader, %di
1:
movb (%si), %al
cmpb %al, (%di)
jnz fail
incw %si
incw %di
decb %cl
jnz 1b
jmp load_loader
fail:
addw DR_LEN(%bx), %bx
jmp next_entry
last_entry:
movw $str_no_loader, %si
call message
jmp panic
/* Found /boot, read contents to 0x1000:0 */
load_loader:
movl DR_EXTENT(%bx), %eax
movl DR_DATA_LEN(%bx), %edx
addl $(BLOCK_SIZE-1), %edx /* Convert file length to */
shrl $11, %edx /* ... number of sectors */
movb %dl, %dh
movl $LOADER_ADDR, %ebx
call read_sectors
/* Finally call into code of /boot */
movl $boot_params, %esi /* Provide boot_params */
xorl %edx, %edx
movb boot_drive, %dl
xorl %ebx, %ebx /* Zero sector number */
lcall $LOADER_ADDR/16, $0
/* fall through on load failure */
panic:
hlt
jmp panic
/*
* Read disk sector(s) into memory
*
* %eax = LBA of starting sector
* %ebx = buffer to store sectors
* %dh = number of sectors to read
*
* Long transfers are split onto multiple 64k reads
*/
#define MAX_SECTORS (0x10000/BLOCK_SIZE)
read_sectors:
pushal
movl %eax, edd_lba
shrl $4, %ebx /* Convert buffer addr to seg:0 */
movw %bx, edd_segment
1: movb %dh, edd_nsecs
cmpb $MAX_SECTORS, %dh
jle 2f /* j if less than 64k */
movb $MAX_SECTORS, edd_nsecs /* Read 32 sectors - 64k bytes */
2: movb boot_drive, %dl
movw $edd_packet, %si
read_again:
movb $0x42, %ah
push %dx /* bios shouldn't kill %dh, but ... */
int $0x13
pop %dx /* ... better safe than sorry! */
jc read_fail
addw $0x1000, edd_segment /* Advance segment addr by 64k bytes */
addl $MAX_SECTORS, edd_lba /* And sector number to match */
sub edd_nsecs, %dh /* Number of sectors remaining */
jnz 1b
popal
ret
read_fail:
cmpb $ERROR_TIMEOUT, %ah
jz read_again
movw $str_read_error, %si
call message
jmp panic
#include <message.S>
edd_packet:
edd_len: .word 16
edd_nsecs: .word 0 /* Number of sectors to transfer */
edd_offset: .word 0
edd_segment: .word 0
edd_lba: .quad 0
wait_count: .byte 6
boot_drive: .byte 0
mbr_loaded: .byte 0
str_banner: .ascii "\r\nNetBSD/x86 cd9660 Primary Bootstrap"
str_crlf: .asciz "\r\n"
str_press_key: .asciz "\r\nPress any key to boot from CD"
str_dot: .asciz "."
str_read_error: .asciz "Can't read CD"
str_no_pvd: .asciz "Can't find Primary Volume Descriptor"
str_no_loader: .asciz "Can't find /boot"
str_loader: .asciz "BOOT.;1"
/* Used to calculate free bytes */
free_space = end - .
. = start + BLOCK_SIZE
end:
|
0xffea/MINIX3
| 12,213
|
sys/arch/i386/stand/bootxx/pbr.S
|
/* $NetBSD: pbr.S,v 1.20 2011/08/17 00:07:38 jakllsch Exp $ */
/*-
* Copyright (c) 2003,2004 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by David Laight.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/*
* i386 partition boot code
*
* This code resides in sector zero of the netbsd partition, or sector
* zero of an unpartitioned disk (eg a floppy).
* Sector 1 is assumed to contain the netbsd disklabel.
* Sectors 2 until the end of the track contain the next phase of bootstrap.
* Which know how to read the interactive 'boot' program from filestore.
* The job of this code is to read in the phase 1 bootstrap.
*
* Makefile supplies:
* PRIMARY_LOAD_ADDRESS: Address we load code to (0x1000).
* BOOTXX_SECTORS: Number of sectors we load (15).
* X86_BOOT_MAGIC_1: A random magic number.
*
* Although this code is executing at 0x7c00, it is linked to address 0x1000.
* All data references MUST be fixed up using R().
*/
#include <machine/asm.h>
#include <sys/bootblock.h>
#define OURADDR 0x7c00 /* our address */
#define BOOTADDR PRIMARY_LOAD_ADDRESS
#define R(a) (a - BOOTADDR + OURADDR)
#define lba_info R(_lba_info)
#define lba_sector R(_lba_sector)
#define errtxt R(_errtxt)
#define errcod R(_errcod)
#define newline R(_newline)
#define TABENTRYSIZE (MBR_BS_PARTNAMESIZE + 1)
#define NAMETABSIZE (4 * TABENTRYSIZE)
#ifdef BOOT_FROM_FAT
#define MBR_AFTERBPB 90 /* BPB size in FAT32 partition BR */
#else
#define MBR_AFTERBPB 62 /* BPB size in floppy master BR */
#endif
#ifdef TERSE_ERROR
/*
* Error codes. Done this way to save space.
*/
#define ERR_READ '2' /* Read error */
#define ERR_NO_BOOTXX 'B' /* No bootxx_xfs in 3rd sector */
#define ERR_PTN 'P' /* partition not defined */
#define ERR_NO_LBA 'L' /* sector above chs limit */
#define set_err(err) movb $err, %al
#else
#define set_err(err) mov $R(err), %ax
#endif
/*
* This code is loaded to addresss 0:7c00 by either the system BIOS
* (for a floppy) or the mbr boot code. Since the boot program will
* be loaded to address 1000:0, we don't need to relocate ourselves
* and can load the subsequent blocks (that load boot) to an address
* of our choosing. 0:1000 is a not unreasonable choice.
*
* On entry the BIOS drive number is in %dl and %esi may contain the
* sector we were loaded from (if we were loaded by NetBSD mbr code).
* In any case we have to re-read sector zero of the disk and hunt
* through the BIOS partition table for the NetBSD partition.
*
* Or, we may have been loaded by a GPT hybrid MBR, handoff state is
* specified in T13 EDD-4 annex A.
*/
.text
.code16
ENTRY(start)
/*
* The PC BIOS architecture defines a Boot Parameter Block (BPB) here.
* The actual format varies between different MS-DOS versions, but
* apparently some system BIOS insist on patching this area
* (especially on LS120 drives - which I thought had an MBR...).
* The initial jmp and nop are part of the standard and may be
* tested for by the system BIOS.
*/
jmp start0
nop
.ascii "NetBSD60" /* oemname (8 bytes) */
. = start + MBR_BPB_OFFSET /* move to start of BPB */
/* (ensures oemname doesn't overflow) */
. = start + MBR_AFTERBPB /* skip BPB */
start0:
xor %cx, %cx /* don't trust values of ds, es or ss */
mov %cx, %ss
mov %cx, %sp
mov %cx, %es
#ifndef BOOT_FROM_FAT
cmpl $0x54504721, %eax /* did a GPT hybrid MBR start us? */
je boot_gpt
#endif
mov %cx, %ds
xor %ax, %ax
/* A 'reset disk system' request is traditional here... */
push %dx /* some BIOS zap %dl here :-( */
int $0x13 /* ah == 0 from code above */
pop %dx
/* Read from start of disk */
incw %cx /* track zero sector 1 */
movb %ch, %dh /* dh = head = 0 */
call chs_read
/* See if this is our code, if so we have already loaded the next stage */
xorl %ebp, %ebp /* pass sector 0 to next stage */
movl (%bx), %eax /* MBR code shouldn't even have ... */
cmpl R(start), %eax /* ... a jmp at the start. */
je pbr_read_ok1
/* Now scan the MBR partition table for a netbsd partition */
xorl %ebx, %ebx /* for base extended ptn chain */
scan_ptn_tbl:
xorl %ecx, %ecx /* for next extended ptn */
movw $BOOTADDR + MBR_PART_OFFSET, %di
1: movb 4(%di), %al /* mbrp_type */
movl 8(%di), %ebp /* mbrp_start == LBA sector */
addl lba_sector, %ebp /* add base of extended partition */
#ifdef BOOT_FROM_FAT
cmpb $MBR_PTYPE_FAT12, %al
je 5f
cmpb $MBR_PTYPE_FAT16S, %al
je 5f
cmpb $MBR_PTYPE_FAT16B, %al
je 5f
cmpb $MBR_PTYPE_FAT32, %al
je 5f
cmpb $MBR_PTYPE_FAT32L, %al
je 5f
cmpb $MBR_PTYPE_FAT16L, %al
je 5f
#elif BOOT_FROM_MINIXFS3
cmpb $MBR_PTYPE_MINIX_14B, %al
je 5f
#else
cmpb $MBR_PTYPE_NETBSD, %al
#endif
jne 10f
5: testl %esi, %esi /* looking for a specific sector? */
je boot
cmpl %ebp, %esi /* ptn we wanted? */
je boot
/* check for extended partition */
10: cmpb $MBR_PTYPE_EXT, %al
je 15f
cmpb $MBR_PTYPE_EXT_LBA, %al
je 15f
cmpb $MBR_PTYPE_EXT_LNX, %al
jne 20f
15: movl 8(%di), %ecx /* sector of next ext. ptn */
20: add $0x10, %di
cmp $BOOTADDR + MBR_MAGIC_OFFSET, %di
jne 1b
/* not in base partitions, check extended ones */
jecxz no_netbsd_ptn
testl %ebx, %ebx
jne 30f
xchgl %ebx, %ecx /* save base of ext ptn chain */
30: addl %ebx, %ecx /* address this ptn */
movl %ecx, lba_sector /* sector to read */
call read_lba
jmp scan_ptn_tbl
no_netbsd_ptn:
/* Specific sector not found: try again looking for first NetBSD ptn */
testl %esi, %esi
set_err(ERR_PTN)
jz error
xorl %esi, %esi
movl %esi, lba_sector
jmp start
/*
* Sector below CHS limit
* Do a cylinder-head-sector read instead
* I believe the BIOS should do reads that cross track boundaries.
* (but the read should start at the beginning of a track...)
*/
read_chs:
movb 1(%di), %dh /* head */
movw 2(%di), %cx /* ch=cyl, cl=sect */
call chs_read
pbr_read_ok1:
jmp pbr_read_ok
/*
* Active partition pointed to by di.
*
* We can either do a CHS (Cylinder Head Sector) or an LBA (Logical
* Block Address) read. Always doing the LBA one
* would be nice - unfortunately not all systems support it.
* Also some may contain a separate (eg SCSI) BIOS that doesn't
* support it even when the main BIOS does.
*
* The safest thing seems to be to find out whether the sector we
* want is inside the CHS sector count. If it is we use CHS, if
* outside we use LBA.
*
* Actually we check that the CHS values reference the LBA sector,
* if not we assume that the LBA sector is above the limit, or that
* the geometry used (by fdisk) isn't correct.
*/
boot:
movl %ebp, lba_sector /* to control block */
testl %ebx, %ebx /* was it an extended ptn? */
jnz boot_lba /* yes - boot with LBA reads */
/* get CHS values from BIOS */
push %dx /* save drive number */
movb $8, %ah
int $0x13 /* chs info */
/*
* Validate geometry, if the CHS sector number doesn't match the LBA one
* we'll do an LBA read.
* calc: (cylinder * number_of_heads + head) * number_of_sectors + sector
* and compare against LBA sector number.
* Take a slight 'flier' and assume we can just check 16bits (very likely
* to be true because the number of sectors per track is 63).
*/
movw 2(%di), %ax /* cylinder + sector */
push %ax /* save for sector */
shr $6, %al
xchgb %al, %ah /* 10 bit cylinder number */
shr $8, %dx /* last head */
inc %dx /* number of heads */
mul %dx
mov 1(%di), %dl /* head we want */
add %dx, %ax
and $0x3f, %cx /* number of sectors */
mul %cx
pop %dx /* recover sector we want */
and $0x3f, %dx
add %dx, %ax
dec %ax
pop %dx /* recover drive nmber */
cmp %bp, %ax
je read_chs
check_lba:
#ifdef NO_LBA_CHECK
jmp boot_lba
#else
/*
* Determine whether we have int13-extensions, by calling
* int 13, function 41. Check for the magic number returned,
* and the disk packet capability.
*
* This is actually relatively pointless:
* 1) we only use LBA reads if CHS ones would fail
* 2) the MBR code managed to read the same sectors
* 3) the BIOS will (ok should) reject the LBA read as a bad BIOS call
*/
movw $0x55aa, %bx
movb $0x41, %ah
int $0x13
jc 1f /* no int13 extensions */
cmpw $0xaa55, %bx
jnz 1f
testb $1, %cl
jnz boot_lba
1: set_err(ERR_NO_LBA)
#endif /* NO_LBA_CHECK */
/*
* Something went wrong,
* Output error code,
*/
error:
#ifdef TERSE_ERROR
movb %al, errcod
movw $errtxt, %si
call message
#else
push %ax
movw $errtxt, %si
call message
pop %si
call message
movw $newline, %si
call message
#endif
1: sti
hlt
jmp 1b
boot_lba:
call read_lba
/*
* Check magic number for valid stage 2 bootcode
* then jump into it.
*/
pbr_read_ok:
cmpl $X86_BOOT_MAGIC_1, bootxx_magic
set_err(ERR_NO_BOOTXX)
jnz error
movl %ebp, %esi /* %esi ptn base, %dl disk id */
movl lba_sector + 4, %edi /* %edi ptn base high */
jmp $0, $bootxx /* our %cs may not be zero */
/* Read disk using int13-extension parameter block */
read_lba:
pusha
movw $lba_info, %si /* ds:si is ctl block */
movb $0x42, %ah
do_read:
int $0x13
popa
set_err(ERR_READ)
jc error
ret
/* Read using CHS */
chs_read:
movw $BOOTADDR, %bx /* es:bx is buffer */
pusha
movw $0x200 + BOOTXX_SECTORS, %ax /* command 2, xx sectors */
jmp do_read
#ifndef BOOT_FROM_FAT
boot_gpt:
movl (20+32+0)(%si), %ebp
movl (20+32+4)(%si), %edi
movw %cx, %ds
movl %ebp, lba_sector + 0
movl %edi, lba_sector + 4
movl %ebp, %esi
jmp boot_lba
#endif
_errtxt: .ascii "Error " /* runs into newline... */
_errcod: .byte 0 /* ... if errcod set */
_newline:
.asciz "\r\n"
#ifndef TERSE_ERROR
ERR_READ: .asciz "read"
ERR_NO_BOOTXX: .asciz "no magic"
ERR_PTN: .asciz "no slice"
#ifndef NO_LBA_CHECK
ERR_NO_LBA: .asciz "need LBA"
#endif
#endif
/*
* I hate #including source files, but pbr_magic below has to be at
* the correct absolute address.
* Clearly this could be done with a linker script.
*/
#include <message.S>
#if 0
#include <dump_eax.S>
#endif
/* Control block for int-13 LBA read. */
_lba_info:
.word 0x10 /* control block length */
.word BOOTXX_SECTORS /* sector count */
.word BOOTADDR /* offset in segment */
.word 0 /* segment */
_lba_sector:
.quad 0 /* sector # goes here... */
/* Drive Serial Number */
. = _C_LABEL(start) + MBR_DSN_OFFSET
.long 0
/* mbr_bootsel_magic (not used here) */
. = _C_LABEL(start) + MBR_BS_MAGIC_OFFSET
.word 0
/*
* Provide empty MBR partition table.
* If this is installed as an MBR, the user can use fdisk(8) to create
* the correct partition table ...
*/
. = _C_LABEL(start) + MBR_PART_OFFSET
_pbr_part0:
.byte 0, 0, 0, 0, 0, 0, 0, 0
.long 0, 0
_pbr_part1:
.byte 0, 0, 0, 0, 0, 0, 0, 0
.long 0, 0
_pbr_part2:
.byte 0, 0, 0, 0, 0, 0, 0, 0
.long 0, 0
_pbr_part3:
.byte 0, 0, 0, 0, 0, 0, 0, 0
.long 0, 0
/*
* The magic comes last
*/
. = _C_LABEL(start) + MBR_MAGIC_OFFSET
pbr_magic:
.word MBR_MAGIC
|
0xffea/MINIX3
| 3,964
|
sys/arch/i386/stand/bootxx/bootxx.S
|
/* $NetBSD: bootxx.S,v 1.10 2011/01/06 01:08:48 jakllsch Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by David Laight.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <machine/asm.h>
#include <sys/bootblock.h>
/*
* Code linked to 0xa00 and copied to sectors 2+ of the netbsd boot
* partition by MI /usr/sbin/installboot.
* Read into memory by code in pbr.S
*
* On entry:
* %dl BIOS drive number
* %edi:%esi Sector number of NetBSD partition
* %cs, %ds, %es, %ss All zero
* %sp near 0xfffc
*/
.text
.code16
ENTRY(bootxx)
jmp 1f
.balign 4
ENTRY(bootxx_magic)
.long X86_BOOT_MAGIC_1 /* checked by installboot & pbr code */
boot_params: /* space for patchable variables */
.long 1f - boot_params /* length of this data area */
#include <boot_params.S>
. = bootxx + 0x80 /* Space for patching unknown params */
1: call gdt_fixup
calll real_to_prot
.code32
push %edi
movl $_end, %ecx /* zero bss */
movl $__bss_start, %edi
subl %edi, %ecx
shr $2, %ecx /* _end and __bss_start are aligned */
xor %eax, %eax
rep
stosl
pop %edi
movzbl %dl, %edx
push %edi /* save args for secondary bootstrap */
push %esi
movl %esp, %esi /* address of sector number */
push %edx
push %esi /* args for boot1 */
push %edx
call _C_LABEL(boot1) /* C code to load /boot */
add $8, %esp
call prot_to_real
.code16
test %ax, %ax
jnz boot_fail
pop %edx /* bios disk number */
pop %ebx /* expected partition start sector */
pop %ecx
movl $boot_params, %esi
orb $X86_BP_FLAGS_LBA64VALID, 4(%esi)
lcall $SECONDARY_LOAD_ADDRESS >> 4, $0
boot_fail:
push %ax /* error string from boot1 */
movw errno, %ax
aam /* largest errno is < 100 */
addw $('0' << 8) | '0', %ax /* to ascii */
rorw $8, %ax
cmpb $'0', %al /* supress leading zero */
jne 10f
movb $' ', %al
10: movw %ax, 12f
movw $11f, %si
call message /* output boot failed message */
pop %si
call message /* and text from boot1 */
jmp loopstop
11: .ascii "Boot failed (errno "
12: .asciz "xx): "
ENTRY(_rtt)
.code32
call prot_to_real
.code16
loopstop:
movb 0x86, %ah /* delay for about a second */
movw $16, %cx
int $0x15
int $0x18 /* might be a boot fail entry */
1: sti /* if not loopstop */
hlt
jmp 1b
/*
* Vector the fs calls through here so we can support multiple
* file system types with one copy of the library code and
* multiple copies of this file.
*/
.global xxfs_open, xxfs_close, xxfs_read, xxfs_stat
.code32
xxfs_open: jmp XXfs_open
xxfs_close: jmp XXfs_close
xxfs_read: jmp XXfs_read
xxfs_stat: jmp XXfs_stat
|
0xffea/MINIX3
| 11,751
|
sys/arch/i386/stand/lib/crt/dos/start_dos.S
|
/* $NetBSD: start_dos.S,v 1.10 2010/12/20 01:12:44 jakllsch Exp $ */
/*
* startup for DOS .COM programs
* with input from:
* netbsd:sys/arch/i386/boot/start.S
* Tor Egge's patches for NetBSD boot (pr port-i386/1002)
* freebsd:sys/i386/boot/netboot/start2.S
* XMS support by Martin Husemann
*/
/*
* Ported to boot 386BSD by Julian Elischer ([email protected]) Sept 1992
*
* Mach Operating System
* Copyright (c) 1992, 1991 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or [email protected]
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/
/*
Copyright 1988, 1989, 1990, 1991, 1992
by Intel Corporation, Santa Clara, California.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and
its documentation for any purpose and without fee is hereby
granted, provided that the above copyright notice appears in all
copies and that both the copyright notice and this permission notice
appear in supporting documentation, and that the name of Intel
not be used in advertising or publicity pertaining to distribution
of the software without specific, written prior permission.
INTEL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
IN NO EVENT SHALL INTEL BE LIABLE FOR ANY SPECIAL, INDIRECT, OR
CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT,
NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <machine/asm.h>
CR0_PE = 0x1
.data
.globl _C_LABEL(ourseg)
_C_LABEL(ourseg):
.long 0
/**************************************************************************
GLOBAL DESCRIPTOR TABLE
**************************************************************************/
#ifdef __ELF__
.align 16
#else
.align 4
#endif
gdt:
.word 0, 0
.byte 0, 0x00, 0x00, 0
#ifdef SUPPORT_LINUX /* additional dummy */
.word 0, 0
.byte 0, 0x00, 0x00, 0
#endif
/* kernel code segment */
.globl flatcodeseg
flatcodeseg = . - gdt
.word 0xffff, 0
.byte 0, 0x9f, 0xcf, 0
/* kernel data segment */
.globl flatdataseg
flatdataseg = . - gdt
.word 0xffff, 0
.byte 0, 0x93, 0xcf, 0
/* boot code segment, base will be patched */
bootcodeseg = . - gdt
.word 0xffff, 0
.byte 0, 0x9e, 0x40, 0
/* boot data segment, base will be patched */
bootdataseg = . - gdt
#ifdef HEAP_BELOW_64K
.word 0xffff, 0
.byte 0, 0x92, 0x00, 0
#else
.word 0xffff, 0
.byte 0, 0x92, 0x4f, 0
#endif
/* 16 bit real mode, base will be patched */
bootrealseg = . - gdt
.word 0xffff, 0
.byte 0, 0x9e, 0x00, 0
/* limits (etc) for data segment in real mode */
bootrealdata = . - gdt
.word 0xffff, 0
.byte 0, 0x92, 0x00, 0
gdtlen = . - gdt
#ifdef __ELF__
.align 16
#else
.align 4
#endif
gdtarg:
.word gdtlen-1 /* limit */
.long 0 /* addr, will be inserted */
.text
ENTRY(start)
.code16
# Check we are in real mode
movl %cr0, %eax
testl $CR0_PE, %eax
jz 2f
mov $1f, %si
call message
ret
1: .asciz "must be in real mode\r\n"
2:
xorl %eax, %eax
mov %cs, %ax
mov %ax, %ds
mov %ax, %es
movl %eax, _C_LABEL(ourseg)
#ifdef STACK_START
add $STACK_START / 16, %ax
mov %ax, %ss
mov $0xfffc, %sp
#endif
/* fix up GDT entries for bootstrap */
#define FIXUP(gdt_index) \
movw %ax, gdt+gdt_index+2; \
movb %bl, gdt+gdt_index+4
mov %cs, %ax
shll $4, %eax
shldl $16, %eax, %ebx
FIXUP(bootcodeseg)
FIXUP(bootrealseg)
FIXUP(bootdataseg)
/* fix up GDT pointer */
addl $gdt, %eax
movl %eax, gdtarg+2
/* change to protected mode */
calll _C_LABEL(real_to_prot)
.code32
/* clear the bss */
movl $_C_LABEL(edata), %edi
movl $_C_LABEL(end), %ecx
subl %edi, %ecx
xorb %al, %al
rep
stosb
call _C_LABEL(doscommain)
ENTRY(_rtt)
call _C_LABEL(prot_to_real)
.code16
ENTRY(exit16)
sti
movb $0x4c, %ah /* return */
int $0x21
/*
* real_to_prot()
* transfer from real mode to protected mode.
*/
ENTRY(real_to_prot)
.code16
pushl %eax
# guarantee that interrupt is disabled when in prot mode
cli
# load the gdtr
lgdtl %cs:gdtarg
# set the PE bit of CR0
movl %cr0, %eax
orl $CR0_PE, %eax
movl %eax, %cr0
# make intrasegment jump to flush the processor pipeline and
# reload CS register
ljmp $bootcodeseg, $xprot
xprot:
.code32
# we are in USE32 mode now
# set up the protected mode segment registers : DS, SS, ES
movl $bootdataseg, %eax
mov %ax, %ds
mov %ax, %es
mov %ax, %ss
#ifdef STACK_START
addl $STACK_START, %esp
#endif
popl %eax
ret
/*
* prot_to_real()
* transfer from protected mode to real mode
*/
ENTRY(prot_to_real)
.code32
pushl %eax
# set up a dummy stack frame for the second seg change.
# Adjust the intersegment jump instruction following
# the clearing of protected mode bit.
# This is self-modifying code, but we need a writable
# code segment, and an intersegment return does not give us that.
movl _C_LABEL(ourseg), %eax
movw %ax, xreal-2
/*
* Load the segment registers while still in protected mode.
* Otherwise the control bits don't get changed.
* The correct values are loaded later.
*/
movw $bootrealdata, %ax
movw %ax, %ds
movw %ax, %es
movw %ax, %ss
# Change to use16 mode.
ljmp $bootrealseg, $x16
x16:
.code16
# clear the PE bit of CR0
movl %cr0, %eax
andl $~CR0_PE, %eax
movl %eax, %cr0
# Here we have an 16 bits intersegment jump.
ljmp $0, $xreal /* segment patched above */
xreal:
# we are in real mode now
# set up the real mode segment registers : DS, SS, ES
mov %cs, %ax
mov %ax, %ds
mov %ax, %es
#ifdef STACK_START
add $STACK_START / 16, %ax
mov %ax, %ss
subl $STACK_START, %esp
#else
mov %ax, %ss
#endif
push %bp
movw %sp, %bp
/* check we are returning to an address below 64k */
movw 2/*bp*/ + 4/*eax*/ + 2(%bp), %ax /* high bits ret addr */
test %ax, %ax
jne 1f
pop %bp
sti
popl %eax
retl
1: movw $2f, %si
call message
movl 2/*bp*/ + 4/*eax*/(%bp), %eax /* return address */
call dump_eax
jmp exit16
2: .asciz "prot_to_real can't return to "
/**************************************************************************
___MAIN - Dummy to keep GCC happy
**************************************************************************/
ENTRY(__main)
ret
/*
* pbzero(dst, cnt)
* where dst is a physical address and cnt is the length
*/
ENTRY(pbzero)
.code32
pushl %ebp
movl %esp, %ebp
pushl %es
pushl %edi
cld
# set %es to point at the flat segment
movl $flatdataseg, %eax
mov %ax, %es
movl 8(%ebp), %edi # destination
movl 12(%ebp), %ecx # count
xorl %eax, %eax # value
rep
stosb
popl %edi
popl %es
popl %ebp
ret
/*
* vpbcopy(src, dst, cnt)
* where src is a virtual address and dst is a physical address
*/
ENTRY(vpbcopy)
.code32
pushl %ebp
movl %esp, %ebp
pushl %es
pushl %esi
pushl %edi
cld
# set %es to point at the flat segment
movl $flatdataseg, %eax
mov %ax, %es
movl 8(%ebp), %esi # source
movl 12(%ebp), %edi # destination
movl 16(%ebp), %ecx # count
rep
movsb
popl %edi
popl %esi
popl %es
popl %ebp
ret
/*
* pvbcopy(src, dst, cnt)
* where src is a physical address and dst is a virtual address
*/
ENTRY(pvbcopy)
.code32
pushl %ebp
movl %esp, %ebp
pushl %ds
pushl %esi
pushl %edi
cld
# set %ds to point at the flat segment
movl $flatdataseg, %eax
mov %ax, %ds
movl 8(%ebp), %esi # source
movl 12(%ebp), %edi # destination
movl 16(%ebp), %ecx # count
rep
movsb
popl %edi
popl %esi
popl %ds
popl %ebp
ret
ENTRY(vtophys)
.code32
movl _C_LABEL(ourseg), %eax
shll $4, %eax
addl 4(%esp), %eax
ret
message:
.code16
pushal
message_1:
cld
1: lodsb
testb %al, %al
jz 2f
movb $0xe, %ah
movw $1, %bx
int $0x10
jmp 1b
2: movb $0x86, %ah
mov $16, %cx
int $0x15 /* delay about a second */
popal
ret
/* These are useful for debugging
*/
.data
eax_buf:
.long 0, 0, 0, 0
.text
ENTRY(dump_eax)
.code16
pushal
movw $eax_buf, %si
mov %si, %di
movw $8, %cx
1: roll $4, %eax
mov %ax, %bx
andb $0x0f, %al
addb $0x30, %al /* 30..3f - clear AF */
#if 1 /* 5 bytes to generate real hex... */
daa /* 30..39, 40..45 */
addb $0xc0, %al /* f0..f9, 00..05 */
adcb $0x40, %al /* 30..39, 41..45 */
#endif
movb %al, (%di) /* %es != %ds, so can't ... */
inc %di /* ... use stosb */
mov %bx, %ax
loop 1b
movw $0x20, %ax /* space + null */
movw %ax, (%di)
jmp message_1
.globl _C_LABEL(trace_word)
_C_LABEL(trace_word):
.code32
movl 4(%esp), %edx
call _C_LABEL(prot_to_real)
.code16
movl %edx, %eax
call dump_eax
calll _C_LABEL(real_to_prot)
.code32
ret
.globl _C_LABEL(trace_str)
_C_LABEL(trace_str):
.code32
pushl %esi
call _C_LABEL(prot_to_real)
.code16
mov %sp, %si
mov 8(%si), %si
call message
calll _C_LABEL(real_to_prot)
.code32
popl %esi
ret
#ifdef XMS
/* pointer to XMS driver, 0 if no XMS used */
.data
_C_LABEL(xmsdrv):
.long 0
.text
ENTRY(checkxms)
.code32
pushl %ebp
movl %esp, %ebp
pushl %ebx
pushl %edx
pushl %es
pushl %esi
pushl %edi
call _C_LABEL(prot_to_real) # enter real mode
.code16
movw $0x4300, %ax
int $0x2f /* check if XMS installed */
cmpb $0x80, %al
jnz noxms
movw $0x4310, %ax
int $0x2f /* get driver address */
movw %bx, _C_LABEL(xmsdrv) /* save es:bx to _xmsdrv */
movw %es, _C_LABEL(xmsdrv) + 2
movb $0x08, %ah /* XMS: query free extended memory */
#if 0
movb $0x00, %bl
#endif
lcall *_C_LABEL(xmsdrv)
jmp xdone
noxms: /* no XMS manager found */
mov $0, %dx
xdone:
calll _C_LABEL(real_to_prot) # back to protected mode
.code32
xorl %eax, %eax
movw %dx, %ax
popl %edi
popl %esi
popl %es
popl %edx
popl %ebx
popl %ebp
ret
/*
Allocate a block of XMS memory with the requested size
void *xmsalloc(long int kBytes);
Depends on _xmsdrv being set by getextmem() before first call
to this function.
Return value: a physical address.
*/
ENTRY(xmsalloc)
.code32
pushl %ebp
movl %esp, %ebp
pushl %ebx
pushl %edx
pushl %esi
pushl %edi
movl 0x8(%ebp), %edx # Kbytes needed
call _C_LABEL(prot_to_real) # enter real mode
.code16
movb $0x09, %ah # XMS allocate block
lcall *_C_LABEL(xmsdrv) # result: handle in %dx
movb $0x0c, %ah # XMS lock block
lcall *_C_LABEL(xmsdrv) # result: 32 bit physical addr in DX:BX
calll _C_LABEL(real_to_prot) # back to protected mode
.code32
movl %edx, %eax
shl $16, %eax
movw %bx, %ax # result in %eax
popl %edi
popl %esi
popl %edx
popl %ebx
popl %ebp
ret
/*
* ppbcopy(src, dst, cnt)
* where src and dst are physical addresses
*/
ENTRY(ppbcopy)
.code32
pushl %ebp
movl %esp, %ebp
pushl %es
pushl %esi
pushl %edi
cld
# set %es to point at the flat segment
movl $flatdataseg, %eax
mov %ax, %es
movl 8(%ebp), %esi # source
movl 12(%ebp), %edi # destination
movl 16(%ebp), %ecx # count
es
rep
movsb
popl %edi
popl %esi
popl %es
popl %ebp
ret
#endif
|
0xffea/MINIX3
| 1,642
|
lib/libhgfs/backdoor.S
|
/* Part of libhgfs - (c) 2009, D.C. van Moolenbroek */
#include <machine/asm.h>
.text
MAGIC = 0x564D5868
BD_PORT = 0x5658
IO_PORT = 0x5659
ENTRY(__libhgfs_backdoor)
pushl %ebx
pushl %esi
pushl %edi
pushl %ebp
movl 4+16(%esp), %ebp
movl $MAGIC, %eax
movl 4(%ebp), %ebx
movl 8(%ebp), %ecx
movl 12(%ebp), %edx
movw $BD_PORT, %dx
movl 16(%ebp), %esi
movl 20(%ebp), %edi
inl %dx
movl %eax, (%ebp)
movl %ebx, 4(%ebp)
movl %ecx, 8(%ebp)
movl %edx, 12(%ebp)
movl %esi, 16(%ebp)
movl %edi, 20(%ebp)
popl %ebp
popl %edi
popl %esi
popl %ebx
ret
ENTRY(__libhgfs_backdoor_in)
pushl %ebx
pushl %esi
pushl %edi
pushl %ebp
movl 4+16(%esp), %eax
movl 4(%eax), %ebx
movl 8(%eax), %ecx
movl 12(%eax), %edx
movw $IO_PORT, %dx
movl 16(%eax), %esi
movl 20(%eax), %edi
movl 24(%eax), %ebp
movl $MAGIC, %eax
cld
repe; insb
pushl %eax
movl 4+20(%esp), %eax
movl %ebx, 4(%eax)
movl %ecx, 8(%eax)
movl %edx, 12(%eax)
movl %esi, 16(%eax)
movl %edi, 20(%eax)
movl %ebp, 24(%eax)
popl %ebx
movl %ebx, (%eax)
movl (%eax), %eax
popl %ebp
popl %edi
popl %esi
popl %ebx
ret
ENTRY(__libhgfs_backdoor_out)
pushl %ebx
pushl %esi
pushl %edi
pushl %ebp
movl 4+16(%esp), %eax
movl 4(%eax), %ebx
movl 8(%eax), %ecx
movl 12(%eax), %edx
movw $IO_PORT, %dx
movl 16(%eax), %esi
movl 20(%eax), %edi
movl 24(%eax), %ebp
movl $MAGIC, %eax
cld
repe; outsb
pushl %eax
movl 4+20(%esp), %eax
movl %ebx, 4(%eax)
movl %ecx, 8(%eax)
movl %edx, 12(%eax)
movl %esi, 16(%eax)
movl %edi, 20(%eax)
movl %ebp, 24(%eax)
popl %ebx
movl %ebx, (%eax)
movl (%eax), %eax
popl %ebp
popl %edi
popl %esi
popl %ebx
ret
|
0xffea/MINIX3
| 1,178
|
lib/libminlib/i386/read_tsc.S
|
/* */
/* sections */
#include <machine/asm.h>
/**===========================================================================* */
/* PUBLIC void read_tsc(unsigned long *high, unsigned long *low); */
/* Read the cycle counter of the CPU. Pentium and up. */
ENTRY(read_tsc)
push %edx
push %eax
.byte 0x0f /* this is the RDTSC instruction */
.byte 0x31 /* it places the TSC in EDX:EAX */
push %ebp
movl 16(%esp), %ebp
movl %edx, (%ebp)
movl 20(%esp), %ebp
movl %eax, (%ebp)
pop %ebp
pop %eax
pop %edx
ret
/**===========================================================================* */
/* PUBLIC void read_host_time_ns(unsigned long *high, unsigned long *low); */
/* access real time in ns from host in vmware. */
ENTRY(read_host_time_ns)
pushl %edx
pushl %eax
pushl %ecx
movl $0x10001, %ecx
.byte 0x0f /* this is the RDTSC instruction */
.byte 0x31 /* it places the TSC in EDX:EAX */
pushl %ebp
movl 20(%esp), %ebp
movl %edx, (%ebp)
movl 24(%esp), %ebp
movl %eax, (%ebp)
popl %ebp
popl %ecx
popl %eax
popl %edx
ret
|
0xffea/MINIX3
| 1,437
|
lib/libminlib/i386/getprocessor.S
|
/* getprocessor() - determine processor type Author: Kees J. Bot */
/* 26 Jan 1994 */
#include <machine/asm.h>
/* int getprocessor(void); */
/* Return 386, 486, 586, ... */
ENTRY(getprocessor)
push %ebp
movl %esp, %ebp
andl $0xFFFFFFFC, %esp /* Align stack to avoid AC fault */
movl $0x00040000, %ecx /* Try to flip the AC bit introduced on the 486 */
call flip
movl $386, %eax /* 386 if it didn't react to "flipping" */
je gotprocessor
movl $0x00200000, %ecx /* Try to flip the ID bit introduced on the 586 */
call flip
movl $486, %eax /* 486 if it didn't react */
je gotprocessor
pushf
pusha /* Save the world */
movl $1, %eax
.byte 0x0F, 0xA2 /* CPUID instruction tells the processor type */
andb $0x0F, %ah /* Extract the family (5, 6, ...) */
movzbl %ah, %eax
cmpl $15, %eax /* 15: extended family */
jne direct
movl $6, %eax /* Make it 686 */
direct:
imull $100, %eax /* 500, 600, ... */
addl $86, %eax /* 586, 686, ... */
movl %eax, 7*4(%esp) /* Pass eax through */
popa
popf
gotprocessor:
leave
ret
flip:
pushf /* Push eflags */
pop %eax /* eax = eflags */
movl %eax, %edx /* Save original eflags */
xorl %ecx, %eax /* Flip the bit to test */
push %eax /* Push modified eflags value */
popf /* Load modified eflags register */
pushf
pop %eax /* Get it again */
push %edx
popf /* Restore original eflags register */
xorl %edx, %eax /* See if the bit changed */
testl %ecx, %eax
ret
|
0xffea/MINIX3
| 1,819
|
lib/libm/arch/i387/s_log1p.S
|
/*
* Written by J.T. Conklin <[email protected]>.
* Public domain.
*/
/*
* Modified by Lex Wennmacher <[email protected]>
* Still public domain.
*/
#include <machine/asm.h>
#include "abi.h"
RCSID("$NetBSD: s_log1p.S,v 1.13 2003/09/16 18:17:11 wennmach Exp $")
/*
* The log1p() function is provided to compute an accurate value of
* log(1 + x), even for tiny values of x. The i387 FPU provides the
* fyl2xp1 instruction for this purpose. However, the range of this
* instruction is limited to:
* -(1 - (sqrt(2) / 2)) <= x <= sqrt(2) - 1
* -0.292893 <= x <= 0.414214
* at least on older processor versions.
*
* log1p() is implemented by testing the range of the argument.
* If it is appropriate for fyl2xp1, this instruction is used.
* Else, we compute log1p(x) = ln(2)*ld(1 + x) the traditional way
* (using fyl2x).
*
* The range testing costs speed, but as the rationale for the very
* existence of this function is accuracy, we accept that.
*
* In order to reduce the cost for testing the range, we check if
* the argument is in the range
* -0.25 <= x <= 0.25
* which can be done with just one conditional branch. If x is
* inside this range, we use fyl2xp1. Outside of this range,
* the use of fyl2x is accurate enough.
*
*/
.text
.align 4
ENTRY(log1p)
XMM_ONE_ARG_DOUBLE_PROLOGUE
fldl ARG_DOUBLE_ONE
fabs
fld1 /* ... x 1 */
fadd %st(0) /* ... x 2 */
fadd %st(0) /* ... x 4 */
fld1 /* ... 4 1 */
fdivp /* ... x 0.25 */
fcompp
fnstsw %ax
andb $69,%ah
jne use_fyl2x
jmp use_fyl2xp1
.align 4
use_fyl2x:
fldln2
fldl ARG_DOUBLE_ONE
fld1
faddp
fyl2x
XMM_DOUBLE_EPILOGUE
ret
.align 4
use_fyl2xp1:
fldln2
fldl ARG_DOUBLE_ONE
fyl2xp1
XMM_DOUBLE_EPILOGUE
ret
|
0xffea/MINIX3
| 3,053
|
lib/libm/arch/i387/s_modf.S
|
/* $NetBSD: s_modf.S,v 1.1 2006/03/22 20:45:58 drochner Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Sean Eric Fagan.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: @(#)modf.s 5.5 (Berkeley) 3/18/91
*/
#include <machine/asm.h>
#if defined(LIBC_SCCS)
RCSID("$NetBSD: s_modf.S,v 1.1 2006/03/22 20:45:58 drochner Exp $")
#endif
/*
* modf(value, iptr): return fractional part of value, and stores the
* integral part into iptr (a pointer to double).
*
* Written by Sean Eric Fagan ([email protected])
* Sun Mar 11 20:27:30 PST 1990
*/
/* With CHOP mode on, frndint behaves as TRUNC does. Useful. */
ENTRY(modf)
#ifdef __x86_64__
pushq %rbp
movq %rsp,%rbp
subq $24,%rsp
/* Set chop mode. */
fnstcw -12(%rbp)
movw -12(%rbp),%dx
orw $3072,%dx
movw %dx,-16(%rbp)
fldcw -16(%rbp)
/* Get integral part. */
movsd %xmm0,-24(%rbp)
fldl -24(%rbp)
frndint
fstpl -8(%rbp)
/* Restore control word. */
fldcw -12(%rbp)
/* Store integral part. */
movsd -8(%rbp),%xmm0
movsd %xmm0,(%rdi)
/* Get fractional part and return it. */
fldl -24(%rbp)
fsubl -8(%rbp)
fstpl -24(%rbp)
movsd -24(%rbp),%xmm0
#else
pushl %ebp
movl %esp,%ebp
subl $16,%esp
fnstcw -12(%ebp)
movw -12(%ebp),%dx
orw $3072,%dx
movw %dx,-16(%ebp)
fldcw -16(%ebp)
fldl 8(%ebp)
frndint
fstpl -8(%ebp)
fldcw -12(%ebp)
movl 16(%ebp),%eax
movl -8(%ebp),%edx
movl -4(%ebp),%ecx
movl %edx,(%eax)
movl %ecx,4(%eax)
fldl 8(%ebp)
fsubl -8(%ebp)
jmp L1
L1:
#endif
leave
ret
|
0xffea/MINIX3
| 3,568
|
lib/libm/arch/i387/e_exp.S
|
/* $NetBSD: e_exp.S,v 1.14 2008/06/23 10:24:13 drochner Exp $ */
/*
* Copyright (c) 1993,94 Winning Strategies, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Winning Strategies, Inc.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* Written by:
* J.T. Conklin ([email protected]), Winning Strategies, Inc.
*/
#include <machine/asm.h>
#include "abi.h"
RCSID("$NetBSD: e_exp.S,v 1.14 2008/06/23 10:24:13 drochner Exp $")
#if 0
RCSID("$FreeBSD: src/lib/msun/i387/e_exp.S,v 1.8.2.1 2000/07/10 09:16:28 obrien Exp $")
#endif
/* e^x = 2^(x * log2(e)) */
ENTRY(__ieee754_exp)
XMM_ONE_ARG_DOUBLE_PROLOGUE
/*
* If x is +-Inf, then the subtraction would give Inf-Inf = NaN.
* Avoid this. Also avoid it if x is NaN for convenience.
*/
movl ARG_DOUBLE_ONE_MSW, %eax
andl $0x7fffffff, %eax
cmpl $0x7ff00000, %eax
jae x_Inf_or_NaN
fldl ARG_DOUBLE_ONE
/*
* Ensure that the rounding mode is to nearest (to give the smallest
* possible fraction) and that the precision is as high as possible.
* We may as well mask interrupts if we switch the mode.
*/
#define CWSTORE_SAV ARG_DOUBLE_ONE_LSW /* XXX overwrites the argument */
#define CWSTORE_TMP ARG_DOUBLE_ONE_MSW
fstcw CWSTORE_SAV
movl CWSTORE_SAV, %eax
andl $0x0f00, %eax
cmpl $0x0300, %eax /* RC == 0 && PC == 3? */
je 1f /* jump if mode is good */
movl $0x137f, CWSTORE_TMP
fldcw CWSTORE_TMP
1:
fldl2e
fmulp /* x * log2(e) */
fst %st(1)
frndint /* int(x * log2(e)) */
fst %st(2)
fsubrp /* fract(x * log2(e)) */
f2xm1 /* 2^(fract(x * log2(e))) - 1 */
fld1
faddp /* 2^(fract(x * log2(e))) */
fscale /* e^x */
fstp %st(1)
je 1f
fldcw CWSTORE_SAV
1:
XMM_DOUBLE_EPILOGUE
ret
x_Inf_or_NaN:
/*
* Return 0 if x is -Inf. Otherwise just return x, although the
* C version would return (x + x) (Real Indefinite) if x is a NaN.
*/
cmpl $0xfff00000, ARG_DOUBLE_ONE_MSW
jne x_not_minus_Inf
cmpl $0, ARG_DOUBLE_ONE_LSW
jne x_not_minus_Inf
fldz
XMM_DOUBLE_EPILOGUE
ret
x_not_minus_Inf:
fldl ARG_DOUBLE_ONE
XMM_DOUBLE_EPILOGUE
ret
|
0xffea/MINIX3
| 1,818
|
lib/libm/arch/i387/s_log1pf.S
|
/*
* Written by J.T. Conklin <[email protected]>.
* Public domain.
*/
/*
* Modified by Lex Wennmacher <[email protected]>
* Still public domain.
*/
#include <machine/asm.h>
#include "abi.h"
RCSID("$NetBSD: s_log1pf.S,v 1.10 2003/09/16 18:17:11 wennmach Exp $")
/*
* The log1pf() function is provided to compute an accurate value of
* log(1 + x), even for tiny values of x. The i387 FPU provides the
* fyl2xp1 instruction for this purpose. However, the range of this
* instruction is limited to:
* -(1 - (sqrt(2) / 2)) <= x <= sqrt(2) - 1
* -0.292893 <= x <= 0.414214
* at least on older processor versions.
*
* log1pf() is implemented by testing the range of the argument.
* If it is appropriate for fyl2xp1, this instruction is used.
* Else, we compute log1pf(x) = ln(2)*ld(1 + x) the traditional way
* (using fyl2x).
*
* The range testing costs speed, but as the rationale for the very
* existence of this function is accuracy, we accept that.
*
* In order to reduce the cost for testing the range, we check if
* the argument is in the range
* -0.25 <= x <= 0.25
* which can be done with just one conditional branch. If x is
* inside this range, we use fyl2xp1. Outside of this range,
* the use of fyl2x is accurate enough.
*
*/
.text
.align 4
ENTRY(log1pf)
XMM_ONE_ARG_FLOAT_PROLOGUE
flds ARG_FLOAT_ONE
fabs
fld1 /* ... x 1 */
fadd %st(0) /* ... x 2 */
fadd %st(0) /* ... x 4 */
fld1 /* ... 4 1 */
fdivp /* ... x 0.25 */
fcompp
fnstsw %ax
andb $69,%ah
jne use_fyl2x
jmp use_fyl2xp1
.align 4
use_fyl2x:
fldln2
flds ARG_FLOAT_ONE
fld1
faddp
fyl2x
XMM_FLOAT_EPILOGUE
ret
.align 4
use_fyl2xp1:
fldln2
flds ARG_FLOAT_ONE
fyl2xp1
XMM_FLOAT_EPILOGUE
ret
|
0xffea/MINIX3
| 1,696
|
lib/libc/compat/arch/m68k/sys/compat___semctl.S
|
/* $NetBSD: compat___semctl.S,v 1.2 2008/04/28 20:22:58 martin Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
* NASA Ames Research Center.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "SYS.h"
PSEUDO(__semctl,compat_14___semctl)
|
0xffea/MINIX3
| 2,854
|
lib/libc/compat/arch/m68k/sys/compat_sigreturn.S
|
/* $NetBSD: compat_sigreturn.S,v 1.1 2006/03/09 16:20:55 christos Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* the Systems Programming Group of the University of Utah Computer
* Science Department.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include "SYS.h"
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
RCSID("from: @(#)sigreturn.s 5.1 (Berkeley) 5/12/90")
#else
RCSID("$NetBSD: compat_sigreturn.S,v 1.1 2006/03/09 16:20:55 christos Exp $")
#endif
#endif /* LIBC_SCCS and not lint */
/*
* We must preserve the state of the registers as the user has set them up.
*/
#ifdef GPROF
#undef ENTRY
#ifdef __STDC__
#define ENTRY(x) \
.globl _C_LABEL(x); .even; _C_LABEL(x):; moveml #0xC0C0,%sp@-; .data; \
PROF ## x:; .long 0; .text; lea PROF ## x,%a0; jbsr MCOUNT_ENTRY; \
moveml %sp@+,#0x0303
#else
#define ENTRY(x) \
.globl _C_LABEL(x); .even; _C_LABEL(x):; moveml #0xC0C0,%sp@-; .data; \
PROF/**/x:; .long 0; .text; lea PROF/**/x,%a0; jbsr MCOUNT_ENTRY; \
moveml %sp@+,#0x0303
#endif /* __STDC__ */
#endif /* GPROF */
WARN_REFERENCES(sigreturn, \
"warning: reference to compatibility sigreturn()")
/*
* NOTE: Trap #1 is used for compat_13_sigreturn13 on the m68k!
*/
ENTRY(sigreturn)
trap #1 /* signals compat_13_sigreturn13() */
jra PIC_PLT(CERROR)
|
0xffea/MINIX3
| 2,296
|
lib/libc/compat/arch/m68k/sys/compat_sigpending.S
|
/* $NetBSD: compat_sigpending.S,v 1.1 2006/03/09 16:20:55 christos Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* the Systems Programming Group of the University of Utah Computer
* Science Department.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include "SYS.h"
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
RCSID("from: @(#)sigpending.s 5.2 (Berkeley) 8/6/90")
#else
RCSID("$NetBSD: compat_sigpending.S,v 1.1 2006/03/09 16:20:55 christos Exp $")
#endif
#endif /* LIBC_SCCS and not lint */
WARN_REFERENCES(sigpending, \
"warning: reference to compatibility sigpending(); include <signal.h> for correct reference")
_SYSCALL(sigpending,compat_13_sigpending13)
movl %sp@(4),%a0
movl %d0,%a0@
clrl %d0
rts
|
0xffea/MINIX3
| 2,716
|
lib/libc/compat/arch/m68k/sys/compat___sigreturn14.S
|
/* $NetBSD: compat___sigreturn14.S,v 1.1 2006/03/09 16:20:55 christos Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* the Systems Programming Group of the University of Utah Computer
* Science Department.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include "SYS.h"
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
RCSID("from: @(#)sigreturn.s 5.1 (Berkeley) 5/12/90")
#else
RCSID("$NetBSD: compat___sigreturn14.S,v 1.1 2006/03/09 16:20:55 christos Exp $")
#endif
#endif /* LIBC_SCCS and not lint */
/*
* We must preserve the state of the registers as the user has set them up.
*/
#ifdef GPROF
#undef ENTRY
#ifdef __STDC__
#define ENTRY(x) \
.globl _C_LABEL(x); .even; _C_LABEL(x):; moveml #0xC0C0,%sp@-; .data; \
PROF ## x:; .long 0; .text; lea PROF ## x,%a0; jbsr MCOUNT_ENTRY; \
moveml %sp@+,#0x0303
#else
#define ENTRY(x) \
.globl _C_LABEL(x); .even; _C_LABEL(x):; moveml #0xC0C0,%sp@-; .data; \
PROF/**/x:; .long 0; .text; lea PROF/**/x,%a0; jbsr MCOUNT_ENTRY; \
moveml %sp@+,#0x0303
#endif /* __STDC__ */
#endif /* GPROF */
ENTRY(__sigreturn14)
trap #3 /* special sigreturn syscall entry point */
jra PIC_PLT(CERROR)
|
0xffea/MINIX3
| 2,409
|
lib/libc/compat/arch/m68k/sys/compat_sigsuspend.S
|
/* $NetBSD: compat_sigsuspend.S,v 1.1 2006/03/09 16:20:55 christos Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* the Systems Programming Group of the University of Utah Computer
* Science Department.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include "SYS.h"
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
RCSID("from: @(#)sigsuspend.s 5.2 (Berkeley) 6/6/90")
#else
RCSID("$NetBSD: compat_sigsuspend.S,v 1.1 2006/03/09 16:20:55 christos Exp $")
#endif
#endif /* LIBC_SCCS and not lint */
WARN_REFERENCES(sigsuspend, \
"warning: reference to compatibility sigsuspend(); include <signal.h> for correct reference")
ENTRY(sigsuspend)
movl %sp@(4),%a0
movl %a0@,%sp@(4) /* indirect to mask arg */
movl #SYS_compat_13_sigsuspend13,%d0
trap #0
jcs err
clrl %d0 /* shouldn't happen */
rts
err:
jra PIC_PLT(CERROR)
|
0xffea/MINIX3
| 1,828
|
lib/libc/compat/arch/m68k/sys/compat_sigaction.S
|
/* $NetBSD: compat_sigaction.S,v 1.2 2008/04/28 20:22:58 martin Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
* NASA Ames Research Center.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "SYS.h"
WARN_REFERENCES(sigaction, \
"warning: reference to compatibility sigaction(); include <signal.h> for correct reference")
PSEUDO(sigaction,compat_13_sigaction13)
|
0xffea/MINIX3
| 2,722
|
lib/libc/compat/arch/m68k/sys/compat_sigprocmask.S
|
/* $NetBSD: compat_sigprocmask.S,v 1.1 2006/03/09 16:20:55 christos Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* the Systems Programming Group of the University of Utah Computer
* Science Department.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include "SYS.h"
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
RCSID("from: @(#)sigprocmask.s 5.2 (Berkeley) 6/6/90")
#else
RCSID("$NetBSD: compat_sigprocmask.S,v 1.1 2006/03/09 16:20:55 christos Exp $")
#endif
#endif /* LIBC_SCCS and not lint */
WARN_REFERENCES(sigprocmask, \
"warning: reference to compatibility sigprocmask(); include <signal.h> for correct reference")
ENTRY(sigprocmask)
tstl %sp@(8) /* check new sigset pointer */
jne gotptr /* if not null, indirect */
/* movl #0,%sp@(8) /* null mask pointer: block empty set */
movl #1,%sp@(4) /* SIG_BLOCK */
jra doit
gotptr:
movl %sp@(8),%a0
movl %a0@,%sp@(8) /* indirect to new mask arg */
doit:
movl #SYS_compat_13_sigprocmask13,%d0
trap #0
jcs err
tstl %sp@(12) /* test if old mask requested */
jeq out
movl %sp@(12),%a0
movl %d0,%a0@ /* store old mask */
out:
clrl %d0
rts
err:
jra PIC_PLT(CERROR)
|
0xffea/MINIX3
| 1,812
|
lib/libc/compat/arch/m68k/sys/compat_msgctl.S
|
/* $NetBSD: compat_msgctl.S,v 1.2 2008/04/28 20:22:58 martin Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
* NASA Ames Research Center.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "SYS.h"
WARN_REFERENCES(msgctl, \
"warning: reference to compatibility msgctl(); include <sys/msg.h> for correct reference")
PSEUDO(msgctl,compat_14_msgctl)
|
0xffea/MINIX3
| 2,175
|
lib/libc/compat/arch/m68k/sys/compat___sigtramp1.S
|
/* $NetBSD: compat___sigtramp1.S,v 1.2 2008/04/28 20:22:58 martin Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Jason R. Thorpe.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "SYS.h"
/*
* The m68k signal trampoline is invoked only to return from
* the signal; the kernel calls the signal handler directly.
*
* On entry, stack looks like:
*
* sigcontext structure [12]
* pointer to sigcontext structure [8]
* signal specific code [4]
* sp-> signal number [0]
*/
ENTRY_NOPROFILE(__sigtramp_sigcontext_1)
leal %sp@(12),%a0 /* get pointer to sigcontext */
movl %a0,%sp@(4) /* put it in the argument slot */
/* fake return address already there */
trap #3 /* special sigreturn trap */
movl %d0,%sp@(4) /* failed, exit with errno */
SYSTRAP(exit)
|
0xffea/MINIX3
| 1,812
|
lib/libc/compat/arch/m68k/sys/compat_shmctl.S
|
/* $NetBSD: compat_shmctl.S,v 1.2 2008/04/28 20:22:58 martin Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
* NASA Ames Research Center.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "SYS.h"
WARN_REFERENCES(shmctl, \
"warning: reference to compatibility shmctl(); include <sys/shm.h> for correct reference")
PSEUDO(shmctl,compat_14_shmctl)
|
0xffea/MINIX3
| 3,526
|
lib/libc/compat/arch/m68k/sys/compat_Ovfork.S
|
/* $NetBSD: compat_Ovfork.S,v 1.1 2006/03/09 16:20:55 christos Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* the Systems Programming Group of the University of Utah Computer
* Science Department.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include "SYS.h"
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
RCSID("from: @(#)Ovfork.s 5.1 (Berkeley) 5/12/90")
#else
RCSID("$NetBSD: compat_Ovfork.S,v 1.1 2006/03/09 16:20:55 christos Exp $")
#endif
#endif /* LIBC_SCCS and not lint */
/*
* @(#)vfork.s 4.1 (Berkeley) 12/21/80
* C library -- vfork
*/
WARN_REFERENCES(vfork, \
"warning: reference to compatibility vfork(); include <unistd.h> for correct reference")
/*
* pid = vfork();
*
* d1 == 0 in parent process, d1 == 1 in child process.
* d0 == pid of child in parent, d0 == pid of parent in child.
*
* trickery here, due to keith sklower, uses ret to clear the stack,
* and then returns with a jump indirect, since only one person can return
* with a ret off this stack... we do the ret before we vfork!
*/
ENTRY(vfork)
movl %sp@+,%a1
movl #SYS_vfork,%d0
trap #0
jcs err
subql #1,%d1 /* from 1 to 0 in child, 0 to -1 in parent */
andl %d1,%d0
jmp %a1@
err:
#ifdef _REENTRANT
.globl _C_LABEL(__errno)
movl %a1,%sp@-
movl %d0,%sp@-
#if defined(PIC) && !defined(__ELF__)
movl #_C_LABEL(_GLOBAL_OFFSET_TABLE_),%a1
lea %pc@(0,a1:l),%a1
movl %a1@(_C_LABEL(__errno):l),%a1
jsr %a1@
#else
jbsr PIC_PLT(_C_LABEL(__errno))
#endif /* PIC */
#ifdef __SVR4_ABI__
movl %sp@+,%a0@
#else
movl %d0,%a1
movl %sp@+,%a1@
#endif /* __SVR4_ABI__ */
movl %sp@+,%a1
#else
.globl _C_LABEL(errno)
#ifdef PIC
#ifdef __ELF__
lea %pc@(_GLOBAL_OFFSET_TABLE_@GOTPC),%a0
movl %a0@(_C_LABEL(errno)@GOT:w),%a0
#else
movl #_C_LABEL(_GLOBAL_OFFSET_TABLE_),%a0
lea %pc@(0,a0:l),%a0
movl %a0@(_C_LABEL(errno):w),%a0
#endif
movl %d0,%a0@
#else
movl %d0,_C_LABEL(errno)
#endif /* PIC */
#endif /* _REENTRANT */
moveq #-1,%d0
jmp %a1@
|
0xffea/MINIX3
| 1,824
|
lib/libc/compat/arch/m68k/sys/compat_quotactl.S
|
/* $NetBSD: compat_quotactl.S,v 1.2 2011/03/06 17:08:13 bouyer Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
* NASA Ames Research Center.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "SYS.h"
WARN_REFERENCES(quotactl, \
"warning: reference to compatibility quotactl(); include <sys/quota.h> for correct reference")
PSEUDO(quotactl,compat_50_quotactl)
|
0xffea/MINIX3
| 2,812
|
lib/libc/compat/arch/m68k/gen/compat_sigsetjmp.S
|
/* $NetBSD: compat_sigsetjmp.S,v 1.1 2006/03/09 16:20:55 christos Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* the Systems Programming Group of the University of Utah Computer
* Science Department.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <machine/asm.h>
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
RCSID("from: @(#)_setjmp.s 5.1 (Berkeley) 5/12/90")
#else
RCSID("$NetBSD: compat_sigsetjmp.S,v 1.1 2006/03/09 16:20:55 christos Exp $")
#endif
#endif /* LIBC_SCCS and not lint */
/*
* C library -- sigsetjmp, siglongjmp
*
* siglongjmp(a,v)
* will generate a "return(v)" from
* the last call to
* sigsetjmp(a,m)
* by restoring registers from the stack,
* The previous signal state is restored if 'm' was non-zero.
*/
/* grab _JBLEN */
#include <m68k/setjmp.h>
ENTRY(sigsetjmp)
movl %sp@(8),%d1 /* grab the mask */
movl %sp@(4),%a0 /* grab the area pointer */
movl %d1,%a0@(_JBLEN * 4 ) /* save at end of area */
tstl %d1
bne dosig
jra PIC_PLT(_C_LABEL(_setjmp))
dosig:
jra PIC_PLT(_C_LABEL(setjmp))
ENTRY(siglongjmp)
movl %sp@(4),%a0 /* save area pointer */
tstl %a0@(_JBLEN * 4) /* check mask... */
bne didsig
jra PIC_PLT(_C_LABEL(_longjmp))
didsig:
jra PIC_PLT(_C_LABEL(longjmp))
|
0xffea/MINIX3
| 3,599
|
lib/libc/compat/arch/m68k/gen/compat_setjmp.S
|
/* $NetBSD: compat_setjmp.S,v 1.1 2006/03/09 16:20:55 christos Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* the Systems Programming Group of the University of Utah Computer
* Science Department.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <machine/asm.h>
#if defined(LIBC_SCCS) && !defined(lint)
#if 0
RCSID("from: @(#)setjmp.s 5.1 (Berkeley) 5/12/90")
#else
RCSID("$NetBSD: compat_setjmp.S,v 1.1 2006/03/09 16:20:55 christos Exp $")
#endif
#endif /* LIBC_SCCS and not lint */
/*
* C library -- setjmp, longjmp
*
* longjmp(a,v)
* will generate a "return(v)" from
* the last call to
* setjmp(a)
* by restoring registers from the stack,
* and a struct sigcontext, see <signal.h>
*/
ENTRY(setjmp)
lea %sp@(-12),%sp /* space for sigstack args/rvals */
clrl %sp@ /* don't change it... */
movl %sp,%sp@(4) /* ...but return the current val */
jbsr PIC_PLT(_C_LABEL(__sigaltstack14))
/* note: flags returned in sp@(8) */
clrl %sp@ /* don't change mask, just return */
jbsr PIC_PLT(_C_LABEL(sigblock)) /* old value */
movl %sp@(8),%d1 /* old flags value */
andl #1,%d1 /* extract onstack flag */
lea %sp@(12),%sp
movl %sp@(4),%a0 /* save area pointer */
movl %d1,%a0@+ /* save old onstack value */
movl %d0,%a0@+ /* save old signal mask */
lea %sp@(4),%a1 /* adjust saved SP since we won't rts */
movl %a1,%a0@+ /* save old SP */
movl %a6,%a0@+ /* save old FP */
clrl %a0@+ /* no AP */
movl %sp@,%a0@+ /* save old PC */
clrl %a0@+ /* clean PS */
moveml #0x3CFC,%a0@ /* save remaining non-scratch regs */
clrl %d0 /* return 0 */
rts
ENTRY(longjmp)
movl %sp@(4),%a0 /* save area pointer */
tstl %a0@(8) /* ensure non-zero SP */
jeq botch /* oops! */
movl %sp@(8),%d0 /* grab return value */
jne ok /* non-zero ok */
moveq #1,%d0 /* else make non-zero */
ok:
moveml %a0@(28),#0x3CFC /* restore non-scratch regs */
movl %a0,%sp@- /* let sigreturn */
jbsr PIC_PLT(_C_LABEL(sigreturn)) /* finish for us */
botch:
jbsr PIC_PLT(_C_LABEL(longjmperror))
stop #0
|
0xffea/MINIX3
| 1,696
|
lib/libc/compat/arch/i386/sys/compat___semctl.S
|
/* $NetBSD: compat___semctl.S,v 1.2 2008/04/28 20:22:58 martin Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
* NASA Ames Research Center.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "SYS.h"
PSEUDO(__semctl,compat_14___semctl)
|
0xffea/MINIX3
| 2,488
|
lib/libc/compat/arch/i386/sys/compat_sigreturn.S
|
/* $NetBSD: compat_sigreturn.S,v 1.2 2011/01/12 23:12:11 joerg Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* William Jolitz.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: @(#)sigreturn.s 5.2 (Berkeley) 12/17/90"
*/
#include <machine/asm.h>
#if defined(SYSLIBC_SCCS) && !defined(lint)
RCSID("$NetBSD: compat_sigreturn.S,v 1.2 2011/01/12 23:12:11 joerg Exp $")
#endif /* SYSLIBC_SCCS and not lint */
#include "SYS.h"
/*
* We must preserve the state of the registers as the user has set them up.
*/
#ifdef GPROF
#undef ENTRY
#ifdef __ELF__
#define MCOUNT_SYMBOL __mcount
#else
#define MCOUNT_SYMBOL mcount
#endif
#define ENTRY(x) \
.globl _ ## x; _ALIGN_TEXT; _ ## x: pusha ; \
.data; 1:; .long 0; .text; movl $1b,%eax; call MCOUNT_SYMBOL; popa ; nop
#endif /* GPROF */
WARN_REFERENCES(sigreturn, \
"warning: reference to compatibility sigreturn()")
PSEUDO(sigreturn,compat_13_sigreturn13)
|
0xffea/MINIX3
| 2,283
|
lib/libc/compat/arch/i386/sys/compat_sigpending.S
|
/* $NetBSD: compat_sigpending.S,v 1.1 2005/09/13 01:44:08 christos Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* William Jolitz.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: @(#)sigpending.s 5.1 (Berkeley) 7/1/90
*/
#include <machine/asm.h>
#if defined(SYSLIBC_SCCS) && !defined(lint)
RCSID("$NetBSD: compat_sigpending.S,v 1.1 2005/09/13 01:44:08 christos Exp $")
#endif /* SYSLIBC_SCCS and not lint */
#include "SYS.h"
WARN_REFERENCES(sigpending, \
"warning: reference to compatibility sigpending(); include <signal.h> for correct reference")
_SYSCALL(sigpending,compat_13_sigpending13)
movl 4(%esp),%ecx # fetch pointer to...
movl %eax,(%ecx) # store old mask
xorl %eax,%eax
ret
|
0xffea/MINIX3
| 2,417
|
lib/libc/compat/arch/i386/sys/compat___sigreturn14.S
|
/* $NetBSD: compat___sigreturn14.S,v 1.2 2011/01/12 23:12:11 joerg Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* William Jolitz.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: @(#)sigreturn.s 5.2 (Berkeley) 12/17/90"
*/
#include <machine/asm.h>
#if defined(SYSLIBC_SCCS) && !defined(lint)
RCSID("$NetBSD: compat___sigreturn14.S,v 1.2 2011/01/12 23:12:11 joerg Exp $")
#endif /* SYSLIBC_SCCS and not lint */
#include "SYS.h"
/*
* We must preserve the state of the registers as the user has set them up.
*/
#ifdef GPROF
#undef ENTRY
#ifdef __ELF__
#define MCOUNT_SYMBOL __mcount
#else
#define MCOUNT_SYMBOL mcount
#endif
#define ENTRY(x) \
.globl _ ## x; _ALIGN_TEXT; _ ## x: pusha ; \
.data; 1:; .long 0; .text; movl $1b,%eax; call MCOUNT_SYMBOL; popa ; nop
#endif /* GPROF */
PSEUDO(__sigreturn14,compat_16___sigreturn14)
|
0xffea/MINIX3
| 2,447
|
lib/libc/compat/arch/i386/sys/compat_sigsuspend.S
|
/* $NetBSD: compat_sigsuspend.S,v 1.1 2005/09/13 01:44:08 christos Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* William Jolitz.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: @(#)sigsuspend.s 5.2 (Berkeley) 12/17/90
*/
#include <machine/asm.h>
#if defined(SYSLIBC_SCCS) && !defined(lint)
RCSID("$NetBSD: compat_sigsuspend.S,v 1.1 2005/09/13 01:44:08 christos Exp $")
#endif /* SYSLIBC_SCCS and not lint */
#include "SYS.h"
WARN_REFERENCES(sigsuspend, \
"warning: reference to compatibility sigsuspend(); include <signal.h> for correct reference")
ENTRY(sigsuspend)
movl 4(%esp),%eax # fetch mask arg
movl (%eax),%eax # indirect to mask arg
movl %eax,4(%esp)
SYSTRAP(compat_13_sigsuspend13)
jc err
xorl %eax,%eax # shouldn t happen
ret
err:
#ifdef PIC
PIC_PROLOGUE
mov PIC_GOT(CERROR), %ecx
PIC_EPILOGUE
jmp *%ecx
#else
jmp CERROR
#endif
|
0xffea/MINIX3
| 1,828
|
lib/libc/compat/arch/i386/sys/compat_sigaction.S
|
/* $NetBSD: compat_sigaction.S,v 1.2 2008/04/28 20:22:58 martin Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
* NASA Ames Research Center.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "SYS.h"
WARN_REFERENCES(sigaction, \
"warning: reference to compatibility sigaction(); include <signal.h> for correct reference")
PSEUDO(sigaction,compat_13_sigaction13)
|
0xffea/MINIX3
| 2,787
|
lib/libc/compat/arch/i386/sys/compat_sigprocmask.S
|
/* $NetBSD: compat_sigprocmask.S,v 1.1 2005/09/13 01:44:08 christos Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* William Jolitz.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: @(#)sigprocmask.s 5.2 (Berkeley) 12/17/90
*/
#include <machine/asm.h>
#if defined(SYSLIBC_SCCS) && !defined(lint)
RCSID("$NetBSD: compat_sigprocmask.S,v 1.1 2005/09/13 01:44:08 christos Exp $")
#endif /* SYSLIBC_SCCS and not lint */
#include "SYS.h"
WARN_REFERENCES(sigprocmask, \
"warning: reference to compatibility sigprocmask(); include <signal.h> for correct reference")
ENTRY(sigprocmask)
movl 8(%esp),%ecx # fetch new sigset pointer
testl %ecx,%ecx # check new sigset pointer
jnz 1f # if not null, indirect
/* movl $0,8(%esp) # null mask pointer: block empty set */
movl $1,4(%esp) # SIG_BLOCK
jmp 2f
1: movl (%ecx),%ecx # fetch indirect ...
movl %ecx,8(%esp) # to new mask arg
2: SYSTRAP(compat_13_sigprocmask13)
jc err
movl 12(%esp),%ecx # fetch old mask requested
testl %ecx,%ecx # test if old mask requested
jz out
movl %eax,(%ecx) # store old mask
out:
xorl %eax,%eax
ret
err:
#ifdef PIC
PIC_PROLOGUE
mov PIC_GOT(CERROR), %ecx
PIC_EPILOGUE
jmp *%ecx
#else
jmp CERROR
#endif
|
0xffea/MINIX3
| 1,812
|
lib/libc/compat/arch/i386/sys/compat_msgctl.S
|
/* $NetBSD: compat_msgctl.S,v 1.2 2008/04/28 20:22:58 martin Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
* NASA Ames Research Center.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "SYS.h"
WARN_REFERENCES(msgctl, \
"warning: reference to compatibility msgctl(); include <sys/msg.h> for correct reference")
PSEUDO(msgctl,compat_14_msgctl)
|
0xffea/MINIX3
| 2,182
|
lib/libc/compat/arch/i386/sys/compat___sigtramp1.S
|
/* $NetBSD: compat___sigtramp1.S,v 1.2 2008/04/28 20:22:58 martin Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Jason R. Thorpe.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "SYS.h"
/*
* The i386 signal trampoline is invoked only to return from
* the signal; the kernel calls the signal handler directly.
*
* On entry, stack looks like:
*
* sigcontext structure [12]
* pointer to sigcontext structure [8]
* signal specific code [4]
* sp-> signal number [0]
*/
NENTRY(__sigtramp_sigcontext_1)
leal 12(%esp),%eax /* get pointer to sigcontext */
movl %eax,4(%esp) /* put it in the argument slot */
/* fake return address already there */
SYSTRAP(compat_16___sigreturn14) /* do sigreturn */
movl %eax,4(%esp) /* error code */
SYSTRAP(exit) /* exit */
|
0xffea/MINIX3
| 1,812
|
lib/libc/compat/arch/i386/sys/compat_shmctl.S
|
/* $NetBSD: compat_shmctl.S,v 1.2 2008/04/28 20:22:58 martin Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
* NASA Ames Research Center.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "SYS.h"
WARN_REFERENCES(shmctl, \
"warning: reference to compatibility shmctl(); include <sys/shm.h> for correct reference")
PSEUDO(shmctl,compat_14_shmctl)
|
0xffea/MINIX3
| 2,505
|
lib/libc/compat/arch/i386/sys/compat_Ovfork.S
|
/* $NetBSD: compat_Ovfork.S,v 1.1 2005/09/13 01:44:08 christos Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* William Jolitz.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: @(#)Ovfork.s 5.1 (Berkeley) 4/23/90
*/
#include <machine/asm.h>
#if defined(SYSLIBC_SCCS) && !defined(lint)
RCSID("$NetBSD: compat_Ovfork.S,v 1.1 2005/09/13 01:44:08 christos Exp $")
#endif /* SYSLIBC_SCCS and not lint */
#include "SYS.h"
WARN_REFERENCES(vfork, \
"warning: reference to compatibility vfork(); include <unistd.h> for correct reference")
/*
* pid = vfork();
*
* %edx == 0 in parent process, %edx == 1 in child process.
* %eax == pid of child in parent, %eax == pid of parent in child.
*
*/
ENTRY(vfork)
popl %ecx /* my rta into ecx */
SYSTRAP(vfork)
jc err
decl %edx
andl %edx,%eax
jmp *%ecx
err:
pushl %ecx
#ifdef PIC
PIC_PROLOGUE
mov PIC_GOT(CERROR), %ecx
PIC_EPILOGUE
jmp *%ecx
#else
jmp CERROR
#endif
|
0xffea/MINIX3
| 2,802
|
lib/libc/compat/arch/i386/gen/compat_sigsetjmp.S
|
/* $NetBSD: compat_sigsetjmp.S,v 1.1 2005/09/13 01:44:08 christos Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* William Jolitz.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: @(#)setjmp.s 5.1 (Berkeley) 4/23/90"
*/
#include <machine/asm.h>
#if defined(LIBC_SCCS)
RCSID("$NetBSD: compat_sigsetjmp.S,v 1.1 2005/09/13 01:44:08 christos Exp $")
#endif
ENTRY(sigsetjmp)
movl 4(%esp),%ecx
movl 8(%esp),%eax
movl %eax,28(%ecx)
testl %eax,%eax
jz 2f
PIC_PROLOGUE
pushl $0
#ifdef PIC
call PIC_PLT(_C_LABEL(sigblock))
#else
call _C_LABEL(sigblock)
#endif
addl $4,%esp
PIC_EPILOGUE
movl 4(%esp),%ecx
movl %eax,24(%ecx)
2: movl 0(%esp),%edx
movl %edx, 0(%ecx)
movl %ebx, 4(%ecx)
movl %esp, 8(%ecx)
movl %ebp,12(%ecx)
movl %esi,16(%ecx)
movl %edi,20(%ecx)
xorl %eax,%eax
ret
ENTRY(siglongjmp)
movl 4(%esp),%edx
cmpl $0,28(%edx)
jz 2f
PIC_PROLOGUE
pushl 24(%edx)
#ifdef PIC
call PIC_PLT(_C_LABEL(sigsetmask))
#else
call _C_LABEL(sigsetmask)
#endif
addl $4,%esp
PIC_EPILOGUE
2: movl 4(%esp),%edx
movl 8(%esp),%eax
movl 0(%edx),%ecx
movl 4(%edx),%ebx
movl 8(%edx),%esp
movl 12(%edx),%ebp
movl 16(%edx),%esi
movl 20(%edx),%edi
testl %eax,%eax
jnz 3f
incl %eax
3: movl %ecx,0(%esp)
ret
|
0xffea/MINIX3
| 2,889
|
lib/libc/compat/arch/i386/gen/compat_setjmp.S
|
/* $NetBSD: compat_setjmp.S,v 1.1 2005/09/13 01:44:08 christos Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* William Jolitz.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: @(#)setjmp.s 5.1 (Berkeley) 4/23/90
*/
#include <machine/asm.h>
#if defined(LIBC_SCCS)
RCSID("$NetBSD: compat_setjmp.S,v 1.1 2005/09/13 01:44:08 christos Exp $")
#endif
/*
* C library -- _setjmp, _longjmp
*
* longjmp(a,v)
* will generate a "return(v)" from the last call to
* setjmp(a)
* by restoring registers from the stack.
* The previous signal state is restored.
*/
ENTRY(setjmp)
PIC_PROLOGUE
pushl $0
#ifdef PIC
call PIC_PLT(_C_LABEL(sigblock))
#else
call _C_LABEL(sigblock)
#endif
addl $4,%esp
PIC_EPILOGUE
movl 4(%esp),%ecx
movl 0(%esp),%edx
movl %edx, 0(%ecx)
movl %ebx, 4(%ecx)
movl %esp, 8(%ecx)
movl %ebp,12(%ecx)
movl %esi,16(%ecx)
movl %edi,20(%ecx)
movl %eax,24(%ecx)
xorl %eax,%eax
ret
ENTRY(longjmp)
movl 4(%esp),%edx
PIC_PROLOGUE
pushl 24(%edx)
#ifdef PIC
call PIC_PLT(_C_LABEL(sigsetmask))
#else
call _C_LABEL(sigsetmask)
#endif
addl $4,%esp
PIC_EPILOGUE
movl 4(%esp),%edx
movl 8(%esp),%eax
movl 0(%edx),%ecx
movl 4(%edx),%ebx
movl 8(%edx),%esp
movl 12(%edx),%ebp
movl 16(%edx),%esi
movl 20(%edx),%edi
testl %eax,%eax
jnz 1f
incl %eax
1: movl %ecx,0(%esp)
ret
|
0xffea/MINIX3
| 1,696
|
lib/libc/compat/arch/sh3/sys/compat___semctl.S
|
/* $NetBSD: compat___semctl.S,v 1.2 2008/04/28 20:22:59 martin Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
* NASA Ames Research Center.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "SYS.h"
PSEUDO(__semctl,compat_14___semctl)
|
0xffea/MINIX3
| 2,210
|
lib/libc/compat/arch/sh3/sys/compat_sigreturn.S
|
/* $NetBSD: compat_sigreturn.S,v 1.1 2005/09/15 21:39:16 uwe Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* William Jolitz.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: @(#)sigreturn.s 5.2 (Berkeley) 12/17/90"
*/
#include <machine/asm.h>
#if defined(SYSLIBC_SCCS) && !defined(lint)
RCSID("$NetBSD: compat_sigreturn.S,v 1.1 2005/09/15 21:39:16 uwe Exp $")
#endif /* SYSLIBC_SCCS and not lint */
#include "SYS.h"
/*
* We must preserve the state of the registers as the user has set them up.
*/
WARN_REFERENCES(sigreturn, \
"warning: reference to compatibility sigreturn()")
PSEUDO(sigreturn,compat_13_sigreturn13)
|
0xffea/MINIX3
| 2,279
|
lib/libc/compat/arch/sh3/sys/compat_sigpending.S
|
/* $NetBSD: compat_sigpending.S,v 1.2 2006/01/06 04:14:35 uwe Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* William Jolitz.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: @(#)sigpending.s 5.1 (Berkeley) 7/1/90
*/
#include <machine/asm.h>
#if defined(SYSLIBC_SCCS) && !defined(lint)
RCSID("$NetBSD: compat_sigpending.S,v 1.2 2006/01/06 04:14:35 uwe Exp $")
#endif /* SYSLIBC_SCCS and not lint */
#include "SYS.h"
WARN_REFERENCES(sigpending, \
"warning: reference to compatibility sigpending(); include <signal.h> for correct reference")
/*
* int
* sigpending(sigset_t *set);
*/
_SYSCALL(sigpending,compat_13_sigpending13)
mov.l r0, @r4 /* store returned mask */
rts
mov #0, r0
|
0xffea/MINIX3
| 2,139
|
lib/libc/compat/arch/sh3/sys/compat___sigreturn14.S
|
/* $NetBSD: compat___sigreturn14.S,v 1.1 2005/09/15 21:39:16 uwe Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* William Jolitz.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: @(#)sigreturn.s 5.2 (Berkeley) 12/17/90"
*/
#include <machine/asm.h>
#if defined(SYSLIBC_SCCS) && !defined(lint)
RCSID("$NetBSD: compat___sigreturn14.S,v 1.1 2005/09/15 21:39:16 uwe Exp $")
#endif /* SYSLIBC_SCCS and not lint */
#include "SYS.h"
/*
* We must preserve the state of the registers as the user has set them up.
*/
PSEUDO(__sigreturn14,compat_16___sigreturn14)
|
0xffea/MINIX3
| 2,408
|
lib/libc/compat/arch/sh3/sys/compat_sigsuspend.S
|
/* $NetBSD: compat_sigsuspend.S,v 1.3 2006/01/06 04:05:55 uwe Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* William Jolitz.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: @(#)sigsuspend.s 5.2 (Berkeley) 12/17/90
*/
#include <machine/asm.h>
#if defined(SYSLIBC_SCCS) && !defined(lint)
RCSID("$NetBSD: compat_sigsuspend.S,v 1.3 2006/01/06 04:05:55 uwe Exp $")
#endif /* SYSLIBC_SCCS and not lint */
#include "SYS.h"
WARN_REFERENCES(sigsuspend, \
"warning: reference to compatibility sigsuspend(); include <signal.h> for correct reference")
/*
* int sigsuspend(const sigset_t *sigmask);
*/
ENTRY(sigsuspend)
mov.l @r4, r4 /* syscall expects mask as the argument */
mov #SYS_compat_13_sigsuspend13, r0
trapa #0x80
bf err
rts /* shouldn t happen */
mov #0, r0
err:
JUMP_CERROR
SET_ENTRY_SIZE(sigsuspend)
|
0xffea/MINIX3
| 1,828
|
lib/libc/compat/arch/sh3/sys/compat_sigaction.S
|
/* $NetBSD: compat_sigaction.S,v 1.2 2008/04/28 20:22:59 martin Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
* NASA Ames Research Center.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "SYS.h"
WARN_REFERENCES(sigaction, \
"warning: reference to compatibility sigaction(); include <signal.h> for correct reference")
PSEUDO(sigaction,compat_13_sigaction13)
|
0xffea/MINIX3
| 2,635
|
lib/libc/compat/arch/sh3/sys/compat_sigprocmask.S
|
/* $NetBSD: compat_sigprocmask.S,v 1.3 2006/01/06 04:08:47 uwe Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* William Jolitz.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: @(#)sigprocmask.s 5.2 (Berkeley) 12/17/90
*/
#include <machine/asm.h>
#if defined(SYSLIBC_SCCS) && !defined(lint)
RCSID("$NetBSD: compat_sigprocmask.S,v 1.3 2006/01/06 04:08:47 uwe Exp $")
#endif /* SYSLIBC_SCCS and not lint */
#include "SYS.h"
WARN_REFERENCES(sigprocmask, \
"warning: reference to compatibility sigprocmask(); include <signal.h> for correct reference")
/*
* int
* sigprocmask(int how, const sigset_t * restrict set,
* sigset_t * restrict oset);
*/
ENTRY(sigprocmask)
tst r5, r5 /* set == NULL? */
bf 1f
bra 2f /* r5 (new mask) is already zero */
mov #1, r4 /* how = SIG_BLOCK */
1: mov.l @r5, r5 /* fetch new mask */
2: mov #SYS_compat_13_sigprocmask13, r0
trapa #0x80
bf err
tst r6, r6 /* oset == NULL? */
bt 3f
mov.l r0, @r6 /* store old mask */
3: rts
mov #0, r0
err:
JUMP_CERROR
SET_ENTRY_SIZE(sigprocmask)
|
0xffea/MINIX3
| 1,812
|
lib/libc/compat/arch/sh3/sys/compat_msgctl.S
|
/* $NetBSD: compat_msgctl.S,v 1.2 2008/04/28 20:22:59 martin Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
* NASA Ames Research Center.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "SYS.h"
WARN_REFERENCES(msgctl, \
"warning: reference to compatibility msgctl(); include <sys/msg.h> for correct reference")
PSEUDO(msgctl,compat_14_msgctl)
|
0xffea/MINIX3
| 1,997
|
lib/libc/compat/arch/sh3/sys/compat___sigtramp1.S
|
/* $NetBSD: compat___sigtramp1.S,v 1.2 2008/04/28 20:22:59 martin Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Jason R. Thorpe.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "SYS.h"
/*
* The SH signal trampoline is invoked only to return from
* the signal; the kernel calls the signal handler directly.
*
* On entry, stack looks like:
*
* sp-> sigcontext structure
*/
NENTRY(__sigtramp_sigcontext_1)
mov r15, r4 /* get pointer to sigcontext */
SYSTRAP(compat_16___sigreturn14) /* and call sigreturn() */
mov r0, r4 /* exit with errno */
SYSTRAP(exit) /* if sigreturn fails */
|
0xffea/MINIX3
| 1,812
|
lib/libc/compat/arch/sh3/sys/compat_shmctl.S
|
/* $NetBSD: compat_shmctl.S,v 1.2 2008/04/28 20:22:59 martin Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
* NASA Ames Research Center.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "SYS.h"
WARN_REFERENCES(shmctl, \
"warning: reference to compatibility shmctl(); include <sys/shm.h> for correct reference")
PSEUDO(shmctl,compat_14_shmctl)
|
0xffea/MINIX3
| 2,475
|
lib/libc/compat/arch/sh3/sys/compat_Ovfork.S
|
/* $NetBSD: compat_Ovfork.S,v 1.2 2006/01/06 04:30:33 uwe Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* William Jolitz.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: @(#)Ovfork.s 5.1 (Berkeley) 4/23/90
*/
#include <machine/asm.h>
#if defined(SYSLIBC_SCCS) && !defined(lint)
RCSID("$NetBSD: compat_Ovfork.S,v 1.2 2006/01/06 04:30:33 uwe Exp $")
#endif /* SYSLIBC_SCCS and not lint */
#include "SYS.h"
WARN_REFERENCES(vfork, \
"warning: reference to compatibility vfork(); include <unistd.h> for correct reference")
/*
* pid = vfork();
*
* r1 == 0 in parent process, r1 == 1 in child process.
* r0 == pid of child in parent, r0 == pid of parent in child.
*
*/
ENTRY(vfork)
mov #SYS_vfork, r0
trapa #0x80
bf err
add #0xff, r1 /* from 1 to 0 in child, 0 to -1 in parent */
rts
and r1, r0 /* 0 in child, child pid in parent */
err:
JUMP_CERROR
SET_ENTRY_SIZE(vfork)
|
0xffea/MINIX3
| 1,824
|
lib/libc/compat/arch/sh3/sys/compat_quotactl.S
|
/* $NetBSD: compat_quotactl.S,v 1.2 2011/03/06 17:08:14 bouyer Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
* NASA Ames Research Center.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "SYS.h"
WARN_REFERENCES(quotactl, \
"warning: reference to compatibility quotactl(); include <sys/quota.h> for correct reference")
PSEUDO(quotactl,compat_50_quotactl)
|
0xffea/MINIX3
| 3,382
|
lib/libc/compat/arch/sh3/gen/compat_sigsetjmp.S
|
/* $NetBSD: compat_sigsetjmp.S,v 1.5 2006/01/05 19:21:37 uwe Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* William Jolitz.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: @(#)setjmp.s 5.1 (Berkeley) 4/23/90"
*/
#include <machine/asm.h>
#include <machine/setjmp.h>
#if defined(LIBC_SCCS)
RCSID("$NetBSD: compat_sigsetjmp.S,v 1.5 2006/01/05 19:21:37 uwe Exp $")
#endif
ENTRY(sigsetjmp)
tst r5, r5
mov.l r5, @(_JB_HAS_MASK * 4, r4)
bt 2f /* if (savemask == 0) */
PIC_PROLOGUE(.L_got_1)
sts.l pr, @-sp
mov.l r4, @-sp
mov.l .L_sigblock, r0
1: CALL r0 /* int mask = sigblock(0); */
mov #0, r4
mov.l @sp+, r4
lds.l @sp+, pr
PIC_EPILOGUE
mov.l r0, @(_JB_SIGMASK * 4, r4)
2: /* identical to _setjmp sans mask */
add #((_JB_REG_R15 + 1) * 4), r4
mov.l r15, @-r4
mov.l r14, @-r4
mov.l r13, @-r4
mov.l r12, @-r4
mov.l r11, @-r4
mov.l r10, @-r4
mov.l r9, @-r4
mov.l r8, @-r4
sts.l pr, @-r4
rts
xor r0, r0
.align 2
.L_got_1: PIC_GOT_DATUM
.L_sigblock: CALL_DATUM(_C_LABEL(sigblock), 1b)
SET_ENTRY_SIZE(sigsetjmp)
ENTRY(siglongjmp)
mov.l @(_JB_HAS_MASK * 4, r4), r0
tst r0, r0
bt 2f /* if no mask */
/* we won't return here, so we don't need to save pr and r12 */
PIC_PROLOGUE_NOSAVE(.L_got_2)
mov.l r5, @-sp
mov.l r4, @-sp
mov.l .L_sigsetmask, r0
1: CALL r0 /* sigsetmask(saved mask) */
mov.l @(_JB_SIGMASK * 4, r4), r4
mov.l @sp+, r4
mov.l @sp+, r5
2: /* identical to _longjmp */
lds.l @r4+, pr
mov.l @r4+, r8
mov.l @r4+, r9
mov.l @r4+, r10
mov.l @r4+, r11
mov.l @r4+, r12
mov.l @r4+, r13
mov.l @r4+, r14
mov.l @r4+, r15
mov r5, r0
tst r0, r0 /* make sure return value is non-zero */
bf .L0
add #1, r0
.L0:
rts
nop
.align 2
.L_got_2: PIC_GOT_DATUM
.L_sigsetmask: CALL_DATUM(_C_LABEL(sigsetmask), 1b)
SET_ENTRY_SIZE(siglongjmp)
|
0xffea/MINIX3
| 3,503
|
lib/libc/compat/arch/sh3/gen/compat_setjmp.S
|
/* $NetBSD: compat_setjmp.S,v 1.3 2006/01/05 19:21:37 uwe Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* William Jolitz.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: @(#)setjmp.s 5.1 (Berkeley) 4/23/90
*/
#include <machine/asm.h>
#include <machine/setjmp.h>
#if defined(LIBC_SCCS)
RCSID("$NetBSD: compat_setjmp.S,v 1.3 2006/01/05 19:21:37 uwe Exp $")
#endif
/*
* C library -- setjmp, longjmp
*
* longjmp(a,v)
* will generate a "return(v)" from the last call to
* setjmp(a)
* by restoring registers from the stack.
* The previous signal state is restored.
*/
ENTRY(setjmp)
PIC_PROLOGUE(.L_got_1)
sts.l pr, @-sp
mov.l r4, @-sp
mov.l .L_sigblock, r0
1: CALL r0 /* int mask = sigblock(0); */
mov #0, r4
mov.l @sp+, r4
lds.l @sp+, pr
PIC_EPILOGUE
/* identical to _setjmp except that mask is present */
add #((_JB_SIGMASK + 1) * 4), r4
mov.l r0, @-r4 /* current mask returned by sigblock */
mov #1, r0
mov.l r0, @-r4 /* has signal mask */
mov.l r15, @-r4
mov.l r14, @-r4
mov.l r13, @-r4
mov.l r12, @-r4
mov.l r11, @-r4
mov.l r10, @-r4
mov.l r9, @-r4
mov.l r8, @-r4
sts.l pr, @-r4
rts
xor r0, r0
.align 2
.L_got_1: PIC_GOT_DATUM
.L_sigblock: CALL_DATUM(_C_LABEL(sigblock), 1b)
SET_ENTRY_SIZE(setjmp)
ENTRY(longjmp)
/* we won't return here, so we don't need to save pr and r12 */
PIC_PROLOGUE_NOSAVE(.L_got_2)
mov.l r5, @-sp
mov.l r4, @-sp
mov.l .L_sigsetmask, r0
1: CALL r0 /* sigsetmask(saved mask) */
mov.l @(_JB_SIGMASK * 4, r4), r4
mov.l @sp+, r4
mov.l @sp+, r5
/* identical to _longjmp */
lds.l @r4+, pr
mov.l @r4+, r8
mov.l @r4+, r9
mov.l @r4+, r10
mov.l @r4+, r11
mov.l @r4+, r12
mov.l @r4+, r13
mov.l @r4+, r14
mov.l @r4+, r15
mov r5, r0
tst r0, r0 /* make sure return value is non-zero */
bf .L0
add #1, r0
.L0:
rts
nop
.align 2
.L_got_2: PIC_GOT_DATUM
.L_sigsetmask: CALL_DATUM(_C_LABEL(sigsetmask), 1b)
SET_ENTRY_SIZE(longjmp)
|
0xffea/MINIX3
| 1,696
|
lib/libc/compat/arch/hppa/sys/compat___semctl.S
|
/* $NetBSD: compat___semctl.S,v 1.2 2008/04/28 20:22:58 martin Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
* NASA Ames Research Center.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "SYS.h"
PSEUDO(__semctl,compat_14___semctl)
|
0xffea/MINIX3
| 1,953
|
lib/libc/compat/arch/hppa/sys/compat_sigreturn.S
|
/* $NetBSD: compat_sigreturn.S,v 1.2 2008/04/28 20:22:58 martin Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Matt Fredette.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/errno.h>
#include "SYS.h"
.import __cerror, code
WARN_REFERENCES(sigreturn, \
"warning: reference to compatibility sigreturn(); include <signal.h> for correct reference")
ENTRY(sigreturn, 0)
/*
* AFAICT, since the hppa port came after __sigreturn14,
* we shouldn't have to supply the compatability sigreturn.
*/
ldi EINVAL, %t1
b,n __cerror
EXIT(sigreturn)
|
0xffea/MINIX3
| 1,960
|
lib/libc/compat/arch/hppa/sys/compat_sigpending.S
|
/* $NetBSD: compat_sigpending.S,v 1.2 2008/04/28 20:22:58 martin Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Matt Fredette.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/errno.h>
#include "SYS.h"
.import __cerror, code
WARN_REFERENCES(sigpending, \
"warning: reference to compatibility sigpending(); include <signal.h> for correct reference")
ENTRY(sigpending, 0)
/*
* AFAICT, since the hppa port came after __sigpending14,
* we shouldn't have to supply the compatability sigpending.
*/
ldi EINVAL, %t1
b,n __cerror
EXIT(sigpending)
|
0xffea/MINIX3
| 2,053
|
lib/libc/compat/arch/hppa/sys/compat___sigreturn14.S
|
/* $NetBSD: compat___sigreturn14.S,v 1.1 2006/03/11 19:54:56 christos Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* the Systems Programming Group of the University of Utah Computer
* Science Department.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include "SYS.h"
#if defined(LIBC_SCCS) && !defined(lint)
RCSID("$NetBSD: compat___sigreturn14.S,v 1.1 2006/03/11 19:54:56 christos Exp $")
#endif /* LIBC_SCCS and not lint */
PSEUDO(__sigreturn14,compat_16___sigreturn14)
|
0xffea/MINIX3
| 1,960
|
lib/libc/compat/arch/hppa/sys/compat_sigsuspend.S
|
/* $NetBSD: compat_sigsuspend.S,v 1.2 2008/04/28 20:22:58 martin Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Matt Fredette.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/errno.h>
#include "SYS.h"
.import __cerror, code
WARN_REFERENCES(sigsuspend, \
"warning: reference to compatibility sigsuspend(); include <signal.h> for correct reference")
ENTRY(sigsuspend, 0)
/*
* AFAICT, since the hppa port came after __sigsuspend14,
* we shouldn't have to supply the compatability sigsuspend.
*/
ldi EINVAL, %t1
b,n __cerror
EXIT(sigsuspend)
|
0xffea/MINIX3
| 1,828
|
lib/libc/compat/arch/hppa/sys/compat_sigaction.S
|
/* $NetBSD: compat_sigaction.S,v 1.2 2008/04/28 20:22:58 martin Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
* NASA Ames Research Center.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "SYS.h"
WARN_REFERENCES(sigaction, \
"warning: reference to compatibility sigaction(); include <signal.h> for correct reference")
PSEUDO(sigaction,compat_13_sigaction13)
|
0xffea/MINIX3
| 1,967
|
lib/libc/compat/arch/hppa/sys/compat_sigprocmask.S
|
/* $NetBSD: compat_sigprocmask.S,v 1.2 2008/04/28 20:22:58 martin Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Matt Fredette.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/errno.h>
#include "SYS.h"
.import __cerror, code
WARN_REFERENCES(sigprocmask, \
"warning: reference to compatibility sigprocmask(); include <signal.h> for correct reference")
ENTRY(sigprocmask, 0)
/*
* AFAICT, since the hppa port came after __sigprocmask14,
* we shouldn't have to supply the compatability sigprocmask.
*/
ldi EINVAL, %t1
b,n __cerror
EXIT(sigprocmask)
|
0xffea/MINIX3
| 1,812
|
lib/libc/compat/arch/hppa/sys/compat_msgctl.S
|
/* $NetBSD: compat_msgctl.S,v 1.2 2008/04/28 20:22:58 martin Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
* NASA Ames Research Center.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "SYS.h"
WARN_REFERENCES(msgctl, \
"warning: reference to compatibility msgctl(); include <sys/msg.h> for correct reference")
PSEUDO(msgctl,compat_14_msgctl)
|
0xffea/MINIX3
| 1,812
|
lib/libc/compat/arch/hppa/sys/compat_shmctl.S
|
/* $NetBSD: compat_shmctl.S,v 1.2 2008/04/28 20:22:58 martin Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
* NASA Ames Research Center.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "SYS.h"
WARN_REFERENCES(shmctl, \
"warning: reference to compatibility shmctl(); include <sys/shm.h> for correct reference")
PSEUDO(shmctl,compat_14_shmctl)
|
0xffea/MINIX3
| 1,764
|
lib/libc/compat/arch/hppa/sys/compat_Ovfork.S
|
/* $NetBSD: compat_Ovfork.S,v 1.2 2009/11/03 05:07:25 snj Exp $ */
/* $OpenBSD: Ovfork.S,v 1.7 2001/06/04 23:14:04 mickey Exp $ */
/*
* Copyright (c) 1999,2002 Michael Shalayeff
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR OR HIS RELATIVES BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF MIND, USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "SYS.h"
#if defined(LIBC_SCCS) && !defined(lint)
RCSID("$NetBSD: compat_Ovfork.S,v 1.2 2009/11/03 05:07:25 snj Exp $")
#endif /* LIBC_SCCS and not lint */
ENTRY(vfork,0)
SYSCALL(vfork)
addi -1, %ret1, %ret1
bv %r0(%rp)
and %ret1, %ret0, %ret0
EXIT(vfork)
.end
|
0xffea/MINIX3
| 1,824
|
lib/libc/compat/arch/hppa/sys/compat_quotactl.S
|
/* $NetBSD: compat_quotactl.S,v 1.2 2011/03/06 17:08:13 bouyer Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
* NASA Ames Research Center.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "SYS.h"
WARN_REFERENCES(quotactl, \
"warning: reference to compatibility quotactl(); include <sys/quota.h> for correct reference")
PSEUDO(quotactl,compat_50_quotactl)
|
0xffea/MINIX3
| 1,696
|
lib/libc/compat/arch/powerpc64/sys/compat___semctl.S
|
/* $NetBSD: compat___semctl.S,v 1.2 2008/04/28 20:22:58 martin Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
* NASA Ames Research Center.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "SYS.h"
PSEUDO(__semctl,compat_14___semctl)
|
0xffea/MINIX3
| 1,812
|
lib/libc/compat/arch/powerpc64/sys/compat_shmctl.S
|
/* $NetBSD: compat_shmctl.S,v 1.2 2008/04/28 20:22:58 martin Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
* NASA Ames Research Center.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "SYS.h"
WARN_REFERENCES(shmctl, \
"warning: reference to compatibility shmctl(); include <sys/shm.h> for correct reference")
PSEUDO(shmctl,compat_14_shmctl)
|
0xffea/MINIX3
| 1,824
|
lib/libc/compat/arch/powerpc64/sys/compat_quotactl.S
|
/* $NetBSD: compat_quotactl.S,v 1.2 2011/03/06 17:08:14 bouyer Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
* NASA Ames Research Center.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "SYS.h"
WARN_REFERENCES(quotactl, \
"warning: reference to compatibility quotactl(); include <sys/quota.h> for correct reference")
PSEUDO(quotactl,compat_50_quotactl)
|
0xffea/MINIX3
| 1,696
|
lib/libc/compat/arch/sparc/sys/compat___semctl.S
|
/* $NetBSD: compat___semctl.S,v 1.2 2008/04/28 20:22:59 martin Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
* NASA Ames Research Center.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "SYS.h"
PSEUDO(__semctl,compat_14___semctl)
|
0xffea/MINIX3
| 2,334
|
lib/libc/compat/arch/sparc/sys/compat_sigreturn.S
|
/* $NetBSD: compat_sigreturn.S,v 1.1 2005/10/15 22:11:22 uwe Exp $ */
/*
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This software was developed by the Computer Systems Engineering group
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
* contributed to Berkeley.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: Header: sigreturn.s,v 1.1 91/07/06 13:06:01 torek Exp
*/
#include <machine/asm.h>
#if defined(SYSLIBC_SCCS) && !defined(lint)
#if 0
.asciz "@(#)sigreturn.s 8.1 (Berkeley) 6/4/93"
#else
RCSID("$NetBSD: compat_sigreturn.S,v 1.1 2005/10/15 22:11:22 uwe Exp $")
#endif
#endif /* SYSLIBC_SCCS and not lint */
#include "SYS.h"
WARN_REFERENCES(sigreturn, \
"warning: reference to compatibility sigreturn()")
ENTRY(sigreturn)
mov SYS_compat_13_sigreturn13, %g1
t ST_SYSCALL
ERROR()
|
0xffea/MINIX3
| 2,533
|
lib/libc/compat/arch/sparc/sys/compat_sigpending.S
|
/* $NetBSD: compat_sigpending.S,v 1.1 2005/10/15 22:11:22 uwe Exp $ */
/*
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This software was developed by the Computer Systems Engineering group
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
* contributed to Berkeley.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: Header: sigpending.s,v 1.1 91/07/06 13:06:00 torek Exp
*/
#include <machine/asm.h>
#if defined(SYSLIBC_SCCS) && !defined(lint)
#if 0
.asciz "@(#)sigpending.s 8.1 (Berkeley) 6/4/93"
#else
RCSID("$NetBSD: compat_sigpending.S,v 1.1 2005/10/15 22:11:22 uwe Exp $")
#endif
#endif /* SYSLIBC_SCCS and not lint */
#include "SYS.h"
WARN_REFERENCES(sigpending, \
"warning: reference to compatibility sigpending(); include <signal.h> for correct reference")
ENTRY(sigpending)
mov %o0, %o2 ! save pointer
mov SYS_compat_13_sigpending13, %g1
t ST_SYSCALL ! sigpending()
bcc,a 1f ! if success,
st %o0, [%o2] ! store return value
ERROR()
1:
retl ! and return 0
clr %o0
|
0xffea/MINIX3
| 2,263
|
lib/libc/compat/arch/sparc/sys/compat___sigreturn14.S
|
/* $NetBSD: compat___sigreturn14.S,v 1.1 2005/10/15 22:11:22 uwe Exp $ */
/*
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This software was developed by the Computer Systems Engineering group
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
* contributed to Berkeley.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: Header: sigreturn.s,v 1.1 91/07/06 13:06:01 torek Exp
*/
#include <machine/asm.h>
#if defined(SYSLIBC_SCCS) && !defined(lint)
#if 0
.asciz "@(#)sigreturn.s 8.1 (Berkeley) 6/4/93"
#else
RCSID("$NetBSD: compat___sigreturn14.S,v 1.1 2005/10/15 22:11:22 uwe Exp $")
#endif
#endif /* SYSLIBC_SCCS and not lint */
#include "SYS.h"
ENTRY(__sigreturn14)
mov SYS_compat_16___sigreturn14, %g1
t ST_SYSCALL
ERROR()
|
0xffea/MINIX3
| 2,461
|
lib/libc/compat/arch/sparc/sys/compat_sigsuspend.S
|
/* $NetBSD: compat_sigsuspend.S,v 1.1 2005/10/15 22:11:22 uwe Exp $ */
/*
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This software was developed by the Computer Systems Engineering group
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
* contributed to Berkeley.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: Header: sigsuspend.s,v 1.1 91/07/06 13:06:01 torek Exp
*/
#include <machine/asm.h>
#if defined(SYSLIBC_SCCS) && !defined(lint)
#if 0
.asciz "@(#)sigsuspend.s 8.1 (Berkeley) 6/4/93"
#else
RCSID("$NetBSD: compat_sigsuspend.S,v 1.1 2005/10/15 22:11:22 uwe Exp $")
#endif
#endif /* SYSLIBC_SCCS and not lint */
#include "SYS.h"
WARN_REFERENCES(sigsuspend, \
"warning: reference to compatibility sigsuspend(); include <signal.h> for correct reference")
ENTRY(sigsuspend)
ld [%o0], %o0 ! indirect to mask argument
mov SYS_compat_13_sigsuspend13, %g1
t ST_SYSCALL
ERROR() ! always terminates with EINTR
|
0xffea/MINIX3
| 1,828
|
lib/libc/compat/arch/sparc/sys/compat_sigaction.S
|
/* $NetBSD: compat_sigaction.S,v 1.2 2008/04/28 20:22:59 martin Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
* NASA Ames Research Center.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "SYS.h"
WARN_REFERENCES(sigaction, \
"warning: reference to compatibility sigaction(); include <signal.h> for correct reference")
PSEUDO(sigaction,compat_13_sigaction13)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.