Compare commits
1
Commits
nosyslinux
..
cc
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
179e51dfc4 |
@@ -4,53 +4,21 @@ on: push
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
||||||
cache:
|
|
||||||
name: Cache
|
|
||||||
runs-on: ubuntu-22.04
|
|
||||||
steps:
|
|
||||||
- name: Cache permissions
|
|
||||||
run: |
|
|
||||||
sudo chown $(id -un) /var/cache/apt/archives
|
|
||||||
- name: Cache packages
|
|
||||||
uses: actions/cache@v3
|
|
||||||
with:
|
|
||||||
path: /var/cache/apt/archives/*.deb
|
|
||||||
key: apt-cache-${{ github.run_id }}-${{ github.run_attempt }}
|
|
||||||
restore-keys: |
|
|
||||||
apt-cache-
|
|
||||||
- name: Download packages
|
|
||||||
run: |
|
|
||||||
sudo apt update
|
|
||||||
sudo apt install -y -d -o Acquire::Retries=50 \
|
|
||||||
mtools syslinux isolinux \
|
|
||||||
libc6-dev-i386 valgrind \
|
|
||||||
gcc-arm-none-eabi gcc-aarch64-linux-gnu
|
|
||||||
|
|
||||||
x86:
|
x86:
|
||||||
name: x86
|
name: x86
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-20.04
|
||||||
needs: cache
|
|
||||||
steps:
|
steps:
|
||||||
- name: Check out code
|
- name: Check out code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- name: Cache permissions
|
|
||||||
run: |
|
|
||||||
sudo chown $(id -un) /var/cache/apt/archives
|
|
||||||
- name: Cache packages
|
|
||||||
uses: actions/cache/restore@v3
|
|
||||||
with:
|
|
||||||
path: /var/cache/apt/archives/*.deb
|
|
||||||
key: apt-cache-${{ github.run_id }}-${{ github.run_attempt }}
|
|
||||||
- name: Install packages
|
- name: Install packages
|
||||||
run: |
|
run: |
|
||||||
sudo dpkg --add-architecture i386
|
sudo dpkg --add-architecture i386
|
||||||
sudo apt update
|
sudo apt update
|
||||||
sudo apt install -y -o Acquire::Retries=50 \
|
sudo apt install -y -o Acquire::Retries=50 \
|
||||||
mtools syslinux isolinux \
|
mtools syslinux isolinux \
|
||||||
libc6-dev-i386 valgrind \
|
libc6-dev-i386 libc6-dbg:i386 valgrind
|
||||||
libgcc-s1:i386 libc6-dbg:i386
|
|
||||||
- name: Build (BIOS)
|
- name: Build (BIOS)
|
||||||
run: |
|
run: |
|
||||||
make -j 4 -C src
|
make -j 4 -C src
|
||||||
@@ -64,21 +32,12 @@ jobs:
|
|||||||
|
|
||||||
arm32:
|
arm32:
|
||||||
name: ARM32
|
name: ARM32
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-20.04
|
||||||
needs: cache
|
|
||||||
steps:
|
steps:
|
||||||
- name: Check out code
|
- name: Check out code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- name: Cache permissions
|
|
||||||
run: |
|
|
||||||
sudo chown $(id -un) /var/cache/apt/archives
|
|
||||||
- name: Cache packages
|
|
||||||
uses: actions/cache/restore@v3
|
|
||||||
with:
|
|
||||||
path: /var/cache/apt/archives/*.deb
|
|
||||||
key: apt-cache-${{ github.run_id }}-${{ github.run_attempt }}
|
|
||||||
- name: Install packages
|
- name: Install packages
|
||||||
run: |
|
run: |
|
||||||
sudo apt update
|
sudo apt update
|
||||||
@@ -93,21 +52,12 @@ jobs:
|
|||||||
|
|
||||||
arm64:
|
arm64:
|
||||||
name: ARM64
|
name: ARM64
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-20.04
|
||||||
needs: cache
|
|
||||||
steps:
|
steps:
|
||||||
- name: Check out code
|
- name: Check out code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- name: Cache permissions
|
|
||||||
run: |
|
|
||||||
sudo chown $(id -un) /var/cache/apt/archives
|
|
||||||
- name: Cache packages
|
|
||||||
uses: actions/cache/restore@v3
|
|
||||||
with:
|
|
||||||
path: /var/cache/apt/archives/*.deb
|
|
||||||
key: apt-cache-${{ github.run_id }}-${{ github.run_attempt }}
|
|
||||||
- name: Install packages
|
- name: Install packages
|
||||||
run: |
|
run: |
|
||||||
sudo apt update
|
sudo apt update
|
||||||
|
|||||||
@@ -8,10 +8,10 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
submit:
|
submit:
|
||||||
name: Submit
|
name: Submit
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
- name: Check out code
|
- name: Check out code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v2
|
||||||
- name: Download Coverity Scan
|
- name: Download Coverity Scan
|
||||||
run: |
|
run: |
|
||||||
curl --form token=${{ secrets.COVERITY_SCAN_TOKEN }} \
|
curl --form token=${{ secrets.COVERITY_SCAN_TOKEN }} \
|
||||||
|
|||||||
+3
-2
@@ -16,7 +16,8 @@ SYMBOL_PREFIX :=
|
|||||||
#
|
#
|
||||||
# Locations of tools
|
# Locations of tools
|
||||||
#
|
#
|
||||||
HOST_CC := gcc
|
CC ?= gcc
|
||||||
|
HOST_CC := $(CC)
|
||||||
RM := rm -f
|
RM := rm -f
|
||||||
TOUCH := touch
|
TOUCH := touch
|
||||||
MKDIR := mkdir
|
MKDIR := mkdir
|
||||||
@@ -26,7 +27,7 @@ PRINTF := printf
|
|||||||
PERL := perl
|
PERL := perl
|
||||||
PYTHON := python
|
PYTHON := python
|
||||||
TRUE := true
|
TRUE := true
|
||||||
CC := $(CROSS_COMPILE)gcc
|
CC := $(CROSS_COMPILE)$(CC)
|
||||||
CPP := $(CC) -E
|
CPP := $(CC) -E
|
||||||
AS := $(CROSS_COMPILE)as
|
AS := $(CROSS_COMPILE)as
|
||||||
LD := $(CROSS_COMPILE)ld
|
LD := $(CROSS_COMPILE)ld
|
||||||
|
|||||||
+1
-5
@@ -50,10 +50,6 @@ $(BIN)/efidrv.cab : $(BIN)/alldrv.efis # $(ALL_drv.efi) is not yet defined
|
|||||||
$(QM)$(ECHO) " [CAB] $@"
|
$(QM)$(ECHO) " [CAB] $@"
|
||||||
$(Q)$(LCAB) -n -q $(ALL_drv.efi) $@
|
$(Q)$(LCAB) -n -q $(ALL_drv.efi) $@
|
||||||
|
|
||||||
$(BIN)/%.iso : $(BIN)/%.efi util/genfsimg
|
$(BIN)/%.iso $(BIN)/%.usb : $(BIN)/%.efi util/genfsimg
|
||||||
$(QM)$(ECHO) " [GENFSIMG] $@"
|
|
||||||
$(Q)util/genfsimg -o $@ $<
|
|
||||||
|
|
||||||
$(BIN)/%.usb : $(BIN)/%.efi util/genfsimg
|
|
||||||
$(QM)$(ECHO) " [GENFSIMG] $@"
|
$(QM)$(ECHO) " [GENFSIMG] $@"
|
||||||
$(Q)util/genfsimg -o $@ $<
|
$(Q)util/genfsimg -o $@ $<
|
||||||
|
|||||||
@@ -502,13 +502,6 @@ LDFLAGS += --gc-sections
|
|||||||
#
|
#
|
||||||
LDFLAGS += -static
|
LDFLAGS += -static
|
||||||
|
|
||||||
# Use separate code segment if supported by linker
|
|
||||||
#
|
|
||||||
ZSC_TEST = $(LD) -z separate-code --version 2>&1 > /dev/null
|
|
||||||
ZSC_FLAGS := $(shell [ -z "`$(ZSC_TEST)`" ] && \
|
|
||||||
$(ECHO) '-z separate-code -z max-page-size=4096')
|
|
||||||
LDFLAGS += $(ZSC_FLAGS)
|
|
||||||
|
|
||||||
# compiler.h is needed for our linking and debugging system
|
# compiler.h is needed for our linking and debugging system
|
||||||
#
|
#
|
||||||
CFLAGS += -include include/compiler.h
|
CFLAGS += -include include/compiler.h
|
||||||
@@ -1009,7 +1002,6 @@ endif
|
|||||||
# Device ID tables (using IDs from ROM definition file)
|
# Device ID tables (using IDs from ROM definition file)
|
||||||
#
|
#
|
||||||
define obj_pci_id_asm
|
define obj_pci_id_asm
|
||||||
.section ".note.GNU-stack", "", $(ASM_TCHAR)progbits
|
|
||||||
.section ".pci_devlist.$(1)", "a", $(ASM_TCHAR)progbits
|
.section ".pci_devlist.$(1)", "a", $(ASM_TCHAR)progbits
|
||||||
.globl pci_devlist_$(1)
|
.globl pci_devlist_$(1)
|
||||||
pci_devlist_$(1):
|
pci_devlist_$(1):
|
||||||
@@ -1179,7 +1171,7 @@ BLIB = $(BIN)/blib.a
|
|||||||
$(BLIB) : $(BLIB_OBJS) $(BLIB_LIST) $(MAKEDEPS)
|
$(BLIB) : $(BLIB_OBJS) $(BLIB_LIST) $(MAKEDEPS)
|
||||||
$(Q)$(RM) $(BLIB)
|
$(Q)$(RM) $(BLIB)
|
||||||
$(QM)$(ECHO) " [AR] $@"
|
$(QM)$(ECHO) " [AR] $@"
|
||||||
$(Q)$(AR) rcD $@ $(sort $(BLIB_OBJS))
|
$(Q)$(AR) rD $@ $(sort $(BLIB_OBJS))
|
||||||
$(Q)$(OBJCOPY) --enable-deterministic-archives \
|
$(Q)$(OBJCOPY) --enable-deterministic-archives \
|
||||||
--prefix-symbols=$(SYMBOL_PREFIX) $@
|
--prefix-symbols=$(SYMBOL_PREFIX) $@
|
||||||
$(Q)$(RANLIB) -D $@
|
$(Q)$(RANLIB) -D $@
|
||||||
|
|||||||
@@ -9,5 +9,4 @@ INCDIRS += arch/arm/include
|
|||||||
|
|
||||||
# ARM-specific directories containing source files
|
# ARM-specific directories containing source files
|
||||||
#
|
#
|
||||||
SRCDIRS += arch/arm/core
|
|
||||||
SRCDIRS += arch/arm/interface/efi
|
SRCDIRS += arch/arm/interface/efi
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ union arm32_io_qword {
|
|||||||
*
|
*
|
||||||
* This is not atomic for ARM32.
|
* This is not atomic for ARM32.
|
||||||
*/
|
*/
|
||||||
static __unused uint64_t arm32_readq ( volatile uint64_t *io_addr ) {
|
static uint64_t arm32_readq ( volatile uint64_t *io_addr ) {
|
||||||
volatile union arm32_io_qword *ptr =
|
volatile union arm32_io_qword *ptr =
|
||||||
container_of ( io_addr, union arm32_io_qword, qword );
|
container_of ( io_addr, union arm32_io_qword, qword );
|
||||||
union arm32_io_qword tmp;
|
union arm32_io_qword tmp;
|
||||||
@@ -64,8 +64,7 @@ static __unused uint64_t arm32_readq ( volatile uint64_t *io_addr ) {
|
|||||||
*
|
*
|
||||||
* This is not atomic for ARM32.
|
* This is not atomic for ARM32.
|
||||||
*/
|
*/
|
||||||
static __unused void arm32_writeq ( uint64_t data,
|
static void arm32_writeq ( uint64_t data, volatile uint64_t *io_addr ) {
|
||||||
volatile uint64_t *io_addr ) {
|
|
||||||
volatile union arm32_io_qword *ptr =
|
volatile union arm32_io_qword *ptr =
|
||||||
container_of ( io_addr, union arm32_io_qword, qword );
|
container_of ( io_addr, union arm32_io_qword, qword );
|
||||||
union arm32_io_qword tmp;
|
union arm32_io_qword tmp;
|
||||||
@@ -83,6 +82,7 @@ PROVIDE_IOAPI_INLINE ( arm, readl );
|
|||||||
PROVIDE_IOAPI_INLINE ( arm, writeb );
|
PROVIDE_IOAPI_INLINE ( arm, writeb );
|
||||||
PROVIDE_IOAPI_INLINE ( arm, writew );
|
PROVIDE_IOAPI_INLINE ( arm, writew );
|
||||||
PROVIDE_IOAPI_INLINE ( arm, writel );
|
PROVIDE_IOAPI_INLINE ( arm, writel );
|
||||||
|
PROVIDE_IOAPI_INLINE ( arm, iodelay );
|
||||||
PROVIDE_IOAPI_INLINE ( arm, mb );
|
PROVIDE_IOAPI_INLINE ( arm, mb );
|
||||||
#ifdef __aarch64__
|
#ifdef __aarch64__
|
||||||
PROVIDE_IOAPI_INLINE ( arm, readq );
|
PROVIDE_IOAPI_INLINE ( arm, readq );
|
||||||
@@ -91,4 +91,3 @@ PROVIDE_IOAPI_INLINE ( arm, writeq );
|
|||||||
PROVIDE_IOAPI ( arm, readq, arm32_readq );
|
PROVIDE_IOAPI ( arm, readq, arm32_readq );
|
||||||
PROVIDE_IOAPI ( arm, writeq, arm32_writeq );
|
PROVIDE_IOAPI ( arm, writeq, arm32_writeq );
|
||||||
#endif
|
#endif
|
||||||
PROVIDE_DUMMY_PIO ( arm );
|
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
#ifndef _BITS_ENTROPY_H
|
||||||
|
#define _BITS_ENTROPY_H
|
||||||
|
|
||||||
|
/** @file
|
||||||
|
*
|
||||||
|
* ARM-specific entropy API implementations
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||||
|
|
||||||
|
#endif /* _BITS_ENTROPY_H */
|
||||||
@@ -9,9 +9,6 @@
|
|||||||
|
|
||||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||||
|
|
||||||
/** Page shift */
|
|
||||||
#define PAGE_SHIFT 12
|
|
||||||
|
|
||||||
#include <ipxe/arm_io.h>
|
#include <ipxe/arm_io.h>
|
||||||
|
|
||||||
#endif /* _BITS_IO_H */
|
#endif /* _BITS_IO_H */
|
||||||
|
|||||||
@@ -9,4 +9,6 @@
|
|||||||
|
|
||||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||||
|
|
||||||
|
#include <ipxe/io.h>
|
||||||
|
|
||||||
#endif /* _BITS_PCI_IO_H */
|
#endif /* _BITS_PCI_IO_H */
|
||||||
|
|||||||
@@ -15,13 +15,14 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
|||||||
#define IOAPI_PREFIX_arm __arm_
|
#define IOAPI_PREFIX_arm __arm_
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <ipxe/dummy_pio.h>
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Memory space mappings
|
* Memory space mappings
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/** Page shift */
|
||||||
|
#define PAGE_SHIFT 12
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Physical<->Bus address mappings
|
* Physical<->Bus address mappings
|
||||||
*
|
*
|
||||||
@@ -79,6 +80,55 @@ ARM_WRITEX ( w, uint16_t, "h", "" );
|
|||||||
ARM_WRITEX ( l, uint32_t, "", "" );
|
ARM_WRITEX ( l, uint32_t, "", "" );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Dummy PIO reads and writes up to 32 bits
|
||||||
|
*
|
||||||
|
* There is no common standard for I/O-space access for ARM, and
|
||||||
|
* non-MMIO peripherals are vanishingly rare. Provide dummy
|
||||||
|
* implementations that will allow code to link and should cause
|
||||||
|
* drivers to simply fail to detect hardware at runtime.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define ARM_INX( _suffix, _type ) \
|
||||||
|
static inline __always_inline _type \
|
||||||
|
IOAPI_INLINE ( arm, in ## _suffix ) ( volatile _type *io_addr __unused) { \
|
||||||
|
return ~( (_type) 0 ); \
|
||||||
|
} \
|
||||||
|
static inline __always_inline void \
|
||||||
|
IOAPI_INLINE ( arm, ins ## _suffix ) ( volatile _type *io_addr __unused, \
|
||||||
|
_type *data, unsigned int count ) { \
|
||||||
|
memset ( data, 0xff, count * sizeof ( *data ) ); \
|
||||||
|
}
|
||||||
|
ARM_INX ( b, uint8_t );
|
||||||
|
ARM_INX ( w, uint16_t );
|
||||||
|
ARM_INX ( l, uint32_t );
|
||||||
|
|
||||||
|
#define ARM_OUTX( _suffix, _type ) \
|
||||||
|
static inline __always_inline void \
|
||||||
|
IOAPI_INLINE ( arm, out ## _suffix ) ( _type data __unused, \
|
||||||
|
volatile _type *io_addr __unused ) { \
|
||||||
|
/* Do nothing */ \
|
||||||
|
} \
|
||||||
|
static inline __always_inline void \
|
||||||
|
IOAPI_INLINE ( arm, outs ## _suffix ) ( volatile _type *io_addr __unused, \
|
||||||
|
const _type *data __unused, \
|
||||||
|
unsigned int count __unused ) { \
|
||||||
|
/* Do nothing */ \
|
||||||
|
}
|
||||||
|
ARM_OUTX ( b, uint8_t );
|
||||||
|
ARM_OUTX ( w, uint16_t );
|
||||||
|
ARM_OUTX ( l, uint32_t );
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Slow down I/O
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
static inline __always_inline void
|
||||||
|
IOAPI_INLINE ( arm, iodelay ) ( void ) {
|
||||||
|
/* Nothing to do */
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Memory barrier
|
* Memory barrier
|
||||||
*
|
*
|
||||||
@@ -93,7 +143,4 @@ IOAPI_INLINE ( arm, mb ) ( void ) {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Dummy PIO */
|
|
||||||
DUMMY_PIO ( arm );
|
|
||||||
|
|
||||||
#endif /* _IPXE_ARM_IO_H */
|
#endif /* _IPXE_ARM_IO_H */
|
||||||
|
|||||||
@@ -8,9 +8,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
|||||||
|
|
||||||
#ifndef ASSEMBLY
|
#ifndef ASSEMBLY
|
||||||
|
|
||||||
/** Unprefixed constant operand modifier */
|
|
||||||
#define ASM_NO_PREFIX "c"
|
|
||||||
|
|
||||||
#define __asmcall
|
#define __asmcall
|
||||||
#define __libgcc
|
#define __libgcc
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
||||||
|
|
||||||
.section ".note.GNU-stack", "", %progbits
|
|
||||||
.text
|
.text
|
||||||
|
|
||||||
/* Must match jmp_buf structure layout */
|
/* Must match jmp_buf structure layout */
|
||||||
|
|||||||
@@ -8,9 +8,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
|||||||
|
|
||||||
#ifndef ASSEMBLY
|
#ifndef ASSEMBLY
|
||||||
|
|
||||||
/** Unprefixed constant operand modifier */
|
|
||||||
#define ASM_NO_PREFIX "c"
|
|
||||||
|
|
||||||
#define __asmcall
|
#define __asmcall
|
||||||
#define __libgcc
|
#define __libgcc
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
* Interrupt handlers
|
* Interrupt handlers
|
||||||
****************************************************************************
|
****************************************************************************
|
||||||
*/
|
*/
|
||||||
.section ".note.GNU-stack", "", @progbits
|
|
||||||
.section ".text", "ax", @progbits
|
.section ".text", "ax", @progbits
|
||||||
.code32
|
.code32
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
||||||
|
|
||||||
.section ".note.GNU-stack", "", @progbits
|
|
||||||
.text
|
.text
|
||||||
.arch i386
|
.arch i386
|
||||||
.code32
|
.code32
|
||||||
|
|||||||
@@ -8,9 +8,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
|||||||
|
|
||||||
#ifndef ASSEMBLY
|
#ifndef ASSEMBLY
|
||||||
|
|
||||||
/** Unprefixed constant operand modifier */
|
|
||||||
#define ASM_NO_PREFIX "c"
|
|
||||||
|
|
||||||
/** Declare a function with standard calling conventions */
|
/** Declare a function with standard calling conventions */
|
||||||
#define __asmcall __attribute__ (( cdecl, regparm(0) ))
|
#define __asmcall __attribute__ (( cdecl, regparm(0) ))
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
.section ".note.GNU-stack", "", @progbits
|
|
||||||
.arch i386
|
.arch i386
|
||||||
|
|
||||||
.section ".data", "aw", @progbits
|
.section ".data", "aw", @progbits
|
||||||
|
|||||||
@@ -1,27 +0,0 @@
|
|||||||
# Assembler section type character
|
|
||||||
#
|
|
||||||
ASM_TCHAR := @
|
|
||||||
ASM_TCHAR_OPS := @
|
|
||||||
|
|
||||||
# LoongArch64-specific flags
|
|
||||||
#
|
|
||||||
CFLAGS += -fstrength-reduce -fomit-frame-pointer
|
|
||||||
CFLAGS += -falign-jumps=1 -falign-loops=1 -falign-functions=1
|
|
||||||
|
|
||||||
# Check if -mno-explicit-relocs is valid
|
|
||||||
ifeq ($(CCTYPE),gcc)
|
|
||||||
MNER_TEST = $(CC) -mno-explicit-relocs -x c -c /dev/null -o /dev/null >/dev/null 2>&1
|
|
||||||
MNER_FLAGS := $(shell $(MNER_TEST) && $(ECHO) '-mno-explicit-relocs')
|
|
||||||
WORKAROUND_CFLAGS += $(MNER_FLAGS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
# EFI requires -fshort-wchar, and nothing else currently uses wchar_t
|
|
||||||
CFLAGS += -fshort-wchar
|
|
||||||
|
|
||||||
# LoongArch64-specific directories containing source files
|
|
||||||
SRCDIRS += arch/loong64/core
|
|
||||||
SRCDIRS += arch/loong64/interface/efi
|
|
||||||
|
|
||||||
# Include platform-specific Makefile
|
|
||||||
MAKEDEPS += arch/loong64/Makefile.$(PLATFORM)
|
|
||||||
include arch/loong64/Makefile.$(PLATFORM)
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
# -*- makefile -*- : Force emacs to use Makefile mode
|
|
||||||
|
|
||||||
# Specify EFI image builder
|
|
||||||
#
|
|
||||||
ELF2EFI = $(ELF2EFI64)
|
|
||||||
|
|
||||||
# Specify EFI boot file
|
|
||||||
#
|
|
||||||
EFI_BOOT_FILE = bootloongarch64.efi
|
|
||||||
|
|
||||||
# Include generic EFI Makefile
|
|
||||||
#
|
|
||||||
MAKEDEPS += Makefile.efi
|
|
||||||
include Makefile.efi
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
# -*- makefile -*- : Force emacs to use Makefile mode
|
|
||||||
|
|
||||||
# Starting virtual address
|
|
||||||
#
|
|
||||||
LDFLAGS += -Ttext=0x120000000
|
|
||||||
|
|
||||||
# Include generic Linux Makefile
|
|
||||||
#
|
|
||||||
MAKEDEPS += Makefile.linux
|
|
||||||
include Makefile.linux
|
|
||||||
@@ -1,120 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2012 Michael Brown <mbrown@fensystems.co.uk>.
|
|
||||||
* Copyright (c) 2023, Xiaotian Wu <wuxiaotian@loongson.cn>
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public License as
|
|
||||||
* published by the Free Software Foundation; either version 2 of the
|
|
||||||
* License, or any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful, but
|
|
||||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
|
||||||
* 02110-1301, USA.
|
|
||||||
*
|
|
||||||
* You can also choose to distribute this program under the terms of
|
|
||||||
* the Unmodified Binary Distribution Licence (as given in the file
|
|
||||||
* COPYING.UBDL), provided that you have satisfied its requirements.
|
|
||||||
*/
|
|
||||||
|
|
||||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <ipxe/bigint.h>
|
|
||||||
|
|
||||||
/** @file
|
|
||||||
*
|
|
||||||
* Big integer support
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Multiply big integers
|
|
||||||
*
|
|
||||||
* @v multiplicand0 Element 0 of big integer to be multiplied
|
|
||||||
* @v multiplier0 Element 0 of big integer to be multiplied
|
|
||||||
* @v result0 Element 0 of big integer to hold result
|
|
||||||
* @v size Number of elements
|
|
||||||
*/
|
|
||||||
void bigint_multiply_raw ( const uint64_t *multiplicand0,
|
|
||||||
const uint64_t *multiplier0,
|
|
||||||
uint64_t *result0, unsigned int size ) {
|
|
||||||
const bigint_t ( size ) __attribute__ (( may_alias )) *multiplicand =
|
|
||||||
( ( const void * ) multiplicand0 );
|
|
||||||
const bigint_t ( size ) __attribute__ (( may_alias )) *multiplier =
|
|
||||||
( ( const void * ) multiplier0 );
|
|
||||||
bigint_t ( size * 2 ) __attribute__ (( may_alias )) *result =
|
|
||||||
( ( void * ) result0 );
|
|
||||||
unsigned int i;
|
|
||||||
unsigned int j;
|
|
||||||
uint64_t multiplicand_element;
|
|
||||||
uint64_t multiplier_element;
|
|
||||||
uint64_t *result_elements;
|
|
||||||
uint64_t discard_low;
|
|
||||||
uint64_t discard_high;
|
|
||||||
uint64_t discard_temp_low;
|
|
||||||
uint64_t discard_temp_high;
|
|
||||||
|
|
||||||
/* Zero result */
|
|
||||||
memset ( result, 0, sizeof ( *result ) );
|
|
||||||
|
|
||||||
/* Multiply integers one element at a time */
|
|
||||||
for ( i = 0 ; i < size ; i++ ) {
|
|
||||||
multiplicand_element = multiplicand->element[i];
|
|
||||||
for ( j = 0 ; j < size ; j++ ) {
|
|
||||||
multiplier_element = multiplier->element[j];
|
|
||||||
result_elements = &result->element[ i + j ];
|
|
||||||
/* Perform a single multiply, and add the
|
|
||||||
* resulting double-element into the result,
|
|
||||||
* carrying as necessary. The carry can
|
|
||||||
* never overflow beyond the end of the
|
|
||||||
* result, since:
|
|
||||||
*
|
|
||||||
* a < 2^{n}, b < 2^{n} => ab < 2^{2n}
|
|
||||||
*/
|
|
||||||
__asm__ __volatile__ ( "mul.d %1, %6, %7\n\t"
|
|
||||||
"mulh.du %2, %6, %7\n\t"
|
|
||||||
|
|
||||||
"ld.d %3, %0, 0\n\t"
|
|
||||||
"ld.d %4, %0, 8\n\t"
|
|
||||||
|
|
||||||
"add.d %3, %3, %1\n\t"
|
|
||||||
"sltu $t0, %3, %1\n\t"
|
|
||||||
|
|
||||||
"add.d %4, %4, %2\n\t"
|
|
||||||
"sltu $t1, %4, %2\n\t"
|
|
||||||
|
|
||||||
"add.d %4, %4, $t0\n\t"
|
|
||||||
"sltu $t0, %4, $t0\n\t"
|
|
||||||
"or $t0, $t0, $t1\n\t"
|
|
||||||
|
|
||||||
"st.d %3, %0, 0\n\t"
|
|
||||||
"st.d %4, %0, 8\n\t"
|
|
||||||
|
|
||||||
"addi.d %0, %0, 16\n\t"
|
|
||||||
"beqz $t0, 2f\n"
|
|
||||||
"1:\n\t"
|
|
||||||
"ld.d %3, %0, 0\n\t"
|
|
||||||
"add.d %3, %3, $t0\n\t"
|
|
||||||
"sltu $t0, %3, $t0\n\t"
|
|
||||||
"st.d %3, %0, 0\n\t"
|
|
||||||
"addi.d %0, %0, 8\n\t"
|
|
||||||
"bnez $t0, 1b\n"
|
|
||||||
"2:"
|
|
||||||
: "+r" ( result_elements ),
|
|
||||||
"=&r" ( discard_low ),
|
|
||||||
"=&r" ( discard_high ),
|
|
||||||
"=r" ( discard_temp_low ),
|
|
||||||
"=r" ( discard_temp_high ),
|
|
||||||
"+m" ( *result )
|
|
||||||
: "r" ( multiplicand_element ),
|
|
||||||
"r" ( multiplier_element )
|
|
||||||
: "t0", "t1" );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2023, Xiaotian Wu <wuxiaotian@loongson.cn>
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public License as
|
|
||||||
* published by the Free Software Foundation; either version 2 of the
|
|
||||||
* License, or any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful, but
|
|
||||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
|
||||||
* 02110-1301, USA.
|
|
||||||
*
|
|
||||||
* You can also choose to distribute this program under the terms of
|
|
||||||
* the Unmodified Binary Distribution Licence (as given in the file
|
|
||||||
* COPYING.UBDL), provided that you have satisfied its requirements.
|
|
||||||
*/
|
|
||||||
|
|
||||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
|
||||||
|
|
||||||
#include <ipxe/io.h>
|
|
||||||
#include <ipxe/loong64_io.h>
|
|
||||||
|
|
||||||
/** @file
|
|
||||||
*
|
|
||||||
* iPXE I/O API for LoongArch64
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
PROVIDE_IOAPI_INLINE ( loong64, phys_to_bus );
|
|
||||||
PROVIDE_IOAPI_INLINE ( loong64, bus_to_phys );
|
|
||||||
PROVIDE_IOAPI_INLINE ( loong64, readb );
|
|
||||||
PROVIDE_IOAPI_INLINE ( loong64, readw );
|
|
||||||
PROVIDE_IOAPI_INLINE ( loong64, readl );
|
|
||||||
PROVIDE_IOAPI_INLINE ( loong64, readq );
|
|
||||||
PROVIDE_IOAPI_INLINE ( loong64, writeb );
|
|
||||||
PROVIDE_IOAPI_INLINE ( loong64, writew );
|
|
||||||
PROVIDE_IOAPI_INLINE ( loong64, writel );
|
|
||||||
PROVIDE_IOAPI_INLINE ( loong64, writeq );
|
|
||||||
PROVIDE_IOAPI_INLINE ( loong64, mb );
|
|
||||||
PROVIDE_DUMMY_PIO ( loong64 );
|
|
||||||
@@ -1,266 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2016 Michael Brown <mbrown@fensystems.co.uk>.
|
|
||||||
* Copyright (c) 2023, Xiaotian Wu <wuxiaotian@loongson.cn>
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public License as
|
|
||||||
* published by the Free Software Foundation; either version 2 of the
|
|
||||||
* License, or any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful, but
|
|
||||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
|
||||||
* 02110-1301, USA.
|
|
||||||
*
|
|
||||||
* You can also choose to distribute this program under the terms of
|
|
||||||
* the Unmodified Binary Distribution Licence (as given in the file
|
|
||||||
* COPYING.UBDL), provided that you have satisfied its requirements.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @file
|
|
||||||
*
|
|
||||||
* Optimised string operations
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Copy memory area
|
|
||||||
*
|
|
||||||
* @v dest Destination address
|
|
||||||
* @v src Source address
|
|
||||||
* @v len Length
|
|
||||||
* @ret dest Destination address
|
|
||||||
*/
|
|
||||||
void loong64_memcpy ( void *dest, const void *src, size_t len ) {
|
|
||||||
void *discard_dest;
|
|
||||||
void *discard_end;
|
|
||||||
const void *discard_src;
|
|
||||||
size_t discard_offset;
|
|
||||||
unsigned long discard_data;
|
|
||||||
unsigned long discard_low;
|
|
||||||
unsigned long discard_high;
|
|
||||||
|
|
||||||
/* If length is too short, then just copy individual bytes.
|
|
||||||
*/
|
|
||||||
if ( len < 16 ) {
|
|
||||||
__asm__ __volatile__ ( "beqz %0, 2f\n\t"
|
|
||||||
"\n1:\n\t"
|
|
||||||
"addi.d %0, %0, -1\n\t"
|
|
||||||
"ldx.b %1, %3, %0\n\t"
|
|
||||||
"stx.b %1, %2, %0\n\t"
|
|
||||||
"bnez %0, 1b\n\t"
|
|
||||||
"\n2:\n\t"
|
|
||||||
: "=&r" ( discard_offset ),
|
|
||||||
"=&r" ( discard_data )
|
|
||||||
: "r" ( dest ), "r" ( src ), "0" ( len )
|
|
||||||
: "memory", "t0" );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Copy 16 bytes at a time: one initial
|
|
||||||
* potentially unaligned access, multiple destination-aligned
|
|
||||||
* accesses, one final potentially unaligned access.
|
|
||||||
*/
|
|
||||||
__asm__ __volatile__ ( "ld.d %3, %1, 0\n\t"
|
|
||||||
"ld.d %4, %1, 8\n\t"
|
|
||||||
"addi.d %1, %1, 16\n\t"
|
|
||||||
"st.d %3, %0, 0\n\t"
|
|
||||||
"st.d %4, %0, 8\n\t"
|
|
||||||
"addi.d %0, %0, 16\n\t"
|
|
||||||
"andi %3, %0, 15\n\t"
|
|
||||||
"sub.d %0, %0, %3\n\t"
|
|
||||||
"sub.d %1, %1, %3\n\t"
|
|
||||||
"addi.d $t0, $zero, 0xf\n\t"
|
|
||||||
"andn %2, %5, $t0\n\t"
|
|
||||||
"b 2f\n\t"
|
|
||||||
"\n1:\n\t"
|
|
||||||
"ld.d %3, %1, 0\n\t"
|
|
||||||
"ld.d %4, %1, 8\n\t"
|
|
||||||
"addi.d %1, %1, 16\n\t"
|
|
||||||
"st.d %3, %0, 0\n\t"
|
|
||||||
"st.d %4, %0, 8\n\t"
|
|
||||||
"addi.d %0, %0, 16\n\t"
|
|
||||||
"\n2:\n\t"
|
|
||||||
"bne %0, %2, 1b\n\t"
|
|
||||||
"ld.d %3, %6, -16\n\t"
|
|
||||||
"ld.d %4, %6, -8\n\t"
|
|
||||||
"st.d %3, %5, -16\n\t"
|
|
||||||
"st.d %4, %5, -8\n\t"
|
|
||||||
: "=&r" ( discard_dest ),
|
|
||||||
"=&r" ( discard_src ),
|
|
||||||
"=&r" ( discard_end ),
|
|
||||||
"=&r" ( discard_low ),
|
|
||||||
"=&r" ( discard_high )
|
|
||||||
: "r" ( dest + len ), "r" ( src + len ),
|
|
||||||
"0" ( dest ), "1" ( src )
|
|
||||||
: "memory", "t0" );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Zero memory region
|
|
||||||
*
|
|
||||||
* @v dest Destination region
|
|
||||||
* @v len Length
|
|
||||||
*/
|
|
||||||
void loong64_bzero ( void *dest, size_t len ) {
|
|
||||||
size_t discard_offset;
|
|
||||||
void *discard_dest;
|
|
||||||
void *discard_end;
|
|
||||||
|
|
||||||
/* If length is too short, then just zero individual bytes.
|
|
||||||
*/
|
|
||||||
if ( len < 16 ) {
|
|
||||||
__asm__ __volatile__ ( "beqz %0, 2f\n\t"
|
|
||||||
"\n1:\n\t"
|
|
||||||
"addi.d %0, %0, -1\n\t"
|
|
||||||
"stx.b $zero, %1, %0\n\t"
|
|
||||||
"bnez %0, 1b\n\t"
|
|
||||||
"\n2:\n\t"
|
|
||||||
: "=&r" ( discard_offset )
|
|
||||||
: "r" ( dest ), "0" ( len )
|
|
||||||
: "memory" );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* To zero 16 bytes at a time: one initial
|
|
||||||
* potentially unaligned access, multiple aligned accesses,
|
|
||||||
* one final potentially unaligned access.
|
|
||||||
*/
|
|
||||||
|
|
||||||
__asm__ __volatile__ ( "st.d $zero, %0, 0\n\t"
|
|
||||||
"st.d $zero, %0, 8\n\t"
|
|
||||||
"addi.d %0, %0, 16\n\t"
|
|
||||||
"addi.w $t0, $zero, 15\n\t"
|
|
||||||
"andn %0, %0, $t0\n\t"
|
|
||||||
"addi.w $t0, $zero, 15\n\t"
|
|
||||||
"andn %1, %2, $t0\n\t"
|
|
||||||
"b 2f\n\t"
|
|
||||||
"\n1:\n\t"
|
|
||||||
"st.d $zero, %0, 0\n\t"
|
|
||||||
"st.d $zero, %0, 8\n\t"
|
|
||||||
"addi.d %0, %0, 16\n\t"
|
|
||||||
"\n2:\n\t"
|
|
||||||
"bne %0, %1, 1b\n\t"
|
|
||||||
"st.d $zero, %2, -16\n\t"
|
|
||||||
"st.d $zero, %2, -8\n\t"
|
|
||||||
: "=&r" ( discard_dest ),
|
|
||||||
"=&r" ( discard_end )
|
|
||||||
: "r" ( dest + len ), "0" ( dest )
|
|
||||||
: "memory", "t0" );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Fill memory region
|
|
||||||
*
|
|
||||||
* @v dest Destination region
|
|
||||||
* @v len Length
|
|
||||||
* @v character Fill character
|
|
||||||
*
|
|
||||||
* The unusual parameter order is to allow for more efficient
|
|
||||||
* tail-calling to loong64_memset() when zeroing a region.
|
|
||||||
*/
|
|
||||||
void loong64_memset ( void *dest, size_t len, int character ) {
|
|
||||||
size_t discard_offset;
|
|
||||||
|
|
||||||
/* Use optimised zeroing code if applicable */
|
|
||||||
if ( character == 0 ) {
|
|
||||||
loong64_bzero ( dest, len );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Fill one byte at a time. Calling memset() with a non-zero
|
|
||||||
* value is relatively rare and unlikely to be
|
|
||||||
* performance-critical.
|
|
||||||
*/
|
|
||||||
__asm__ __volatile__ ( "beqz %0, 2f\n\t"
|
|
||||||
"\n1:\n\t"
|
|
||||||
"addi.d %0, %0, -1\n\t"
|
|
||||||
"stx.b %2, %1, %0\n\t"
|
|
||||||
"bnez %0, 1b\n\t"
|
|
||||||
"\n2:\n\t"
|
|
||||||
: "=&r" ( discard_offset )
|
|
||||||
: "r" ( dest ), "r" ( character ), "0" ( len )
|
|
||||||
: "memory" );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Copy (possibly overlapping) memory region forwards
|
|
||||||
*
|
|
||||||
* @v dest Destination region
|
|
||||||
* @v src Source region
|
|
||||||
* @v len Length
|
|
||||||
*/
|
|
||||||
void loong64_memmove_forwards ( void *dest, const void *src, size_t len ) {
|
|
||||||
void *discard_dest;
|
|
||||||
const void *discard_src;
|
|
||||||
unsigned long discard_data;
|
|
||||||
|
|
||||||
/* Assume memmove() is not performance-critical, and perform a
|
|
||||||
* bytewise copy for simplicity.
|
|
||||||
*/
|
|
||||||
__asm__ __volatile__ ( "b 2f\n\t"
|
|
||||||
"\n1:\n\t"
|
|
||||||
"ld.b %2, %1, 0\n\t"
|
|
||||||
"addi.d %1, %1, 1\n\t"
|
|
||||||
"st.b %2, %0, 0\n\t"
|
|
||||||
"addi.d %0, %0, 1\n\t"
|
|
||||||
"\n2:\n\t"
|
|
||||||
"bne %0, %3, 1b\n\t"
|
|
||||||
: "=&r" ( discard_dest ),
|
|
||||||
"=&r" ( discard_src ),
|
|
||||||
"=&r" ( discard_data )
|
|
||||||
: "r" ( dest + len ), "0" ( dest ), "1" ( src )
|
|
||||||
: "memory" );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Copy (possibly overlapping) memory region backwards
|
|
||||||
*
|
|
||||||
* @v dest Destination region
|
|
||||||
* @v src Source region
|
|
||||||
* @v len Length
|
|
||||||
*/
|
|
||||||
void loong64_memmove_backwards ( void *dest, const void *src, size_t len ) {
|
|
||||||
size_t discard_offset;
|
|
||||||
unsigned long discard_data;
|
|
||||||
|
|
||||||
/* Assume memmove() is not performance-critical, and perform a
|
|
||||||
* bytewise copy for simplicity.
|
|
||||||
*/
|
|
||||||
__asm__ __volatile__ ( "beqz %0, 2f\n\t"
|
|
||||||
"\n1:\n\t"
|
|
||||||
"addi.d %0, %0, -1\n\t"
|
|
||||||
"ldx.b %1, %3, %0\n\t"
|
|
||||||
"stx.b %1, %2, %0\n\t"
|
|
||||||
"bnez %0, 1b\n\t"
|
|
||||||
"\n2:\n\t"
|
|
||||||
: "=&r" ( discard_offset ),
|
|
||||||
"=&r" ( discard_data )
|
|
||||||
: "r" ( dest ), "r" ( src ), "0" ( len )
|
|
||||||
: "memory" );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Copy (possibly overlapping) memory region
|
|
||||||
*
|
|
||||||
* @v dest Destination region
|
|
||||||
* @v src Source region
|
|
||||||
* @v len Length
|
|
||||||
*/
|
|
||||||
void loong64_memmove ( void *dest, const void *src, size_t len ) {
|
|
||||||
|
|
||||||
if ( dest <= src ) {
|
|
||||||
loong64_memmove_forwards ( dest, src, len );
|
|
||||||
} else {
|
|
||||||
loong64_memmove_backwards ( dest, src, len );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,53 +0,0 @@
|
|||||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
|
||||||
|
|
||||||
.section ".note.GNU-stack", "", %progbits
|
|
||||||
.text
|
|
||||||
/*
|
|
||||||
int setjmp(jmp_buf env);
|
|
||||||
*/
|
|
||||||
.globl setjmp
|
|
||||||
.type setjmp, %function
|
|
||||||
setjmp:
|
|
||||||
/* Store registers */
|
|
||||||
st.d $s0, $a0, 0x0
|
|
||||||
st.d $s1, $a0, 0x8
|
|
||||||
st.d $s2, $a0, 0x10
|
|
||||||
st.d $s3, $a0, 0x18
|
|
||||||
st.d $s4, $a0, 0x20
|
|
||||||
st.d $s5, $a0, 0x28
|
|
||||||
st.d $s6, $a0, 0x30
|
|
||||||
st.d $s7, $a0, 0x38
|
|
||||||
st.d $s8, $a0, 0x40
|
|
||||||
st.d $fp, $a0, 0x48
|
|
||||||
st.d $sp, $a0, 0x50
|
|
||||||
st.d $ra, $a0, 0x58
|
|
||||||
|
|
||||||
move $a0, $zero
|
|
||||||
jirl $zero, $ra, 0
|
|
||||||
.size setjmp, . - setjmp
|
|
||||||
|
|
||||||
/*
|
|
||||||
void longjmp(jmp_buf env, int val);
|
|
||||||
*/
|
|
||||||
.globl longjmp
|
|
||||||
.type longjmp, %function
|
|
||||||
longjmp:
|
|
||||||
/* Restore registers */
|
|
||||||
ld.d $s0, $a0, 0x0
|
|
||||||
ld.d $s1, $a0, 0x8
|
|
||||||
ld.d $s2, $a0, 0x10
|
|
||||||
ld.d $s3, $a0, 0x18
|
|
||||||
ld.d $s4, $a0, 0x20
|
|
||||||
ld.d $s5, $a0, 0x28
|
|
||||||
ld.d $s6, $a0, 0x30
|
|
||||||
ld.d $s7, $a0, 0x38
|
|
||||||
ld.d $s8, $a0, 0x40
|
|
||||||
ld.d $fp, $a0, 0x48
|
|
||||||
ld.d $sp, $a0, 0x50
|
|
||||||
ld.d $ra, $a0, 0x58
|
|
||||||
addi.d $a0, $zero, 1 # a0 = 1
|
|
||||||
beqz $a1, .exit # if (a1 == 0); goto L0
|
|
||||||
move $a0, $a1 # a0 = a1
|
|
||||||
.exit:
|
|
||||||
jirl $zero, $ra, 0
|
|
||||||
.size longjmp, . - longjmp
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
#ifndef _BITS_ACPI_H
|
|
||||||
#define _BITS_ACPI_H
|
|
||||||
|
|
||||||
/** @file
|
|
||||||
*
|
|
||||||
* LoongArch64-specific ACPI API implementations
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
|
||||||
|
|
||||||
#endif /* _BITS_ACPI_H */
|
|
||||||
@@ -1,336 +0,0 @@
|
|||||||
#ifndef _BITS_BIGINT_H
|
|
||||||
#define _BITS_BIGINT_H
|
|
||||||
|
|
||||||
/** @file
|
|
||||||
*
|
|
||||||
* Big integer support
|
|
||||||
*/
|
|
||||||
|
|
||||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <strings.h>
|
|
||||||
|
|
||||||
/** Element of a big integer */
|
|
||||||
typedef uint64_t bigint_element_t;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialise big integer
|
|
||||||
*
|
|
||||||
* @v value0 Element 0 of big integer to initialise
|
|
||||||
* @v size Number of elements
|
|
||||||
* @v data Raw data
|
|
||||||
* @v len Length of raw data
|
|
||||||
*/
|
|
||||||
static inline __attribute__ (( always_inline )) void
|
|
||||||
bigint_init_raw ( uint64_t *value0, unsigned int size,
|
|
||||||
const void *data, size_t len ) {
|
|
||||||
size_t pad_len = ( sizeof ( bigint_t ( size ) ) - len );
|
|
||||||
uint8_t *value_byte = ( ( void * ) value0 );
|
|
||||||
const uint8_t *data_byte = ( data + len );
|
|
||||||
|
|
||||||
/* Copy raw data in reverse order, padding with zeros */
|
|
||||||
while ( len-- )
|
|
||||||
*(value_byte++) = *(--data_byte);
|
|
||||||
while ( pad_len-- )
|
|
||||||
*(value_byte++) = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add big integers
|
|
||||||
*
|
|
||||||
* @v addend0 Element 0 of big integer to add
|
|
||||||
* @v value0 Element 0 of big integer to be added to
|
|
||||||
* @v size Number of elements
|
|
||||||
*/
|
|
||||||
static inline __attribute__ (( always_inline )) void
|
|
||||||
bigint_add_raw ( const uint64_t *addend0, uint64_t *value0,
|
|
||||||
unsigned int size ) {
|
|
||||||
bigint_t ( size ) __attribute__ (( may_alias )) *value =
|
|
||||||
( ( void * ) value0 );
|
|
||||||
uint64_t *discard_addend;
|
|
||||||
uint64_t *discard_value;
|
|
||||||
uint64_t discard_addend_i;
|
|
||||||
uint64_t discard_value_i;
|
|
||||||
unsigned int discard_size;
|
|
||||||
__asm__ __volatile__ ( "move $t0, $zero\n"
|
|
||||||
"1:\n\t"
|
|
||||||
"ld.d %3, %0, 0\n\t"
|
|
||||||
"addi.d %0, %0, 8\n\t"
|
|
||||||
"ld.d %4, %1, 0\n\t"
|
|
||||||
|
|
||||||
"add.d %4, %4, $t0\n\t"
|
|
||||||
"sltu $t0, %4, $t0\n\t"
|
|
||||||
|
|
||||||
"add.d %4, %4, %3\n\t"
|
|
||||||
"sltu $t1, %4, %3\n\t"
|
|
||||||
|
|
||||||
"or $t0, $t0, $t1\n\t"
|
|
||||||
"st.d %4, %1, 0\n\t"
|
|
||||||
"addi.d %1, %1, 8\n\t"
|
|
||||||
"addi.w %2, %2, -1\n\t"
|
|
||||||
"bnez %2, 1b"
|
|
||||||
: "=r" ( discard_addend ),
|
|
||||||
"=r" ( discard_value ),
|
|
||||||
"=r" ( discard_size ),
|
|
||||||
"=r" ( discard_addend_i ),
|
|
||||||
"=r" ( discard_value_i ),
|
|
||||||
"+m" ( *value )
|
|
||||||
: "0" ( addend0 ),
|
|
||||||
"1" ( value0 ),
|
|
||||||
"2" ( size )
|
|
||||||
: "t0", "t1" );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Subtract big integers
|
|
||||||
*
|
|
||||||
* @v subtrahend0 Element 0 of big integer to subtract
|
|
||||||
* @v value0 Element 0 of big integer to be subtracted from
|
|
||||||
* @v size Number of elements
|
|
||||||
*/
|
|
||||||
static inline __attribute__ (( always_inline )) void
|
|
||||||
bigint_subtract_raw ( const uint64_t *subtrahend0, uint64_t *value0,
|
|
||||||
unsigned int size ) {
|
|
||||||
uint64_t *discard_subtrahend;
|
|
||||||
uint64_t *discard_value;
|
|
||||||
uint64_t discard_subtrahend_i;
|
|
||||||
uint64_t discard_value_i;
|
|
||||||
unsigned int discard_size;
|
|
||||||
unsigned int flag = 0;
|
|
||||||
|
|
||||||
discard_subtrahend = (uint64_t*) subtrahend0;
|
|
||||||
discard_value = value0;
|
|
||||||
discard_size = size;
|
|
||||||
|
|
||||||
do {
|
|
||||||
discard_subtrahend_i = *discard_subtrahend;
|
|
||||||
discard_subtrahend++;
|
|
||||||
discard_value_i = *discard_value;
|
|
||||||
|
|
||||||
discard_value_i = discard_value_i - discard_subtrahend_i - flag;
|
|
||||||
|
|
||||||
if ( *discard_value < (discard_subtrahend_i + flag)) {
|
|
||||||
flag = 1;
|
|
||||||
} else {
|
|
||||||
flag = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
*discard_value = discard_value_i;
|
|
||||||
|
|
||||||
discard_value++;
|
|
||||||
discard_size -= 1;
|
|
||||||
} while (discard_size != 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Rotate big integer left
|
|
||||||
*
|
|
||||||
* @v value0 Element 0 of big integer
|
|
||||||
* @v size Number of elements
|
|
||||||
*/
|
|
||||||
static inline __attribute__ (( always_inline )) void
|
|
||||||
bigint_rol_raw ( uint64_t *value0, unsigned int size ) {
|
|
||||||
uint64_t *discard_value;
|
|
||||||
uint64_t discard_value_i;
|
|
||||||
unsigned int discard_size;
|
|
||||||
uint64_t current_value_i;
|
|
||||||
unsigned int flag = 0;
|
|
||||||
|
|
||||||
discard_value = value0;
|
|
||||||
discard_size = size;
|
|
||||||
do {
|
|
||||||
discard_value_i = *discard_value;
|
|
||||||
current_value_i = discard_value_i;
|
|
||||||
|
|
||||||
discard_value_i += discard_value_i + flag;
|
|
||||||
|
|
||||||
if (discard_value_i < current_value_i) {
|
|
||||||
flag = 1;
|
|
||||||
} else {
|
|
||||||
flag = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
*discard_value = discard_value_i;
|
|
||||||
discard_value++;
|
|
||||||
discard_size -= 1;
|
|
||||||
} while ( discard_size != 0 );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Rotate big integer right
|
|
||||||
*
|
|
||||||
* @v value0 Element 0 of big integer
|
|
||||||
* @v size Number of elements
|
|
||||||
*/
|
|
||||||
static inline __attribute__ (( always_inline )) void
|
|
||||||
bigint_ror_raw ( uint64_t *value0, unsigned int size ) {
|
|
||||||
uint64_t *discard_value;
|
|
||||||
uint64_t discard_value_i;
|
|
||||||
uint64_t discard_value_j;
|
|
||||||
unsigned int discard_size;
|
|
||||||
|
|
||||||
discard_value = value0;
|
|
||||||
discard_size = size;
|
|
||||||
|
|
||||||
discard_value_j = 0;
|
|
||||||
|
|
||||||
do {
|
|
||||||
discard_size -= 1;
|
|
||||||
|
|
||||||
discard_value_i = *(discard_value + discard_size);
|
|
||||||
|
|
||||||
discard_value_j = (discard_value_j << 63) | (discard_value_i >> 1);
|
|
||||||
|
|
||||||
*(discard_value + discard_size) = discard_value_j;
|
|
||||||
|
|
||||||
discard_value_j = discard_value_i;
|
|
||||||
} while ( discard_size > 0 );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Test if big integer is equal to zero
|
|
||||||
*
|
|
||||||
* @v value0 Element 0 of big integer
|
|
||||||
* @v size Number of elements
|
|
||||||
* @ret is_zero Big integer is equal to zero
|
|
||||||
*/
|
|
||||||
static inline __attribute__ (( always_inline, pure )) int
|
|
||||||
bigint_is_zero_raw ( const uint64_t *value0, unsigned int size ) {
|
|
||||||
const uint64_t *value = value0;
|
|
||||||
uint64_t value_i;
|
|
||||||
|
|
||||||
do {
|
|
||||||
value_i = *(value++);
|
|
||||||
if ( value_i )
|
|
||||||
break;
|
|
||||||
} while ( --size );
|
|
||||||
|
|
||||||
return ( value_i == 0 );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Compare big integers
|
|
||||||
*
|
|
||||||
* @v value0 Element 0 of big integer
|
|
||||||
* @v reference0 Element 0 of reference big integer
|
|
||||||
* @v size Number of elements
|
|
||||||
* @ret geq Big integer is greater than or equal to the reference
|
|
||||||
*/
|
|
||||||
static inline __attribute__ (( always_inline, pure )) int
|
|
||||||
bigint_is_geq_raw ( const uint64_t *value0, const uint64_t *reference0,
|
|
||||||
unsigned int size ) {
|
|
||||||
const uint64_t *value = ( value0 + size );
|
|
||||||
const uint64_t *reference = ( reference0 + size );
|
|
||||||
uint64_t value_i;
|
|
||||||
uint64_t reference_i;
|
|
||||||
|
|
||||||
do {
|
|
||||||
value_i = *(--value);
|
|
||||||
reference_i = *(--reference);
|
|
||||||
if ( value_i != reference_i )
|
|
||||||
break;
|
|
||||||
} while ( --size );
|
|
||||||
|
|
||||||
return ( value_i >= reference_i );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Test if bit is set in big integer
|
|
||||||
*
|
|
||||||
* @v value0 Element 0 of big integer
|
|
||||||
* @v size Number of elements
|
|
||||||
* @v bit Bit to test
|
|
||||||
* @ret is_set Bit is set
|
|
||||||
*/
|
|
||||||
static inline __attribute__ (( always_inline )) int
|
|
||||||
bigint_bit_is_set_raw ( const uint64_t *value0, unsigned int size,
|
|
||||||
unsigned int bit ) {
|
|
||||||
const bigint_t ( size ) __attribute__ (( may_alias )) *value =
|
|
||||||
( ( const void * ) value0 );
|
|
||||||
unsigned int index = ( bit / ( 8 * sizeof ( value->element[0] ) ) );
|
|
||||||
unsigned int subindex = ( bit % ( 8 * sizeof ( value->element[0] ) ) );
|
|
||||||
|
|
||||||
return ( !! ( value->element[index] & ( 1UL << subindex ) ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Find highest bit set in big integer
|
|
||||||
*
|
|
||||||
* @v value0 Element 0 of big integer
|
|
||||||
* @v size Number of elements
|
|
||||||
* @ret max_bit Highest bit set + 1 (or 0 if no bits set)
|
|
||||||
*/
|
|
||||||
static inline __attribute__ (( always_inline )) int
|
|
||||||
bigint_max_set_bit_raw ( const uint64_t *value0, unsigned int size ) {
|
|
||||||
const uint64_t *value = ( value0 + size );
|
|
||||||
int max_bit = ( 8 * sizeof ( bigint_t ( size ) ) );
|
|
||||||
uint64_t value_i;
|
|
||||||
|
|
||||||
do {
|
|
||||||
value_i = *(--value);
|
|
||||||
max_bit -= ( 64 - fls ( value_i ) );
|
|
||||||
if ( value_i )
|
|
||||||
break;
|
|
||||||
} while ( --size );
|
|
||||||
|
|
||||||
return max_bit;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Grow big integer
|
|
||||||
*
|
|
||||||
* @v source0 Element 0 of source big integer
|
|
||||||
* @v source_size Number of elements in source big integer
|
|
||||||
* @v dest0 Element 0 of destination big integer
|
|
||||||
* @v dest_size Number of elements in destination big integer
|
|
||||||
*/
|
|
||||||
static inline __attribute__ (( always_inline )) void
|
|
||||||
bigint_grow_raw ( const uint64_t *source0, unsigned int source_size,
|
|
||||||
uint64_t *dest0, unsigned int dest_size ) {
|
|
||||||
unsigned int pad_size = ( dest_size - source_size );
|
|
||||||
|
|
||||||
memcpy ( dest0, source0, sizeof ( bigint_t ( source_size ) ) );
|
|
||||||
memset ( ( dest0 + source_size ), 0, sizeof ( bigint_t ( pad_size ) ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Shrink big integer
|
|
||||||
*
|
|
||||||
* @v source0 Element 0 of source big integer
|
|
||||||
* @v source_size Number of elements in source big integer
|
|
||||||
* @v dest0 Element 0 of destination big integer
|
|
||||||
* @v dest_size Number of elements in destination big integer
|
|
||||||
*/
|
|
||||||
static inline __attribute__ (( always_inline )) void
|
|
||||||
bigint_shrink_raw ( const uint64_t *source0, unsigned int source_size __unused,
|
|
||||||
uint64_t *dest0, unsigned int dest_size ) {
|
|
||||||
|
|
||||||
memcpy ( dest0, source0, sizeof ( bigint_t ( dest_size ) ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Finalise big integer
|
|
||||||
*
|
|
||||||
* @v value0 Element 0 of big integer to finalise
|
|
||||||
* @v size Number of elements
|
|
||||||
* @v out Output buffer
|
|
||||||
* @v len Length of output buffer
|
|
||||||
*/
|
|
||||||
static inline __attribute__ (( always_inline )) void
|
|
||||||
bigint_done_raw ( const uint64_t *value0, unsigned int size __unused,
|
|
||||||
void *out, size_t len ) {
|
|
||||||
const uint8_t *value_byte = ( ( const void * ) value0 );
|
|
||||||
uint8_t *out_byte = ( out + len );
|
|
||||||
|
|
||||||
/* Copy raw data in reverse order */
|
|
||||||
while ( len-- )
|
|
||||||
*(--out_byte) = *(value_byte++);
|
|
||||||
}
|
|
||||||
|
|
||||||
extern void bigint_multiply_raw ( const uint64_t *multiplicand0,
|
|
||||||
const uint64_t *multiplier0,
|
|
||||||
uint64_t *value0, unsigned int size );
|
|
||||||
|
|
||||||
#endif /* _BITS_BIGINT_H */
|
|
||||||
@@ -1,102 +0,0 @@
|
|||||||
#ifndef _BITS_BITOPS_H
|
|
||||||
#define _BITS_BITOPS_H
|
|
||||||
|
|
||||||
/** @file
|
|
||||||
*
|
|
||||||
* loongArch bit operations
|
|
||||||
*
|
|
||||||
* We perform atomic bit set and bit clear operations using "ll"
|
|
||||||
* and "sc". We use the output constraint to inform the
|
|
||||||
* compiler that any memory from the start of the bit field up to and
|
|
||||||
* including the byte containing the bit may be modified. (This is
|
|
||||||
* overkill but shouldn't matter in practice since we're unlikely to
|
|
||||||
* subsequently read other bits from the same bit field.)
|
|
||||||
*/
|
|
||||||
|
|
||||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Test and set bit atomically
|
|
||||||
*
|
|
||||||
* @v bit Bit to set
|
|
||||||
* @v bits Bit field
|
|
||||||
* @ret old Old value of bit (zero or non-zero)
|
|
||||||
*/
|
|
||||||
static inline __attribute__ (( always_inline )) int
|
|
||||||
test_and_set_bit ( unsigned int bit, volatile void *bits ) {
|
|
||||||
unsigned int index = ( bit / 64 );
|
|
||||||
unsigned int offset = ( bit % 64 );
|
|
||||||
volatile uint64_t *qword = ( ( ( volatile uint64_t * ) bits ) + index );
|
|
||||||
uint64_t mask = ( 1UL << offset );
|
|
||||||
uint64_t old;
|
|
||||||
uint64_t new;
|
|
||||||
|
|
||||||
__asm__ __volatile__ ( "1: \n\t"
|
|
||||||
"ll.d %[old], %[qword] \n\t"
|
|
||||||
"or %[new], %[old], %[mask] \n\t"
|
|
||||||
"sc.d %[new], %[qword] \n\t"
|
|
||||||
"beqz %[new], 1b \n\t"
|
|
||||||
: [old] "=&r" ( old ),
|
|
||||||
[new] "=&r" ( new ),
|
|
||||||
[qword] "+m" ( *qword )
|
|
||||||
: [mask] "r" ( mask )
|
|
||||||
: "cc", "memory");
|
|
||||||
return ( !! ( old & mask ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Test and clear bit atomically
|
|
||||||
*
|
|
||||||
* @v bit Bit to set
|
|
||||||
* @v bits Bit field
|
|
||||||
* @ret old Old value of bit (zero or non-zero)
|
|
||||||
*/
|
|
||||||
static inline __attribute__ (( always_inline )) int
|
|
||||||
test_and_clear_bit ( unsigned int bit, volatile void *bits ) {
|
|
||||||
unsigned int index = ( bit / 64 );
|
|
||||||
unsigned int offset = ( bit % 64 );
|
|
||||||
volatile uint64_t *qword = ( ( ( volatile uint64_t * ) bits ) + index );
|
|
||||||
uint64_t mask = ( 1UL << offset );
|
|
||||||
uint64_t old;
|
|
||||||
uint64_t new;
|
|
||||||
|
|
||||||
__asm__ __volatile__ ( "1: \n\t"
|
|
||||||
"ll.d %[old], %[qword] \n\t"
|
|
||||||
"andn %[new], %[old], %[mask] \n\t"
|
|
||||||
"sc.d %[new], %[qword] \n\t"
|
|
||||||
"beqz %[new], 1b \n\t"
|
|
||||||
: [old] "=&r" ( old ),
|
|
||||||
[new] "=&r" ( new ),
|
|
||||||
[qword] "+m" ( *qword )
|
|
||||||
: [mask] "r" ( mask )
|
|
||||||
: "cc", "memory");
|
|
||||||
return ( !! ( old & mask ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set bit atomically
|
|
||||||
*
|
|
||||||
* @v bit Bit to set
|
|
||||||
* @v bits Bit field
|
|
||||||
*/
|
|
||||||
static inline __attribute__ (( always_inline )) void
|
|
||||||
set_bit ( unsigned int bit, volatile void *bits ) {
|
|
||||||
|
|
||||||
test_and_set_bit ( bit, bits );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Clear bit atomically
|
|
||||||
*
|
|
||||||
* @v bit Bit to set
|
|
||||||
* @v bits Bit field
|
|
||||||
*/
|
|
||||||
static inline __attribute__ (( always_inline )) void
|
|
||||||
clear_bit ( unsigned int bit, volatile void *bits ) {
|
|
||||||
|
|
||||||
test_and_clear_bit ( bit, bits );
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* _BITS_BITOPS_H */
|
|
||||||
@@ -1,47 +0,0 @@
|
|||||||
#ifndef _BITS_BYTESWAP_H
|
|
||||||
#define _BITS_BYTESWAP_H
|
|
||||||
|
|
||||||
/** @file
|
|
||||||
*
|
|
||||||
* Byte-order swapping functions
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
|
||||||
|
|
||||||
static inline __attribute__ (( always_inline, const )) uint16_t
|
|
||||||
__bswap_variable_16 ( uint16_t x ) {
|
|
||||||
__asm__ ( "revb.2h %0, %1" : "=r" ( x ) : "r" ( x ) );
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline __attribute__ (( always_inline )) void
|
|
||||||
__bswap_16s ( uint16_t *x ) {
|
|
||||||
*x = __bswap_variable_16 ( *x );
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline __attribute__ (( always_inline, const )) uint32_t
|
|
||||||
__bswap_variable_32 ( uint32_t x ) {
|
|
||||||
__asm__ ( "revb.2w %0, %1" : "=r" ( x ) : "r" ( x ) );
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline __attribute__ (( always_inline )) void
|
|
||||||
__bswap_32s ( uint32_t *x ) {
|
|
||||||
*x = __bswap_variable_32 ( *x );
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline __attribute__ (( always_inline, const )) uint64_t
|
|
||||||
__bswap_variable_64 ( uint64_t x ) {
|
|
||||||
__asm__ ( "revb.d %0, %1" : "=r" ( x ) : "r" ( x ) );
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline __attribute__ (( always_inline )) void
|
|
||||||
__bswap_64s ( uint64_t *x ) {
|
|
||||||
*x = __bswap_variable_64 ( *x );
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
#ifndef _BITS_COMPILER_H
|
|
||||||
#define _BITS_COMPILER_H
|
|
||||||
|
|
||||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
|
||||||
|
|
||||||
/** Dummy relocation type */
|
|
||||||
#define RELOC_TYPE_NONE R_LARCH_NONE
|
|
||||||
|
|
||||||
#ifndef ASSEMBLY
|
|
||||||
|
|
||||||
/** Unprefixed constant operand modifier */
|
|
||||||
#define ASM_NO_PREFIX "a"
|
|
||||||
|
|
||||||
#define __asmcall
|
|
||||||
#define __libgcc
|
|
||||||
|
|
||||||
#endif /* ASSEMBLY */
|
|
||||||
|
|
||||||
#endif /*_BITS_COMPILER_H */
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
#ifndef _BITS_ENDIAN_H
|
|
||||||
#define _BITS_ENDIAN_H
|
|
||||||
|
|
||||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
|
||||||
|
|
||||||
#define __BYTE_ORDER __LITTLE_ENDIAN
|
|
||||||
|
|
||||||
#endif /* _BITS_ENDIAN_H */
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
#ifndef _BITS_ERRFILE_H
|
|
||||||
#define _BITS_ERRFILE_H
|
|
||||||
|
|
||||||
/** @file
|
|
||||||
*
|
|
||||||
* LoongArch64-specific error file identifiers
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @addtogroup errfile Error file identifiers
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @} */
|
|
||||||
|
|
||||||
#endif /* _BITS_ERRFILE_H */
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
#ifndef _BITS_HYPERV_H
|
|
||||||
#define _BITS_HYPERV_H
|
|
||||||
|
|
||||||
/** @file
|
|
||||||
*
|
|
||||||
* Hyper-V interface
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
|
||||||
|
|
||||||
#endif /* _BITS_HYPERV_H */
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
#ifndef _BITS_IO_H
|
|
||||||
#define _BITS_IO_H
|
|
||||||
|
|
||||||
/** @file
|
|
||||||
*
|
|
||||||
* LoongArch64-specific I/O API implementations
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
|
||||||
|
|
||||||
/** Page shift */
|
|
||||||
#define PAGE_SHIFT 12
|
|
||||||
|
|
||||||
#include <ipxe/loong64_io.h>
|
|
||||||
|
|
||||||
#endif /* _BITS_IO_H */
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
#ifndef _BITS_IOMAP_H
|
|
||||||
#define _BITS_IOMAP_H
|
|
||||||
|
|
||||||
/** @file
|
|
||||||
*
|
|
||||||
* LoongArch64-specific I/O mapping API implementations
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
|
||||||
|
|
||||||
#endif /* _BITS_IOMAP_H */
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
#ifndef _BITS_NAP_H
|
|
||||||
#define _BITS_NAP_H
|
|
||||||
|
|
||||||
/** @file
|
|
||||||
*
|
|
||||||
* LoongArch64-specific CPU sleeping API implementations
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
|
||||||
|
|
||||||
#include <ipxe/efi/efiloong64_nap.h>
|
|
||||||
|
|
||||||
#endif /* _BITS_NAP_H */
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
#ifndef _BITS_PCI_IO_H
|
|
||||||
#define _BITS_PCI_IO_H
|
|
||||||
|
|
||||||
/** @file
|
|
||||||
*
|
|
||||||
* LoongArch64-specific PCI I/O API implementations
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
|
||||||
|
|
||||||
#endif /* _BITS_PCI_IO_H */
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
#ifndef _BITS_PROFILE_H
|
|
||||||
#define _BITS_PROFILE_H
|
|
||||||
|
|
||||||
/** @file
|
|
||||||
*
|
|
||||||
* Profiling
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get profiling timestamp
|
|
||||||
*
|
|
||||||
* @ret timestamp Timestamp
|
|
||||||
*/
|
|
||||||
static inline __attribute__ (( always_inline )) uint64_t
|
|
||||||
profile_timestamp ( void ) {
|
|
||||||
uint64_t cycles;
|
|
||||||
|
|
||||||
/* Read cycle counter */
|
|
||||||
__asm__ __volatile__ ( "rdtime.d %0, $zero\n\t" : "=r" ( cycles ) );
|
|
||||||
return cycles;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* _BITS_PROFILE_H */
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
#ifndef _BITS_REBOOT_H
|
|
||||||
#define _BITS_REBOOT_H
|
|
||||||
|
|
||||||
/** @file
|
|
||||||
*
|
|
||||||
* LoongArch64-specific reboot API implementations
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
|
||||||
|
|
||||||
#endif /* _BITS_REBOOT_H */
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
#ifndef _BITS_SANBOOT_H
|
|
||||||
#define _BITS_SANBOOT_H
|
|
||||||
|
|
||||||
/** @file
|
|
||||||
*
|
|
||||||
* LoongArch64-specific sanboot API implementations
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
|
||||||
|
|
||||||
#endif /* _BITS_SANBOOT_H */
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
#ifndef _BITS_SMBIOS_H
|
|
||||||
#define _BITS_SMBIOS_H
|
|
||||||
|
|
||||||
/** @file
|
|
||||||
*
|
|
||||||
* LoongArch64-specific SMBIOS API implementations
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
|
||||||
|
|
||||||
#endif /* _BITS_SMBIOS_H */
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
#ifndef _BITS_STDINT_H
|
|
||||||
#define _BITS_STDINT_H
|
|
||||||
|
|
||||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
|
||||||
|
|
||||||
typedef __SIZE_TYPE__ size_t;
|
|
||||||
typedef signed long ssize_t;
|
|
||||||
typedef signed long off_t;
|
|
||||||
|
|
||||||
typedef unsigned char uint8_t;
|
|
||||||
typedef unsigned short uint16_t;
|
|
||||||
typedef unsigned int uint32_t;
|
|
||||||
typedef unsigned long long uint64_t;
|
|
||||||
|
|
||||||
typedef signed char int8_t;
|
|
||||||
typedef signed short int16_t;
|
|
||||||
typedef signed int int32_t;
|
|
||||||
typedef signed long long int64_t;
|
|
||||||
|
|
||||||
typedef unsigned long physaddr_t;
|
|
||||||
typedef unsigned long intptr_t;
|
|
||||||
|
|
||||||
#endif /* _BITS_STDINT_H */
|
|
||||||
@@ -1,61 +0,0 @@
|
|||||||
#ifndef _BITS_STRING_H
|
|
||||||
#define _BITS_STRING_H
|
|
||||||
|
|
||||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
|
||||||
|
|
||||||
/** @file
|
|
||||||
*
|
|
||||||
* String functions
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
extern void loong64_bzero ( void *dest, size_t len );
|
|
||||||
extern void loong64_memset ( void *dest, size_t len, int character );
|
|
||||||
extern void loong64_memcpy ( void *dest, const void *src, size_t len );
|
|
||||||
extern void loong64_memmove_forwards ( void *dest, const void *src, size_t len );
|
|
||||||
extern void loong64_memmove_backwards ( void *dest, const void *src, size_t len );
|
|
||||||
extern void loong64_memmove ( void *dest, const void *src, size_t len );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Fill memory region
|
|
||||||
*
|
|
||||||
* @v dest Destination region
|
|
||||||
* @v character Fill character
|
|
||||||
* @v len Length
|
|
||||||
* @ret dest Destination region
|
|
||||||
*/
|
|
||||||
static inline __attribute__ (( always_inline )) void *
|
|
||||||
memset ( void *dest, int character, size_t len ) {
|
|
||||||
loong64_memset ( dest, len, character );
|
|
||||||
return dest;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Copy memory region
|
|
||||||
*
|
|
||||||
* @v dest Destination region
|
|
||||||
* @v src Source region
|
|
||||||
* @v len Length
|
|
||||||
* @ret dest Destination region
|
|
||||||
*/
|
|
||||||
static inline __attribute__ (( always_inline )) void *
|
|
||||||
memcpy ( void *dest, const void *src, size_t len ) {
|
|
||||||
loong64_memcpy ( dest, src, len );
|
|
||||||
return dest;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Copy (possibly overlapping) memory region
|
|
||||||
*
|
|
||||||
* @v dest Destination region
|
|
||||||
* @v src Source region
|
|
||||||
* @v len Length
|
|
||||||
* @ret dest Destination region
|
|
||||||
*/
|
|
||||||
static inline __attribute__ (( always_inline )) void *
|
|
||||||
memmove ( void *dest, const void *src, size_t len ) {
|
|
||||||
loong64_memmove ( dest, src, len );
|
|
||||||
return dest;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* _BITS_STRING_H */
|
|
||||||
@@ -1,69 +0,0 @@
|
|||||||
#ifndef _BITS_STRINGS_H
|
|
||||||
#define _BITS_STRINGS_H
|
|
||||||
|
|
||||||
/** @file
|
|
||||||
*
|
|
||||||
* String functions
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Find first (i.e. least significant) set bit
|
|
||||||
*
|
|
||||||
* @v value Value
|
|
||||||
* @ret lsb Least significant bit set in value (LSB=1), or zero
|
|
||||||
*/
|
|
||||||
static inline __attribute__ (( always_inline )) int __ffsll ( long long value ){
|
|
||||||
unsigned long long bits = value;
|
|
||||||
unsigned long long lsb;
|
|
||||||
unsigned int lz;
|
|
||||||
|
|
||||||
/* Extract least significant set bit */
|
|
||||||
lsb = ( bits & -bits );
|
|
||||||
|
|
||||||
/* Count number of leading zeroes before LSB */
|
|
||||||
__asm__ ( "clz.d %0, %1" : "=r" ( lz ) : "r" ( lsb ) );
|
|
||||||
|
|
||||||
return ( 64 - lz );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Find first (i.e. least significant) set bit
|
|
||||||
*
|
|
||||||
* @v value Value
|
|
||||||
* @ret lsb Least significant bit set in value (LSB=1), or zero
|
|
||||||
*/
|
|
||||||
static inline __attribute__ (( always_inline )) int __ffsl ( long value ) {
|
|
||||||
|
|
||||||
return __ffsll ( value );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Find last (i.e. most significant) set bit
|
|
||||||
*
|
|
||||||
* @v value Value
|
|
||||||
* @ret msb Most significant bit set in value (LSB=1), or zero
|
|
||||||
*/
|
|
||||||
static inline __attribute__ (( always_inline )) int __flsll ( long long value ){
|
|
||||||
unsigned int lz;
|
|
||||||
|
|
||||||
/* Count number of leading zeroes */
|
|
||||||
__asm__ ( "clz.d %0, %1" : "=r" ( lz ) : "r" ( value ) );
|
|
||||||
|
|
||||||
return ( 64 - lz );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Find last (i.e. most significant) set bit
|
|
||||||
*
|
|
||||||
* @v value Value
|
|
||||||
* @ret msb Most significant bit set in value (LSB=1), or zero
|
|
||||||
*/
|
|
||||||
static inline __attribute__ (( always_inline )) int __flsl ( long value ) {
|
|
||||||
|
|
||||||
return __flsll ( value );
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* _BITS_STRINGS_H */
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
#ifndef _BITS_TCPIP_H
|
|
||||||
#define _BITS_TCPIP_H
|
|
||||||
|
|
||||||
/** @file
|
|
||||||
*
|
|
||||||
* Transport-network layer interface
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
|
||||||
|
|
||||||
static inline __attribute__ (( always_inline )) uint16_t
|
|
||||||
tcpip_continue_chksum ( uint16_t partial, const void *data, size_t len ) {
|
|
||||||
|
|
||||||
/* Not yet optimised */
|
|
||||||
return generic_tcpip_continue_chksum ( partial, data, len );
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* _BITS_TCPIP_H */
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
#ifndef _BITS_TIME_H
|
|
||||||
#define _BITS_TIME_H
|
|
||||||
|
|
||||||
/** @file
|
|
||||||
*
|
|
||||||
* LoongArch64-specific time API implementations
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
|
||||||
|
|
||||||
#endif /* _BITS_TIME_H */
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
#ifndef _BITS_UACCESS_H
|
|
||||||
#define _BITS_UACCESS_H
|
|
||||||
|
|
||||||
/** @file
|
|
||||||
*
|
|
||||||
* LoongArch64-specific user access API implementations
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
|
||||||
|
|
||||||
#endif /* _BITS_UACCESS_H */
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
#ifndef _BITS_UART_H
|
|
||||||
#define _BITS_UART_H
|
|
||||||
|
|
||||||
/** @file
|
|
||||||
*
|
|
||||||
* 16550-compatible UART
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
|
||||||
|
|
||||||
#endif /* _BITS_UART_H */
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
#ifndef _BITS_UMALLOC_H
|
|
||||||
#define _BITS_UMALLOC_H
|
|
||||||
|
|
||||||
/** @file
|
|
||||||
*
|
|
||||||
* LoongArch64-specific user memory allocation API implementations
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
|
||||||
|
|
||||||
#endif /* _BITS_UMALLOC_H */
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
#ifndef _BITS_XEN_H
|
|
||||||
#define _BITS_XEN_H
|
|
||||||
|
|
||||||
/** @file
|
|
||||||
*
|
|
||||||
* Xen interface
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
|
||||||
|
|
||||||
#include <ipxe/nonxen.h>
|
|
||||||
|
|
||||||
#endif /* _BITS_XEN_H */
|
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
#ifndef GDBMACH_H
|
|
||||||
#define GDBMACH_H
|
|
||||||
|
|
||||||
/** @file
|
|
||||||
*
|
|
||||||
* GDB architecture specifics
|
|
||||||
*
|
|
||||||
* This file declares functions for manipulating the machine state and
|
|
||||||
* debugging context.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
typedef unsigned long gdbreg_t;
|
|
||||||
|
|
||||||
/* Register snapshot */
|
|
||||||
enum {
|
|
||||||
/* Not yet implemented */
|
|
||||||
GDBMACH_NREGS,
|
|
||||||
};
|
|
||||||
|
|
||||||
#define GDBMACH_SIZEOF_REGS ( GDBMACH_NREGS * sizeof ( gdbreg_t ) )
|
|
||||||
|
|
||||||
static inline void gdbmach_set_pc ( gdbreg_t *regs, gdbreg_t pc ) {
|
|
||||||
/* Not yet implemented */
|
|
||||||
( void ) regs;
|
|
||||||
( void ) pc;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void gdbmach_set_single_step ( gdbreg_t *regs, int step ) {
|
|
||||||
/* Not yet implemented */
|
|
||||||
( void ) regs;
|
|
||||||
( void ) step;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void gdbmach_breakpoint ( void ) {
|
|
||||||
/* Not yet implemented */
|
|
||||||
}
|
|
||||||
|
|
||||||
extern int gdbmach_set_breakpoint ( int type, unsigned long addr, size_t len,
|
|
||||||
int enable );
|
|
||||||
extern void gdbmach_init ( void );
|
|
||||||
|
|
||||||
#endif /* GDBMACH_H */
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
#ifndef _IPXE_EFI_DHCPARCH_H
|
|
||||||
#define _IPXE_EFI_DHCPARCH_H
|
|
||||||
|
|
||||||
/** @file
|
|
||||||
*
|
|
||||||
* DHCP client architecture definitions
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
|
||||||
|
|
||||||
#include <ipxe/dhcp.h>
|
|
||||||
|
|
||||||
/** DHCP client architecture */
|
|
||||||
#define DHCP_ARCH_CLIENT_ARCHITECTURE DHCP_CLIENT_ARCHITECTURE_LOONG64
|
|
||||||
|
|
||||||
/** DHCP client network device interface */
|
|
||||||
#define DHCP_ARCH_CLIENT_NDI 1 /* UNDI */ , 3, 10 /* v3.10 */
|
|
||||||
|
|
||||||
#endif /* _IPXE_EFI_DHCPARCH_H */
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
#ifndef _IPXE_EFILOONG64_NAP_H
|
|
||||||
#define _IPXE_EFILOONG64_NAP_H
|
|
||||||
|
|
||||||
/** @file
|
|
||||||
*
|
|
||||||
* EFI CPU sleeping
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
|
||||||
|
|
||||||
#ifdef NAP_EFILOONG64
|
|
||||||
#define NAP_PREFIX_efiloong64
|
|
||||||
#else
|
|
||||||
#define NAP_PREFIX_efiloong64 __efiloong64_
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* _IPXE_EFILOONG64_NAP_H */
|
|
||||||
@@ -1,82 +0,0 @@
|
|||||||
#ifndef _IPXE_LOONG64_IO_H
|
|
||||||
#define _IPXE_LOONG64_IO_H
|
|
||||||
|
|
||||||
/** @file
|
|
||||||
*
|
|
||||||
* iPXE I/O API for LoongArch64
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
|
||||||
|
|
||||||
#ifdef IOAPI_LOONG64
|
|
||||||
#define IOAPI_PREFIX_loong64
|
|
||||||
#else
|
|
||||||
#define IOAPI_PREFIX_loong64 __loong64_
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <ipxe/dummy_pio.h>
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Memory space mappings
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Physical<->Bus address mappings
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
static inline __always_inline unsigned long
|
|
||||||
IOAPI_INLINE ( loong64, phys_to_bus ) ( unsigned long phys_addr ) {
|
|
||||||
return phys_addr;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline __always_inline unsigned long
|
|
||||||
IOAPI_INLINE ( loong64, bus_to_phys ) ( unsigned long bus_addr ) {
|
|
||||||
return bus_addr;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* MMIO reads and writes up to native word size
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define LOONG64_READX( _suffix, _type, _insn_suffix ) \
|
|
||||||
static inline __always_inline _type \
|
|
||||||
IOAPI_INLINE ( loong64, read ## _suffix ) ( volatile _type *io_addr ) { \
|
|
||||||
_type data; \
|
|
||||||
__asm__ __volatile__ ( "ld." _insn_suffix " %0, %1" \
|
|
||||||
: "=r" ( data ) : "m" ( *io_addr ) ); \
|
|
||||||
return data; \
|
|
||||||
}
|
|
||||||
LOONG64_READX ( b, uint8_t, "bu");
|
|
||||||
LOONG64_READX ( w, uint16_t, "hu");
|
|
||||||
LOONG64_READX ( l, uint32_t, "wu");
|
|
||||||
LOONG64_READX ( q, uint64_t, "d");
|
|
||||||
|
|
||||||
#define LOONG64_WRITEX( _suffix, _type, _insn_suffix ) \
|
|
||||||
static inline __always_inline void \
|
|
||||||
IOAPI_INLINE ( loong64, write ## _suffix ) ( _type data, \
|
|
||||||
volatile _type *io_addr ) { \
|
|
||||||
__asm__ __volatile__ ( "st." _insn_suffix " %0, %1" \
|
|
||||||
: : "r" ( data ), "m" ( *io_addr ) ); \
|
|
||||||
}
|
|
||||||
LOONG64_WRITEX ( b, uint8_t, "b");
|
|
||||||
LOONG64_WRITEX ( w, uint16_t, "h");
|
|
||||||
LOONG64_WRITEX ( l, uint32_t, "w" );
|
|
||||||
LOONG64_WRITEX ( q, uint64_t, "d");
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Memory barrier
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
static inline __always_inline void
|
|
||||||
IOAPI_INLINE ( loong64, mb ) ( void ) {
|
|
||||||
__asm__ __volatile__ ( "dbar 0" );
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Dummy PIO */
|
|
||||||
DUMMY_PIO ( loong64 );
|
|
||||||
|
|
||||||
#endif /* _IPXE_LOONG64_IO_H */
|
|
||||||
@@ -1,53 +0,0 @@
|
|||||||
#ifndef LIMITS_H
|
|
||||||
#define LIMITS_H 1
|
|
||||||
|
|
||||||
/* Number of bits in a `char' */
|
|
||||||
#define CHAR_BIT 8
|
|
||||||
|
|
||||||
/* Minimum and maximum values a `signed char' can hold */
|
|
||||||
#define SCHAR_MIN (-128)
|
|
||||||
#define SCHAR_MAX 127
|
|
||||||
|
|
||||||
/* Maximum value an `unsigned char' can hold. (Minimum is 0.) */
|
|
||||||
#define UCHAR_MAX 255
|
|
||||||
|
|
||||||
/* Minimum and maximum values a `char' can hold */
|
|
||||||
#define CHAR_MIN SCHAR_MIN
|
|
||||||
#define CHAR_MAX SCHAR_MAX
|
|
||||||
|
|
||||||
/* Minimum and maximum values a `signed short int' can hold */
|
|
||||||
#define SHRT_MIN (-32768)
|
|
||||||
#define SHRT_MAX 32767
|
|
||||||
|
|
||||||
/* Maximum value an `unsigned short' can hold. (Minimum is 0.) */
|
|
||||||
#define USHRT_MAX 65535
|
|
||||||
|
|
||||||
/* Minimum and maximum values a `signed int' can hold */
|
|
||||||
#define INT_MIN (-INT_MAX - 1)
|
|
||||||
#define INT_MAX 2147483647
|
|
||||||
|
|
||||||
/* Maximum value an `unsigned int' can hold. (Minimum is 0.) */
|
|
||||||
#define UINT_MAX 4294967295U
|
|
||||||
|
|
||||||
/* Minimum and maximum values a `signed int' can hold */
|
|
||||||
#define INT_MAX 2147483647
|
|
||||||
#define INT_MIN (-INT_MAX - 1)
|
|
||||||
|
|
||||||
/* Maximum value an `unsigned int' can hold. (Minimum is 0.) */
|
|
||||||
#define UINT_MAX 4294967295U
|
|
||||||
|
|
||||||
/* Minimum and maximum values a `signed long' can hold */
|
|
||||||
#define LONG_MAX 9223372036854775807L
|
|
||||||
#define LONG_MIN (-LONG_MAX - 1L)
|
|
||||||
|
|
||||||
/* Maximum value an `unsigned long' can hold. (Minimum is 0.) */
|
|
||||||
#define ULONG_MAX 18446744073709551615UL
|
|
||||||
|
|
||||||
/* Minimum and maximum values a `signed long long' can hold */
|
|
||||||
#define LLONG_MAX 9223372036854775807LL
|
|
||||||
#define LLONG_MIN (-LONG_MAX - 1LL)
|
|
||||||
|
|
||||||
/* Maximum value an `unsigned long long' can hold. (Minimum is 0.) */
|
|
||||||
#define ULLONG_MAX 18446744073709551615ULL
|
|
||||||
|
|
||||||
#endif /* LIMITS_H */
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
#ifndef _SETJMP_H
|
|
||||||
#define _SETJMP_H
|
|
||||||
|
|
||||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
/** jump buffer env*/
|
|
||||||
typedef struct {
|
|
||||||
uint64_t s0;
|
|
||||||
uint64_t s1;
|
|
||||||
uint64_t s2;
|
|
||||||
uint64_t s3;
|
|
||||||
uint64_t s4;
|
|
||||||
uint64_t s5;
|
|
||||||
uint64_t s6;
|
|
||||||
uint64_t s7;
|
|
||||||
uint64_t s8;
|
|
||||||
|
|
||||||
uint64_t fp;
|
|
||||||
uint64_t sp;
|
|
||||||
uint64_t ra;
|
|
||||||
} jmp_buf[1];
|
|
||||||
|
|
||||||
extern int __asmcall __attribute__ (( returns_twice ))
|
|
||||||
setjmp ( jmp_buf env );
|
|
||||||
|
|
||||||
extern void __asmcall __attribute__ (( noreturn ))
|
|
||||||
longjmp ( jmp_buf env, int val );
|
|
||||||
|
|
||||||
#endif /* _SETJMP_H */
|
|
||||||
@@ -1,53 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2023, Xiaotian Wu <wuxiaotian@loongson.cn>
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public License as
|
|
||||||
* published by the Free Software Foundation; either version 2 of the
|
|
||||||
* License, or any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful, but
|
|
||||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
|
||||||
* 02110-1301, USA.
|
|
||||||
*
|
|
||||||
* You can also choose to distribute this program under the terms of
|
|
||||||
* the Unmodified Binary Distribution Licence (as given in the file
|
|
||||||
* COPYING.UBDL), provided that you have satisfied its requirements.
|
|
||||||
*/
|
|
||||||
|
|
||||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
|
||||||
|
|
||||||
#include <ipxe/nap.h>
|
|
||||||
#include <ipxe/efi/efi.h>
|
|
||||||
|
|
||||||
/** @file
|
|
||||||
*
|
|
||||||
* iPXE CPU sleeping API for EFI
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sleep until next interrupt
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
static void efiloong64_cpu_nap ( void ) {
|
|
||||||
/*
|
|
||||||
* I can't find any EFI API that allows us to put the CPU to
|
|
||||||
* sleep. The CpuSleep() function is defined in CpuLib.h, but
|
|
||||||
* isn't part of any exposed protocol so we have no way to
|
|
||||||
* call it.
|
|
||||||
*
|
|
||||||
* The EFI shell doesn't seem to bother sleeping the CPU; it
|
|
||||||
* just sits there idly burning power.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
__asm__ __volatile__ ( "idle 0" );
|
|
||||||
}
|
|
||||||
|
|
||||||
PROVIDE_NAP ( efiloong64, cpu_nap, efiloong64_cpu_nap );
|
|
||||||
@@ -13,13 +13,6 @@ LDSCRIPT_PREFIX = arch/x86/scripts/prefixonly.lds
|
|||||||
#
|
#
|
||||||
LDFLAGS += -N --no-check-sections
|
LDFLAGS += -N --no-check-sections
|
||||||
|
|
||||||
# Do not warn about RWX segments (required by most prefixes)
|
|
||||||
#
|
|
||||||
WRWX_TEST = $(LD) --warn-rwx-segments --version 2>&1 > /dev/null
|
|
||||||
WRWX_FLAGS := $(shell [ -z "`$(WRWX_TEST)`" ] && \
|
|
||||||
$(ECHO) '--no-warn-rwx-segments')
|
|
||||||
LDFLAGS += $(WRWX_FLAGS)
|
|
||||||
|
|
||||||
# Media types.
|
# Media types.
|
||||||
#
|
#
|
||||||
MEDIA += rom
|
MEDIA += rom
|
||||||
@@ -61,15 +54,9 @@ LIST_NAME_mrom := ROMS
|
|||||||
LIST_NAME_pcirom := ROMS
|
LIST_NAME_pcirom := ROMS
|
||||||
LIST_NAME_isarom := ROMS
|
LIST_NAME_isarom := ROMS
|
||||||
|
|
||||||
# ISO images
|
# ISO or FAT filesystem images
|
||||||
NON_AUTO_MEDIA += iso
|
NON_AUTO_MEDIA += iso
|
||||||
$(BIN)/%.iso : $(BIN)/%.lkrn util/genfsimg
|
$(BIN)/%.iso $(BIN)/%.sdsk: $(BIN)/%.lkrn util/genfsimg
|
||||||
$(QM)$(ECHO) " [GENFSIMG] $@"
|
|
||||||
$(Q)util/genfsimg -o $@ $<
|
|
||||||
|
|
||||||
# FAT filesystem images (via syslinux)
|
|
||||||
NON_AUTO_MEDIA += sdsk
|
|
||||||
$(BIN)/%.sdsk : $(BIN)/%.lkrn util/genfsimg
|
|
||||||
$(QM)$(ECHO) " [GENFSIMG] $@"
|
$(QM)$(ECHO) " [GENFSIMG] $@"
|
||||||
$(Q)util/genfsimg -o $@ $<
|
$(Q)util/genfsimg -o $@ $<
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,6 @@
|
|||||||
|
|
||||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
||||||
|
|
||||||
.section ".note.GNU-stack", "", @progbits
|
|
||||||
.text
|
.text
|
||||||
.arch i386
|
.arch i386
|
||||||
.code16
|
.code16
|
||||||
|
|||||||
@@ -1,103 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2023 Michael Brown <mbrown@fensystems.co.uk>.
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public License as
|
|
||||||
* published by the Free Software Foundation; either version 2 of the
|
|
||||||
* License, or any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful, but
|
|
||||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
|
||||||
* 02110-1301, USA.
|
|
||||||
*
|
|
||||||
* You can also choose to distribute this program under the terms of
|
|
||||||
* the Unmodified Binary Distribution Licence (as given in the file
|
|
||||||
* COPYING.UBDL), provided that you have satisfied its requirements.
|
|
||||||
*/
|
|
||||||
|
|
||||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
|
||||||
|
|
||||||
/** @file
|
|
||||||
*
|
|
||||||
* Hardware random number generator
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
#include <ipxe/cpuid.h>
|
|
||||||
#include <ipxe/entropy.h>
|
|
||||||
#include <ipxe/drbg.h>
|
|
||||||
|
|
||||||
struct entropy_source rdrand_entropy __entropy_source ( ENTROPY_PREFERRED );
|
|
||||||
|
|
||||||
/** Number of times to retry RDRAND instruction */
|
|
||||||
#define RDRAND_RETRY_COUNT 16
|
|
||||||
|
|
||||||
/** Colour for debug messages */
|
|
||||||
#define colour &rdrand_entropy
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Enable entropy gathering
|
|
||||||
*
|
|
||||||
* @ret rc Return status code
|
|
||||||
*/
|
|
||||||
static int rdrand_entropy_enable ( void ) {
|
|
||||||
struct x86_features features;
|
|
||||||
|
|
||||||
/* Check that RDRAND is supported */
|
|
||||||
x86_features ( &features );
|
|
||||||
if ( ! ( features.intel.ecx & CPUID_FEATURES_INTEL_ECX_RDRAND ) ) {
|
|
||||||
DBGC ( colour, "RDRAND not supported\n" );
|
|
||||||
return -ENOTSUP;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Data returned by RDRAND is theoretically full entropy, up
|
|
||||||
* to a security strength of 128 bits, so assume that each
|
|
||||||
* sample contains exactly 8 bits of entropy.
|
|
||||||
*/
|
|
||||||
if ( DRBG_SECURITY_STRENGTH > 128 )
|
|
||||||
return -ENOTSUP;
|
|
||||||
entropy_init ( &rdrand_entropy, MIN_ENTROPY ( 8.0 ) );
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get noise sample
|
|
||||||
*
|
|
||||||
* @ret noise Noise sample
|
|
||||||
* @ret rc Return status code
|
|
||||||
*/
|
|
||||||
static int rdrand_get_noise ( noise_sample_t *noise ) {
|
|
||||||
unsigned int result;
|
|
||||||
unsigned int discard_c;
|
|
||||||
unsigned int ok;
|
|
||||||
|
|
||||||
/* Issue RDRAND, retrying until CF is set */
|
|
||||||
__asm__ ( "\n1:\n\t"
|
|
||||||
"rdrand %0\n\t"
|
|
||||||
"sbb %1, %1\n\t"
|
|
||||||
"loopz 1b\n\t"
|
|
||||||
: "=r" ( result ), "=r" ( ok ), "=c" ( discard_c )
|
|
||||||
: "2" ( RDRAND_RETRY_COUNT ) );
|
|
||||||
if ( ! ok ) {
|
|
||||||
DBGC ( colour, "RDRAND failed to become ready\n" );
|
|
||||||
return -EBUSY;
|
|
||||||
}
|
|
||||||
|
|
||||||
*noise = result;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Hardware random number generator entropy source */
|
|
||||||
struct entropy_source rdrand_entropy __entropy_source ( ENTROPY_PREFERRED ) = {
|
|
||||||
.name = "rdrand",
|
|
||||||
.enable = rdrand_entropy_enable,
|
|
||||||
.get_noise = rdrand_get_noise,
|
|
||||||
};
|
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
||||||
|
|
||||||
.section ".note.GNU-stack", "", @progbits
|
|
||||||
.arch i386
|
.arch i386
|
||||||
|
|
||||||
#ifdef __x86_64__
|
#ifdef __x86_64__
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
||||||
|
|
||||||
.section ".note.GNU-stack", "", @progbits
|
|
||||||
.arch i386
|
.arch i386
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ FILE_LICENCE ( GPL2_OR_LATER )
|
|||||||
#define PIC1_ICR 0x20
|
#define PIC1_ICR 0x20
|
||||||
#define PIC2_ICR 0xa0
|
#define PIC2_ICR 0xa0
|
||||||
|
|
||||||
.section ".note.GNU-stack", "", @progbits
|
|
||||||
.text
|
.text
|
||||||
.arch i386
|
.arch i386
|
||||||
.code16
|
.code16
|
||||||
|
|||||||
@@ -247,17 +247,19 @@ static void bzimage_update_header ( struct image *image,
|
|||||||
*
|
*
|
||||||
* @v image bzImage file
|
* @v image bzImage file
|
||||||
* @v bzimg bzImage context
|
* @v bzimg bzImage context
|
||||||
|
* @v cmdline Kernel command line
|
||||||
* @ret rc Return status code
|
* @ret rc Return status code
|
||||||
*/
|
*/
|
||||||
static int bzimage_parse_cmdline ( struct image *image,
|
static int bzimage_parse_cmdline ( struct image *image,
|
||||||
struct bzimage_context *bzimg ) {
|
struct bzimage_context *bzimg,
|
||||||
const char *vga;
|
char *cmdline ) {
|
||||||
const char *mem;
|
|
||||||
char *sep;
|
char *sep;
|
||||||
char *end;
|
char *vga;
|
||||||
|
char *mem;
|
||||||
|
|
||||||
/* Look for "vga=" */
|
/* Look for "vga=" */
|
||||||
if ( ( vga = image_argument ( image, "vga=" ) ) ) {
|
if ( ( vga = strstr ( cmdline, "vga=" ) ) ) {
|
||||||
|
vga += 4;
|
||||||
sep = strchr ( vga, ' ' );
|
sep = strchr ( vga, ' ' );
|
||||||
if ( sep )
|
if ( sep )
|
||||||
*sep = '\0';
|
*sep = '\0';
|
||||||
@@ -268,10 +270,10 @@ static int bzimage_parse_cmdline ( struct image *image,
|
|||||||
} else if ( strcmp ( vga, "ask" ) == 0 ) {
|
} else if ( strcmp ( vga, "ask" ) == 0 ) {
|
||||||
bzimg->vid_mode = BZI_VID_MODE_ASK;
|
bzimg->vid_mode = BZI_VID_MODE_ASK;
|
||||||
} else {
|
} else {
|
||||||
bzimg->vid_mode = strtoul ( vga, &end, 0 );
|
bzimg->vid_mode = strtoul ( vga, &vga, 0 );
|
||||||
if ( *end ) {
|
if ( *vga ) {
|
||||||
DBGC ( image, "bzImage %p strange \"vga=\" "
|
DBGC ( image, "bzImage %p strange \"vga=\" "
|
||||||
"terminator '%c'\n", image, *end );
|
"terminator '%c'\n", image, *vga );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( sep )
|
if ( sep )
|
||||||
@@ -279,9 +281,10 @@ static int bzimage_parse_cmdline ( struct image *image,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Look for "mem=" */
|
/* Look for "mem=" */
|
||||||
if ( ( mem = image_argument ( image, "mem=" ) ) ) {
|
if ( ( mem = strstr ( cmdline, "mem=" ) ) ) {
|
||||||
bzimg->mem_limit = strtoul ( mem, &end, 0 );
|
mem += 4;
|
||||||
switch ( *end ) {
|
bzimg->mem_limit = strtoul ( mem, &mem, 0 );
|
||||||
|
switch ( *mem ) {
|
||||||
case 'G':
|
case 'G':
|
||||||
case 'g':
|
case 'g':
|
||||||
bzimg->mem_limit <<= 10;
|
bzimg->mem_limit <<= 10;
|
||||||
@@ -299,7 +302,7 @@ static int bzimage_parse_cmdline ( struct image *image,
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
DBGC ( image, "bzImage %p strange \"mem=\" "
|
DBGC ( image, "bzImage %p strange \"mem=\" "
|
||||||
"terminator '%c'\n", image, *end );
|
"terminator '%c'\n", image, *mem );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
bzimg->mem_limit -= 1;
|
bzimg->mem_limit -= 1;
|
||||||
@@ -313,10 +316,11 @@ static int bzimage_parse_cmdline ( struct image *image,
|
|||||||
*
|
*
|
||||||
* @v image bzImage image
|
* @v image bzImage image
|
||||||
* @v bzimg bzImage context
|
* @v bzimg bzImage context
|
||||||
|
* @v cmdline Kernel command line
|
||||||
*/
|
*/
|
||||||
static void bzimage_set_cmdline ( struct image *image,
|
static void bzimage_set_cmdline ( struct image *image,
|
||||||
struct bzimage_context *bzimg ) {
|
struct bzimage_context *bzimg,
|
||||||
const char *cmdline = ( image->cmdline ? image->cmdline : "" );
|
const char *cmdline ) {
|
||||||
size_t cmdline_len;
|
size_t cmdline_len;
|
||||||
|
|
||||||
/* Copy command line down to real-mode portion */
|
/* Copy command line down to real-mode portion */
|
||||||
@@ -355,8 +359,8 @@ static size_t bzimage_load_initrd ( struct image *image,
|
|||||||
size_t offset;
|
size_t offset;
|
||||||
size_t pad_len;
|
size_t pad_len;
|
||||||
|
|
||||||
/* Skip hidden images */
|
/* Do not include kernel image itself as an initrd */
|
||||||
if ( initrd->flags & IMAGE_HIDDEN )
|
if ( initrd == image )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* Create cpio header for non-prebuilt images */
|
/* Create cpio header for non-prebuilt images */
|
||||||
@@ -406,6 +410,10 @@ static int bzimage_check_initrds ( struct image *image,
|
|||||||
/* Calculate total loaded length of initrds */
|
/* Calculate total loaded length of initrds */
|
||||||
for_each_image ( initrd ) {
|
for_each_image ( initrd ) {
|
||||||
|
|
||||||
|
/* Skip kernel */
|
||||||
|
if ( initrd == image )
|
||||||
|
continue;
|
||||||
|
|
||||||
/* Calculate length */
|
/* Calculate length */
|
||||||
len += bzimage_load_initrd ( image, initrd, UNULL );
|
len += bzimage_load_initrd ( image, initrd, UNULL );
|
||||||
len = bzimage_align ( len );
|
len = bzimage_align ( len );
|
||||||
@@ -520,6 +528,7 @@ static void bzimage_load_initrds ( struct image *image,
|
|||||||
*/
|
*/
|
||||||
static int bzimage_exec ( struct image *image ) {
|
static int bzimage_exec ( struct image *image ) {
|
||||||
struct bzimage_context bzimg;
|
struct bzimage_context bzimg;
|
||||||
|
char *cmdline = ( image->cmdline ? image->cmdline : "" );
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
/* Read and parse header from image */
|
/* Read and parse header from image */
|
||||||
@@ -542,7 +551,7 @@ static int bzimage_exec ( struct image *image ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Parse command line for bootloader parameters */
|
/* Parse command line for bootloader parameters */
|
||||||
if ( ( rc = bzimage_parse_cmdline ( image, &bzimg ) ) != 0)
|
if ( ( rc = bzimage_parse_cmdline ( image, &bzimg, cmdline ) ) != 0)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
/* Check that initrds can be loaded */
|
/* Check that initrds can be loaded */
|
||||||
@@ -559,7 +568,7 @@ static int bzimage_exec ( struct image *image ) {
|
|||||||
bzimg.rm_filesz, bzimg.pm_sz );
|
bzimg.rm_filesz, bzimg.pm_sz );
|
||||||
|
|
||||||
/* Store command line */
|
/* Store command line */
|
||||||
bzimage_set_cmdline ( image, &bzimg );
|
bzimage_set_cmdline ( image, &bzimg, cmdline );
|
||||||
|
|
||||||
/* Prepare for exiting. Must do this before loading initrds,
|
/* Prepare for exiting. Must do this before loading initrds,
|
||||||
* since loading the initrds will corrupt the external heap.
|
* since loading the initrds will corrupt the external heap.
|
||||||
|
|||||||
@@ -204,8 +204,8 @@ static int multiboot_add_modules ( struct image *image, physaddr_t start,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Skip hidden images */
|
/* Do not include kernel image itself as a module */
|
||||||
if ( module_image->flags & IMAGE_HIDDEN )
|
if ( module_image == image )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* Page-align the module */
|
/* Page-align the module */
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
#ifndef _BITS_ENTROPY_H
|
||||||
|
#define _BITS_ENTROPY_H
|
||||||
|
|
||||||
|
/** @file
|
||||||
|
*
|
||||||
|
* x86-specific entropy API implementations
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||||
|
|
||||||
|
#include <ipxe/rtc_entropy.h>
|
||||||
|
|
||||||
|
#endif /* _BITS_ENTROPY_H */
|
||||||
@@ -28,7 +28,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
|||||||
#define ERRFILE_cpuid ( ERRFILE_ARCH | ERRFILE_CORE | 0x00110000 )
|
#define ERRFILE_cpuid ( ERRFILE_ARCH | ERRFILE_CORE | 0x00110000 )
|
||||||
#define ERRFILE_rdtsc_timer ( ERRFILE_ARCH | ERRFILE_CORE | 0x00120000 )
|
#define ERRFILE_rdtsc_timer ( ERRFILE_ARCH | ERRFILE_CORE | 0x00120000 )
|
||||||
#define ERRFILE_acpi_timer ( ERRFILE_ARCH | ERRFILE_CORE | 0x00130000 )
|
#define ERRFILE_acpi_timer ( ERRFILE_ARCH | ERRFILE_CORE | 0x00130000 )
|
||||||
#define ERRFILE_rdrand ( ERRFILE_ARCH | ERRFILE_CORE | 0x00140000 )
|
|
||||||
|
|
||||||
#define ERRFILE_bootsector ( ERRFILE_ARCH | ERRFILE_IMAGE | 0x00000000 )
|
#define ERRFILE_bootsector ( ERRFILE_ARCH | ERRFILE_IMAGE | 0x00000000 )
|
||||||
#define ERRFILE_bzimage ( ERRFILE_ARCH | ERRFILE_IMAGE | 0x00010000 )
|
#define ERRFILE_bzimage ( ERRFILE_ARCH | ERRFILE_IMAGE | 0x00010000 )
|
||||||
|
|||||||
@@ -9,9 +9,6 @@
|
|||||||
|
|
||||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||||
|
|
||||||
/** Page shift */
|
|
||||||
#define PAGE_SHIFT 12
|
|
||||||
|
|
||||||
#include <ipxe/x86_io.h>
|
#include <ipxe/x86_io.h>
|
||||||
|
|
||||||
#endif /* _BITS_IO_H */
|
#endif /* _BITS_IO_H */
|
||||||
|
|||||||
@@ -39,9 +39,6 @@ struct x86_features {
|
|||||||
/** Get standard features */
|
/** Get standard features */
|
||||||
#define CPUID_FEATURES 0x00000001UL
|
#define CPUID_FEATURES 0x00000001UL
|
||||||
|
|
||||||
/** RDRAND instruction is supported */
|
|
||||||
#define CPUID_FEATURES_INTEL_ECX_RDRAND 0x40000000UL
|
|
||||||
|
|
||||||
/** Hypervisor is present */
|
/** Hypervisor is present */
|
||||||
#define CPUID_FEATURES_INTEL_ECX_HYPERVISOR 0x80000000UL
|
#define CPUID_FEATURES_INTEL_ECX_HYPERVISOR 0x80000000UL
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,62 @@
|
|||||||
|
#ifndef _IPXE_RTC_ENTROPY_H
|
||||||
|
#define _IPXE_RTC_ENTROPY_H
|
||||||
|
|
||||||
|
/** @file
|
||||||
|
*
|
||||||
|
* RTC-based entropy source
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#ifdef ENTROPY_RTC
|
||||||
|
#define ENTROPY_PREFIX_rtc
|
||||||
|
#else
|
||||||
|
#define ENTROPY_PREFIX_rtc __rtc_
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* min-entropy per sample
|
||||||
|
*
|
||||||
|
* @ret min_entropy min-entropy of each sample
|
||||||
|
*/
|
||||||
|
static inline __always_inline min_entropy_t
|
||||||
|
ENTROPY_INLINE ( rtc, min_entropy_per_sample ) ( void ) {
|
||||||
|
|
||||||
|
/* The min-entropy has been measured on several platforms
|
||||||
|
* using the entropy_sample test code. Modelling the samples
|
||||||
|
* as independent, and using a confidence level of 99.99%, the
|
||||||
|
* measurements were as follows:
|
||||||
|
*
|
||||||
|
* qemu-kvm : 7.38 bits
|
||||||
|
* VMware : 7.46 bits
|
||||||
|
* Physical hardware : 2.67 bits
|
||||||
|
*
|
||||||
|
* We choose the lowest of these (2.67 bits) and apply a 50%
|
||||||
|
* safety margin to allow for some potential non-independence
|
||||||
|
* of samples.
|
||||||
|
*/
|
||||||
|
return MIN_ENTROPY ( 1.3 );
|
||||||
|
}
|
||||||
|
|
||||||
|
extern uint8_t rtc_sample ( void );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get noise sample
|
||||||
|
*
|
||||||
|
* @ret noise Noise sample
|
||||||
|
* @ret rc Return status code
|
||||||
|
*/
|
||||||
|
static inline __always_inline int
|
||||||
|
ENTROPY_INLINE ( rtc, get_noise ) ( noise_sample_t *noise ) {
|
||||||
|
|
||||||
|
/* Get sample */
|
||||||
|
*noise = rtc_sample();
|
||||||
|
|
||||||
|
/* Always successful */
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* _IPXE_RTC_ENTROPY_H */
|
||||||
@@ -28,6 +28,9 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/** Page shift */
|
||||||
|
#define PAGE_SHIFT 12
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Physical<->Bus address mappings
|
* Physical<->Bus address mappings
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -290,38 +290,29 @@ static const char *bios_ansi_input = "";
|
|||||||
struct bios_key {
|
struct bios_key {
|
||||||
/** Scancode */
|
/** Scancode */
|
||||||
uint8_t scancode;
|
uint8_t scancode;
|
||||||
/** Relative key value */
|
/** Key code */
|
||||||
uint16_t rkey;
|
uint16_t key;
|
||||||
} __attribute__ (( packed ));
|
} __attribute__ (( packed ));
|
||||||
|
|
||||||
/**
|
|
||||||
* Define a BIOS key mapping
|
|
||||||
*
|
|
||||||
* @v scancode Scancode
|
|
||||||
* @v key iPXE key code
|
|
||||||
* @v bioskey BIOS key mapping
|
|
||||||
*/
|
|
||||||
#define BIOS_KEY( scancode, key ) { scancode, KEY_REL ( key ) }
|
|
||||||
|
|
||||||
/** Mapping from BIOS scan codes to iPXE key codes */
|
/** Mapping from BIOS scan codes to iPXE key codes */
|
||||||
static const struct bios_key bios_keys[] = {
|
static const struct bios_key bios_keys[] = {
|
||||||
BIOS_KEY ( 0x53, KEY_DC ),
|
{ 0x53, KEY_DC },
|
||||||
BIOS_KEY ( 0x48, KEY_UP ),
|
{ 0x48, KEY_UP },
|
||||||
BIOS_KEY ( 0x50, KEY_DOWN ),
|
{ 0x50, KEY_DOWN },
|
||||||
BIOS_KEY ( 0x4b, KEY_LEFT ),
|
{ 0x4b, KEY_LEFT },
|
||||||
BIOS_KEY ( 0x4d, KEY_RIGHT ),
|
{ 0x4d, KEY_RIGHT },
|
||||||
BIOS_KEY ( 0x47, KEY_HOME ),
|
{ 0x47, KEY_HOME },
|
||||||
BIOS_KEY ( 0x4f, KEY_END ),
|
{ 0x4f, KEY_END },
|
||||||
BIOS_KEY ( 0x49, KEY_PPAGE ),
|
{ 0x49, KEY_PPAGE },
|
||||||
BIOS_KEY ( 0x51, KEY_NPAGE ),
|
{ 0x51, KEY_NPAGE },
|
||||||
BIOS_KEY ( 0x3f, KEY_F5 ),
|
{ 0x3f, KEY_F5 },
|
||||||
BIOS_KEY ( 0x40, KEY_F6 ),
|
{ 0x40, KEY_F6 },
|
||||||
BIOS_KEY ( 0x41, KEY_F7 ),
|
{ 0x41, KEY_F7 },
|
||||||
BIOS_KEY ( 0x42, KEY_F8 ),
|
{ 0x42, KEY_F8 },
|
||||||
BIOS_KEY ( 0x43, KEY_F9 ),
|
{ 0x43, KEY_F9 },
|
||||||
BIOS_KEY ( 0x44, KEY_F10 ),
|
{ 0x44, KEY_F10 },
|
||||||
BIOS_KEY ( 0x85, KEY_F11 ),
|
{ 0x85, KEY_F11 },
|
||||||
BIOS_KEY ( 0x86, KEY_F12 ),
|
{ 0x86, KEY_F12 },
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -332,7 +323,7 @@ static const struct bios_key bios_keys[] = {
|
|||||||
*/
|
*/
|
||||||
static const char * bios_ansi_seq ( unsigned int scancode ) {
|
static const char * bios_ansi_seq ( unsigned int scancode ) {
|
||||||
static char buf[ 5 /* "[" + two digits + terminator + NUL */ ];
|
static char buf[ 5 /* "[" + two digits + terminator + NUL */ ];
|
||||||
unsigned int rkey;
|
unsigned int key;
|
||||||
unsigned int terminator;
|
unsigned int terminator;
|
||||||
unsigned int n;
|
unsigned int n;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
@@ -347,9 +338,9 @@ static const char * bios_ansi_seq ( unsigned int scancode ) {
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* Construct escape sequence */
|
/* Construct escape sequence */
|
||||||
rkey = bios_keys[i].rkey;
|
key = bios_keys[i].key;
|
||||||
n = KEY_ANSI_N ( rkey );
|
n = KEY_ANSI_N ( key );
|
||||||
terminator = KEY_ANSI_TERMINATOR ( rkey );
|
terminator = KEY_ANSI_TERMINATOR ( key );
|
||||||
*(tmp++) = '[';
|
*(tmp++) = '[';
|
||||||
if ( n )
|
if ( n )
|
||||||
tmp += sprintf ( tmp, "%d", n );
|
tmp += sprintf ( tmp, "%d", n );
|
||||||
@@ -488,7 +479,6 @@ struct console_driver bios_console __console_driver = {
|
|||||||
static __asmcall __used void bios_inject ( struct i386_all_regs *ix86 ) {
|
static __asmcall __used void bios_inject ( struct i386_all_regs *ix86 ) {
|
||||||
unsigned int discard_a;
|
unsigned int discard_a;
|
||||||
unsigned int scancode;
|
unsigned int scancode;
|
||||||
unsigned int rkey;
|
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
uint16_t keypress;
|
uint16_t keypress;
|
||||||
int key;
|
int key;
|
||||||
@@ -531,10 +521,9 @@ static __asmcall __used void bios_inject ( struct i386_all_regs *ix86 ) {
|
|||||||
|
|
||||||
/* Handle special keys */
|
/* Handle special keys */
|
||||||
if ( key >= KEY_MIN ) {
|
if ( key >= KEY_MIN ) {
|
||||||
rkey = KEY_REL ( key );
|
|
||||||
for ( i = 0 ; i < ( sizeof ( bios_keys ) /
|
for ( i = 0 ; i < ( sizeof ( bios_keys ) /
|
||||||
sizeof ( bios_keys[0] ) ) ; i++ ) {
|
sizeof ( bios_keys[0] ) ) ; i++ ) {
|
||||||
if ( bios_keys[i].rkey == rkey ) {
|
if ( bios_keys[i].key == key ) {
|
||||||
scancode = bios_keys[i].scancode;
|
scancode = bios_keys[i].scancode;
|
||||||
keypress = ( scancode << 8 );
|
keypress = ( scancode << 8 );
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -23,7 +23,6 @@
|
|||||||
|
|
||||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
||||||
|
|
||||||
.section ".note.GNU-stack", "", @progbits
|
|
||||||
.text
|
.text
|
||||||
.arch i386
|
.arch i386
|
||||||
.code16
|
.code16
|
||||||
|
|||||||
@@ -39,14 +39,9 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
|||||||
#include <ipxe/cpuid.h>
|
#include <ipxe/cpuid.h>
|
||||||
#include <ipxe/entropy.h>
|
#include <ipxe/entropy.h>
|
||||||
|
|
||||||
struct entropy_source rtc_entropy __entropy_source ( ENTROPY_NORMAL );
|
|
||||||
|
|
||||||
/** Maximum time to wait for an RTC interrupt, in milliseconds */
|
/** Maximum time to wait for an RTC interrupt, in milliseconds */
|
||||||
#define RTC_MAX_WAIT_MS 100
|
#define RTC_MAX_WAIT_MS 100
|
||||||
|
|
||||||
/** Number of RTC interrupts to check for */
|
|
||||||
#define RTC_CHECK_COUNT 3
|
|
||||||
|
|
||||||
/** RTC interrupt handler */
|
/** RTC interrupt handler */
|
||||||
extern void rtc_isr ( void );
|
extern void rtc_isr ( void );
|
||||||
|
|
||||||
@@ -150,7 +145,6 @@ static void rtc_disable_int ( void ) {
|
|||||||
* @ret rc Return status code
|
* @ret rc Return status code
|
||||||
*/
|
*/
|
||||||
static int rtc_entropy_check ( void ) {
|
static int rtc_entropy_check ( void ) {
|
||||||
unsigned int count = 0;
|
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
/* Check that RTC interrupts are working */
|
/* Check that RTC interrupts are working */
|
||||||
@@ -164,18 +158,14 @@ static int rtc_entropy_check ( void ) {
|
|||||||
"cli\n\t" );
|
"cli\n\t" );
|
||||||
|
|
||||||
/* Check for RTC interrupt flag */
|
/* Check for RTC interrupt flag */
|
||||||
if ( rtc_flag ) {
|
if ( rtc_flag )
|
||||||
rtc_flag = 0;
|
return 0;
|
||||||
if ( ++count >= RTC_CHECK_COUNT )
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Delay */
|
/* Delay */
|
||||||
mdelay ( 1 );
|
mdelay ( 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
DBGC ( &rtc_flag, "RTC timed out waiting for interrupt %d/%d\n",
|
DBGC ( &rtc_flag, "RTC timed out waiting for interrupt\n" );
|
||||||
( count + 1 ), RTC_CHECK_COUNT );
|
|
||||||
return -ETIMEDOUT;
|
return -ETIMEDOUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -205,21 +195,6 @@ static int rtc_entropy_enable ( void ) {
|
|||||||
if ( ( rc = rtc_entropy_check() ) != 0 )
|
if ( ( rc = rtc_entropy_check() ) != 0 )
|
||||||
goto err_check;
|
goto err_check;
|
||||||
|
|
||||||
/* The min-entropy has been measured on several platforms
|
|
||||||
* using the entropy_sample test code. Modelling the samples
|
|
||||||
* as independent, and using a confidence level of 99.99%, the
|
|
||||||
* measurements were as follows:
|
|
||||||
*
|
|
||||||
* qemu-kvm : 7.38 bits
|
|
||||||
* VMware : 7.46 bits
|
|
||||||
* Physical hardware : 2.67 bits
|
|
||||||
*
|
|
||||||
* We choose the lowest of these (2.67 bits) and apply a 50%
|
|
||||||
* safety margin to allow for some potential non-independence
|
|
||||||
* of samples.
|
|
||||||
*/
|
|
||||||
entropy_init ( &rtc_entropy, MIN_ENTROPY ( 1.3 ) );
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
err_check:
|
err_check:
|
||||||
@@ -243,12 +218,11 @@ static void rtc_entropy_disable ( void ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get noise sample
|
* Measure a single RTC tick
|
||||||
*
|
*
|
||||||
* @ret noise Noise sample
|
* @ret delta Length of RTC tick (in TSC units)
|
||||||
* @ret rc Return status code
|
|
||||||
*/
|
*/
|
||||||
static int rtc_get_noise ( noise_sample_t *noise ) {
|
uint8_t rtc_sample ( void ) {
|
||||||
uint32_t before;
|
uint32_t before;
|
||||||
uint32_t after;
|
uint32_t after;
|
||||||
uint32_t temp;
|
uint32_t temp;
|
||||||
@@ -283,14 +257,10 @@ static int rtc_get_noise ( noise_sample_t *noise ) {
|
|||||||
: "=a" ( after ), "=d" ( before ), "=Q" ( temp )
|
: "=a" ( after ), "=d" ( before ), "=Q" ( temp )
|
||||||
: "2" ( 0 ) );
|
: "2" ( 0 ) );
|
||||||
|
|
||||||
*noise = ( after - before );
|
return ( after - before );
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** RTC entropy source */
|
PROVIDE_ENTROPY_INLINE ( rtc, min_entropy_per_sample );
|
||||||
struct entropy_source rtc_entropy __entropy_source ( ENTROPY_NORMAL ) = {
|
PROVIDE_ENTROPY ( rtc, entropy_enable, rtc_entropy_enable );
|
||||||
.name = "rtc",
|
PROVIDE_ENTROPY ( rtc, entropy_disable, rtc_entropy_disable );
|
||||||
.enable = rtc_entropy_enable,
|
PROVIDE_ENTROPY_INLINE ( rtc, get_noise );
|
||||||
.disable = rtc_entropy_disable,
|
|
||||||
.get_noise = rtc_get_noise,
|
|
||||||
};
|
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
|||||||
|
|
||||||
#include <librm.h>
|
#include <librm.h>
|
||||||
|
|
||||||
.section ".note.GNU-stack", "", @progbits
|
|
||||||
.arch i386
|
.arch i386
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ FILE_LICENCE ( GPL2_OR_LATER )
|
|||||||
|
|
||||||
#include "librm.h"
|
#include "librm.h"
|
||||||
|
|
||||||
.section ".note.GNU-stack", "", @progbits
|
|
||||||
.text
|
.text
|
||||||
|
|
||||||
.code32
|
.code32
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
|||||||
#define STACK_SEG 0x0200
|
#define STACK_SEG 0x0200
|
||||||
#define STACK_SIZE 0x2000
|
#define STACK_SIZE 0x2000
|
||||||
|
|
||||||
.section ".note.GNU-stack", "", @progbits
|
|
||||||
.text
|
.text
|
||||||
.arch i386
|
.arch i386
|
||||||
.section ".prefix", "awx", @progbits
|
.section ".prefix", "awx", @progbits
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ FILE_LICENCE ( GPL2_ONLY )
|
|||||||
|
|
||||||
.equ SYSSEG, 0x1000 /* system loaded at SYSSEG<<4 */
|
.equ SYSSEG, 0x1000 /* system loaded at SYSSEG<<4 */
|
||||||
|
|
||||||
.section ".note.GNU-stack", "", @progbits
|
|
||||||
.org 0
|
.org 0
|
||||||
.arch i386
|
.arch i386
|
||||||
.text
|
.text
|
||||||
|
|||||||
@@ -36,7 +36,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
|||||||
#define PSP_CMDLINE_LEN 0x80
|
#define PSP_CMDLINE_LEN 0x80
|
||||||
#define PSP_CMDLINE_START 0x81
|
#define PSP_CMDLINE_START 0x81
|
||||||
|
|
||||||
.section ".note.GNU-stack", "", @progbits
|
|
||||||
.text
|
.text
|
||||||
.arch i386
|
.arch i386
|
||||||
.org 0
|
.org 0
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
|||||||
|
|
||||||
#include <librm.h>
|
#include <librm.h>
|
||||||
|
|
||||||
.section ".note.GNU-stack", "", @progbits
|
|
||||||
.text
|
.text
|
||||||
.arch i386
|
.arch i386
|
||||||
.section ".prefix", "awx", @progbits
|
.section ".prefix", "awx", @progbits
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
|||||||
|
|
||||||
#include <librm.h>
|
#include <librm.h>
|
||||||
|
|
||||||
.section ".note.GNU-stack", "", @progbits
|
|
||||||
.arch i386
|
.arch i386
|
||||||
|
|
||||||
/* Image compression enabled */
|
/* Image compression enabled */
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
|||||||
|
|
||||||
#define BZI_LOAD_HIGH_ADDR 0x100000
|
#define BZI_LOAD_HIGH_ADDR 0x100000
|
||||||
|
|
||||||
.section ".note.GNU-stack", "", @progbits
|
|
||||||
.text
|
.text
|
||||||
.arch i386
|
.arch i386
|
||||||
.code16
|
.code16
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
||||||
|
|
||||||
.section ".note.GNU-stack", "", @progbits
|
|
||||||
.text
|
.text
|
||||||
.arch i386
|
.arch i386
|
||||||
.section ".prefix", "awx", @progbits
|
.section ".prefix", "awx", @progbits
|
||||||
|
|||||||
@@ -41,7 +41,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
|||||||
#define _pcirom_start _mrom_start
|
#define _pcirom_start _mrom_start
|
||||||
#include "pciromprefix.S"
|
#include "pciromprefix.S"
|
||||||
|
|
||||||
.section ".note.GNU-stack", "", @progbits
|
|
||||||
.text
|
.text
|
||||||
.arch i386
|
.arch i386
|
||||||
.code16
|
.code16
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
|||||||
|
|
||||||
#include <librm.h>
|
#include <librm.h>
|
||||||
|
|
||||||
.section ".note.GNU-stack", "", @progbits
|
|
||||||
.text
|
.text
|
||||||
.arch i386
|
.arch i386
|
||||||
.code16
|
.code16
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
||||||
|
|
||||||
.section ".note.GNU-stack", "", @progbits
|
|
||||||
.org 0
|
.org 0
|
||||||
.text
|
.text
|
||||||
.arch i386
|
.arch i386
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
|||||||
|
|
||||||
#define PXE_HACK_EB54 0x0001
|
#define PXE_HACK_EB54 0x0001
|
||||||
|
|
||||||
.section ".note.GNU-stack", "", @progbits
|
|
||||||
.text
|
.text
|
||||||
.arch i386
|
.arch i386
|
||||||
.org 0
|
.org 0
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
|
|
||||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
||||||
|
|
||||||
.section ".note.GNU-stack", "", @progbits
|
|
||||||
.text
|
.text
|
||||||
.arch i386
|
.arch i386
|
||||||
.org 0
|
.org 0
|
||||||
|
|||||||
@@ -54,7 +54,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
|||||||
#define BUSTYPE "PCIR"
|
#define BUSTYPE "PCIR"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
.section ".note.GNU-stack", "", @progbits
|
|
||||||
.text
|
.text
|
||||||
.code16
|
.code16
|
||||||
.arch i386
|
.arch i386
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
|||||||
|
|
||||||
#include <librm.h>
|
#include <librm.h>
|
||||||
|
|
||||||
.section ".note.GNU-stack", "", @progbits
|
|
||||||
.text
|
.text
|
||||||
.code16
|
.code16
|
||||||
.arch i386
|
.arch i386
|
||||||
|
|||||||
@@ -43,7 +43,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
|||||||
****************************************************************************
|
****************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
.section ".note.GNU-stack", "", @progbits
|
|
||||||
.text
|
.text
|
||||||
.arch i486
|
.arch i486
|
||||||
.section ".prefix.lib", "ax", @progbits
|
.section ".prefix.lib", "ax", @progbits
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
|||||||
|
|
||||||
#include <config/console.h>
|
#include <config/console.h>
|
||||||
|
|
||||||
.section ".note.GNU-stack", "", @progbits
|
|
||||||
.text
|
.text
|
||||||
.arch i386
|
.arch i386
|
||||||
.section ".prefix", "awx", @progbits
|
.section ".prefix", "awx", @progbits
|
||||||
|
|||||||
@@ -24,7 +24,6 @@
|
|||||||
|
|
||||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
||||||
|
|
||||||
.section ".note.GNU-stack", "", @progbits
|
|
||||||
.arch i386
|
.arch i386
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
|||||||
/* Breakpoint for when debugging under bochs */
|
/* Breakpoint for when debugging under bochs */
|
||||||
#define BOCHSBP xchgw %bx, %bx
|
#define BOCHSBP xchgw %bx, %bx
|
||||||
|
|
||||||
.section ".note.GNU-stack", "", @progbits
|
|
||||||
.text
|
.text
|
||||||
.arch i386
|
.arch i386
|
||||||
.section ".text16", "awx", @progbits
|
.section ".text16", "awx", @progbits
|
||||||
|
|||||||
@@ -83,8 +83,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
|||||||
#define if64 if 0
|
#define if64 if 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
.section ".note.GNU-stack", "", @progbits
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Global descriptor table
|
* Global descriptor table
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
|||||||
#define SIGFPE 8
|
#define SIGFPE 8
|
||||||
#define SIGSTKFLT 16
|
#define SIGSTKFLT 16
|
||||||
|
|
||||||
.section ".note.GNU-stack", "", @progbits
|
|
||||||
.section ".text.gdbmach_interrupt", "ax", @progbits
|
.section ".text.gdbmach_interrupt", "ax", @progbits
|
||||||
.code64
|
.code64
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
||||||
|
|
||||||
.section ".note.GNU-stack", "", @progbits
|
|
||||||
.text
|
.text
|
||||||
.code64
|
.code64
|
||||||
|
|
||||||
|
|||||||
@@ -8,9 +8,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
|||||||
|
|
||||||
#ifndef ASSEMBLY
|
#ifndef ASSEMBLY
|
||||||
|
|
||||||
/** Unprefixed constant operand modifier */
|
|
||||||
#define ASM_NO_PREFIX "c"
|
|
||||||
|
|
||||||
/** Declare a function with standard calling conventions */
|
/** Declare a function with standard calling conventions */
|
||||||
#define __asmcall __attribute__ (( regparm(0) ))
|
#define __asmcall __attribute__ (( regparm(0) ))
|
||||||
|
|
||||||
|
|||||||
@@ -290,9 +290,6 @@ REQUIRE_OBJECT ( cert_cmd );
|
|||||||
#ifdef IMAGE_MEM_CMD
|
#ifdef IMAGE_MEM_CMD
|
||||||
REQUIRE_OBJECT ( image_mem_cmd );
|
REQUIRE_OBJECT ( image_mem_cmd );
|
||||||
#endif
|
#endif
|
||||||
#ifdef SHIM_CMD
|
|
||||||
REQUIRE_OBJECT ( shim_cmd );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Drag in miscellaneous objects
|
* Drag in miscellaneous objects
|
||||||
@@ -355,9 +352,6 @@ REQUIRE_OBJECT ( vram_settings );
|
|||||||
#ifdef ACPI_SETTINGS
|
#ifdef ACPI_SETTINGS
|
||||||
REQUIRE_OBJECT ( acpi_settings );
|
REQUIRE_OBJECT ( acpi_settings );
|
||||||
#endif
|
#endif
|
||||||
#ifdef EFI_SETTINGS
|
|
||||||
REQUIRE_OBJECT ( efi_settings );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Drag in selected keyboard map
|
* Drag in selected keyboard map
|
||||||
|
|||||||
@@ -49,6 +49,3 @@ REQUIRE_OBJECT ( eth_slow );
|
|||||||
#ifdef NET_PROTO_EAPOL
|
#ifdef NET_PROTO_EAPOL
|
||||||
REQUIRE_OBJECT ( eapol );
|
REQUIRE_OBJECT ( eapol );
|
||||||
#endif
|
#endif
|
||||||
#ifdef NET_PROTO_LLDP
|
|
||||||
REQUIRE_OBJECT ( lldp );
|
|
||||||
#endif
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user