Merge branch 'master' into telnet

This commit is contained in:
Arsenic Blood 2024-03-11 03:30:23 -04:00 committed by GitHub
commit b08af238d0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 167 additions and 33 deletions

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

@ -0,0 +1,69 @@
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
timeout-minutes: 10
if: ${{ success() }}
run: |
cd build
./build-iso.sh --headless
cd ..
- name: ISO Check
if: ${{ success() && hashFiles('./build/*.iso') == '' }}
run: |
echo "ISOs not built!"
exit 1
- 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
[![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.

Binary file not shown.

View file

@ -13,8 +13,10 @@ then
exit
fi
# Uncomment if you use doas instead of sudo
#alias sudo=doas
[ "$1" = "--headless" ] && QEMU_HEADLESS='-display none'
KVM=''
(lsmod | grep -q kvm) && KVM=' -accel kvm'
# Set this true if you want to test ISOs in QEMU after building.
TESTING=false
@ -50,7 +52,7 @@ set +e
echo "Making temp vdisk, running auto-install ..."
$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/ ..."
rm ../src/Home/Registry.ZC 2> /dev/null
@ -62,7 +64,7 @@ sudo cp -r ../src/* $TMPMOUNT/Tmp/OSBuild
umount_tempdisk
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"
@ -73,6 +75,8 @@ then
git fetch
git remote set-head origin $LIMINE_BINARY_BRANCH
git switch $LIMINE_BINARY_BRANCH
git config --local pull.ff true
git config --local pull.rebase true
git pull
rm limine
@ -130,11 +134,11 @@ if [ "$TESTING" = true ]; then
cd ..
fi
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 ..."
$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 ..."
$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
# 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
FORK_LOCAL=$FORK_BRANCH"-testing"
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..."
git pull https://github.com/$FORK_USERNAME/ZealOS.git $FORK_BRANCH

View file

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

View file

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

View file

@ -59,6 +59,7 @@
#define PCNET_INT_TINTM 9 // Transmit Interrupt Mask
#define PCNET_INT_RINTM 10 // Receive Interrupt Mask
#define PCNET_FEATURE_ASTRPRCV 10
#define PCNET_FEATURE_APADXMT 11
#define PCNET_BCR_MISC_CONFIG_ASEL 1
@ -455,7 +456,7 @@ U0 PCNetInterruptCSRSet()
U0 PCNetTXAutoPadEnable()
{/* AMD PCNet datasheet p.1-958
Setting bit 11 (Auto Pad Transmit) allows
shoft transmit frames to be automatically
short transmit frames to be automatically
extended to 64 bytes. */
U32 csr = PCNetCSRRead(PCNET_CSR_FEATURECTRL);
@ -465,6 +466,19 @@ U0 PCNetTXAutoPadEnable()
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()
{/* AMD PCNet datasheet p.1-954
PCNet controller can be started
@ -621,7 +635,13 @@ I64 PCNetPacketReceive(U8 **packet_buffer_out, U16 *packet_length_out)
NetDebug("PCNET RECEIVE PACKET: de_index incremented = 0x%0X", pcnet.current_rx_de_index);
*packet_buffer_out = pcnet.rx_buffer_addr_phys + de_index * ETHERNET_FRAME_SIZE;
*packet_length_out = packet_length;
// ASTRPRCV causes 802.3 packets to be stripped and FCS to be checked
U16 ethertype = (*packet_buffer_out)[ETHERNET_ETHERTYPE_OFFSET + 1] | (*packet_buffer_out)[ETHERNET_ETHERTYPE_OFFSET] << 8;
if (ethertype < ETHERNET_v2_MTU)
*packet_length_out = ethertype;
else
*packet_length_out = packet_length - FCS_LENGTH; // ethertype ii TODO: Validate FCS
return de_index;
}
@ -749,6 +769,8 @@ U0 PCNetInit()
PCNetTXAutoPadEnable;
PCNetRXAutoStripEnable;
PCNetAutoLinkSelect;
PCNetEnableFullDuplex;
@ -845,4 +867,4 @@ U0 NetStart()
PCNetCSRWrite(PCNET_CSR_CTRLSTATUS, csr);
}
PCNetInit;
PCNetInit;

View file

@ -27,17 +27,15 @@ U0 EthernetGlobalsInit()
}
}
//TODO: check length , figure out the length+4
U0 EthernetFrameParse(CEthernetFrame *frame_out, U8 *frame, U16 length)
{
//TODO: Check length ! We need to figure out what
//lengths are appropriate
// length is assumed to NOT include the FCS.
//Shrine also says MemCopy has a
//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.
// Shrine says MemCopy has a 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.
NetLog("ETHERNET FRAME PARSE: Parsing frame, copying out to frame_out param.");
@ -49,7 +47,7 @@ U0 EthernetFrameParse(CEthernetFrame *frame_out, U8 *frame, U16 length)
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?
frame_out->length = length - ETHERNET_MAC_HEADER_LENGTH;
}
U0 EthernetFrameFinish(I64 de_index)

View file

@ -5,11 +5,14 @@
#define ETHERNET_ETHERTYPE_OFFSET 12
#define ETHERNET_DATA_OFFSET 14
#define MAC_ADDRESS_LENGTH 6
#define FCS_LENGTH 4
/* 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. */
#define ETHERNET_FRAME_SIZE 2000
#define ETHERNET_v2_MTU 1500
#define HTYPE_ETHERNET 1
#define HLEN_ETHERNET 6
#define PLEN_IPV4 4

View file

@ -37,6 +37,16 @@ U0 NetQueueEntryHandle(CNetQueueEntry *entry)
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)
{
case ETHERTYPE_ARP:

View file

@ -110,6 +110,16 @@ Bool MyPutKey(I64 ch, I64 sc)
}
return TRUE;
case SC_F12:
if (!(sc & SCF_SHIFT))
{
if (sc & SCF_KEY_DESC)
KeyDescSet("Cmd /SysLogToggle");
else
SysLogToggle;
}
return TRUE;
case SC_DELETE:
if (sc & SCF_SHIFT)
{

View file

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

View file

@ -47,9 +47,9 @@ See also $LK,"GrUpdateScreen",A="MN:GrUpdateScreen"$().
}
else if (ch == '\n')
{
RawPutChar(CH_SPACE);
while (text.raw_col % text.cols)
do
RawPutChar(CH_SPACE);
while (text.raw_col % text.cols);
}
else if (Bt(char_bmp_displayable, ch))
{

View file

@ -504,6 +504,14 @@ I64 Sys(U8 *format, ...)
return res;
}
U0 SysLogToggle()
{
if (Bt(&sys_task->display_flags, DISPLAYf_SHOW))
LBtr(&sys_task->display_flags, DISPLAYf_SHOW);
else
LBts(&sys_task->display_flags, DISPLAYf_SHOW);
}
U0 SysLog(U8 *format, ...)
{//Display text in sys_task.
U8 *buf = StrPrintJoin(NULL, format, argc, argv);

View file

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

View file

@ -437,6 +437,7 @@ public extern I64 Scale2Mem(I64 min, I64 max, I64 limit=2*1024*1024*1024);
public extern U0 SysErr( U8 *format, ...);
public extern U0 SysWarn(U8 *format, ...);
public extern U0 SysLog( U8 *format, ...);
public extern U0 SysLogToggle();
public extern I64 ExeCmdLine(CCompCtrl *cc);
public extern U0 JobDel(CJob *tmpc);
public extern I64 JobsHandler(I64 run_flags, CTask *task=NULL);

View file

@ -242,7 +242,7 @@ and take address.
*/
U8 *buf, *ptr, **pptr;
Bool left_justify = FALSE;
I64 ch, cur_arg = 0, i, len, *i_ptr, dec_len;
I64 ch, cur_arg = 0, len, *i_ptr, dec_len;
F64 *d_ptr;
if (!format)
@ -301,9 +301,9 @@ and take address.
}
}
buf = MAlloc(len + 1);
for (i = 0; i < len; i++)
buf[i] = *src++;
buf[i] = 0;
MemCopy(buf, src, len);
buf[len] = 0;
src += len;
switch (ch)
{
case 's':

View file

@ -137,11 +137,11 @@ public U0 DocClear(CDoc *doc=NULL, Bool clear_holds=FALSE)
{//Clear all doc entries, except +H, hold entries.
Bool unlock;
text.raw_col = 0;
if (!doc && !(doc = DocPut))
{
if (IsRaw)
{
text.raw_col = 0;
MemSet(text.fb_alias, BLACK32, text.buffer_size);
}
return;