Skip to content

Commit 3afda1a

Browse files
committed
Increase process size limit to 128KB
1 parent 8e87f8c commit 3afda1a

File tree

4 files changed

+11
-12
lines changed

4 files changed

+11
-12
lines changed

include/fuzzy/memmgr/layout.h

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,11 @@
44
// and kernel's pid is 0.
55
#define PID_KERNEL 0
66

7-
#define MEMORY_KERNEL_LOCATION 0x10000
8-
#define MEMORY_KERNEL_SIZE 0x0FFFF
7+
#define MEMORY_APPBASE_LOCATION 0x10000
8+
#define MEMORY_APP_SIZE 0x20000
99

10-
#define MEMORY_APPBASE_LOCATION 0x20000
11-
#define MEMORY_APP_SIZE 0x0FFFF
12-
13-
// pid starts from 1
14-
#define memmgr_app_abs_location(pid) ((pid)!=0?(MEMORY_APPBASE_LOCATION+((pid)-1)*MEMORY_APP_SIZE):MEMORY_KERNEL_LOCATION)
10+
#define memmgr_app_abs_location(pid) (MEMORY_APPBASE_LOCATION + (pid)*MEMORY_APP_SIZE)
1511
#define memmgr_app_size(pid) (MEMORY_APP_SIZE)
12+
13+
#define MEMORY_KERNEL_LOCATION memmgr_app_abs_location(PID_KERNEL)
14+
#define MEMORY_KERNEL_SIZE memmgr_app_size(PID_KERNEL)

src/kernel/process/allocation.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,13 +121,13 @@ int process_create() {
121121
// Application Code Segment Selector
122122
populate_gdt_entry(
123123
&gdt_table[idt_cs_entry],
124-
memory_location, memory_location+0xFFFF,
124+
memory_location, memory_location+memory_size-1,
125125
0b0100, // 32-bit protected mode
126126
0x9a);
127127
// Application Data Segment Selector
128128
populate_gdt_entry(
129129
&gdt_table[idt_ds_entry],
130-
memory_location, memory_location+0xFFFF,
130+
memory_location, memory_location+memory_size-1,
131131
0b0100, // 32-bit protected mode
132132
0x92);
133133
create_infant_process_irq0_stack(process->ss);

src/memmgr/tables/gdt.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ void populate_gdt_table(
3838
// Kernel Code Segment Selector
3939
populate_gdt_entry(
4040
&gdt_table[1],
41-
MEMORY_KERNEL_LOCATION, MEMORY_KERNEL_LOCATION+MEMORY_KERNEL_SIZE,
41+
MEMORY_KERNEL_LOCATION, MEMORY_KERNEL_LOCATION+MEMORY_KERNEL_SIZE-1,
4242
0b0100, // 32-bit protected mode
4343
0x9a);
4444
// Kernel Data Segment Selector
4545
populate_gdt_entry(
4646
&gdt_table[2],
47-
MEMORY_KERNEL_LOCATION, MEMORY_KERNEL_LOCATION+MEMORY_KERNEL_SIZE,
47+
MEMORY_KERNEL_LOCATION, MEMORY_KERNEL_LOCATION+MEMORY_KERNEL_SIZE-1,
4848
0b0100, // 32-bit protected mode
4949
0x92);
5050
// Absolute Code Segment Selector

tests/bootloader_stage2_test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ set -e
1212

1313
test_screen_content $LINENO "Bootloader: Stage 2"
1414
test_screen_content $LINENO "Static library loaded at 0x00007E00: `build_8hexbyte real_mode/static_library`"
15-
test_screen_content $LINENO "Kernel loaded at 0x0000C000: `build_8hexbyte kernel/core`"
15+
test_screen_content $LINENO "Kernel loaded at 0x[0-9A-Fa-f]\+: `build_8hexbyte kernel/core`"
1616
test_screen_content $LINENO "Loading GDT Table and entering protected mode"
1717

1818
wait ${QEMU_PID:?}

0 commit comments

Comments
 (0)