Merge branch 'master' into kdisplay_loop

This commit is contained in:
Arsenic Blood 2024-03-07 00:00:28 -05:00 committed by GitHub
commit 0995eb82df
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 129 additions and 26 deletions

62
.github/workflows/build.yml vendored Normal file
View file

@ -0,0 +1,62 @@
name: Build ZealOS ISOs
on:
push:
branches:
- 'master'
paths-ignore:
- '**.md'
- 'screenshots/**'
- '**/LICENSE'
pull_request:
branches:
- 'master'
paths-ignore:
- '**.md'
- 'screenshots/**'
- '**/LICENSE'
workflow_dispatch:
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: 'true'
- name: Install Dependencies
run: |
sudo apt-get -y update
sudo apt-get -y install build-essential git xorriso qemu-system-x86
- name: Enable KVM Group Perms
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
- name: Run ISOs Build Script
if: ${{ success() }}
run: |
cd build
./build-iso.sh --headless
cd ..
- name: Releasing Latest ISOs
if: ${{ success() && github.event_name == 'push'}}
uses: "GutPuncher/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "latest"
prerelease: false
title: "Pre-Built ISOs [${{ github.sha }}]"
files: ./build/*.iso
- name: OK
if: ${{ success() }}
run: |
echo "Build OK"

View file

@ -1,6 +1,6 @@
# ZealOS # ZealOS
[![Discord](https://img.shields.io/discord/934200098144022609?color=7289DA&label=Discord&logo=discord&logoColor=white)](https://discord.gg/rK6U3xdr7D) [![](https://img.shields.io/badge/wiki-documentation-forestgreen)](https://zeal-operating-system.github.io/ZealOS-wiki/) [![Discord](https://img.shields.io/discord/934200098144022609?color=7289DA&label=Discord&logo=discord&logoColor=white)](https://discord.gg/rK6U3xdr7D) [![](https://img.shields.io/badge/wiki-documentation-forestgreen)](https://zeal-operating-system.github.io/ZealOS-wiki/) [![Build ZealOS ISOs](https://github.com/Zeal-Operating-System/ZealOS/actions/workflows/build.yml/badge.svg)](https://github.com/Zeal-Operating-System/ZealOS/actions/workflows/build.yml)
The Zeal Operating System is a modernized fork of the 64-bit Temple Operating System. Guiding principles of development include transparency, full user control, and adherence to public-domain/open-source implementations. The Zeal Operating System is a modernized fork of the 64-bit Temple Operating System. Guiding principles of development include transparency, full user control, and adherence to public-domain/open-source implementations.

Binary file not shown.

View file

@ -13,8 +13,10 @@ then
exit exit
fi fi
# Uncomment if you use doas instead of sudo [ "$1" = "--headless" ] && QEMU_HEADLESS='-display none'
#alias sudo=doas
KVM=''
(lsmod | grep -q kvm) && KVM=' -accel kvm'
# Set this true if you want to test ISOs in QEMU after building. # Set this true if you want to test ISOs in QEMU after building.
TESTING=false TESTING=false
@ -50,7 +52,7 @@ set +e
echo "Making temp vdisk, running auto-install ..." echo "Making temp vdisk, running auto-install ..."
$QEMU_BIN_PATH/qemu-img create -f raw $TMPDISK 1024M $QEMU_BIN_PATH/qemu-img create -f raw $TMPDISK 1024M
$QEMU_BIN_PATH/qemu-system-x86_64 -machine q35,accel=kvm -drive format=raw,file=$TMPDISK -m 1G -rtc base=localtime -smp 4 -cdrom AUTO.ISO -device isa-debug-exit $QEMU_BIN_PATH/qemu-system-x86_64 -machine q35 $KVM -drive format=raw,file=$TMPDISK -m 1G -rtc base=localtime -smp 4 -cdrom AUTO.ISO -device isa-debug-exit $QEMU_HEADLESS
echo "Copying all src/ code into vdisk Tmp/OSBuild/ ..." echo "Copying all src/ code into vdisk Tmp/OSBuild/ ..."
rm ../src/Home/Registry.ZC 2> /dev/null rm ../src/Home/Registry.ZC 2> /dev/null
@ -62,7 +64,7 @@ sudo cp -r ../src/* $TMPMOUNT/Tmp/OSBuild
umount_tempdisk umount_tempdisk
echo "Rebuilding kernel headers, kernel, OS, and building Distro ISO ..." echo "Rebuilding kernel headers, kernel, OS, and building Distro ISO ..."
$QEMU_BIN_PATH/qemu-system-x86_64 -machine q35,accel=kvm -drive format=raw,file=$TMPDISK -m 1G -rtc base=localtime -smp 4 -device isa-debug-exit $QEMU_BIN_PATH/qemu-system-x86_64 -machine q35 $KVM -drive format=raw,file=$TMPDISK -m 1G -rtc base=localtime -smp 4 -device isa-debug-exit $QEMU_HEADLESS
LIMINE_BINARY_BRANCH="v6.x-branch-binary" LIMINE_BINARY_BRANCH="v6.x-branch-binary"
@ -73,6 +75,8 @@ then
git fetch git fetch
git remote set-head origin $LIMINE_BINARY_BRANCH git remote set-head origin $LIMINE_BINARY_BRANCH
git switch $LIMINE_BINARY_BRANCH git switch $LIMINE_BINARY_BRANCH
git config --local pull.ff true
git config --local pull.rebase true
git pull git pull
rm limine rm limine
@ -130,11 +134,11 @@ if [ "$TESTING" = true ]; then
cd .. cd ..
fi fi
echo "Testing limine-zealbooter-xorriso isohybrid boot in UEFI mode ..." echo "Testing limine-zealbooter-xorriso isohybrid boot in UEFI mode ..."
$QEMU_BIN_PATH/qemu-system-x86_64 -machine q35,accel=kvm -m 1G -rtc base=localtime -bios ovmf/OVMF.fd -smp 4 -cdrom ZealOS-limine.iso $QEMU_BIN_PATH/qemu-system-x86_64 -machine q35 $KVM -m 1G -rtc base=localtime -bios ovmf/OVMF.fd -smp 4 -cdrom ZealOS-limine.iso $QEMU_HEADLESS
echo "Testing limine-zealbooter-xorriso isohybrid boot in BIOS mode ..." echo "Testing limine-zealbooter-xorriso isohybrid boot in BIOS mode ..."
$QEMU_BIN_PATH/qemu-system-x86_64 -machine q35,accel=kvm -m 1G -rtc base=localtime -smp 4 -cdrom ZealOS-limine.iso $QEMU_BIN_PATH/qemu-system-x86_64 -machine q35 $KVM -m 1G -rtc base=localtime -smp 4 -cdrom ZealOS-limine.iso $QEMU_HEADLESS
echo "Testing native ZealC MyDistro legacy ISO in BIOS mode ..." echo "Testing native ZealC MyDistro legacy ISO in BIOS mode ..."
$QEMU_BIN_PATH/qemu-system-x86_64 -machine q35,accel=kvm -m 1G -rtc base=localtime -smp 4 -cdrom ZealOS-MyDistro.iso $QEMU_BIN_PATH/qemu-system-x86_64 -machine q35 $KVM -m 1G -rtc base=localtime -smp 4 -cdrom ZealOS-MyDistro.iso $QEMU_HEADLESS
fi fi
# comment these 2 lines if you want lingering old Distro ISOs # comment these 2 lines if you want lingering old Distro ISOs

View file

@ -15,7 +15,7 @@ read -p "Enter fork branch name: " FORK_BRANCH
echo $FORK_BRANCH echo $FORK_BRANCH
FORK_LOCAL=$FORK_BRANCH"-testing" FORK_LOCAL=$FORK_BRANCH"-testing"
echo "Creating new local branch for testing: "$FORK_LOCAL" ..." echo "Creating new local branch for testing: "$FORK_LOCAL" ..."
git checkout -b $FORK_LOCAL git checkout -B $FORK_LOCAL
echo "Pulling changes from user's branch into new local branch..." echo "Pulling changes from user's branch into new local branch..."
git pull https://github.com/$FORK_USERNAME/ZealOS.git $FORK_BRANCH git pull https://github.com/$FORK_USERNAME/ZealOS.git $FORK_BRANCH

View file

@ -90,6 +90,7 @@ else
umount_vdisk umount_vdisk
[ -f ../src/Tmp/AUTO.ISO.C ] && mv ../src/Tmp/AUTO.ISO.C ./AUTO.ISO [ -f ../src/Tmp/AUTO.ISO.C ] && mv ../src/Tmp/AUTO.ISO.C ./AUTO.ISO
echo "Finished." echo "Finished."
cd ../
git status git status
;; ;;
vm) vm)

View file

@ -664,18 +664,25 @@ I64 MoveCnt(GameState *state)
{ {
I64 i, res = 0, mv_cnt; I64 i, res = 0, mv_cnt;
Move mvs[32]; Move mvs[32];
Bool king_stalemate = TRUE;
for (i = 0; i < 32; i++) for (i = 0; i < 32; i++)
{
if (state->pieces[i].player == state->cur_player) if (state->pieces[i].player == state->cur_player)
{ {
mv_cnt = PieceMoves(state, i, mvs); mv_cnt = PieceMoves(state, i, mvs);
mv_cnt = ChkPieceMoves(state, i, mvs,mv_cnt); mv_cnt = ChkPieceMoves(state, i, mvs,mv_cnt);
res += mv_cnt; res += mv_cnt;
} }
if (state->pieces[i].type != P_KING && state->pieces[i].player >= 0)
king_stalemate = FALSE;
}
if (king_stalemate)
return 0;
else
return res; return res;
} }
U0 DrawIt(CTask *task, CDC *dc) U0 DrawIt(CTask *task, CDC *dc)
{ {
I64 i, x, y, z, k0, k1; I64 i, x, y, z, k0, k1;

View file

@ -59,6 +59,7 @@
#define PCNET_INT_TINTM 9 // Transmit Interrupt Mask #define PCNET_INT_TINTM 9 // Transmit Interrupt Mask
#define PCNET_INT_RINTM 10 // Receive Interrupt Mask #define PCNET_INT_RINTM 10 // Receive Interrupt Mask
#define PCNET_FEATURE_ASTRPRCV 10
#define PCNET_FEATURE_APADXMT 11 #define PCNET_FEATURE_APADXMT 11
#define PCNET_BCR_MISC_CONFIG_ASEL 1 #define PCNET_BCR_MISC_CONFIG_ASEL 1
@ -455,7 +456,7 @@ U0 PCNetInterruptCSRSet()
U0 PCNetTXAutoPadEnable() U0 PCNetTXAutoPadEnable()
{/* AMD PCNet datasheet p.1-958 {/* AMD PCNet datasheet p.1-958
Setting bit 11 (Auto Pad Transmit) allows Setting bit 11 (Auto Pad Transmit) allows
shoft transmit frames to be automatically short transmit frames to be automatically
extended to 64 bytes. */ extended to 64 bytes. */
U32 csr = PCNetCSRRead(PCNET_CSR_FEATURECTRL); U32 csr = PCNetCSRRead(PCNET_CSR_FEATURECTRL);
@ -465,6 +466,19 @@ U0 PCNetTXAutoPadEnable()
PCNetCSRWrite(PCNET_CSR_FEATURECTRL, csr); PCNetCSRWrite(PCNET_CSR_FEATURECTRL, csr);
} }
U0 PCNetRXAutoStripEnable()
{/* AMD PCNet datasheet p.1-958
Setting bit 10 (Auto Strip Receive) allows
pad and FCS fields to be automatically
stripped. ONLY WORKS ON 802.3!!! */
U32 csr = PCNetCSRRead(PCNET_CSR_FEATURECTRL);
Bts(&csr, PCNET_FEATURE_ASTRPRCV);
PCNetCSRWrite(PCNET_CSR_FEATURECTRL, csr);
}
U0 PCNetConfigModeExit() U0 PCNetConfigModeExit()
{/* AMD PCNet datasheet p.1-954 {/* AMD PCNet datasheet p.1-954
PCNet controller can be started PCNet controller can be started
@ -749,6 +763,8 @@ U0 PCNetInit()
PCNetTXAutoPadEnable; PCNetTXAutoPadEnable;
PCNetRXAutoStripEnable;
PCNetAutoLinkSelect; PCNetAutoLinkSelect;
PCNetEnableFullDuplex; PCNetEnableFullDuplex;

View file

@ -27,16 +27,12 @@ U0 EthernetGlobalsInit()
} }
} }
//TODO: check length , figure out the length+4
U0 EthernetFrameParse(CEthernetFrame *frame_out, U8 *frame, U16 length) U0 EthernetFrameParse(CEthernetFrame *frame_out, U8 *frame, U16 length)
{ {
//TODO: Check length ! We need to figure out what // Shrine says MemCopy has a high overhead.
//lengths are appropriate // Almost tempted to say that means that a lot
// of the current system should be done with
//Shrine also says MemCopy has a // less extra allocation altogether, more passing.
//high overhead. Almost tempted to say that means that a lot
//of the current system should be done with less extra allocation
//altogether, more passing.
// In practice, MemCopy causes the most slowdown on bare-metal. // In practice, MemCopy causes the most slowdown on bare-metal.
NetLog("ETHERNET FRAME PARSE: Parsing frame, copying out to frame_out param."); NetLog("ETHERNET FRAME PARSE: Parsing frame, copying out to frame_out param.");
@ -49,7 +45,10 @@ U0 EthernetFrameParse(CEthernetFrame *frame_out, U8 *frame, U16 length)
frame_out->data = frame + ETHERNET_DATA_OFFSET; frame_out->data = frame + ETHERNET_DATA_OFFSET;
frame_out->length = length - ETHERNET_MAC_HEADER_LENGTH - 4; // He has a comment literally just saying "??". + or - 4? if (frame_out->ethertype <= ETHERNET_v2_MTU) // check if the field is a length or an ethertype
frame_out->length = frame_out->ethertype;
else
frame_out->length = length - ETHERNET_MAC_HEADER_LENGTH - FCS_LENGTH;
} }
U0 EthernetFrameFinish(I64 de_index) U0 EthernetFrameFinish(I64 de_index)

View file

@ -5,11 +5,14 @@
#define ETHERNET_ETHERTYPE_OFFSET 12 #define ETHERNET_ETHERTYPE_OFFSET 12
#define ETHERNET_DATA_OFFSET 14 #define ETHERNET_DATA_OFFSET 14
#define MAC_ADDRESS_LENGTH 6 #define MAC_ADDRESS_LENGTH 6
#define FCS_LENGTH 4
/* Ethernet Frame Size. /* Ethernet Frame Size.
Linux uses 1544, OSDev and Shrine use 1548. Based on IEEE 802.3as, max frame size was agreed upon as 2000 bytes. */ Linux uses 1544, OSDev and Shrine use 1548. Based on IEEE 802.3as, max frame size was agreed upon as 2000 bytes. */
#define ETHERNET_FRAME_SIZE 2000 #define ETHERNET_FRAME_SIZE 2000
#define ETHERNET_v2_MTU 1500
#define HTYPE_ETHERNET 1 #define HTYPE_ETHERNET 1
#define HLEN_ETHERNET 6 #define HLEN_ETHERNET 6
#define PLEN_IPV4 4 #define PLEN_IPV4 4

View file

@ -37,6 +37,16 @@ U0 NetQueueEntryHandle(CNetQueueEntry *entry)
EthernetFrameParse(&ethernet_frame, entry->frame, entry->packet_length); EthernetFrameParse(&ethernet_frame, entry->frame, entry->packet_length);
U8 *mac = EthernetMACGet();
Bool is_our_mac = !MemCompare(mac, ethernet_frame.destination_address, MAC_ADDRESS_LENGTH); // check the RX packet MAC against local MAC
Bool is_broadcast = !MemCompare(ethernet_globals.ethernet_broadcast, ethernet_frame.destination_address, MAC_ADDRESS_LENGTH); // check the RX packet MAC against broadcast MAC
if (!is_our_mac && !is_broadcast)
{
NetLog("HANDLE NETQUEUE ENTRY: Not for us, discarding.");
return;
}
switch (ethernet_frame.ethertype) switch (ethernet_frame.ethertype)
{ {
case ETHERTYPE_ARP: case ETHERTYPE_ARP:

View file

@ -286,6 +286,7 @@ I64 AHCIAtapiCapacityGet(CBlkDev *bd)
cmd_fis->type = FISt_H2D; cmd_fis->type = FISt_H2D;
PCIBts(&cmd_fis->desc, AHCI_CF_DESCf_C); //Set Command bit in H2D FIS. PCIBts(&cmd_fis->desc, AHCI_CF_DESCf_C); //Set Command bit in H2D FIS.
cmd_fis->command = ATA_PACKET; cmd_fis->command = ATA_PACKET;
cmd_fis->lba1 = 8;
cmd_table->acmd[0] = ATAPI_READ_CAPACITY >> 8; cmd_table->acmd[0] = ATAPI_READ_CAPACITY >> 8;
AHCIPortWait(bd->port_num, tS + 2); AHCIPortWait(bd->port_num, tS + 2);

View file

@ -14,7 +14,7 @@ U8 *rev_bits_table; //Table with U8 bits reversed
CDate local_time_offset; CDate local_time_offset;
F64 *pow10_I64, F64 *pow10_I64,
sys_os_version = 2.03; sys_os_version = 2.03;
U64 sys_os_version_sub = 109; U64 sys_os_version_sub = 113;
U8 *sys_os_version_str; U8 *sys_os_version_str;
U8 *sys_os_version_full; U8 *sys_os_version_full;
U8 *sys_os_version_nice; U8 *sys_os_version_nice;