Compare commits
2 commits
7fec5d45f6
...
949fb48523
Author | SHA1 | Date | |
---|---|---|---|
d0p1 🏳️⚧️ | 949fb48523 | ||
d0p1 🏳️⚧️ | 18c807d210 |
35
CODE_OF_CONDUCT.md
Normal file
35
CODE_OF_CONDUCT.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# StupidOS Code of Conduct
|
||||
|
||||
The StupidOS community has always worked to be a welcoming and respectful community, and we want to ensure that doesn't change as we grow and evolve. To that end, we have a few ground rules that we ask people to adhere to:
|
||||
|
||||
- be friendly and patient,
|
||||
- be welcoming,
|
||||
- be considerate,
|
||||
- be respectful,
|
||||
- be careful in the words that you choose and be kind to others,
|
||||
- when we disagree, try to understand why.
|
||||
|
||||
This isn't an exhaustive list of things that you can't do. Rather, take it in the spirit in which it's intended - a guide to make it easier to communicate and participate in the community.
|
||||
|
||||
This code of conduct applies to all spaces managed by the StupidOS project. This includes online chat, mailing lists, bug trackers, StupidOS events such as the developer meetings and socials, and any other forums created by the project that the community uses for communication. It applies to all of your communication and conduct in these spaces, including emails, chats, things you say, slides, videos, posters, signs, or even t-shirts you display in these spaces. In addition, violations of this code outside these spaces may, in rare cases, affect a person's ability to participate within them, when the conduct amounts to an egregious violation of this code.
|
||||
|
||||
If you believe someone is violating the code of conduct, we ask that you report it by emailing [conduct@stupidos.d0p1.eu](mailto:conduct@stupidos.d0p1.eu).
|
||||
|
||||
- **Be friendly and patient.**
|
||||
- **Be welcoming.** We strive to be a community that welcomes and supports people of all backgrounds and identities. This includes, but is not limited to members of any race, ethnicity, culture, national origin, color, immigration status, social and economic class, educational level, sex, sexual orientation, gender identity and expression, age, size, family status, political belief, religion or lack thereof, and mental and physical ability.
|
||||
- **Be considerate.** Your work will be used by other people, and you in turn will depend on the work of others. Any decision you take will affect users and colleagues, and you should take those consequences into account. Remember that we're a world-wide community, so you might not be communicating in someone else's primary language.
|
||||
- **Be respectful.** Not all of us will agree all the time, but disagreement is no excuse for poor behavior and poor manners. We might all experience some frustration now and then, but we cannot allow that frustration to turn into a personal attack. It's important to remember that a community where people feel uncomfortable or threatened is not a productive one. Members of the StupidOS community should be respectful when dealing with other members as well as with people outside the StupidOS community.
|
||||
- **Be careful in the words that you choose and be kind to others.** Do not insult or put down other participants. Harassment and other exclusionary behavior aren't acceptable. This includes, but is not limited to:
|
||||
- Violent threats or language directed against another person.
|
||||
- Discriminatory jokes and language.
|
||||
- Posting sexually explicit or violent material.
|
||||
- Posting (or threatening to post) other people's personally identifying information ("doxing").
|
||||
- Personal insults, especially those using racist or sexist terms.
|
||||
- Unwelcome sexual attention.
|
||||
- Advocating for, or encouraging, any of the above behavior.
|
||||
- **In general, if someone asks you to stop, then stop.** Persisting in such behavior after being asked to stop is considered harassment.
|
||||
- **When we disagree, try to understand why.** Disagreements, both social and technical, happen all the time and StupidOS is no exception. It is important that we resolve disagreements and differing views constructively. Remember that we're different. The strength of StupidOS comes from its varied community, people from a wide range of backgrounds. Different people have different perspectives on issues. Being unable to understand why someone holds a viewpoint doesn't mean that they're wrong. Don't forget that it is human to err and blaming each other doesn't get us anywhere. Instead, focus on helping to resolve issues and learning from mistakes.
|
||||
|
||||
---
|
||||
|
||||
*This text is based on the [FreeBSD Code of Conduct](https://www.freebsd.org/internal/code-of-conduct/), which in turn is based on the [LLVM Project's draft CoC](https://llvm.org/docs/CodeOfConduct.html), which in turn is based on the [Django Project Code of Conduct](https://www.djangoproject.com/conduct/), which is in turn based on wording from the Speak Up! project.*
|
|
@ -17,7 +17,11 @@ SRCS = kernel.asm \
|
|||
dev/at/pit.inc \
|
||||
dev/at/cga.inc \
|
||||
dev/at/kbd.inc \
|
||||
dev/at/floppy.inc
|
||||
dev/at/floppy.inc \
|
||||
fs/fat.inc \
|
||||
fs/stpdfs.inc \
|
||||
fs/xv6fs.inc \
|
||||
vfs.inc
|
||||
|
||||
.PHONY: all
|
||||
all: $(KERNEL)
|
||||
|
|
|
@ -1,13 +1,58 @@
|
|||
;; File: cmos.inc
|
||||
;;
|
||||
;; > +--------------------------------
|
||||
;; > | 0x00 | RTC seconds
|
||||
;; > +---------------
|
||||
;; > | 0x01 | RTC seconds alarm
|
||||
;; > +--------------------
|
||||
;; > | 0x02 | RTC minutes
|
||||
;; > +------------------------
|
||||
|
||||
;; > +------+-------------------------+
|
||||
;; > | 0x00 | RTC seconds |
|
||||
;; > +------+-------------------------+
|
||||
;; > | 0x01 | RTC seconds alarm |
|
||||
;; > +------+-------------------------+
|
||||
;; > | 0x02 | RTC minutes |
|
||||
;; > +------+-------------------------+
|
||||
;; > | 0x03 | RTC minutes alarm |
|
||||
;; > +------+-------------------------+
|
||||
;; > | 0x04 | RTC hours |
|
||||
;; > +------+-------------------------+
|
||||
;; > | 0x05 | RTC hours alarm |
|
||||
;; > +------+-------------------------+
|
||||
;; > | 0x06 | RTC day of week |
|
||||
;; > +------+-------------------------+
|
||||
;; > | 0x07 | RTC date day |
|
||||
;; > +------+-------------------------+
|
||||
;; > | 0x08 | RTC date month |
|
||||
;; > +------+-------------------------+
|
||||
;; > | 0x09 | RTC date year |
|
||||
;; > +------+-------------------------+
|
||||
;; > | 0x0A | Status register A |
|
||||
;; > +------+-------------------------+
|
||||
;; > | 0x0B | Status register B |
|
||||
;; > +------+-------------------------+
|
||||
;; > | 0x0C | Status register C |
|
||||
;; > +------+-------------------------+
|
||||
;; > | 0x0D | Status register D |
|
||||
;; > +------+-------------------------+
|
||||
;; > | 0x0E | Diagnostic Status |
|
||||
;; > +------+-------------------------+
|
||||
;; > | 0x0F | CMOS Shutdown Status |
|
||||
;; > +------+-------------------------+
|
||||
;; > | 0x10 | Floppy Disk Drive Type |
|
||||
;; > +------+-------------------------+
|
||||
;; > | 0x11 | System Conf Settings |
|
||||
;; > +------+-------------------------+
|
||||
;; > | 0x12 | Hard Disk Type |
|
||||
;; > +------+-------------------------+
|
||||
;; > | 0x13 | Typematic Parameters |
|
||||
;; > +------+-------------------------+
|
||||
;; > | 0x14 | Installed Equipment |
|
||||
;; > +------+-------------------------+
|
||||
;; > | 0x15 | Base Memory LO |
|
||||
;; > +------+-------------------------+
|
||||
;; > | 0x16 | Base Memory HI |
|
||||
;; > +------+-------------------------+
|
||||
;; > | 0x17 | Extended Memory LO |
|
||||
;; > +------+-------------------------+
|
||||
;; > | 0x18 | Extended Memory HI |
|
||||
;; > +------+-------------------------+
|
||||
;; > | 0x19 | Hard Disk Extended Type |
|
||||
;; > +------+-------------------------+
|
||||
|
||||
CMOS_COMMAND = 0x70
|
||||
CMOS_DATA = 0x71
|
||||
|
|
|
@ -18,4 +18,7 @@ console_read:
|
|||
call lock_release
|
||||
ret
|
||||
|
||||
console_init:
|
||||
ret
|
||||
|
||||
uConsoleLock dd 0
|
||||
|
|
|
@ -6,3 +6,5 @@ struc Device {
|
|||
.probe dd ?
|
||||
}
|
||||
|
||||
dev_init:
|
||||
ret
|
||||
|
|
|
@ -1,9 +1,73 @@
|
|||
;; File: fat.inc
|
||||
;;
|
||||
;; Usefull links:
|
||||
;; - <Spec at https://academy.cba.mit.edu/classes/networking_communications/SD/FAT.pdf>
|
||||
|
||||
FAT_SECTOR_SIZE = 512
|
||||
FAT_MDIR_SIZE = 32
|
||||
|
||||
struc FatBootSector {
|
||||
.jump db 3 dup(?)
|
||||
.banner db 8 dup(?)
|
||||
struc FATFS_BootSectorBase {
|
||||
.jump db 3 dup(?)
|
||||
.oemName db 8 dup(?)
|
||||
.byts_per_sec dw ?
|
||||
.sec_per_clus db ?
|
||||
.rsvd_sec_cnt dw ?
|
||||
.num_fats db ?
|
||||
.root_ent_cnt dw ?
|
||||
.tot_sec16 dw ?
|
||||
.media db ?
|
||||
.fat_sz16 dw ?
|
||||
.sec_per_trk dw ?
|
||||
.num_heads dw ?
|
||||
.hidd_sec dd ?
|
||||
.tot_sec32 dd ?
|
||||
}
|
||||
|
||||
struc FATFS_BootSector16 {
|
||||
.base FATFS_BootSectorBase
|
||||
|
||||
;; Extended BPB Structure
|
||||
.drv_num db ?
|
||||
.reserved1 db 0
|
||||
.boot_sig db ?
|
||||
.volume_id dd ?
|
||||
.volume_label db 11 dup(?)
|
||||
.filsys_type db 8 dup(?)
|
||||
.code db 448 dup(?)
|
||||
.signature dw ?
|
||||
}
|
||||
|
||||
struc FATFS_BootSector32 {
|
||||
.base FATFS_BootSectorBase
|
||||
|
||||
.fat_sz32 dd ?
|
||||
.ext_flags dw ?
|
||||
.fs_ver dw ?
|
||||
.root_clus dd ?
|
||||
.fs_info dw ?
|
||||
.bk_boot_sec dw ?
|
||||
.reserved0 db 12 dup(?)
|
||||
.drv_num db ?
|
||||
.reserved1 db ?
|
||||
.boot_sig db ?
|
||||
.volume_id dd ?
|
||||
.volume_label db 11 dup(?)
|
||||
.filsys_type db 8 dup(?)
|
||||
.code db 420 dup(?)
|
||||
.signature dw ?
|
||||
}
|
||||
|
||||
szVfsFatName db 'FATFS', 0
|
||||
|
||||
vfs_fatfs:
|
||||
dd szVfsFatName
|
||||
dd 0
|
||||
dd vops_fatfs
|
||||
|
||||
vops_fatfs:
|
||||
dd 0
|
||||
|
||||
fatfs_init:
|
||||
mov eax, vfs_fatfs
|
||||
call vfs_register
|
||||
ret
|
||||
|
|
|
@ -1,5 +1,51 @@
|
|||
;; File: stpdfs.inc
|
||||
|
||||
STPDFS_SB_MAGIC = 0x44505453
|
||||
STPDFS_SB_REV = 1
|
||||
STPDFS_SB_REV = 1
|
||||
STPDFS_BSIZE = 512
|
||||
STPDFS_ROOTINO = 1
|
||||
STPDFS_NDIRECT = 7
|
||||
|
||||
STPDFS_CLEANLY_UNMOUNTED = 0
|
||||
STPDFS_ERROR = 1
|
||||
STPDFS_DIRTY = 1
|
||||
|
||||
struc StpdFS_Sb {
|
||||
.magic dd ?
|
||||
.isize dd ?
|
||||
.fsize dd ?
|
||||
.free dd 100 dup(?)
|
||||
.nfree db ?
|
||||
.rev db ?
|
||||
.state dw ?
|
||||
.time dq ?
|
||||
}
|
||||
DEFN StpdFS_Sb
|
||||
|
||||
struc StpdFS_Inode {
|
||||
.mode dw ?
|
||||
.nlink dw ?
|
||||
.uid dw ?
|
||||
.gid dw ?
|
||||
.flags dw ?
|
||||
.size dd ?
|
||||
.zones dd (STPDFS_NDIRECT + 3) dup(?)
|
||||
.actime dq ?
|
||||
.modtime dq ?
|
||||
}
|
||||
DEFN StpdFS_Inode
|
||||
|
||||
szVfsStpdFSName db 'StupidFS', 0
|
||||
|
||||
vops_stpdfs:
|
||||
dd 0
|
||||
|
||||
vfs_stpdfs:
|
||||
dd szVfsStpdFSName
|
||||
dd 0
|
||||
dd vops_stpdfs
|
||||
|
||||
stpdfs_init:
|
||||
mov eax, vfs_stpdfs
|
||||
call vfs_register
|
||||
ret
|
||||
|
|
57
kernel/fs/xv6fs.inc
Normal file
57
kernel/fs/xv6fs.inc
Normal file
|
@ -0,0 +1,57 @@
|
|||
;; File: xv6fs.inc
|
||||
;;
|
||||
;; Usefull links:
|
||||
;; - <https://github.com/mit-pdos/xv6-riscv/blob/riscv/kernel/fs.h>
|
||||
;; - <xv6 book at https://pdos.csail.mit.edu/6.1810/2023/xv6/book-riscv-rev3.pdf>
|
||||
|
||||
XV6FS_BSIZE = 1024
|
||||
XV6FS_ROOTINO = 1
|
||||
XV6FS_MAGIC = 0x10203040
|
||||
XV6FS_NDIRECT = 12
|
||||
XV6FS_NINDIRECT = (XV6FS_BSIZE / 4)
|
||||
XV6FS_MAXFILE = (XV6FS_NDIRECT + XV6FS_NINDIRECT)
|
||||
XV6FS_IPB = (XV6FS_BSIZE / 64)
|
||||
XV6FS_DIRSIZE = 14
|
||||
|
||||
struc Xv6FS_Sb {
|
||||
.magic dd ?
|
||||
.size dd ?
|
||||
.nblock dd ?
|
||||
.ninodes dd ?
|
||||
.nlog dd ?
|
||||
.nlogstart dd ?
|
||||
.inodestart dd ?
|
||||
.bmapstart dd ?
|
||||
}
|
||||
DEFN Xv6FS_Sb
|
||||
|
||||
struc Xv6FS_Inode {
|
||||
.type dw ?
|
||||
.major dw ?
|
||||
.minor dw ?
|
||||
.nlink dw ?
|
||||
.size dd ?
|
||||
.addrs dd (XV6FS_NDIRECT + 1) dup(?)
|
||||
}
|
||||
DEFN Xv6FS_Inode
|
||||
|
||||
struc Xv6FS_Dirent {
|
||||
.inum dw ?
|
||||
.name db XV6FS_DIRSIZE dup(?)
|
||||
}
|
||||
|
||||
szVfsXv6FSName db 'xv6FS', 0
|
||||
|
||||
vops_xv6fs:
|
||||
dd 0
|
||||
|
||||
vfs_xv6fs:
|
||||
dd szVfsXv6FSName
|
||||
dd 0
|
||||
dd vops_xv6fs
|
||||
|
||||
xv6fs_init:
|
||||
mov eax, vfs_xv6fs
|
||||
call vfs_register
|
||||
ret
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
format binary
|
||||
|
||||
include 'const.inc'
|
||||
include 'sys/macro.inc'
|
||||
include 'sys/bootinfo.inc'
|
||||
include 'sys/cpu.inc'
|
||||
|
||||
|
@ -64,6 +65,8 @@ kmain:
|
|||
|
||||
call pit_init
|
||||
|
||||
call vfs_init
|
||||
|
||||
mov eax, SYSCALL_EXIT
|
||||
int 0x42
|
||||
|
||||
|
@ -81,6 +84,11 @@ kmain:
|
|||
call klog
|
||||
jmp .halt
|
||||
|
||||
include 'dev/at/cmos.inc'
|
||||
include 'dev/at/pit.inc'
|
||||
include 'dev/at/kbd.inc'
|
||||
include 'dev/at/cga.inc'
|
||||
include 'dev/at/floppy.inc'
|
||||
include 'klog.inc'
|
||||
include 'dev/console.inc'
|
||||
include 'mm/mm.inc'
|
||||
|
@ -90,10 +98,10 @@ kmain:
|
|||
include 'isr.inc'
|
||||
include 'idt.inc'
|
||||
include 'pic.inc'
|
||||
include 'dev/at/pit.inc'
|
||||
include 'dev/at/kbd.inc'
|
||||
include 'dev/at/cga.inc'
|
||||
include 'dev/at/floppy.inc'
|
||||
include 'vfs.inc'
|
||||
include 'fs/fat.inc'
|
||||
include 'fs/stpdfs.inc'
|
||||
include 'fs/xv6fs.inc'
|
||||
|
||||
|
||||
szMsgKernelAlive db "Kernel (", VERSION_FULL , ") is alive", 0
|
||||
|
|
6
kernel/sys/macro.inc
Normal file
6
kernel/sys/macro.inc
Normal file
|
@ -0,0 +1,6 @@
|
|||
macro DEFN x {
|
||||
virtual at 0
|
||||
x x
|
||||
sizeof.#x:
|
||||
end virtual
|
||||
}
|
|
@ -5,6 +5,13 @@
|
|||
;;
|
||||
|
||||
struc VFS {
|
||||
.name dd ?
|
||||
.next dd ?
|
||||
.op dd ?
|
||||
}
|
||||
DEFN VFS
|
||||
|
||||
struc Mount {
|
||||
.next dd ?
|
||||
.op dd ?
|
||||
.vnodes dd ?
|
||||
|
@ -23,6 +30,7 @@ struc VFSOps {
|
|||
.vget dd ?
|
||||
}
|
||||
|
||||
;;
|
||||
VNODE_TYPE_NON = 0x0
|
||||
VNODE_TYPE_REG = 0x1
|
||||
VNODE_TYPE_DIR = 0x2
|
||||
|
@ -32,6 +40,7 @@ VNODE_TYPE_LNK = 0x5
|
|||
VNODE_TYPE_SOCK = 0x6
|
||||
VNODE_TYPE_BAD = 0x7
|
||||
|
||||
;; Struc: VNode
|
||||
struc VNode {
|
||||
.flag dw ?
|
||||
.refcount dw ?
|
||||
|
@ -72,8 +81,29 @@ struc VNodeOps {
|
|||
.brelse dd ?
|
||||
}
|
||||
|
||||
vfs_init:
|
||||
;; Function: vfs_register
|
||||
;;
|
||||
;; In:
|
||||
;; EAX - Pointer to VFS struct
|
||||
;;
|
||||
vfs_register:
|
||||
mov edx, [pVFS]
|
||||
mov [eax + VFS.next], edx
|
||||
mov [pVFS], eax
|
||||
|
||||
mov eax, [eax + VFS.name]
|
||||
push eax
|
||||
mov esi, szMsgVFSRegister
|
||||
call klog
|
||||
ret
|
||||
|
||||
|
||||
vfs_init:
|
||||
call fatfs_init
|
||||
call stpdfs_init
|
||||
call xv6fs_init
|
||||
ret
|
||||
|
||||
pVFS dd 0
|
||||
pRootFS dd 0
|
||||
|
||||
szMsgVFSRegister db 'VFS: register %s', 0
|
||||
|
|
Loading…
Reference in a new issue